Errors and status codes¶
The Public API follows standard HTTP status codes and documents the error body for each operation. Authentication failures can have an empty body. Use the status code to drive your retry and fallback logic.
Common status codes¶
200/201: request successful.400: request is invalid (missing or malformed input, or a V2 query parameter that is unknown or has an invalid value: see Query parameter errors).401: authentication error: an invalid, expired or revoked API key (the JWT sent inX-Api-Key), or a missing client or tenant header. A rejected API key returns an empty body and aWWW-Authenticate: ApiKeyheader.403: authorization error (no API key sent, or not allowed for the current tenant context).404: resource or requested page not found.409: the request conflicts with the current resource state or company configuration.429: rate limit exceeded (retry later).500: unexpected server error.
Error response shape¶
Error bodies depend on the failure source. Most JSON errors include a detail
field describing what went wrong. Domain errors and rate-limit responses also
include a stable code; validation and permission errors may instead include a
status field or field-specific validation messages. Authentication can also
return an empty body. The API Reference documents the possible bodies for each
operation and status.
A list request for a page that does not exist returns 404 with detail and a status
field. A V2 query parameter that is unknown or has an invalid value returns 400 with code
BSPORT-400: see Query parameter errors.
Shared infrastructure codes use the BSPORT-<http_status> pattern, for example
BSPORT-400 for an unknown or invalid V2 query parameter, BSPORT-429 for a
rate-limit rejection and BSPORT-500 for an unexpected server error. Domain errors use exactly three uppercase letters followed by a hyphen and
three digits, such as CLI-001, CAP-103, or ASV-001. When a response includes
code, match on it rather than parsing detail:
the message wording can change, while the documented code identifies the error.
Include the error code in support tickets
If you contact support, include the code value when present, the full
response payload and the timestamp of the request to help us trace logs
quickly.
Query parameter errors¶
A V2 request returns 400 with code BSPORT-400 when a query parameter is unknown to the
operation or has a value its filter cannot read. One response lists
every problem. For example, GET /api/v2/management/invoices/?created_after_date=2026-10-01&status=bogus
returns:
{
"detail": "Unknown query parameters: created_after_date (did you mean created_after?). Invalid query parameter values: status.",
"code": "BSPORT-400",
"status": 400,
"invalid_params": [
{"name": "created_after_date", "reason": "unknown", "suggestion": "created_after"},
{"name": "status", "reason": "invalid_value", "message": "Select a valid choice. bogus is not one of the available choices."}
],
"doc_url": "https://api-docs.production.bsport.io/guides/04-errors-and-statuses.html#query-parameter-errors"
}
Each invalid_params entry has these fields:
| Field | Meaning |
|---|---|
name |
The query parameter as you sent it. |
reason |
unknown: the operation does not read this parameter. invalid_value: the filter exists but cannot read the value. |
suggestion |
For unknown, the closest parameter the operation supports, when one is close enough. |
message |
For invalid_value, why the value was refused. |
Rename or remove the parameter before retrying, and check the operation's parameters in the API
Reference. An unsupported ordering field is still ignored.
Retries¶
- Retry
429responses after the rate limit window. See Rate limits and bulk data sync for the exact wait. - Do not retry
400or403without changing the request. - Retry failed reads with bounded backoff. For writes, a
500, timeout or lost response does not prove that no change occurred. Read the affected resource before deciding whether to retry. Communication sends cannot be conclusively matched after a lost response and must not be automatically resent. - For a configuration conflict, correct the company or resource configuration before retrying. Gift-card and product financial setup is not editable through this API; arrange that setup with the company in Back Office.
No Retry-After header is returned
A 429 response carries the standard error body and no Retry-After header.
Wait for the documented rate limit window rather than reading a header value.