Skip to main content

Error Handling

The ColisMove API returns consistent error responses using standard HTTP status codes and a structured JSON body.

Error Response Format

{
  "status": 400,
  "error": "Bad Request",
  "message": "Le prix par kilo doit etre positif",
  "timestamp": "2026-04-13T10:30:00Z",
  "path": "/v1/api/annonces"
}

HTTP Status Codes

CodeMeaningWhen
400Bad RequestValidation error, missing required field, invalid format
401UnauthorizedMissing or expired JWT token
403ForbiddenInsufficient role (e.g., non-verified user creating an announcement)
404Not FoundResource does not exist
409ConflictDuplicate resource (e.g., email already registered)
422Unprocessable EntityBusiness rule violation (e.g., invalid booking state transition)
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server error

Validation Errors

For field-level validation errors, the response includes details about each invalid field:
{
  "status": 400,
  "error": "Bad Request",
  "message": "Validation failed",
  "fieldErrors": [
    {
      "field": "email",
      "message": "must be a valid email address"
    },
    {
      "field": "password",
      "message": "must be at least 8 characters"
    }
  ]
}

Domain Errors

Business rule violations return descriptive French-language messages:
ErrorDescription
Annonce non trouveeAnnouncement not found
Reservation non trouveeBooking not found
Transition invalideInvalid state transition for a booking
Utilisateur non verifieUser has not completed KYC verification
Solde insuffisantInsufficient wallet balance for withdrawal

Rate Limiting

Certain endpoints are rate-limited. When exceeded, you receive:
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Implement exponential backoff when receiving 429 responses. The Retry-After header indicates how many seconds to wait.