Quick Start
All API requests follow this pattern:- Format - JSON request body with
Content-Type: application/json - Authenticate - Sign requests using RSA-SHA256 JWT tokens
- Handle - Process responses and errors appropriately
Request Format
Content Type
All requests must use JSON encoding:- Content-Type:
application/json - Request bodies must be valid, well-formed JSON
- All responses are returned in JSON format
Required Headers
Every API request must include these headers:Authentication
All API requests require cryptographic signatures:- SHA-256 - For hashing request bodies
- RSA - For signing JWT tokens
Example Request
Response Format
Response Headers
All API responses include standard HTTP headers plus:Success Responses
Successful requests return:- HTTP Status:
200 OK(or201 Createdfor resource creation) - Body: JSON-encoded response data
Response Structure
Response bodies follow consistent patterns:- Single Resource: Object with resource properties
- List Resources: Object with
dataarray and pagination metadata - Empty Response:
{}ornullfor DELETE operations
HTTP Status Codes
The API uses standard HTTP status codes to communicate request outcomes:Status Code Details
200 OK
The request succeeded. Response body contains the requested data.201 Created
Resource was successfully created. Response body contains the new resource.400 Bad Request
The request is malformed or contains invalid parameters. Check the error response for specific issues. Common causes:- Missing required fields
- Invalid field formats
- Malformed JSON
- Invalid enum values
401 Unauthorized
Authentication failed. The access key or JWT signature is invalid. Common causes:- Invalid or missing access key
- Incorrect JWT signature
- Missing Authorization header
- Signature verification failure
- JWT token expired (must be less than 30 seconds old)
- URI or method claims don’t match the request
403 Forbidden
Access denied. Your credentials are valid but you don’t have permission. Common causes:- Account is inactive
- Subscription doesn’t include this feature
- IP address not whitelisted
- Invalid account number or unique_id
- Insufficient permissions
404 Not Found
The requested resource doesn’t exist or isn’t accessible. Common causes:- Resource ID is incorrect
- Resource belongs to another account
- Resource has been deleted
409 Conflict
The request conflicts with the current state of the resource. Common causes:- Duplicate resource (e.g., card with same reference)
- Resource already exists
- Concurrent modification conflict
429 Too Many Requests
Rate limit exceeded. Too many requests in a given time period. Response includes:Retry-Afterheader indicating seconds to wait- Error details in response body
500 Internal Server Error
A server-side error occurred. This is typically temporary. Action: Retry the request with exponential backoff.502/503/504 Service Unavailable
The service is temporarily unavailable or undergoing maintenance. Action: Retry after a delay. Check status page for maintenance windows.Error Responses
When an error occurs, the API returns an appropriate HTTP status code with a structured error response.Error Response Format
All error responses follow this structure:Error Response Fields
Common Error Codes by Status
Authentication Errors (401)
- Verify your access key is correct
- Check the
Authorizationheader is properly formatted - Verify your JWT signature is correct
- Check that the
uriandmethodclaims match the request exactly - Ensure the JWT token hasn’t expired (must be less than 30 seconds old)
Validation Errors (400)
- Check all required fields are present
- Verify field formats match the API specification
- Ensure numeric values are within valid ranges
- Review validation rules in the API Reference
Insufficient Balance (400)
- Check account balance before initiating transfers
- Fund the account using the appropriate endpoint
- Verify currency matches between accounts
Resource Not Found (404)
- Verify the resource ID is correct
- Ensure the resource belongs to your account
- Check if the resource has been deleted
- Verify you’re using the correct endpoint
Rate Limit Errors (429)
The
Retry-After header will be included in the HTTP response headers, not in the error body.- Implement exponential backoff
- Respect the
Retry-Afterheader - Review your rate limits
- Consider batching requests when possible
Conflict Errors (409)
- Check for existing resources before creating
- Use idempotency keys for safe retries
- Verify unique constraints in the API specification
Common Error Codes
For a complete list of error codes, refer to the API Reference. Error codes are defined in the OpenAPI specification for each endpoint.
Error Handling Best Practices
1. Check HTTP Status Codes
Always check the HTTP status code first:2. Implement Retry Logic
Retry only for transient failures (5xx, 429):3. Log Request IDs
Always log thex-request-id from error responses:
4. Handle Rate Limits Gracefully
Respect rate limits and retry after the specified time:5. Display User-Friendly Messages
Don’t expose raw API errors to end users:Retrying Requests
Not all failed requests should be retried. Implement retry logic only for specific scenarios.When to Retry
Retry these status codes:- 5xx (Server errors) - Temporary server-side issues
- 429 (Rate Limits) - Rate limit exceeded, wait and retry
- 400 (Bad Request) - Fix the request first
- 401 (Unauthorized) - Check authentication
- 403 (Forbidden) - Verify permissions
- 404 (Not Found) - Resource doesn’t exist
- 409 (Conflict) - Resolve conflict first
Retry Implementation
Exponential Backoff
Implement exponential backoff with jitter to prevent thundering herd problems:Respect Rate Limits
When receiving a 429 response, respect theRetry-After header:
Idempotency Keys
Always use a new idempotency key for each retry attempt:Request ID Tracking
Every API response includes anx-request-id header. This unique identifier is essential for:
- Debugging - Track specific requests in your logs
- Support - Reference requests when contacting support
- Troubleshooting - Correlate requests across systems
- Auditing - Track API usage and issues
Best Practices
Always log the request ID:- The
x-request-idfrom the response - Timestamp of the request
- Endpoint and method used
- Request payload (sanitized of sensitive data)
Best Practices
Request Formatting
- Validate JSON - Ensure request bodies are valid JSON before sending
- Use consistent formatting - Follow the API specification exactly
- Include all required fields - Check endpoint documentation
- Use proper data types - Numbers as numbers, not strings (unless specified)
Error Handling
- Check status codes first - Handle different status codes appropriately
- Use error codes, not messages - Parse the
codefield for programmatic handling - Log request IDs - Always capture
x-request-idfor debugging - Implement retry logic - For transient failures (5xx, 429)
- Don’t retry client errors - Fix 4xx errors before retrying
Performance
- Use idempotency keys - Prevents duplicate operations
- Implement connection pooling - Reuse HTTP connections
- Batch operations - When possible, use batch endpoints
- Respect rate limits - Monitor your usage and implement backoff
Security
- Never log sensitive data - Don’t log full request/response bodies
- Store credentials securely - Use environment variables or secure vaults
- Rotate keys regularly - Follow security best practices
- Validate responses - Don’t trust response data blindly
Code Examples
JavaScript/TypeScript
Python
Troubleshooting
Common Issues
Issue: “Invalid JSON” errors- Solution: Validate JSON before sending. Ensure proper escaping of special characters.
- Solution: Verify your private key is correct and the JWT is properly signed. Check the
uriandmethodclaims match exactly.
- Solution: Implement exponential backoff and respect
Retry-Afterheaders. Review your rate limits.
- Solution: Always capture and log the
x-request-idheader from responses.
- Solution: Use unique idempotency keys for each request. Don’t reuse keys across different operations.
Next Steps
- Review Authentication for detailed signing instructions
- Learn about Idempotency for safe retry handling
- Understand Rate Limits to optimize your integration
- Explore the API Reference for endpoint-specific details

