Documentation menu

Project keys

The keys of the calling project key's project.

A project key manages the project, its environments and everything in them, with its role's permissions; an environment's endpoint called with it names the environment in x-hixel-environment. A key's secret is shown once, when it is created, and stored only as a hash.

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

List project keys#

GET/v1/project/keyshixel.projectKeys.list

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

Takes a project key with the member role or higher.

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: ProjectKeyList

FieldTypeDescription
data requiredarray of ProjectKey
data[].id requiredstringThe id of a project key (pkey_…); never the key itself.
data[].organization_id requiredstringThe id of your organization (org_…).
data[].project_id requiredstringThe id of a project (proj_…).
data[].name requiredstring
data[].role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
data[].last_four requiredstringThe key's last four characters, to tell keys apart.
data[].status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project 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.
    • 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 project key was revoked or expired while the request ran.
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
  • 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/project/keys" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY"

Create a project key#

POST/v1/project/keyshixel.projectKeys.create

Creates a key of the project and answers its secret, which is never shown again.. A project key cannot give a key more reach than its own (key_reach_exceeded): the admin role when it is a member, a later expiry than its own, or none when it has one.

Takes a project key with the admin role. Accepts an Idempotency-Key header: a retry with the same key runs once.

Request body: CreateProjectKeyBody

FieldTypeDescription
name requiredstringA name to tell the key apart.
role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
expires_atstring (date-time)When the key stops working; never when left out.

Response 200: CreatedProjectKey

FieldTypeDescription
key requiredProjectKeyA key of the project, as every read shows it: never the key itself.
key.id requiredstringThe id of a project key (pkey_…); never the key itself.
key.organization_id requiredstringThe id of your organization (org_…).
key.project_id requiredstringThe id of a project (proj_…).
key.name requiredstring
key.role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
key.last_four requiredstringThe key's last four characters, to tell keys apart.
key.status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project key created it, through this API.
key.created_at requiredstring (date-time)
key.updated_at requiredstring (date-time)
secret requiredstring | nullThe key itself, hx_proj_…: 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.
    • 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 project key was revoked or expired while the request ran.
    • key_reach_exceeded
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 409
    • project_archived: This project 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/project/keys" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc.",
    "role": "admin"
  }'

Get a project key#

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

The project key, never its secret; project_key_not_found when the project has none by this id.

Takes a project key with the member role or higher.

Parameters

NameInTypeDescription
id requiredpathstringThe project key's id (pkey_…).

Response 200: ProjectKey

FieldTypeDescription
id requiredstringThe id of a project key (pkey_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project 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_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 project key was revoked or expired while the request ran.
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
  • 404 project_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
  • 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/project/keys/pkey_123" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY"

Update a project key#

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

Renames the key or changes its expiry. A revoked or expired key cannot be changed. A project key cannot give a later expiry than its own, or none when it has one (key_reach_exceeded). Its role cannot change: create a key with the role instead.

Takes a project key with the admin role. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe project key's id (pkey_…).

Request body: UpdateProjectKeyBody

FieldTypeDescription
namestringA name to tell the key apart.
expires_atstring | nullWhen the key stops working; null for never.

Response 200: ProjectKey

FieldTypeDescription
id requiredstringThe id of a project key (pkey_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project 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.
    • invalid_idempotency_key: an Idempotency-Key is 1 to 255 characters of visible ASCII.
    • 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 project key was revoked or expired while the request ran.
    • key_reach_exceeded
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404 project_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
  • 409
    • project_archived: This project 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/project/keys/pkey_123" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc."
  }'

Rotate a project key#

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

Creates the key's successor, with its name, role and expiry, 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); without one it is revoked at once, the calling key too when it rotates itself. The body may be empty.

Takes a project key with the admin role. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe project key's id (pkey_…).

Request body: RotateProjectKeyBody

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

Response 200: RotatedProjectKey

FieldTypeDescription
previous requiredProjectKeyA key of the project, as every read shows it: never the key itself.
previous.id requiredstringThe id of a project key (pkey_…); never the key itself.
previous.organization_id requiredstringThe id of your organization (org_…).
previous.project_id requiredstringThe id of a project (proj_…).
previous.name requiredstring
previous.role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
previous.last_four requiredstringThe key's last four characters, to tell keys apart.
previous.status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project key created it, through this API.
previous.created_at requiredstring (date-time)
previous.updated_at requiredstring (date-time)
key requiredProjectKeyA key of the project, as every read shows it: never the key itself.
key.id requiredstringThe id of a project key (pkey_…); never the key itself.
key.organization_id requiredstringThe id of your organization (org_…).
key.project_id requiredstringThe id of a project (proj_…).
key.name requiredstring
key.role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
key.last_four requiredstringThe key's last four characters, to tell keys apart.
key.status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project key created it, through this API.
key.created_at requiredstring (date-time)
key.updated_at requiredstring (date-time)
secret requiredstring | nullThe successor itself, hx_proj_…: 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.
    • 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 project key was revoked or expired while the request ran.
    • key_reach_exceeded
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404 project_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
  • 409
    • project_archived: This project 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/project/keys/pkey_123/rotate" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "grace_period_seconds": 3600
  }'

Revoke a project key#

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

The key stops working, the calling key too when it revokes itself.. Revoking cannot be undone.

Takes a project key with the admin role. Accepts an Idempotency-Key header: a retry with the same key runs once.

Parameters

NameInTypeDescription
id requiredpathstringThe project key's id (pkey_…).

Response 200: ProjectKey

FieldTypeDescription
id requiredstringThe id of a project key (pkey_…); never the key itself.
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
role required"admin" | "member"admin manages the project, its environments and everything in them; member reads them. Never anything of the organization's own.
last_four requiredstringThe key's last four characters, to tell keys apart.
status required"active" | "expired" | "revoked"Where a key stands; expired is an unrevoked key past its expiry.
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 project 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.
    • 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 project key was revoked or expired while the request ran.
    • project_key_required: an environment's key was sent; the project's endpoints take a project key.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404 project_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.
  • 409
    • project_archived: This project 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/project/keys/pkey_123/revoke" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY"