FlatPeak uses HTTP status codes to indicate the success or failure of requests.

This includes:

CodeDescription
2XXIndicates success.
4XXIndicates an invalid request. (error type: invalid_request)
5XXindicates FlatPeak-related issues (error type: api_error).

Error object

When an error needs to be returned in API response, FlatPeak uses a standardised error object across all endpoints:

{
  "object": "error",
  "live_mode": false,
  "context": "connect.postal_address_capture",
  "type": "invalid_request",
  "code": "country_code_missing",
  "message": "Country code is required",
  "connect_token": "cot_6587fa4362341be5b524de3b",
  "time_created": "2022-01-24T14:15:22.003"
}
PropertyDescription
objectIndicates API object type, i.e. error.
live_modeIndicates if live or test mode API key was used.
contextIndicates error context. It provides information on which service and method has errored. For example, connect.postal_address_capture or api.location_create.
typeIndicates error type; possible values are invalid_request - when your request is invalid. And api_error when the FlatPeak service cannot process the request (these are rare).
codeConnect-related error codes are listed in connect-headless guide under code sample of every page. API-related error codes are listed in the API error codes table later on this page. Example: country_code_missing.
messageError description in the English language. Example: Country code is required.
connect_tokenThe Connect token used to make the request resulted in an error.
time_createdTimestamp when this error has occurred.

Account disabled error

When your account is out of subscription or is disabled for any other reason, you will receive an error 422 when trying to access any of the API endpoints.

{
  "object": "error",
  "live_mode": true,
  "context": "api.tariff_create",
  "type": "api_error",
  "code": "account_disabled",
  "message": "Your account is disabled",
  "time_created": "2024-05-16T17:41:50Z",
}

When it happens, open Dashboard and go to Settings > Billing to restore your subscription.