Rotates a project's key
POST/v2/ projects/ {projectId}/ ai-hosting-keys/ {keyId}/ actions/ rotate/
API version
v2
Request method
POST
Operation ID
ai-hosting-project-rotate-key
Issues a new secret for the key. The old secret is revoked immediately unless a grace period is supplied.
Request
Responses
Usage examples
- cURL
- JavaScript SDK
- PHP SDK
$ curl \
--fail \
--location \
-X POST \
-d '{"gracePeriod":"24h"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/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.aiHostingProjectRotateKey({
"projectId": "string",
"keyId": "string",
"data": {
"gracePeriod": "24h"
}
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingProjectRotateKey\AiHostingProjectRotateKeyRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\AIHosting\AiHostingProjectRotateKey\AiHostingProjectRotateKeyRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// AiHostingProjectRotateKeyRequestBody to learn how to construct a valid instance
$body = new AiHostingProjectRotateKeyRequestBody(/* TODO: ... */);
$request = (new AiHostingProjectRotateKeyRequest(
projectId: "string",
keyId: "string",
body: $body
));
$response = $client->aiHosting()->aiHostingProjectRotateKey($request);
var_dump($response->getBody();