Skip to main content
The Widgetic API uses Bearer token authentication. Send an Authorization header with your API key or editor session token on every request, except the public embed routes, which take no key. There are two kinds of API key, an organisation key and a partner key: see API keys for which one you need.

Authentication Methods

API Keys (Server-Side)

API keys are the recommended authentication method for server-side applications. They give long-lived access: a key made in the dashboard works for ten years, or until you delete it.
You make a key in the dashboard: open the workspace, then Settings → API keys (the owner of a workspace opens that page). A key you make there is a workspace key. It starts with wdg_org_ (wgt_prt_ in your partner’s home workspace: see API keys), acts as that workspace and works in it only, and it does not follow the workspace you have open afterwards, so make one key for each workspace you work in. GET /tokens/validate says which workspace a key works in (data.workspace: its id and name). A key can be limited to what its application needs, a build server for example: see Limit what a key can do. Only a person signed in on widgetic.com can make a key (a key cannot make another key), and the workspace needs a paid plan to hold keys (the home workspace of a partner needs none: it pays by the invoices of its contract).

Editor Sessions (For Customer Browsers)

To run Widgetic’s editors inside your own page for one of your customers, mint a short-lived editor session on your server and pass that session token to the browser.

API Key Types and Access Levels

Your API key prefix determines your role and what endpoints you can access. API keys puts the two kinds side by side, lists what each can call and shows how to check which one you hold:

Understanding Access Levels

Each API endpoint specifies an x-access-level that determines which keys can call it:
  • public: No key. These are the routes a visitor’s browser calls to show a published widget (the embed routes).
  • user: An organisation key or a partner key.
  • partner: A partner key (wgt_prt_), made in your partner’s home workspace.
The x-access-level is a role gate, not a visibility gate. Every endpoint appears in the API reference, and your key decides which ones answer. A call with the wrong kind of key is refused with 403 and the code AUTHZ_INSUFFICIENT_PERMISSIONS. In the sidebar of the reference, an endpoint that needs a partner key carries a Partner key label. See API keys for the calls of each group.

Limit What a Key Can Do

A key made without a limit has full access: it does everything its owner can, and so does every key made before limits existed. A key you put on a build server, or in a partner’s backend, needs only the part of the API it uses. Limit it, and a leaked key can do no more than that. You choose the limit when you make the key, in the dialog on Settings → API keys: Full access, Content, Read only or Custom, where you tick what the key may do. The names below are the ones the dialog shows. A limit is one preset or a list of scopes, never both: When a preset is not enough, name the scopes you want:
  • Writing includes reading. Naming content:write gives content:read too, and the same goes for the other write scopes. A list that names every scope makes a key with full access.
  • Scopes only narrow. A limited key still needs what its owner needs: the role, the plan and, for a partner, an account in force.
  • The partner scopes (partner:read, partner:write) are for a partner’s home workspace. Only there is a key a partner key, so only there does the dialog offer them; in any other workspace they would open nothing.
  • The limit is fixed when the key is made. To widen it, make a new key and delete the old one.
  • A limited key cannot make itself a bigger one. No key can make a key: only a person signed in on widgetic.com can, and only that person can switch a key back on. A key with account:read can list the keys of its account, and renaming, switching off and deleting them needs full access.
  • Changing the Brand Kit needs full access, because a change reshapes every widget the account makes from then on. A key with account:read may look at it. See Brand Kit.
  • The MCP server needs full access. https://mcp.widgetic.com hands an assistant every tool your account has, so only a key made with full access opens it, and a limited key is refused with 403. See Authentication for AI assistants.
  • A partner’s backend needs three scopes to start an editor session for a managed user: partner:write, content:write and generate together. See Editor Sessions.
  • Moving an item to another managed user needs two scopes: partner:write and content:write. See Moving Content to Another Managed User.
A request outside the scopes of the key is refused with 403 and the code API_KEY_SCOPE_MISSING. error.details.missingScopes lists what a new key needs, and error.details.fullAccessRequired is true when no list of scopes would have been enough:
These scopes belong to the key and last as long as it does. To give a customer’s browser limited, short-lived access to only that customer’s content, mint an editor session on your server instead.

Keys and your workspace plan

A key is a credential for a paying workspace, so it follows the plan of the workspace it was made for. One rule covers the REST API, the CLI and the MCP server: none of them lets a key in that another one refuses. A key of a workspace that has lapsed is switched off, not deleted. Choose a plan (or update billing) and the same key works again within about a minute, with nothing to make again. Only the workspace’s own plan counts: another workspace of the same person, paid or not, neither unlocks it nor locks it.
An assistant connected through the MCP server is told in another way once its workspace has no plan: the connection is accepted, and each tool answers with the plan’s words instead of doing the work. Only get_profile, and the tools that follow or cancel a build that started while the plan was active, answer. See When the workspace has no plan. The CLI exits with code 3 when the REST API refuses a key for its plan, and with 5 when an MCP tool does.

Validating Tokens

You can validate a token to check its status and associated permissions:
Response:
workspace is the workspace the key works in. It is null for a credential that names none, such as a signed-in session. The answer does not say whether the key acts as a partner: for that, see Check which key you hold.

Best Practices

  • Never expose API keys in client-side code
  • Use environment variables to store keys
  • Rotate keys periodically
  • Use the token exchange flow for browser applications
  • Make one workspace key (wdg_org_) for each workspace you work in, and one for each application
  • Limit a key to what its application needs: Read only for a report, Content for a build server
  • For a partner integration, make the key in your partner’s home workspace: it is a partner key (wgt_prt_) and acts as your partner. Make one for each integration (the checkout server, the support tool), named after it, so that you can switch off or delete one without touching the others
  • JWT tokens expire after a set period
  • Implement token refresh logic in your application
  • Use the SDK’s async token provider for automatic handling

Error Responses

When authentication fails, you’ll receive one of these responses: Example error response:

Next Steps

Partner Authentication

Learn about partner-specific authentication flows

API Reference

Explore all available endpoints