Skip to main content
POST
Create an API key

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string
required

Required: a call without it is refused with 400. A key of your own that names this one request; a UUID is ideal. It is 8 to 50 characters of letters, digits, - and _. Send the same key again when you retry (after a timeout, a dropped connection or a 5xx) and the call is carried out once: the retry gets the first answer back, marked X-Idempotency-Cached: true. The same key with a different body is refused with 422, and a retry that arrives while the first call is still running with 409 (see Retry-After).

Required string length: 8 - 50
Pattern: ^[a-zA-Z0-9_-]{8,50}$
Example:

"9b2d6f0a-3c41-4e5a-8d77-1f2e3a4b5c6d"

Path Parameters

id
string<uuid>
required

The account the key is for. For your own, your own user id

Body

application/json
name
string
required

A name for the key, to tell it from the account's other keys

Required string length: 1 - 100
Example:

"Production"

expiresAt
string<date-time>

When the key stops working, as a date and time in the future with a zone. Omit it for a key that does not expire

Example:

"2027-01-31T00:00:00Z"

preset
enum<string>

A ready-made list of scopes. read_only looks at everything the account holds and changes nothing. content builds and manages widgets and compositions and runs the AI, and touches no billing, no people and no partners. full_access is the same as sending neither preset nor scopes. Send either preset or scopes, not both

Available options:
read_only,
content,
full_access
Example:

"content"

scopes
enum<string>[]

What the key may do, when a preset is not enough. Naming a write scope includes its read scope, and a list that holds every scope is a key with full access. Send either scopes or preset, not both

Minimum array length: 1

One thing an API key may be allowed to do. A key made with a list of scopes does only what the list names; a key made without one has full access, and does everything its owner can.

  • content:read reads widgets, compositions, canvases, projects, folders, uploads, translations and the analytics of your content.
  • content:write creates, changes, publishes and deletes the same. It includes content:read.
  • generate runs the AI that builds widgets and compositions, and follows or cancels what it is doing. This spends credits.
  • partner:read reads managed users, what they spent, presets, the contract and the storage destination.
  • partner:write creates, changes and deletes managed users and presets. It includes partner:read.
  • billing:read reads credits, usage, invoices, subscriptions and payment methods.
  • billing:write buys credits, pays invoices and changes a subscription or a payment method. It includes billing:read.
  • account:read reads the profile, organizations and members, allowed domains, notices and the names of API keys.
  • account:write changes the profile, organizations and members, allowed domains and integrations. It includes account:read.

Starting an editor session for a managed user needs partner:write, content:write and generate together. Making, changing and deleting keys, exchanging tokens, signing in and the administration routes need full access: a limited key cannot make itself a bigger one.

A request outside the scopes of the key is refused with 403 and the code API_KEY_SCOPE_MISSING. error.details.missingScopes names what a new key needs, and error.details.fullAccessRequired is true when no list of scopes would have been enough. The scopes of a key cannot be changed once it is made.

Available options:
content:read,
content:write,
generate,
partner:read,
partner:write,
billing:read,
billing:write,
account:read,
account:write
Example:

Response

The key was made. The secret is in key, and is not shown again

success
boolean
required

Always true on a success.

Example:

true

data
object
required

A key that has just been made. It is the only answer that ever carries the secret, in key. Store it now: Widgetic keeps only a hash of it, and it cannot be shown again.

Example:
meta
object

Extra information about the answer: where a page sits in a list, the cursor of the next page, or warnings about a call that succeeded with a caveat.