Skip to main content
The Issuing API uses JSON for request and response bodies, and requires cryptographic signatures for authentication. This guide covers everything you need to know about making requests and handling responses.

Quick Start

All API requests follow this pattern:
  1. Format - JSON request body with Content-Type: application/json
  2. Authenticate - Sign requests using RSA-SHA256 JWT tokens
  3. 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:
Idempotency Key: Always include an Idempotency-Key header for POST requests. This ensures safe retries and prevents duplicate operations. See Idempotency for details.

Authentication

All API requests require cryptographic signatures:
  • SHA-256 - For hashing request bodies
  • RSA - For signing JWT tokens
See the Authentication guide for detailed signing instructions.

Example Request


Response Format

Response Headers

All API responses include standard HTTP headers plus:

Success Responses

Successful requests return:
  • HTTP Status: 200 OK (or 201 Created for resource creation)
  • Body: JSON-encoded response data
Example Success Response:

Response Structure

Response bodies follow consistent patterns:
  • Single Resource: Object with resource properties
  • List Resources: Object with data array and pagination metadata
  • Empty Response: {} or null for 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-After header indicating seconds to wait
  • Error details in response body
See Rate Limiting for details.

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:
Some errors may include additional context:

Error Response Fields

Important: Always use the code field for programmatic error handling. The message field is for human readability and may change over time.

Common Error Codes by Status

Authentication Errors (401)

Solutions:
  • Verify your access key is correct
  • Check the Authorization header is properly formatted
  • Verify your JWT signature is correct
  • Check that the uri and method claims match the request exactly
  • Ensure the JWT token hasn’t expired (must be less than 30 seconds old)

Validation Errors (400)

Solutions:
  • 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)

Solutions:
  • Check account balance before initiating transfers
  • Fund the account using the appropriate endpoint
  • Verify currency matches between accounts

Resource Not Found (404)

Solutions:
  • 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.
Solutions:
  • Implement exponential backoff
  • Respect the Retry-After header
  • Review your rate limits
  • Consider batching requests when possible

Conflict Errors (409)

Solutions:
  • 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 the x-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
Do NOT retry these status codes:
  • 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 the Retry-After header:

Idempotency Keys

Always use a new idempotency key for each retry attempt:
Critical: When retrying, always provide a new idempotency key. Requests with the same idempotency key return the same result, including errors. This ensures retries are treated as new attempts.

Request ID Tracking

Every API response includes an x-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:
Include in support requests: When contacting support, always include:
  • The x-request-id from the response
  • Timestamp of the request
  • Endpoint and method used
  • Request payload (sanitized of sensitive data)

Best Practices

Request Formatting

  1. Validate JSON - Ensure request bodies are valid JSON before sending
  2. Use consistent formatting - Follow the API specification exactly
  3. Include all required fields - Check endpoint documentation
  4. Use proper data types - Numbers as numbers, not strings (unless specified)

Error Handling

  1. Check status codes first - Handle different status codes appropriately
  2. Use error codes, not messages - Parse the code field for programmatic handling
  3. Log request IDs - Always capture x-request-id for debugging
  4. Implement retry logic - For transient failures (5xx, 429)
  5. Don’t retry client errors - Fix 4xx errors before retrying

Performance

  1. Use idempotency keys - Prevents duplicate operations
  2. Implement connection pooling - Reuse HTTP connections
  3. Batch operations - When possible, use batch endpoints
  4. Respect rate limits - Monitor your usage and implement backoff

Security

  1. Never log sensitive data - Don’t log full request/response bodies
  2. Store credentials securely - Use environment variables or secure vaults
  3. Rotate keys regularly - Follow security best practices
  4. 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.
Issue: “Signature verification failed”
  • Solution: Verify your private key is correct and the JWT is properly signed. Check the uri and method claims match exactly.
Issue: “Rate limit exceeded”
  • Solution: Implement exponential backoff and respect Retry-After headers. Review your rate limits.
Issue: “Request ID not found in logs”
  • Solution: Always capture and log the x-request-id header from responses.
Issue: “Duplicate operations”
  • Solution: Use unique idempotency keys for each request. Don’t reuse keys across different operations.


Next Steps