Documentation menu

Customer portal

What a customer's admin governs in the hosted portal, which your backend can read and change too.

the customer's team policy, its members' own budgets and models, portal sessions and the portal's look.

OperationMethodSDK
Get a customer's team policyGEThixel.customerPolicy.get
Update a customer's team policyPATCHhixel.customerPolicy.update
List a customer's membersGEThixel.members.list
Get a memberGEThixel.members.get
Create or update a memberPUThixel.members.put
Remove a memberDELETEhixel.members.remove
Get a member's effective policyGEThixel.members.effectivePolicy
Create a portal sessionPOSThixel.portalSessions.create
Revoke portal sessionsDELETEhixel.portalSessions.revoke
Get the portal settingsGEThixel.portalSettings.get
Update the portal settingsPATCHhixel.portalSettings.update
List the portal filesGEThixel.portalAssets.list
Upload a portal filePOSThixel.portalAssets.upload
Remove a portal fileDELETEhixel.portalAssets.remove

Get a customer's team policy#

GET/v1/customers/{external_id}/policyhixel.customerPolicy.get

The team budget, the default member budget and the models the team may use; all null when none is set.

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
external_id requiredpathstringYour id for the customer.

Response 200: CustomerPolicy

FieldTypeDescription
customer requiredstringYour id for the customer (its external_id), as every path takes it.
team_budget_micros requiredBudgetMicros | nullA cap on the customer's spend per calendar month (UTC); null for none.
member_budget_micros requiredBudgetMicros | nullEvery member's budget per calendar month (UTC), unless the member has its own; null for none.
allowed_models requiredarray of string | nullExact model names, each one the tenant allows the customer; null allows every model the level above allows.
updated_at requiredstring | nullWhen it last changed; null when never set.

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
    • customer_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/customers/org_42/policy" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Update a customer's team policy#

PATCH/v1/customers/{external_id}/policyhixel.customerPolicy.update

Sets the fields given; null clears one. Budgets are per calendar month (UTC) and only restrict further: one above your own limits changes nothing, and none is refused for it. Each model must be one you allow the customer today (model_not_available).

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
external_id requiredpathstringYour id for the customer.

Request body: UpdateCustomerPolicyBody

FieldTypeDescription
team_budget_microsBudgetMicros | nullThe team budget; null removes it.
member_budget_microsBudgetMicros | nullThe default member budget; null removes it.
allowed_modelsarray of string | nullExact model names the team may use, each one the tenant allows the customer today (model_not_available otherwise); null allows every one.

Response 200: CustomerPolicy

FieldTypeDescription
customer requiredstringYour id for the customer (its external_id), as every path takes it.
team_budget_micros requiredBudgetMicros | nullA cap on the customer's spend per calendar month (UTC); null for none.
member_budget_micros requiredBudgetMicros | nullEvery member's budget per calendar month (UTC), unless the member has its own; null for none.
allowed_models requiredarray of string | nullExact model names, each one the tenant allows the customer; null allows every model the level above allows.
updated_at requiredstring | nullWhen it last changed; null when never set.

Errors

  • 400
    • invalid_parameter: The request is malformed or fails validation; param names the field.
    • model_not_available: This model is not one the customer may use.
    • 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.
    • 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
    • customer_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.
    • 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/customers/org_42/policy" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "team_budget_micros": "5000000"
  }'

List a customer's members#

GET/v1/customers/{external_id}/membershixel.members.list

A page of the customer's member rows, oldest first. Members that only made requests have no row.

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
external_id requiredpathstringYour id for the customer.
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: MemberList

FieldTypeDescription
data requiredarray of Member
data[].id requiredstringThe platform's id of the member row (mem_…); every path takes your id for it.
data[].external_id requiredstringYour id for the member, unique within the customer: what x-hixel-member names.
data[].name requiredstring | nullA display name; null for none.
data[].email requiredstring | nullAn email address; null for none.
data[].budget requiredany{"type": "inherit"} takes the team's default member budget, {"type": "unlimited"} sets none, {"type": "limit", "limit_micros": "…"} sets the member's own, per calendar month (UTC).
data[].allowed_models requiredarray of string | nullExact model names, each one the tenant allows the customer; null allows every model the level above allows.
data[].created_at requiredstring (date-time)
data[].updated_at requiredstring (date-time)
data[].customer requiredstringYour id for the customer (its external_id), as every path takes it.
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_params, 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
    • customer_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/customers/org_42/members" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Get a member#

GET/v1/customers/{external_id}/members/{member}hixel.members.get

The member's row; member_not_found when the customer has none for it.

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
external_id requiredpathstringYour id for the customer.
member requiredpathstringYour id for the member, as x-hixel-member names it.

Response 200: Member

