Skip to content

API keys

3 operations in the WP Waterfall API.

List API keys

get/api-keysPermalink to List API keys

  • Scope: keys:read
  • Permission: api_keys.read

Lists the API keys of the signed-in person, whichever company is selected (ADR 211). A key belongs to a person and reaches all their companies or only the ones named in company_ids. The connection of an AI assistant may list them too when the person gave it the keys:read scope; the answer then marks the key the connection acts with (current) and the keys behind assistant connections (assistant_connection). A plain API key cannot call this route.

Parameters

NameInTypeDescription
limitqueryintegerHow many rows to return in one page: at most 200, and 50 when left out. Default: 50. Range: 1 to 200.
cursorquerystringThe next_cursor of the page before. Leave it out for the first page.

Responses

StatusBodyDescription
200ApiKeyListAPI keys
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

200 response fields

NameTypeDescription
data requiredarray of ApiKeyThe rows of this page.
data[].id requiredstring (uuid)
data[].name requiredstring
data[].prefix requiredstring
data[].scopes requiredarray of string
data[].company_ids requiredarray or nullThe companies the key reaches. Null means every company the person belongs to, now and later. A call names its company in the X-Company-Id header.
data[].expires_at requiredstring or null (date-time)
data[].ip_allowlist requiredarray or null
data[].last_used_at requiredstring or null (date-time)
data[].created_at requiredstring (date-time)
data[].age_daysintegerWhole days since the key was made. Range: 0 to any.
data[].revoked_atstring or null (date-time)Set once the key is revoked. A revoked key stays in the list so activity can still name it.
data[].revoked_reasonstring or nullWhy a key stopped: "creator left" when the person who made it was removed from the company or their account was deleted, "role changed" when a lower role left it with no scope it may hold. Null for a key a person revoked themselves.
data[].effective_scopesarray or nullThe scopes the key can use now. A key never does more than the person who made it, so a downgrade of that person's role takes scopes away. Null when the key works as it was made.
data[].currentbooleanOnly for a caller that is an AI assistant connection. current is true for the key that connection acts with, and assistant_connection is true for any key that backs an AI assistant connection. Both are left out for a signed-in person.
data[].assistant_connectionboolean
next_cursor requiredstring or nullSend it as cursor to get the next page. Null on the last page.

Create an API key

post/api-keysPermalink to Create an API key

  • Scope: keys:write
  • Permission: api_keys.write
  • Needs a confirmation

A signed-in person makes a key with any scope their role allows in at least one company the key reaches; what it may do in a company is decided by their role there on every call. Send company_ids to limit it to some companies, or leave it out for every company the person belongs to, now and later. A call with the key names its company in the X-Company-Id header (optional when the key reaches one). The connection of an AI assistant may make one when the person gave it the keys:write scope and sends confirm: true. A key made that way never holds more scopes than the connection or the person's role, never danger:destroy, and never a connection only scope (keys:read, keys:write, ssh-keys:read, ssh-keys:write). It always expires: 30 days when expires_at is left out, 365 days at most. The secret is shown once, in this answer. A plain API key cannot call this route.

Parameters

NameInTypeDescription
Idempotency-Key requiredheaderstringSend a fresh unique value on every POST: a POST without it answers 422. The answer is stored for 24 hours, so a retry with the same key and body returns the first answer, and the same key with a different body returns 422.
confirmquerystringAn API key must say yes to this change: confirm=true here, or confirm: true in the JSON body. Without it the call answers 422 and changes nothing. One of: true.

Request body application/json, required, CreateApiKeyRequest

Fields

NameTypeDescription
name requiredstring
scopes requiredarray of string
expires_atstring (date-time)
ip_allowlistarray of string
company_idsarray of stringThe companies the key reaches. Left out, it reaches every company the person belongs to, now and later. Each id must be a company the person belongs to. At most 100.
confirmbooleanA key lasts one year when expires_at is left out. An expires_at more than a year away needs confirm: true. For an AI assistant connection only: the person's yes. The server refuses a key made through a connection without it. A signed-in person leaves it out.

Responses

StatusBodyDescription
201CreatedApiKeyThe key, with its secret shown once
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
409ProblemThe current state does not allow this: the same change is already running, or another change got there first.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

201 response fields

NameTypeDescription
id requiredstring (uuid)
name requiredstring
prefix requiredstring
scopes requiredarray of string
company_ids requiredarray or nullThe companies the key reaches. Null means every company the person belongs to, now and later. A call names its company in the X-Company-Id header.
expires_at requiredstring or null (date-time)
ip_allowlist requiredarray or null
last_used_at requiredstring or null (date-time)
created_at requiredstring (date-time)
age_daysintegerWhole days since the key was made. Range: 0 to any.
revoked_atstring or null (date-time)Set once the key is revoked. A revoked key stays in the list so activity can still name it.
revoked_reasonstring or nullWhy a key stopped: "creator left" when the person who made it was removed from the company or their account was deleted, "role changed" when a lower role left it with no scope it may hold. Null for a key a person revoked themselves.
effective_scopesarray or nullThe scopes the key can use now. A key never does more than the person who made it, so a downgrade of that person's role takes scopes away. Null when the key works as it was made.
currentbooleanOnly for a caller that is an AI assistant connection. current is true for the key that connection acts with, and assistant_connection is true for any key that backs an AI assistant connection. Both are left out for a signed-in person.
assistant_connectionboolean
secret requiredstring

Revoke an API key

delete/api-keys/{id}Permalink to Revoke an API key

  • Scope: keys:write
  • Permission: api_keys.write
  • Needs a confirmation

A signed-in person revokes one of their own keys. The connection of an AI assistant may revoke a key when it holds the keys:write scope and sends confirm=true. It cannot revoke the key behind another assistant connection. Revoking the key it acts with also ends its connection and needs confirm_self=true. A plain API key cannot call this route.

Parameters

NameInTypeDescription
id requiredpathstring (uuid)The id of the API key.
confirmquerystringThe person's yes. A connection that revokes without it gets a 422. A session leaves it out. One of: true.
confirm_selfquerystringNeeded to revoke the key the connection itself acts with, which ends the connection. One of: true.

Responses

StatusBodyDescription
204Revoked
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
404ProblemThe thing in the path does not exist, or it belongs to another company. The answer is the same for both.
409ProblemThe current state does not allow this: the same change is already running, or another change got there first.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)