Success Codes
200 OK
The request was successful.- POST /auth/login: Authentication successful, access token returned
- GET /v1/price/:coinId: Current price successfully retrieved
- GET /v1/price/:coinId/history: Historical prices successfully retrieved
Client Error Codes
400 Bad Request
The request was malformed or contains invalid parameters. Occurs when:- POST /auth/login: Invalid request body or missing required fields
- GET /v1/price/:coinId: Invalid
coinIdformat (must be lowercase, numbers, and hyphens) - GET /v1/price/:coinId/history: Invalid query parameters (incorrect date format, invalid
limit/pagevalues, orfromdate is aftertodate)
401 Unauthorized
Authentication failed or is missing. Occurs when:- POST /auth/login: Invalid username or password
- GET /v1/price/:coinId: Missing or invalid bearer token
- GET /v1/price/:coinId/history: Missing or invalid bearer token
Protected endpoints require a valid JWT token in the
Authorization header as Bearer <token>. Obtain a token by calling POST /auth/login.404 Not Found
The requested resource does not exist. Occurs when:- GET /v1/price/:coinId: Coin ID not found in CoinGecko’s database
429 Too Many Requests
Rate limit exceeded. Occurs when:- POST /auth/login: Login rate limit exceeded (5 requests per 60 seconds)
- GET /v1/price/:coinId: Global rate limit exceeded (20 requests per 60 seconds) or upstream CoinGecko rate limit
- GET /v1/price/:coinId/history: Global rate limit exceeded (20 requests per 60 seconds)
See Rate Limits for detailed information about rate limiting behavior.
Server Error Codes
502 Bad Gateway
Upstream service request failed. Occurs when:- GET /v1/price/:coinId: CoinGecko API request failed or returned an error
503 Service Unavailable
Backend coordination service is unavailable. Occurs when:- POST /auth/login: Redis (rate limiter backend) is unavailable
- GET /v1/price/:coinId: Redis is unavailable (needed for rate limiting or request batching coordination)
- GET /v1/price/:coinId/history: Redis (rate limiter backend) is unavailable
504 Gateway Timeout
Request timed out while waiting for a response. Occurs when:- GET /v1/price/:coinId: Timed out waiting for batch result (default timeout: 8 seconds)
Error Response Format
All error responses follow the standard NestJS error format:message field may contain an array of specific validation failures: