Mint an API key
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', slug: '<string>'})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys', 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"
payload = {
"name": "<string>",
"slug": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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
Mint an API key
Mints an org API key scoped to this collection. The raw key is returned
exactly once, in the secret field: store it now, it cannot be retrieved
again.
POST
/
v1
/
collections
/
{collection_id}
/
api-keys
Mint an API key
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"slug": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', slug: '<string>'})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/api-keys', 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"
payload = {
"name": "<string>",
"slug": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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.
Body
application/json
Response
API key created. secret is shown only once.
API key metadata. The raw key is never included here.
Was this page helpful?