Authentication

Every request to the API is authenticated with an API key, sent in the Authorization header. A key acts as the user who created it, within the forms it was created for.

Sending the key

Send the key as a bearer token in the Authorization header of every request:

Request

curl https://api.backmyform.com/v1/me \
  -H "Authorization: Bearer bmf_TFrW8x1lq4vYp0M2c9kHd3NnRz7aGfQe5JbUoS6iXyC"

A key starts with bmf_, followed by 43 random characters. BackMyForm stores only a hash of it: the key is shown once, when it is created, and can't be shown again. A lost key can't be recovered: delete it and create a new one.

A request without a key, or with a key that doesn't exist or was deleted, is refused with a 401 status:

Response

{
	"status": 401,
	"name": "AuthenticationError",
	"message": "Invalid API key"
}

Who the key acts as

A key belongs to one workspace and to the user who created it. It has no rights of its own: each request is made as that user, with the role they have in the workspace when the request is made.

ActionMemberAdminOwner
Read the workspace, the forms, their fields and their submissionsYesYesYes
Mark submissions as read, rename fields, delete submissionsYesYesYes
Read the webhooks (secrets and header values masked)YesYesYes
Create, update and delete formsNoYesYes
Create, update and delete webhooksNoYesYes
Invite members, change their role and remove themNoYesYes

An action the role doesn't allow is refused with a 403 status. The keys are created by the owners and the admins, so a new key always starts with one of these roles. A user's keys are deleted when the user leaves the workspace or becomes a member.

The read state of the submissions is personal: read is the state for the user of the key, and marking a submission as read marks it for that user only.

Keys of all the forms and keys of one form

A key reaches all the forms of the workspace, or one form only:

  • A key of all the forms is created in Settings → API keys. It reaches every form, and the routes of the whole workspace: creating and deleting forms, the members, the workspace.
  • A key of one form is created in the Integrations → API tab of the form. It reaches that form, its fields, its submissions and its webhooks, and nothing else.

With a key of one form:

  • GET /v1/forms lists that form only, and GET /v1/webhooks the webhooks of that form only.
  • A request about another form, or about a webhook of another form or of all the forms, is answered with a 404 status, as if it didn't exist.
  • The routes of the whole workspace (POST /v1/forms, DELETE /v1/forms/:id, /v1/workspace and /v1/members) and the creation of a webhook of all the forms are refused with a 403 status:

Response

{
	"status": 403,
	"name": "AuthorizationError",
	"message": "This API key only gives access to one form"
}

Managing the keys

The keys are listed in Settings → API keys, with their last use and their number of calls over the last 30 days. Admins see every key of the workspace and delete their own; owners delete any key. A deleted key stops working at once.

Give each tool its own key, named after it: you can then see which one makes the calls, and stop one tool without breaking the others.