Skip to content
Markets open

API reference

API keys

Create, scope and revoke API keys. Dashboard session only: a key can never mint or list keys.

4 operationsBase URL https://packetexchange.io/api/v1Postman collection

List your API keys

GET/api/v1/account/api-keys

Access
Dashboard session. API keys are refused with 403. Use a login access token.
Rate limit
100 requests per second (the default)

Active (non-revoked) keys with their prefix, scopes and last use. Never includes a secret.

Response 200

FieldTypeDescription
datarequiredobject[]-
idrequireddata[].idstring (uuid)-
keyPrefixrequireddata[].keyPrefixstringThe first characters of the key, for recognising it. The full key is never shown again.
labelrequireddata[].labelstring-
scopesrequireddata[].scopesstring[] | nullnull = full access; otherwise the only scopes this key may useOne of voice:send, sms:send, dialer:write, routes:read, account:read, purchases:write, offers:write, billing:write, numbers:read, numbers:write, account:write, routes:write and 5 more
environmentrequireddata[].environmentstring-One of live, test
lastUsedAtrequireddata[].lastUsedAtstring (date-time) | nullISO-8601 timestamp (UTC)
createdAtrequireddata[].createdAtstring (date-time)ISO-8601 timestamp (UTC)
expiresAtrequireddata[].expiresAtstring (date-time) | nullISO-8601 timestamp (UTC)

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Create an API key

POST/api/v1/account/api-keys

Access
Dashboard session. API keys are refused with 403. Use a login access token.
Rate limit
100 requests per second (the default)

Returns the full key ONCE in key. Omit scopes for a full-access key; a scoped key can reach only the operations whose scope it holds. Scopes can be narrowed later but never broadened, so include everything the integration needs. A security email is sent to the account owner.

Request body (application/json)

FieldTypeDescription
labelrequiredstring-max 100 chars
scopesstring[]-One of voice:send, sms:send, dialer:write, routes:read, account:read, purchases:write, offers:write, billing:write, numbers:read, numbers:write, account:write, routes:write and 5 more
environmentstring-One of live, test
expiresAtstring (date-time) | null-

Response 201

FieldTypeDescription
datarequiredobject-
idrequireddata.idstring (uuid)-
keyrequireddata.keystringThe full secret key. Returned ONCE, here; store it now.
keyPrefixrequireddata.keyPrefixstringSame value as prefix; the name the list and update responses use.
prefixrequireddata.prefixstringDeprecated alias of keyPrefix, kept for existing clients.
labelrequireddata.labelstring-
scopesrequireddata.scopesstring[] | null-One of voice:send, sms:send, dialer:write, routes:read, account:read, purchases:write, offers:write, billing:write, numbers:read, numbers:write, account:write, routes:write and 5 more
environmentrequireddata.environmentstring-One of live, test
expiresAtrequireddata.expiresAtstring (date-time) | nullISO-8601 timestamp (UTC)

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Rename an API key or narrow its scopes

PATCH/api/v1/account/api-keys/{id}

Access
Dashboard session. API keys are refused with 403. Use a login access token.
Rate limit
100 requests per second (the default)

Scopes may only be tightened: any scope not already on the key is rejected with VALIDATION_ERROR.

Parameters

NameInTypeDescription
idrequiredpathstring-

Request body (application/json)

FieldTypeDescription
labelstring-max 100 chars
scopesstring[]-One of voice:send, sms:send, dialer:write, routes:read, account:read, purchases:write, offers:write, billing:write, numbers:read, numbers:write, account:write, routes:write and 5 more

Response 200

FieldTypeDescription
datarequiredobjectSame fields as ApiKey, shown earlier on this page.

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 404NOT_FOUND: no such resource on your account.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.

Revoke an API key

DELETE/api/v1/account/api-keys/{id}

Access
Dashboard session. API keys are refused with 403. Use a login access token.
Rate limit
100 requests per second (the default)

Takes effect immediately; requests with the key then get 401.

Parameters

NameInTypeDescription
idrequiredpathstring-

Response 200

FieldTypeDescription
datarequiredobject-
messagerequireddata.messagestring-

Errors

  • 400VALIDATION_ERROR, INVALID_INPUT or BAD_REQUEST. For VALIDATION_ERROR, error.details is an array of { path, message }.
  • 401UNAUTHORIZED: missing, invalid, expired or revoked credential.
  • 403FORBIDDEN: not allowed - a scoped key lacks the scope, or the endpoint is session-only.
  • 404NOT_FOUND: no such resource on your account.
  • 409CONFLICT (or a code-specific 409): the change clashes with existing state.
  • 429RATE_LIMITED: slow down and retry after the Retry-After seconds.
  • 500INTERNAL_ERROR: unexpected failure. Quote X-Request-Id to support.