Skip to main content

Rotates a customer's key

POST/v2/customers/{customerId}/ai-hosting-keys/{keyId}/actions/rotate
API version
v2
Request method
POST
Operation ID
ai-hosting-customer-rotate-key

Issues a new secret for the key. The old secret is revoked immediately unless a grace period is supplied.

Request​

  • customerIdstringrequired
  • keyIdstringrequired

Responses​

Format
application/json
Description

The key with its new secret.

  • containerMetaobject
    • containerIdstring
    • errorMessagestring
    • ingressIdstring
    • stackIdstring
    • statusstring (one of: created, requested, failed)required
  • customerIdstringdeprecated

    This Field is deprecated. Use the profileId field instead.

  • isBlockedbooleanrequired

    Indicates whether the key is blocked.

  • keystringdeprecatedrequired

    The secret API key. For security reasons we no longer want to keep exposing this value on every response — this field is deprecated and will stop returning the real key in a future change. It still returns the real value for now.

  • keyIdstringrequired

    Auto generated uuid to identify keys in requests.

  • modelsarray of stringdeprecatedrequired

    This Field is deprecated. You can find the allowed models in the /ai-hosting route.

    • Array[
      • *string
      ]
  • namestringrequired
  • planIdstringrequired
  • profileIdstringrequired
  • projectIdstring
  • rateLimitobjectrequired

    The number of allowed requests per unit. Limits are shared across all keys within the same project.

    • allowedRequestsPerUnitintegerrequired
    • unit"minute"required
  • tokenUsageobjectrequired
    • planLimitinteger (≥ -1, int64)required
    • usedinteger (≥ 0, int64)required
Content-Type: application/json

{
"containerMeta": {
"containerId": "string",
"errorMessage": "string",
"ingressId": "string",
"stackId": "string",
"status": "created"
},
"isBlocked": true,
"keyId": "string",
"name": "string",
"planId": "string",
"profileId": "string",
"projectId": "string",
"rateLimit": {
"allowedRequestsPerUnit": 123,
"unit": "minute"
},
"tokenUsage": {
"planLimit": 123,
"used": 123
}
}
{
"properties": {
"containerMeta": {
"properties": {
"containerId": {
"type": "string"
},
"errorMessage": {
"type": "string"
},
"ingressId": {
"type": "string"
},
"stackId": {
"type": "string"
},
"status": {
"enum": [
"created",
"requested",
"failed"
],
"type": "string"
}
},
"required": [
"status"
],
"type": "object"
},
"customerId": {
"deprecated": true,
"description": "This Field is deprecated. Use the profileId field instead.",
"type": "string"
},
"isBlocked": {
"default": false,
"description": "Indicates whether the key is blocked.",
"type": "boolean"
},
"key": {
"deprecated": true,
"description": "The secret API key. For security reasons we no longer want to keep exposing this value on every response — this field is deprecated and will stop returning the real key in a future change. It still returns the real value for now.",
"type": "string"
},
"keyId": {
"description": "Auto generated uuid to identify keys in requests.",
"type": "string"
},
"models": {
"deprecated": true,
"description": "This Field is deprecated. You can find the allowed models in the /ai-hosting route.",
"items": {
"type": "string"
},
"type": "array"
},
"name": {
"type": "string"
},
"planId": {
"type": "string"
},
"profileId": {
"type": "string"
},
"projectId": {
"type": "string"
},
"rateLimit": {
"description": "The number of allowed requests per unit. Limits are shared across all keys within the same project.",
"properties": {
"allowedRequestsPerUnit": {
"type": "integer"
},
"unit": {
"enum": [
"minute"
],
"type": "string"
}
},
"required": [
"allowedRequestsPerUnit",
"unit"
],
"type": "object"
},
"tokenUsage": {
"properties": {
"planLimit": {
"format": "int64",
"minimum": -1,
"type": "integer"
},
"used": {
"format": "int64",
"minimum": 0,
"type": "integer"
}
},
"required": [
"used",
"planLimit"
],
"type": "object"
}
},
"required": [
"keyId",
"profileId",
"planId",
"key",
"models",
"name",
"isBlocked",
"tokenUsage",
"rateLimit"
],
"type": "object"
}

Usage examples​

$ curl \
--fail \
--location \
-X POST \
-d '{"gracePeriod":"24h"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/customers/string/ai-hosting-keys/string/actions/rotate
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.aiHosting.aiHostingCustomerRotateKey({
"customerId": "string",
"keyId": "string",
"data": {
"gracePeriod": "24h"
}
});

assertStatus(response, 200);

use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingCustomerRotateKey\AiHostingCustomerRotateKeyRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingCustomerRotateKey\AiHostingCustomerRotateKeyRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// AiHostingCustomerRotateKeyRequestBody to learn how to construct a valid instance
$body = new AiHostingCustomerRotateKeyRequestBody(/* TODO: ... */);

$request = (new AiHostingCustomerRotateKeyRequest(
customerId: "string",
keyId: "string",
body: $body
));
$response = $client->aiHosting()->aiHostingCustomerRotateKey($request);

var_dump($response->getBody();

On this page