For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Keys

Manage runtime API keys for projects

Get API keys

get

Returns the API keys for a specific project. API keys are used to authenticate requests to the Spice.ai runtime.

Authorizations
AuthorizationstringRequired

OAuth 2.0 access token obtained from the Spice.ai authentication service

Path parameters
projectIdintegerRequired

The ID of the project

Header parameters
X-Org-NamestringOptional

The organization to act on, by handle. Omit it to act on the organization the credential is bound to; sending it blank is a 400, not the same as omitting it. A user credential may name any organization its owner belongs to; a machine credential is pinned to its own.

Pattern: ^[A-Za-z0-9._-]{1,255}$
Responses
200

API keys for the project

application/json
api_keystring · nullableOptional

Primary API key

api_key_2string · nullableOptional

Secondary API key (for key rotation)

get/v1/projects/{projectId}/api-keys
GET /v1/projects/{projectId}/api-keys HTTP/1.1
Host: api.spice.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "api_key": "text",
  "api_key_2": "text"
}

Regenerate an API key

post

Regenerates an API key for the specified project. This invalidates the previous key. Use key_number to specify which key to regenerate (0 for both, 1 for primary, 2 for secondary).

Authorizations
AuthorizationstringRequired

OAuth 2.0 access token obtained from the Spice.ai authentication service

Path parameters
projectIdintegerRequired

The ID of the project

Header parameters
X-Org-NamestringOptional

The organization to act on, by handle. Omit it to act on the organization the credential is bound to; sending it blank is a 400, not the same as omitting it. A user credential may name any organization its owner belongs to; a machine credential is pinned to its own.

Pattern: ^[A-Za-z0-9._-]{1,255}$
Body
key_numberinteger · enumOptional

Which API key to regenerate (0 = both, 1 = primary, 2 = secondary)

Default: 1Possible values:
Responses
200

API key regenerated successfully

application/json
api_keystring · nullableOptional

Primary API key

api_key_2string · nullableOptional

Secondary API key

regenerated_keyinteger · enumOptional

Which key was regenerated (0 = both, 1 = primary, 2 = secondary)

Possible values:
post/v1/projects/{projectId}/api-keys
POST /v1/projects/{projectId}/api-keys HTTP/1.1
Host: api.spice.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "key_number": 1
}
{
  "api_key": "text",
  "api_key_2": "text",
  "regenerated_key": 0
}
Deprecated

Get API keys

get

Legacy alias of /v1/projects/{projectId}/api-keys — projects were previously called apps. Returns the API keys for a specific project. API keys are used to authenticate requests to the Spice.ai runtime.

Authorizations
AuthorizationstringRequired

OAuth 2.0 access token obtained from the Spice.ai authentication service

Path parameters
appIdintegerRequired

The ID of the project

Header parameters
X-Org-NamestringOptional

The organization to act on, by handle. Omit it to act on the organization the credential is bound to; sending it blank is a 400, not the same as omitting it. A user credential may name any organization its owner belongs to; a machine credential is pinned to its own.

Pattern: ^[A-Za-z0-9._-]{1,255}$
Responses
200

API keys for the project

application/json
api_keystring · nullableOptional

Primary API key

api_key_2string · nullableOptional

Secondary API key (for key rotation)

get/v1/apps/{appId}/api-keys
GET /v1/apps/{appId}/api-keys HTTP/1.1
Host: api.spice.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "api_key": "text",
  "api_key_2": "text"
}
Deprecated

Regenerate an API key

post

Legacy alias of /v1/projects/{projectId}/api-keys — projects were previously called apps. Regenerates an API key for the specified project. This invalidates the previous key. Use key_number to specify which key to regenerate (0 for both, 1 for primary, 2 for secondary).

Authorizations
AuthorizationstringRequired

OAuth 2.0 access token obtained from the Spice.ai authentication service

Path parameters
appIdintegerRequired

The ID of the project

Header parameters
X-Org-NamestringOptional

The organization to act on, by handle. Omit it to act on the organization the credential is bound to; sending it blank is a 400, not the same as omitting it. A user credential may name any organization its owner belongs to; a machine credential is pinned to its own.

Pattern: ^[A-Za-z0-9._-]{1,255}$
Body
key_numberinteger · enumOptional

Which API key to regenerate (0 = both, 1 = primary, 2 = secondary)

Default: 1Possible values:
Responses
200

API key regenerated successfully

application/json
api_keystring · nullableOptional

Primary API key

api_key_2string · nullableOptional

Secondary API key

regenerated_keyinteger · enumOptional

Which key was regenerated (0 = both, 1 = primary, 2 = secondary)

Possible values:
post/v1/apps/{appId}/api-keys
POST /v1/apps/{appId}/api-keys HTTP/1.1
Host: api.spice.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "key_number": 1
}
{
  "api_key": "text",
  "api_key_2": "text",
  "regenerated_key": 0
}

Last updated

Was this helpful?