Create Key
POSThttps://api.confident-ai.com/v2/projects/{projectId}/api-keys
Mints a new project-scoped API key. The full value is returned exactly once, in this response, and can never be retrieved again — store it securely. This is the key your application uses to send traces and run evaluations against the project.
curl -X POST "https://api.confident-ai.com/v2/projects/{projectId}/api-keys" \
-H "CONFIDENT_API_KEY: <ORGANIZATION-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "CI pipeline",
"expiresInDays": 90
}'{
"success": true,
"data": {
"id": 1420,
"name": "CI pipeline",
"valid": true,
"created_at": "2025-01-15T09:30:00.000Z",
"expiresAt": "2025-04-15T09:30:00.000Z",
"value": "confident_us_org_9mJq2sVb1hXk4pR7tYw0aZc3eF6gH8iJ0kLmNoPq",
"shadowValue": null,
"rotatesAt": null,
"lastUsed": null
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe organization API key for your Confident AI organization.
Path parameters
projectIdstringRequiredThe id of the project the key belongs to.
Request body
namestringRequiredA label for the key, shown on the Confident AI platform.
expiresInDaysintegerHow long the key lasts, in days from now — a duration, not a date. Confident AI turns it into the
expiresAtinstant on the key. Omit it for a key that never expires.
Response
Create Key succeeded.
successbooleanIndicates if the request was successful.
dataobjectA newly minted API key, carrying the only copy of its full value.
Show 9 propertiesHide 9 properties
idintegerThe id of the API key, generated by Confident AI.
namestring | nullThe label for the key, shown on the Confident AI platform.
validbooleanWhether the key authenticates. A deactivated key is rejected on every request until it is reactivated.
created_atstringWhen the key was created.
expiresAtstring | nullThe instant the key stops authenticating, or null when it never expires. Confident AI computes it from the
expiresInDaysduration sent when the key was created or last rotated.valuestringThe full API key. This response is the only place it is ever returned, so store it now — every later response masks it, and a lost value can only be replaced by rotating the key.
shadowValuenullAlways null on a key that has just been created; only a rotation with a grace period puts a second value in flight.
rotatesAtnullAlways null on a key that has just been created.
lastUsednullAlways null on a key that has just been created; it is set the first time the key authenticates a request.
deprecatedbooleanIndicates if this endpoint is deprecated.