Documentation menu

Keys

The keys of the calling key's environment.

A key with the inference scope calls models through the gateway; one with the management scope calls this API. A key's secret is shown once, when it is created or rotated, and stored only as a hash.

OperationMethodSDK
List keysGEThixel.keys.list
Create a keyPOSThixel.keys.create
Get a keyGEThixel.keys.get
Update a keyPATCHhixel.keys.update
Revoke a keyPOSThixel.keys.revoke
Rotate a keyPOSThixel.keys.rotate

List keys#

GET/v1/keyshixel.keys.list

A page of the environment's keys, newest first, revoked and expired ones included.

Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.

Parameters

NameInTypeDescription
cursorquerystringThe next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it.
limitqueryintegerHow many items the page holds: an integer from 1 to 100; 50 when left out.

Response 200: KeyList

FieldTypeDescription
data requiredarray of Key
data[].id requiredstringThe id of a key (key_…); never the key itself.
data[].organization_id requiredstringThe id of your organization (org_…).
data[].project_id requiredstringThe id of a project (proj_…).
data[].environment_id requiredstringThe id of an environment (env_…).
data[].name requiredstring
data[].last_four requiredstringThe key's last four characters, to tell keys apart.
data[].status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
data[].scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
data[].customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
data[].member requiredstring | nullYour id for the member the key is pinned to; null for none.
data[].allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
data[].tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
data[].expires_at requiredstring | nullWhen the key stops working; null for never.
data[].revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
data[].created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
data[].created_at requiredstring (date-time)
data[].updated_at requiredstring (date-time)
next_cursor requiredstring | nullPass back as cursor for the next page; null on the last page.

Errors

  • 400
    • invalid_request: The request is malformed or fails validation; param names the field.
    • invalid_cursor: The cursor is not one this list gave.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_query: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • management_scope_required: the environment's key does not have the management scope.
  • 404 environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503 database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/keys" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Create a key#

POST/v1/keyshixel.keys.create

Creates a key in the calling key's environment and answers its secret, which is never shown again. A key acting through this API cannot give a key more reach than its own (key_reach_exceeded): a scope it lacks, a model its allowlist does not cover, or a later expiry.

Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.

Request body: CreateKeyBody

