Error handling
This page describes the HTTP status codes, the error response format, and best practices for handling errors in the Flixer Pro API.HTTP status codes
Error response format
Error responses follow the standard NestJS format with three fields:statusCode— The HTTP status code (matches the response status)message— A human-friendly error description. For validation errors this can be an array of strings (one per field that fails)error— The HTTP status text (e.g.Bad Request,Unauthorized)
Every response also includes an
X-Request-Id header. Keep this value and
mention it in support requests — it makes it possible to trace the request on
the server side.Common errors
400 — Bad Request (Validation error)
Causes:- A required field is missing (e.g.
customerNameortitlewhen creating a lead) - A field value does not meet the rules (e.g. a field that is too long)
- Read the
messagefield of the response — it describes which field is causing the problem - Validate required fields on the client side before sending them
- Consult the endpoint documentation for the field requirements
401 — Unauthorized (Not Authenticated)
Causes:- The
X-API-Keyheader is missing from the request - The API key is invalid or has been revoked
- Make sure you send the header:
- Check that the key has not been revoked in Settings > API keys
- Create a new key if needed
403 — Forbidden (Insufficient Scope)
Causes:- The key is valid, but lacks the scope this endpoint requires
(e.g.
leads:writefor creating a lead)
- Check which scope the endpoint requires (see Authentication)
- Create a key with the correct scopes, or use a key with the
fullscope
429 — Too Many Requests (Rate Limit)
Causes:- Too many requests were sent in a short period
- Implement retry logic with exponential backoff (see below)
- Reduce the frequency of your requests; do not poll more often than necessary
500 — Internal Server Error (Server Error)
Causes:- An unexpected error in the server application
- These errors are usually temporary — implement retry logic with exponential backoff
- Wait a few seconds and try again
- If the problem persists, mention the
X-Request-Idto the support team
Error handling in code
JavaScript/TypeScript
Python
Retry strategy
Implement exponential backoff for 5xx errors and 429:Best practices
- Always check
response.ok— do not assume every request succeeds - Read the
messagefield — on a 400 it tells you exactly what went wrong - Keep the
X-Request-Id— indispensable for support requests - Exponential backoff — for 5xx and 429, with jitter
- Set timeouts — prevent requests from hanging indefinitely
- Use minimal scopes — limit the impact if a key leaks