FieldTypeDescription
id requiredstringThe platform's id of the member row (mem_…); every path takes your id for it.
external_id requiredstringYour id for the member, unique within the customer: what x-hixel-member names.
name requiredstring | nullA display name; null for none.
email requiredstring | nullAn email address; null for none.
budget requiredany{"type": "inherit"} takes the team's default member budget, {"type": "unlimited"} sets none, {"type": "limit", "limit_micros": "…"} sets the member's own, per calendar month (UTC).
allowed_models requiredarray of string | nullExact model names, each one the tenant allows the customer; null allows every model the level above allows.
created_at requiredstring (date-time)
updated_at requiredstring (date-time)
customer requiredstringYour id for the customer (its external_id), as every path takes it.

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
    • customer_not_found, member_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/customers/org_42/members/member_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Create or update a member#

PUT/v1/customers/{external_id}/members/{member}hixel.members.put

Creates the member's row with the fields given (201), or changes the fields given of the existing one (200). A customer has at most 2,000 members with a budget or model list of their own (member_overrides_limit_reached).

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
external_id requiredpathstringYour id for the customer.
member requiredpathstringYour id for the member, as x-hixel-member names it.

Request body: PutMemberBody

FieldTypeDescription
namestring | nullA display name, at most 255 characters; null removes it.
emailstring | nullAn email address; null removes it.
budgetany{"type": "inherit"} takes the team's default member budget, {"type": "unlimited"} sets none, {"type": "limit", "limit_micros": "…"} sets the member's own, per calendar month (UTC).
allowed_modelsarray of string | nullExact model names the member may use, each one the tenant allows the customer today (model_not_available otherwise); null allows every one the team allows.

Response 200, 201: Member

200: The row existed and was changed. 201: The row was created.

FieldTypeDescription
id requiredstringThe platform's id of the member row (mem_…); every path takes your id for it.
external_id requiredstringYour id for the member, unique within the customer: what x-hixel-member names.
name requiredstring | nullA display name; null for none.
email requiredstring | nullAn email address; null for none.
budget requiredany{"type": "inherit"} takes the team's default member budget, {"type": "unlimited"} sets none, {"type": "limit", "limit_micros": "…"} sets the member's own, per calendar month (UTC).
allowed_models requiredarray of string | nullExact model names, each one the tenant allows the customer; null allows every model the level above allows.
created_at requiredstring (date-time)
updated_at requiredstring (date-time)
customer requiredstringYour id for the customer (its external_id), as every path takes it.

Errors

  • 400
    • invalid_parameter: The request is malformed or fails validation; param names the field.
    • model_not_available: This model is not one the customer may use.
    • 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.
    • 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
    • customer_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.
    • member_overrides_limit_reached: This customer has the most members with a budget or model list of their own (2,000). Return one to the team's defaults first.
    • 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 PUT "https://api.hixel.dev/v1/customers/org_42/members/member_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Inc."
  }'

Remove a member#

DELETE/v1/customers/{external_id}/members/{member}hixel.members.remove

Deletes the member's row, and with it its own budget and models; the member can still make requests, held to the team's defaults. Answers 204 with no body.

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
external_id requiredpathstringYour id for the customer.
member requiredpathstringYour id for the member, as x-hixel-member names it.

Response 204

No body.

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
    • customer_not_found, member_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.
    • 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 DELETE "https://api.hixel.dev/v1/customers/org_42/members/member_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Get a member's effective policy#

GET/v1/customers/{external_id}/members/{member}/policyhixel.members.effectivePolicy

What applies to the member right now, every layer merged, whether it has a row or not: the models it may request, its budget and the team's with what is spent, and your spend limits that apply. A spent amount is null when it cannot be read.

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
external_id requiredpathstringYour id for the customer.
member requiredpathstringYour id for the member, as x-hixel-member names it.

Response 200: MemberEffectivePolicy

FieldTypeDescription
member requiredstringYour id for the member.
models requiredarray of stringEvery model the member may request now, by name: what every layer allows.
member_budget requiredEffectiveMemberBudget | nullnull when neither the member nor the team sets a member budget.
member_budget.source required"member" | "team"member: the member's own budget; team: the team's default member budget.
member_budget.limit_micros requiredBudgetMicros | nullnull when the member's own budget is unlimited.
member_budget.spent_micros requiredstring | nullSpent in the current window, as the customer's limiter counts it; null when it cannot be read.
team_budget requiredEffectiveTeamBudget | nullnull when the team sets no budget.
team_budget.limit_micros requiredanyMicro-USD as a decimal string, from "0" (refuses every request that costs anything) to 2^63 − 1.
team_budget.spent_micros requiredstring | nullSpent in the current window, as the customer's limiter counts it; null when it cannot be read.
limits requiredarray of EffectiveSpendLimitYour own spend limits that apply to the member, the customer's first.
limits[].id requiredstringThe spend limit's id, as the tenant named it.
limits[].applies_to required"customer" | "member"customer: the customer's own limits or the environment's customer limits; member: the environment's member limits.
limits[].window required"day" | "week" | "month" | "total"
limits[].limit_micros requiredUnsignedMicros
limits[].spent_micros requiredstring | nullSpent in the current window, as the customer's limiter counts it; null when it cannot be read.
limits[].resets_at requiredstring | nullWhen the window starts again; null for a total limit, which never does.
resets_at requiredstring (date-time)When the budgets start again: the first instant of the next calendar month (UTC).

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
    • customer_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/customers/org_42/members/member_123/policy" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Create a portal session#

