Documentation menu

Environments

The environments of the calling project key's project.

An environment's own endpoints (/v1/keys, /v1/customers, …) take a project key with x-hixel-environment: env_….

OperationMethodSDK
List environmentsGEThixel.environments.list
Create an environmentPOSThixel.environments.create
Update an environmentPATCHhixel.environments.update
Archive an environmentPOSThixel.environments.archive

List environments#

GET/v1/environmentshixel.environments.list

A page of the project's environments: Production first, then the test ones, oldest first; archived ones only with include_archived=true.

Takes a project key with the member role or higher.

Parameters

NameInTypeDescription
include_archivedquerybooleantrue to list archived environments too.
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: EnvironmentList

FieldTypeDescription
data requiredarray of Environment
data[].id requiredstringThe id of an environment (env_…).
data[].organization_id requiredstringThe id of your organization (org_…).
data[].project_id requiredstringThe id of a project (proj_…).
data[].name requiredstring
data[].slug requiredstringThe environment's name in URLs; unique in its project.
data[].kind required"live" | "test"live for the project's one Production, test for the others.
data[].archived_at requiredstring | nullWhen the environment was archived; null while it is not. An archived environment serves no traffic.
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/environments" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY"

Create an environment#

POST/v1/environmentshixel.environments.create

Adds a test environment; Production is the project's only live one and came with it..

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

Request body: CreateEnvironmentBody

FieldTypeDescription
name requiredstring1 to 100 characters.
slug requiredstring2 to 48 lowercase letters, digits and dashes; unique in the project; not settings.

Response 201: Environment

FieldTypeDescription
id requiredstringThe id of an environment (env_…).
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
slug requiredstringThe environment's name in URLs; unique in its project.
kind required"live" | "test"live for the project's one Production, test for the others.
archived_at requiredstring | nullWhen the environment was archived; null while it is not. An archived environment serves no traffic.
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.
    • slug_reserved
    • 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.
    • 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.
    • slug_taken: Another environment of this project already uses this slug.
    • 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/environments" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc.",
    "slug": "…"
  }'

Update an environment#

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

Renames the environment or changes its slug..

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 environment's id (env_…).

Request body: UpdateEnvironmentBody

FieldTypeDescription
namestring
slugstring

Response 200: Environment

FieldTypeDescription
id requiredstringThe id of an environment (env_…).
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
slug requiredstringThe environment's name in URLs; unique in its project.
kind required"live" | "test"live for the project's one Production, test for the others.
archived_at requiredstring | nullWhen the environment was archived; null while it is not. An archived environment serves no traffic.
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.
    • slug_reserved
    • 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.
    • 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 environment_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.
    • environment_archived: This environment is archived.
    • slug_taken: Another environment of this project already uses this slug.
    • 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/environments/env_123" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc."
  }'

Archive an environment#

POST/v1/environments/{id}/archivehixel.environments.archive

Archives a test environment: its keys, customers and settings are kept, and it serves no traffic. Production is archived with its project only (live_environment).. Archiving 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 environment's id (env_…).

Response 200: Environment

FieldTypeDescription
id requiredstringThe id of an environment (env_…).
organization_id requiredstringThe id of your organization (org_…).
project_id requiredstringThe id of a project (proj_…).
name requiredstring
slug requiredstringThe environment's name in URLs; unique in its project.
kind required"live" | "test"live for the project's one Production, test for the others.
archived_at requiredstring | nullWhen the environment was archived; null while it is not. An archived environment serves no traffic.
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 environment_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.
    • environment_archived: This environment is archived.
    • live_environment: Production is archived with its project. Archive the project instead.
    • 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/environments/env_123/archive" \
  -H "Authorization: Bearer $HIXEL_PROJECT_KEY"