FieldTypeDescription
name requiredstringA name to tell the key apart.
scopesarray of "inference" | "management"inference, management or both; ["inference"] when left out. A key pinned to a customer cannot have management.
customerstringPins the key to this customer, by your id for it: the key then acts for that customer only.
memberstringPins the key to this member of the customer, by your id.
allowed_modelsarray of stringModel names and prefix/* patterns the key may use, within what the environment allows; every model it allows when left out.
tagsarray of stringFree labels, up to 64 characters of visible ASCII each.
expires_atstring (date-time)When the key stops working; never when left out.

Response 200: CreatedKey

FieldTypeDescription
key requiredKeyA key of the environment, as every read shows it: never the key itself.
key.id requiredstringThe id of a key (key_…); never the key itself.
key.organization_id requiredstringThe id of your organization (org_…).
key.project_id requiredstringThe id of a project (proj_…).
key.environment_id requiredstringThe id of an environment (env_…).
key.name requiredstring
key.last_four requiredstringThe key's last four characters, to tell keys apart.
key.status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
key.scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
key.customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
key.member requiredstring | nullYour id for the member the key is pinned to; null for none.
key.allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
key.tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
key.expires_at requiredstring | nullWhen the key stops working; null for never.
key.revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
key.created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
key.created_at requiredstring (date-time)
key.updated_at requiredstring (date-time)
secret requiredstring | nullThe key itself, hx_sk_… (hx_sk_test_… in a test environment): store it now, it is never shown again. null in a response replayed for an Idempotency-Key.

Errors

  • 400
    • invalid_parameter: The request is malformed or fails validation; param names the field.
    • pinned_key_management: A key pinned to a customer cannot have the management scope.
    • invalid_idempotency_key: an Idempotency-Key is 1 to 255 characters of visible ASCII.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_payload, malformed_body, body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • key_reach_exceeded
    • management_scope_required: the environment's key does not have the management scope.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404 environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 409
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
    • idempotency_key_reused, idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/keys" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc."
  }'

Get a key#

GET/v1/keys/{id}hixel.keys.get

The key, never its secret; key_not_found when the environment has none by this id.

Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.

Parameters

NameInTypeDescription
id requiredpathstringThe key's id (key_…).

Response 200: Key

FieldTypeDescription
id requiredstringThe id of a key (key_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
environment_id requiredstringThe id of an environment (env_…).
name requiredstring
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
member requiredstring | nullYour id for the member the key is pinned to; null for none.
allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
expires_at requiredstring | nullWhen the key stops working; null for never.
revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
created_at requiredstring (date-time)
updated_at requiredstring (date-time)

Errors

  • 400
    • invalid_request: The request is malformed or fails validation; param names the field.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • management_scope_required: the environment's key does not have the management scope.
  • 404
    • key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
    • environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503 database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/keys/key_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Update a key#

PATCH/v1/keys/{id}hixel.keys.update

Changes the fields given. A revoked or expired key cannot be changed. A key acting through this API cannot give a key more reach than its own (key_reach_exceeded): a scope it lacks, a model its allowlist does not cover, or a later expiry.

Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe key's id (key_…).

Request body: UpdateKeyBody

FieldTypeDescription
namestring
scopesarray of "inference" | "management"
allowed_modelsarray of string | nullThe models the key may use; null allows every model the environment allows.
tagsarray of stringReplaces the key's tags.
expires_atstring | nullWhen the key stops working; null for never.

Response 200: Key

FieldTypeDescription
id requiredstringThe id of a key (key_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
environment_id requiredstringThe id of an environment (env_…).
name requiredstring
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
member requiredstring | nullYour id for the member the key is pinned to; null for none.
allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
expires_at requiredstring | nullWhen the key stops working; null for never.
revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
created_at requiredstring (date-time)
updated_at requiredstring (date-time)

Errors

  • 400
    • invalid_parameter: The request is malformed or fails validation; param names the field.
    • pinned_key_management: A key pinned to a customer cannot have the management scope.
    • invalid_idempotency_key: an Idempotency-Key is 1 to 255 characters of visible ASCII.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_params, invalid_payload, malformed_body, body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • key_reach_exceeded
    • management_scope_required: the environment's key does not have the management scope.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404
    • key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
    • environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 409
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
    • key_revoked: This key is revoked.
    • key_expired: This key has expired.
    • idempotency_key_reused, idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X PATCH "https://api.hixel.dev/v1/keys/key_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc."
  }'

Revoke a key#

POST/v1/keys/{id}/revokehixel.keys.revoke

The key stops working. Revoking cannot be undone.

Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe key's id (key_…).

Response 200: Key

FieldTypeDescription
id requiredstringThe id of a key (key_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
environment_id requiredstringThe id of an environment (env_…).
name requiredstring
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
member requiredstring | nullYour id for the member the key is pinned to; null for none.
allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
expires_at requiredstring | nullWhen the key stops working; null for never.
revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
created_at requiredstring (date-time)
updated_at requiredstring (date-time)

Errors

  • 400
    • invalid_request: The request is malformed or fails validation; param names the field.
    • invalid_idempotency_key: an Idempotency-Key is 1 to 255 characters of visible ASCII.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • management_scope_required: the environment's key does not have the management scope.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404
    • key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
    • environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 409
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
    • key_revoked: This key is revoked.
    • idempotency_key_reused, idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/keys/key_123/revoke" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Rotate a key#

POST/v1/keys/{id}/rotatehixel.keys.rotate

Creates the key's successor and answers its secret, which is never shown again. The old key keeps working for grace_period_seconds (none by default, at most 30 days). The body may be empty. A key acting through this API cannot give a key more reach than its own (key_reach_exceeded): a scope it lacks, a model its allowlist does not cover, or a later expiry.

Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe key's id (key_…).

Request body: RotateKeyBody

FieldTypeDescription
grace_period_secondsintegerHow long the old key keeps working, in seconds: 0 (the default) to 30 days.

Response 200: RotatedKey

FieldTypeDescription
previous requiredKeyA key of the environment, as every read shows it: never the key itself.
previous.id requiredstringThe id of a key (key_…); never the key itself.
previous.organization_id requiredstringThe id of your organization (org_…).
previous.project_id requiredstringThe id of a project (proj_…).
previous.environment_id requiredstringThe id of an environment (env_…).
previous.name requiredstring
previous.last_four requiredstringThe key's last four characters, to tell keys apart.
previous.status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
previous.scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
previous.customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
previous.member requiredstring | nullYour id for the member the key is pinned to; null for none.
previous.allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
previous.tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
previous.expires_at requiredstring | nullWhen the key stops working; null for never.
previous.revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
previous.created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
previous.created_at requiredstring (date-time)
previous.updated_at requiredstring (date-time)
key requiredKeyA key of the environment, as every read shows it: never the key itself.
key.id requiredstringThe id of a key (key_…); never the key itself.
key.organization_id requiredstringThe id of your organization (org_…).
key.project_id requiredstringThe id of a project (proj_…).
key.environment_id requiredstringThe id of an environment (env_…).
key.name requiredstring
key.last_four requiredstringThe key's last four characters, to tell keys apart.
key.status required"active" | "expired" | "revoked"Where the key stands; expired is an unrevoked key past its expiry.
key.scopes requiredarray of "inference" | "management"What the key may be used for: inference (calling models through the gateway), management (this API), or both.
key.customer requiredstring | nullYour id for the customer the key is pinned to; null for none.
key.member requiredstring | nullYour id for the member the key is pinned to; null for none.
key.allowed_models requiredarray of string | nullModel names and prefix/* patterns a request may use; null allows every model the level above allows.
key.tags requiredarray of stringFree labels, up to 64 characters of visible ASCII each.
key.expires_at requiredstring | nullWhen the key stops working; null for never.
key.revoked_at requiredstring | nullWhen the key was revoked; null while it is not.
key.created_by_user_id requiredstring | nullThe person who created the key in the dashboard; null when a key created it, through this API.
key.created_at requiredstring (date-time)
key.updated_at requiredstring (date-time)
secret requiredstring | nullThe key itself, hx_sk_… (hx_sk_test_… in a test environment): store it now, it is never shown again. null in a response replayed for an Idempotency-Key.

Errors

  • 400
    • invalid_parameter: The request is malformed or fails validation; param names the field.
    • invalid_idempotency_key: an Idempotency-Key is 1 to 255 characters of visible ASCII.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_params, invalid_payload, malformed_body, body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
  • 401 api_key_required, invalid_api_key, expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired.
  • 403
    • key_inactive: the key was revoked or expired while the request ran, or an environment's key lost the management scope.
    • key_reach_exceeded
    • management_scope_required: the environment's key does not have the management scope.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404
    • key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
    • environment_not_found: x-hixel-environment names an environment outside the project key's project, an archived one, or another than the environment key's own.
  • 409
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
    • key_revoked: This key is revoked.
    • key_expired: This key has expired.
    • idempotency_key_reused, idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/keys/key_123/rotate" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grace_period_seconds": 3600
  }'