Skip to Content
API keys

Create an API key

Permissioninference-api-keys:createAdd-onInferenceRetriesIdempotency-Key requiredAuthentication
POST
/inference/api-keys

Creates a scoped Inference key.

The secret appears once

It is in this response only and can never be retrieved again. Store it before you move on.

Scopes are canonicalized, and may not exceed your own permissions.

See key management.

Authorization

inferenceBearerAuth
headerAuthorizationBearer <token>

Use an Inference API key. Access and keys.

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Supply either expires_in_days or expires_at, not both. Omit both for a non-expiring credential.

name*string
Length1 <= length <= 120
scopes*array<string>
Items1 <= items <= 256
expires_in_days?integer

Relative lifetime in whole days from creation; mutually exclusive with expires_at.

Range1 <= value <= 3650
expires_at?string

RFC 3339 instant strictly after the request time and no more than 3650 days in the future; mutually exclusive with expires_in_days.

Formatdate-time

Response Body

API key metadata plus the one-time secret.

application/json
  1. response

Complete safe metadata plus the one-time credential secret.

id*string
Formatuuid
prefix*string
Length1 <= length
name*string
Length1 <= length <= 120
scopes*array<string>
Items1 <= items <= 256
status*string
Value in"active""expired""revoked"
created_by_user_id*|
Formatuuid
created_by_api_key_id*|
Formatuuid
last_used_at*|
Formatdate-time
expires_at*|
Formatdate-time
revoked_at*|
Formatdate-time
version*integer
Formatint64
Range1 <= value
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
key*string
Length1 <= length
Example Request
curl -X POST 'https://api.kejue.co/v1/inference/api-keys' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "scopes": [    "string"  ]}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "prefix": "string",  "name": "string",  "scopes": [    "string"  ],  "status": "active",  "created_by_user_id": "209f54c4-4c33-43bc-9c6a-ef4c65ad7473",  "created_by_api_key_id": "16a8c1ea-aaaf-49f0-9266-c657c48ceff3",  "last_used_at": "2019-08-24T14:15:22Z",  "expires_at": "2019-08-24T14:15:22Z",  "revoked_at": "2019-08-24T14:15:22Z",  "version": 1,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "key": "string"}