Error handling
The Flex Forward API uses standard HTTP status codes and structured error responses. This page covers the error formats, status code meanings, and guidance for handling failures.Error response formats
The API returns three error response shapes depending on the type of failure. Understanding which shape to expect helps you write correct error-parsing logic.Standard error
Returned for authentication failures, not-found errors, and server errors:Validation error
Returned for request validation failures (HTTP 400). Includes adetails array with field-level error information:
details contains:
HTTP status codes
Validation errors (400)
Validation errors indicate that the request body does not meet the API schema requirements. The response always includes adetails array with specific field paths.
Common causes:
- Missing required fields (
shipment.shipTo,courier,idempotencyKey) - Invalid field formats (country code, email, phone number)
- Invalid numeric values (weight must be greater than 0)
Fix all validation errors listed in the
details array before retrying. The same idempotencyKey can be reused after a 400 response because no label was created.Authentication errors (401 / 403)
401 Unauthorized
Thex-rr-apikey or x-rr-apitoken header is missing or invalid:
403 Forbidden
The credentials are valid but the caller does not have access to the requested resource. This occurs when attempting to retrieve a label or tracking information that belongs to a different account:Downstream courier errors (502)
When the courier service returns an error, the API responds with HTTP 502. The label is persisted in the database withstatus: failed and includes the courier error details:
error object contains:
Retryable vs non-retryable errors
See Idempotency and Retries for the recommended retry strategy.
Troubleshooting
Missing Content-Type header
Missing Content-Type header
All POST requests must include
Content-Type: application/json. Without it, the request body will not be parsed and the API returns a 400 error.Wrong base URL or HTTP instead of HTTPS
Wrong base URL or HTTP instead of HTTPS
All requests must use HTTPS. Verify you are using the correct environment URL:
https://api.flexforward.com (production) or https://sandbox.flexforward.com (development).Invalid UUID format for label ID
Invalid UUID format for label ID
The
id parameter in GET /labels/{id} and GET /tracking/{id} must be a valid UUID. Passing a tracking number or other identifier format will return a 404 error.Label created but status is failed
Label created but status is failed
A
status: failed response with HTTP 201 or 200 means the label was persisted but the courier rejected the request. Check the error object for the courier’s error message. Common causes: invalid address, unsupported destination, or courier account configuration issues.