POST/v1/customers/{external_id}/portal_sessionshixel.portalSessions.create

A session of the hosted portal for a member of the customer you have signed in, with the role you assert (admin or member). Send the browser to url: it works once, within five minutes. Creates the customer and the member's row when needed, and writes name and email to the row when sent. Answered once (cache-control: no-store); a replayed response's url is null.

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
external_id requiredpathstringYour id for the customer.

Request body: CreatePortalSessionBody

FieldTypeDescription
member requiredstringYour id for the member the session acts for: 1 to 256 characters of visible ASCII, as x-hixel-member takes it.
role required"admin" | "member"admin: governs the customer's budgets, models and members; member: sees its own policy and usage.
namestringThe member's display name, written to its row when sent.
emailstringThe member's email address, written to its row when sent.
return_urlstringWhere the portal sends the member back to: an https:// URL of at most 2,048 characters; the environment's default when left out.
expires_in_secondsintegerHow long the session lasts once created: 300 to 86,400; 3,600 when left out.

Response 201: PortalSession

FieldTypeDescription
id requiredstringThe id of a portal session (ps_…).
url requiredstring | nullWhere to send the member's browser: usable once, for five minutes. null in a replayed response (Idempotent-Replayed: true): create another session.
expires_at requiredstring (date-time)When the session ends.

Errors

  • 400
    • invalid_parameter, invalid_url: 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.
    • customer_blocked: the customer is blocked; unblock it before opening its portal.
    • 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, portal_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.
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl -X POST "https://api.hixel.dev/v1/customers/org_42/portal_sessions" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "member": "user_7",
    "role": "admin"
  }'

Revoke portal sessions#

DELETE/v1/customers/{external_id}/portal_sessionshixel.portalSessions.revoke

Ends the customer's portal sessions, or only member's, entered or not: their next call in the portal is signed out and an unused url no longer works. Use it when you remove a member or change its role. Answers how many were ended; repeating it ends none. Removing a member (DELETE …/members/{member}) ends its sessions too.

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
external_id requiredpathstringYour id for the customer.
memberquerystringYour id for the member whose sessions end; every member's when left out.

Response 200: PortalSessionsRevoked

FieldTypeDescription
revoked requiredintegerHow many sessions were ended: those not yet ended, entered or not. 0 when there were none.

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_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.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404
    • customer_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 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 DELETE "https://api.hixel.dev/v1/customers/org_42/portal_sessions" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Get the portal settings#

GET/v1/portal_settingshixel.portalSettings.get

The portal's display name, default return address and theme; null (or a theme field left out) where the default applies.

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.

Response 200: PortalSettings

FieldTypeDescription
environment_id requiredstringThe id of an environment (env_…).
display_name requiredstring | nullThe name the portal shows; the project's name when null.
return_url requiredstring | nullWhere a member goes back to when its session names none; null for none.
theme requiredanyHow the portal looks. Every field is optional and one left out is the default: {} is the portal as it ships.
updated_at requiredstring | nullWhen it last changed; null when never set.

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.
  • 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/portal_settings" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Update the portal settings#

PATCH/v1/portal_settingshixel.portalSettings.update

Sets the fields given; null restores a field's default. A theme sent replaces the whole theme (null resets it); a field of it at fault is invalid_request naming its path in param (theme.links.footer.2.url).

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

FieldTypeDescription
display_namestring | null
return_urlstring | null
themeobject | nullThe whole theme, in the shape theme is answered in: it replaces the one set, and a field left out is the default. null resets every field. A field at fault is invalid_request naming its path in param (theme.colors.dark.primary).

Response 200: PortalSettings

FieldTypeDescription
environment_id requiredstringThe id of an environment (env_…).
display_name requiredstring | nullThe name the portal shows; the project's name when null.
return_url requiredstring | nullWhere a member goes back to when its session names none; null for none.
theme requiredanyHow the portal looks. Every field is optional and one left out is the default: {} is the portal as it ships.
updated_at requiredstring | nullWhen it last changed; null when never set.

Errors

  • 400
    • invalid_parameter, invalid_url: 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_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.
    • 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 PATCH "https://api.hixel.dev/v1/portal_settings" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "…"
  }'

