Launch Week 02 wrapped — explore all five launches

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.

POST/v2/projects/{projectId}/api-keys
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
}'
200
{
  "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_KEYstringRequired

    The organization API key for your Confident AI organization.

Path parameters

  • projectIdstringRequired

    The id of the project the key belongs to.

Request body

  • namestringRequired

    A label for the key, shown on the Confident AI platform.

  • expiresInDaysinteger

    How long the key lasts, in days from now — a duration, not a date. Confident AI turns it into the expiresAt instant on the key. Omit it for a key that never expires.

Response

Create Key succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A newly minted API key, carrying the only copy of its full value.

    Show 9 propertiesHide 9 properties
    • idinteger

      The id of the API key, generated by Confident AI.

    • namestring | null

      The label for the key, shown on the Confident AI platform.

    • validboolean

      Whether the key authenticates. A deactivated key is rejected on every request until it is reactivated.

    • created_atstring

      When the key was created.

    • expiresAtstring | null

      The instant the key stops authenticating, or null when it never expires. Confident AI computes it from the expiresInDays duration sent when the key was created or last rotated.

    • valuestring

      The 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.

    • shadowValuenull

      Always null on a key that has just been created; only a rotation with a grace period puts a second value in flight.

    • rotatesAtnull

      Always null on a key that has just been created.

    • lastUsednull

      Always null on a key that has just been created; it is set the first time the key authenticates a request.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI