Skip to content

Authentication

Every request to the cmdform API is authenticated with a personal access token. A token acts on behalf of the account that created it, in the team it was created in, and only with the scopes chosen for it.

API tokens work for teams on the Essential plan or higher. On a lower plan, the token screen does not create tokens, and every API request with a token of that team is refused with 403:

{
"message": "API access is available from the Essential plan."
}
  1. In cmdform, switch to the team the token is for, open your profile and go to API keys.
  2. Give the token a name that says where it is used, for example CRM sync or Data warehouse, so you can tell your tokens apart later.
  3. Choose its scopes: pick a preset or set the access to each resource. Give a token only what its integration needs.
  4. Create the token, copy it and store it in your secret manager or environment variables.

A scope gives a token read or write access to one resource. A request that needs a scope the token does not have is refused with 403, for example This API token does not have the "contacts:write" permission.

Resource:read lets the token:write lets the token
formsList forms and workspaces, get a form with its definition, its translations and a translation template.Create forms, save a definition, set a theme and save, delete translations.
themesList themes and read one.Create and change your team’s themes.
responsesGet responses and a single response.Change a single response.
webhooksRead the webhooks of a form.Create, change and delete webhooks, including Zapier’s.
contactsRead contacts, contact lists, tags and imports.Create, change, import and delete them.
distributionsRead sends, their details and the email templates and SMTP settings.Send surveys by email, SMS or WhatsApp, schedule reminders, create unique links.
dashboardsRead dashboards and their data.Create and change dashboards and their blocks.
flowsRead the automations that run after a response.Create, change and delete them.
questionsRead the question library.Add, change and delete saved questions and folders.

The token screen offers three presets:

  • Read only: every :read scope.
  • Integrations: forms:read, responses:read, webhooks:read and webhooks:write, enough for Zapier, Make and similar tools.
  • Full access: every scope.

A new token starts with forms:read and responses:read.

A change that a token may make but not read answers with a short confirmation instead of the changed data. For example, a token with responses:write and without responses:read gets {"token": "…", "updated": true} after changing a response, and dashboard data without responses:read holds counts and summaries but no single answers.

A token works in the team it was created in, whichever team you have open in cmdform later:

  • it reaches the forms, workspaces, responses, contacts and other data of that team only, even if your account belongs to other teams too;
  • it stops working when you leave the team or are removed from it, and it is deleted with the team.

To work with another team, create a token in that team.

Put the token in the Authorization header of every request:

Authorization: Bearer <token>

Tokens work with the API at https://api.cmdform.com/v1 only. Addresses of the cmdform app refuse them.

GET https://api.cmdform.com/v1/test-auth
Terminal window
curl https://api.cmdform.com/v1/test-auth \
-H "Authorization: Bearer <token>"

When the token works, the response is the e-mail address of the account it belongs to:

{
"email": "joe@example.com"
}
StatusMeaning
401No token, a token that does not exist or was deleted, or a token whose owner no longer belongs to its team.
403The token lacks the scope the request needs, the team’s plan does not include the API, or the data belongs to another team.
  • Treat a token like a password. Keep it on your server and out of browser code, mobile apps and public repositories.
  • Use a separate token for each integration, with only the scopes it needs, so you can delete one without stopping the others.
  • Delete a token you no longer use, or one that may have leaked, on the API keys page. The team’s owner or an admin can delete any token of the team.