Rotate an API key
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text){
"id": "<string>",
"object": "collection.api_key",
"collection_id": "<string>",
"slug": "<string>",
"name": "<string>",
"scope": "ai-collection-v3:collections:3f2a9c1e-...",
"permissions": [
"<string>"
],
"expires_at": 123,
"secret": "<string>"
}{
"error": "InvalidArguments",
"message": "<string>"
}API Keys
Rotate an API key
Regenerates the key. The new raw key is returned once, in secret.
POST
/
v1
/
collections
/
{collection_id}
/
api-keys
/
{key_id}
/
rotate
Rotate an API key
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys/{key_id}/rotate"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text){
"id": "<string>",
"object": "collection.api_key",
"collection_id": "<string>",
"slug": "<string>",
"name": "<string>",
"scope": "ai-collection-v3:collections:3f2a9c1e-...",
"permissions": [
"<string>"
],
"expires_at": 123,
"secret": "<string>"
}{
"error": "InvalidArguments",
"message": "<string>"
}Authorizations
BearerAuthOrgApiKeyAuth
User session JWT. Send as Authorization: Bearer <token>.
Path Parameters
Collection identifier returned at creation.
Response
Key rotated. secret is shown only once.
API key metadata. The raw key is never included here.
Was this page helpful?