API tokens

Create, list and revoke the owf_ API tokens that authenticate requests to the API, the CLI and the MCP server.

On this page

API tokens (owf_…) authenticate the API, the SDKs, the CLI and the MCP server. A token acts with the role of its member, limited to the token's own role and, optionally, to one zone or one client. See Authentication.

OperationEndpoint
List tokensGET /v1/orgs/{org}/tokens
Create tokenPOST /v1/orgs/{org}/tokens
Revoke tokenDELETE /v1/orgs/{org}/tokens/{id}

List tokens

GET /v1/orgs/{org}/tokens

Lists the active API tokens of the organization, never their secrets. prefix helps to recognise each one and last_used_at tells when it was last used.

Required role: admin or higher. Organization-wide.

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).

Response

  • 200: Returns items, an array of APIToken.
FieldTypeDescription
items[].idstring (uuid)Id.
items[].org_idstring (uuid)Organization id.
items[].zone_idstring (uuid)Zone id.
items[].user_idstring (uuid)User id of the member.
items[].namestringName.
items[].rolestringRole. One of owner, admin, tech, readonly.
items[].prefixstringFirst characters of the secret, to recognise it.
items[].purge_onlybooleanCan only purge its zone's cache.
items[].created_bystringWho created it (actor).
items[].created_atstring (date-time)Creation time.
items[].expires_atstring (date-time)Expiry time.
items[].last_used_atstring (date-time)Last use.
items[].client_idstring (uuid) or nullClient the token is limited to (roles tech and readonly only); null = the whole organization.

Example

curl "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/tokens" \
  -H "Authorization: Bearer $OPENWAF_TOKEN"
200
{
  "items": [
    {
      "id": "11111111-2222-4333-8444-555555555555",
      "org_id": "1e7c9a3b-5d2f-4b8a-9c6e-0f2a4b6c8d1e",
      "zone_id": "6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d",
      "user_id": "5b8e2a1c-7d3f-4a9e-b6c2-1e4d7f0a3b9c",
      "name": "ci-deploy",
      "role": "tech",
      "prefix": "owf_8Jx2",
      "purge_only": false,
      "created_by": "user:5b8e2a1c-7d3f-4a9e-b6c2-1e4d7f0a3b9c",
      "created_at": "2026-10-27T09:30:00Z",
      "expires_at": "2027-01-25T09:30:00Z",
      "client_id": null
    }
  ]
}

Create token

POST /v1/orgs/{org}/tokens

Creates an API token for the caller's own member. Without role the token gets the caller's role. It can be limited to one zone (zone_id), to one client (client_id) or to purging its zone's cache (purge_only). See Limit a token.

The secret (owf_…) is returned only in this answer: store it right away.

Required role: readonly or higher. The new token's role cannot be higher than the caller's. Not available to tokens limited to a zone.

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).

Request body

Content type application/json.

FieldTypeRequiredDescription
namestringYesName. At most 200 characters.
rolestringNoRole of the token; by default the caller's (tech with purge_only). One of owner, admin, tech, readonly.
zone_idstring (uuid)NoLimits the token to that zone.
expires_in_daysintegerNoDefault 90. From 1 to 365.
purge_onlybooleanNoToken that can only purge its zone's cache (POST cache/purge and GET cache/purges; any other route, MCP included, answers 403 token_scope). Needs zone_id and no client; role tech (default). Default false.
client_idstring (uuid)NoLimits the token to the zones of one client (roles tech and readonly only). A client-limited credential only issues tokens of its own client.

Response

  • 201: Created; secret is shown only once. Returns IssuedToken.
FieldTypeDescription
idstring (uuid)Id.
org_idstring (uuid)Organization id.
zone_idstring (uuid)Zone id.
user_idstring (uuid)User id of the member.
namestringName.
rolestringRole. One of owner, admin, tech, readonly.
prefixstringFirst characters of the secret, to recognise it.
purge_onlybooleanCan only purge its zone's cache.
created_bystringWho created it (actor).
created_atstring (date-time)Creation time.
expires_atstring (date-time)Expiry time.
last_used_atstring (date-time)Last use.
client_idstring (uuid) or nullClient the token is limited to (roles tech and readonly only); null = the whole organization.
secretstringShown only once; only its SHA-256 is stored.

Errors

StatusDescription
403The token's role or limits do not allow it (forbidden).
404Not found, or not visible to the token (not_found).

Example

curl -X POST "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/tokens" \
  -H "Authorization: Bearer $OPENWAF_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{
    "name": "ci-deploy",
    "role": "tech",
    "zone_id": "6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d",
    "expires_in_days": 90
  }'
201
{
  "id": "11111111-2222-4333-8444-555555555555",
  "org_id": "1e7c9a3b-5d2f-4b8a-9c6e-0f2a4b6c8d1e",
  "zone_id": "6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d",
  "user_id": "5b8e2a1c-7d3f-4a9e-b6c2-1e4d7f0a3b9c",
  "name": "ci-deploy",
  "role": "tech",
  "prefix": "owf_8Jx2",
  "purge_only": false,
  "created_by": "user:5b8e2a1c-7d3f-4a9e-b6c2-1e4d7f0a3b9c",
  "created_at": "2026-10-27T09:30:00Z",
  "expires_at": "2027-01-25T09:30:00Z",
  "client_id": null,
  "secret": "owf_8Jx2…"
}

Revoke token

DELETE /v1/orgs/{org}/tokens/{id}

Revokes a token; it stops working at once.

Required role: admin or higher. Organization-wide, or any role to revoke the token making the request.

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).
idpathstring (uuid)YesId of the resource.

Response

  • 204: Revoked. No body.

Errors

StatusDescription
404Not found, or not visible to the token (not_found).

Example

curl -X DELETE "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/tokens/11111111-2222-4333-8444-555555555555" \
  -H "Authorization: Bearer $OPENWAF_TOKEN"

Last updated:

↑↓ to navigate↵ to openesc to close