Introduction
The NeuraTrade API is a RESTful API that provides programmatic access to trading analytics, market data, arbitrage opportunities, and autonomous trading features. All endpoints return JSON responses and use standard HTTP response codes.Base URL
The API is accessible at:In production environments, replace
localhost:8080 with your deployed API URL.API Versioning
All API endpoints are versioned and mounted under the/api/v1 prefix:
- Market data:
GET /api/v1/market/prices - Arbitrage:
GET /api/v1/arbitrage/opportunities - User profile:
GET /api/v1/users/profile
Response Format
All API responses follow a consistent JSON structure:Successful Response
Error Response
Response status:
"success" or "error"Main response payload (present in successful responses)
Error message (present in error responses)
Additional context or description
Machine-readable error code for client handling
HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
200 | Success - Request completed successfully |
201 | Created - Resource created successfully |
400 | Bad Request - Invalid request parameters |
401 | Unauthorized - Authentication required or failed |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource does not exist |
409 | Conflict - Resource already exists |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Server-side error |
503 | Service Unavailable - Service temporarily unavailable |
Error Handling
Common Error Codes
Admin authentication required for this endpoint
JWT token is invalid or expired
Rate limit threshold exceeded for your API key or IP address
Error Response Example
Rate Limiting
The API implements rate limiting to ensure fair usage and system stability.Rate Limit Headers
All API responses include rate limit information in the headers:Maximum number of requests allowed in the current window
Number of requests remaining in the current window
Unix timestamp when the rate limit window resets
Rate limit policy identifier (e.g.,
"rate_limit_exceeded")Default Limits
- Default: 100 requests per minute per IP address
- Authenticated: Higher limits based on subscription tier
- Admin endpoints: Separate rate limits with higher thresholds
Rate Limit Exceeded Response
When rate limits are exceeded, the API returns HTTP 429:Number of seconds to wait before retrying the request
Health check endpoints (
/health, /ready, /live) are exempt from rate limiting.Health Check Endpoints
The API provides multiple health check endpoints for monitoring:System Health
Readiness Check
Liveness Check
Request Headers
Common Headers
Bearer token for authenticated endpoints:
Bearer <jwt_token>Admin API key for admin-protected endpoints
Request content type (for POST/PUT requests)
Pagination
Endpoints returning lists support pagination through query parameters:Number of items to return (max 100)
Number of items to skip
Environment-Specific Behavior
Next Steps
Authentication
Learn about JWT tokens and API key authentication
Market Data
Access real-time market prices and orderbook data
Arbitrage
Discover arbitrage opportunities across exchanges
Trading
Execute trades and manage positions