List the portal files#

GET/v1/portal_assetshixel.portalAssets.list

Every file uploaded in the environment, newest first; there are at most 100.

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.

Response 200: PortalAssetList

FieldTypeDescription
data requiredarray of PortalAsset
data[].id requiredstringThe id of an uploaded portal file (pas_…).
data[].environment_id requiredstringThe id of an environment (env_…).
data[].kind required"image" | "font"image: PNG, JPEG, WebP, GIF, ICO or SVG, at most 1 MiB; font: WOFF2, at most 2 MiB.
data[].content_type requiredstringThe type read from the file's bytes, which it is served with (image/png, font/woff2, …).
data[].size_bytes requiredintegerThe file's size in bytes.
data[].sha256 requiredstringThe lowercase hex SHA-256 of the file.
data[].filename requiredstringThe name the file was uploaded with, for display only; never part of its URL.
data[].url requiredstringWhere the file is served from, publicly and unchanging: put it in a field of the portal's theme (logo.light_url, icon_url, typography.body.url, …).
data[].created_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.
  • 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, assets_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/portal_assets" \
  -H "Authorization: Bearer $HIXEL_API_KEY"

Upload a portal file#

POST/v1/portal_assetshixel.portalAssets.upload

Stores an image or a font for the portal's theme and answers it with its url, which you then put in the theme (PATCH /v1/portal_settings). Send the file's bytes as the body with Content-Type: application/octet-stream; its type is read from the bytes, never from the name. An SVG with script, event handlers, javascript: URLs, a foreignObject, a DOCTYPE or references to other files is refused (unsafe_svg). An environment keeps at most 100 files (asset_limit_reached). Idempotency-Key does not apply: every upload is a new file, and a retried upload makes a second one, which is removed once it is a day old and no saved theme names it.

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

Parameters

NameInTypeDescription
filenamequerystringThe file's name, for display only: kept without its folders or control characters, cut at 255 characters; file when left out.

Response 201: PortalAsset

FieldTypeDescription
id requiredstringThe id of an uploaded portal file (pas_…).
environment_id requiredstringThe id of an environment (env_…).
kind required"image" | "font"image: PNG, JPEG, WebP, GIF, ICO or SVG, at most 1 MiB; font: WOFF2, at most 2 MiB.
content_type requiredstringThe type read from the file's bytes, which it is served with (image/png, font/woff2, …).
size_bytes requiredintegerThe file's size in bytes.
sha256 requiredstringThe lowercase hex SHA-256 of the file.
filename requiredstringThe name the file was uploaded with, for display only; never part of its URL.
url requiredstringWhere the file is served from, publicly and unchanging: put it in a field of the portal's theme (logo.light_url, icon_url, typography.body.url, …).
created_at requiredstring (date-time)

Errors

  • 400
    • invalid_request: The request is malformed or fails validation; param names the field.
    • empty_file: The file is empty: send its bytes as the request body.
    • unsupported_file_type: The file is not one the portal takes: a PNG, JPEG, WebP, GIF, ICO or SVG image, or a WOFF2 font. Its type is read from its contents, not its name.
    • unsafe_svg: The SVG contains script, an event handler, a javascript: URL, a foreignObject, a DOCTYPE or a reference to another file. Export it as a plain image and upload it again.
    • file_too_large: An image may be at most 1 MiB and a font at most 2 MiB.
    • environment_required: a project key was sent without x-hixel-environment.
    • invalid_query, unsupported_content_type, malformed_body: the request's query does not match its schema, the body is not sent as application/octet-stream, or it cannot be read.
  • 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 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
    • asset_limit_reached: This environment keeps the most uploaded files it may (100). Remove one it no longer uses first.
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
  • 500 internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned.
  • 503
    • database_unavailable, assets_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
    • database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl -X POST "https://api.hixel.dev/v1/portal_assets" \
  -H "Authorization: Bearer $HIXEL_API_KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @logo.png

Remove a portal file#

DELETE/v1/portal_assets/{id}hixel.portalAssets.remove

Deletes the file; its URL stops serving. A file the saved theme names is refused (asset_in_use): save a theme without it first. Answers 204 with no body.

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

Parameters

NameInTypeDescription
id requiredpathstringThe file's id, pas_….

Response 204

No body.

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.
    • role_not_allowed: the project key's member role does not allow this; it takes admin.
  • 404
    • portal_asset_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
    • asset_in_use: The portal's saved theme uses this file. Save a theme without it first.
    • project_archived: This project is archived.
    • environment_archived: This environment is archived.
  • 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 -X DELETE "https://api.hixel.dev/v1/portal_assets/pas_123" \
  -H "Authorization: Bearer $HIXEL_API_KEY"