Errors
The API tells whether a request succeeded with the HTTP status of its response. A request that fails gets a JSON body explaining why.
Status codes
A status in the 2xx range is a success, 4xx an error in the request (fix the request before sending it again), and 5xx an error on BackMyForm's side (try again later).
| Status | Name | Meaning |
|---|---|---|
200 | The request succeeded. | |
400 | ValidationError, JsonValidationError | The request is invalid: a parameter is missing or wrong, or the action is not possible in the current state. |
401 | AuthenticationError | The API key is missing, or doesn't exist. See Authentication. |
402 | PaymentRequiredError | The plan of the workspace doesn't include the feature. |
403 | AuthorizationError | The role of the user, or the form of the key, doesn't allow the action. |
404 | NotFoundError | The resource doesn't exist, was deleted, or is out of reach of the key. |
429 | TooManyRequestsError | Too many requests were made with the key. See Rate limits. |
500 | InternalError | An unexpected error on BackMyForm's side. |
The error body
- Name
status- Type
- integer
- Description
The HTTP status of the response.
- Name
name- Type
- string
- Description
The kind of error, given in the table above.
- Name
message- Type
- string
- Description
What went wrong, in English. Written for developers: don't show it to your users as it is, and don't parse it.
- Name
code- Type
- string
- Description
A code to handle the error in your code, when the error has one (see below).
- Name
data- Type
- object
- Description
The details of the error, when it has some: the invalid parameters, the feature missing from the plan, the time to wait.
Response
{
"status": 404,
"name": "NotFoundError",
"message": "*Form* not found for id *1f0b2c4e-1a2b-6c3d-8e4f-5a6b7c8d9e0f*",
"code": "resource_missing"
}Error codes
| Code | Status | Meaning |
|---|---|---|
JSON_SCHEMA | 400 | A parameter of the body or of the query string is missing or invalid: data lists them. |
invalid_resource | 400 | The request is not valid for the resource, as told by message. |
resource_already_exists | 400 | The resource already exists, for example a member who already joined the workspace. |
plan_required | 402 | The plan of the workspace doesn't include the feature named in data.feature. |
resource_missing | 404 | The resource doesn't exist. |
too_many_requests | 429 | The rate limit of the key is reached: wait data.retryAfter seconds. |
Invalid parameters
The body and the query string of the requests are checked before anything is done. When they are invalid, the error has the JSON_SCHEMA code and lists every problem in data: instancePath is the parameter, message what is wrong with it.
Response
{
"status": 400,
"name": "JsonValidationError",
"message": "Invalid data found",
"code": "JSON_SCHEMA",
"data": [
{
"instancePath": "/name",
"schemaPath": "#/properties/name/maxLength",
"keyword": "maxLength",
"params": { "limit": 100 },
"message": "must NOT have more than 100 characters"
}
]
}A body that is not valid JSON is refused with a 400 status and the Invalid JSON message: send the body with the Content-Type: application/json header.
Features of the plans
Some settings need a paid plan, like hiding the BackMyForm branding or the partial submissions. Changing them on a workspace whose plan doesn't include them is refused with a 402 status. data.feature names the feature:
Response
{
"status": 402,
"name": "PaymentRequiredError",
"message": "The *formHideBranding* feature requires a higher plan",
"code": "plan_required",
"data": { "feature": "formHideBranding" }
}The features of the workspace, and the lowest plan including each of them, are returned by GET /v1/workspace.