Error Response Format
All API errors follow a consistent JSON structure:boolean
required
Always
false for error responsesstring
required
Human-readable error message in Spanish
string
Optional error code for programmatic handling
HTTP Status Codes
The Viax API uses standard HTTP status codes:Success Codes
OK
Request succeeded. Response includes requested data.
Created
Resource successfully created (not commonly used)
Client Error Codes
Bad Request
Invalid request parameters or malformed JSONCommon causes:
- Missing required fields
- Invalid data types
- Malformed JSON
Unauthorized
Authentication failed or missing credentialsCommon causes:
- Invalid email/password combination
- User account does not exist
Forbidden
User lacks permission for the requested actionCommon causes:
- Account is inactive or suspended
- Insufficient permissions for admin endpoints
- Driver not approved
Not Found
Requested resource does not existCommon causes:
- User ID not found
- Trip ID not found
- Endpoint URL is incorrect
Server Error Codes
Internal Server Error
Unexpected server errorAction: Retry the request. If the error persists, contact support.
Service Unavailable
Service temporarily unavailableAction: Wait and retry with exponential backoff.
Exception Types
The Viax client SDK defines the following exception types:ServerException
Thrown when the server returns an error response (HTTP 400, 500, etc.).NetworkException
Thrown when there’s a network connectivity issue.- No internet connection
- Request timeout
- DNS resolution failure
- Connection refused
NotFoundException
Thrown when a resource is not found (HTTP 404).AuthException
Thrown for authentication failures (HTTP 401).UnauthorizedException
Thrown for authorization failures (HTTP 403).ValidationException
Thrown for data validation errors.Common Error Scenarios
Invalid Credentials
Email Already Registered
Missing Required Fields
Trip Not Found
Driver Not Available
Network Timeout
Error Handling Best Practices
1
Check HTTP Status
Always check the HTTP status code first to determine the error category
2
Parse Error Response
Parse the JSON error response to get the specific error message
3
Handle Gracefully
Display user-friendly error messages and provide actionable next steps
4
Log for Debugging
Log errors for debugging, but never expose sensitive information
5
Retry When Appropriate
Implement retry logic for network errors and 5xx server errors
Retry Strategy
For transient errors (network issues, 503 errors), implement exponential backoff:Timeout Configuration
The API has a default timeout of 30 seconds:Error Monitoring
The API includes error logging and crash reporting. Enable analytics in your configuration:
Support
If you encounter persistent errors or unexpected behavior:- Check API status if monitoring is available
- Review the documentation for the specific endpoint
- Verify your request format matches the examples
- Contact technical support with:
- Timestamp of the error
- Request details (without sensitive data)
- Full error response
- Steps to reproduce