Skip to main content

Error Codes

The Bitcore APIs utilize HTTP status codes to indicate the outcome of requests. 2XX status codes signify successful operations, while 4XX and 5XX status codes indicate errors.

4XX status codes represent client errors, meaning the request was malformed or unauthorized, often due to issues like invalid parameters or authentication failures. In such cases, it's essential to review the response body for specific error codes and messages to understand the nature of the problem.

5XX status codes indicate server errors, suggesting that an issue occurred on the server side while processing the request. If you encounter a 5XX error, it may be a temporary issue, and retrying the request after some time is advisable. Always check the response body for additional details regarding the error.


General Error Response Format

Each error response follows a standard JSON format. Depending on the error type, optional fields like errors, details, extra_info may be included.

Minimal Format for Simple Errors

{   
"status": <HTTP_STATUS_CODE>,
"success": false,
"error_code": "<ERROR_CODE>",
"message": "<HUMAN_READABLE_MESSAGE>"
}

Extended Format

{
"status": <HTTP_STATUS_CODE>,
"success": false,
"error_code": "<ERROR_CODE>",
"message": "<HUMAN_READABLE_MESSAGE>",
"errors": [
{
"field": "<FIELD_NAME>",
"message": "<SPECIFIC_ERROR_MESSAGE>"
}
],
"details": {
"hint": "<SUGGESTED_FIX_OR_DETAILS>",
"reference": "<DOCUMENTATION_LINK>",
"possible_causes": ["<POSSIBLE_CAUSE_1>", "<POSSIBLE_CAUSE_2>"]
},
"metadata": {
"request_id": "<UNIQUE_REQUEST_IDENTIFIER>",
"timestamp": "<ISO_8601_UTC_TIMESTAMP>",
"retry_after": <SECONDS>,
"throttle_info": <RATE_LIMITING_INFO>
}
}

Extended Error Format Description

Some API error responses include an extended format to help with debugging and handling:

  • metadata: General request info like request_id, retry_after, or rate-limit indicators.

  • errors: Field-specific validation issues (e.g., missing or invalid input).

  • details: Helpful hints or links to fix the issue.

    {
    "hint": "Ensure the API key is valid",
    "reference": "https://docs.example.com/errors/401"
    }
  • throttle_info (only if rate-limited): Shows current rate limit status.

    {
    "limit": 500,
    "remaining": 10,
    "reset_in": 120,
    "policy": "500 requests per 10 minutes"
    }

Client Errors (4xx)

CodeStatus NameError CodeMeaning
400Bad RequestINVALID_INPUT, INVALID_FILE_TYPE, FILE_TOO_LARGE, MALFORMED_REQUESTThe request is malformed or has invalid parameters.
401UnauthorizedTOKEN_EXPIRED, TOKEN_REVOKED, INVALID_CREDENTIALS, INVALID_TOKEN, UNAUTHORIZED_ACCESSAuthentication is required or failed.
402Payment RequiredINSUFFICIENT_BALANCE, PAYMENT_REQUIRED, PAYMENT_FAILED, INVOICE_OVERDUEPayment-related issues.
403ForbiddenINSUFFICIENT_PERMISSIONSUser does not have permission to access.
404Not FoundRESOURCE_NOT_FOUND, FILE_NOT_FOUNDThe requested resource does not exist.
405Method Not AllowedMETHOD_NOT_ALLOWEDThe HTTP method used is not allowed for this endpoint.
409ConflictBUSINESS_RULE_VIOLATION, RESOURCE_ALREADY_EXISTSConflict due to duplicate records or business rule violation. Example: This asset already has an associated NFT. Onboarding not completed. Minting is restricted.
415Unsupported Media TypeUNSUPPORTED_MEDIA_TYPE, INVALID_CONTENT_TYPE, UNSUPPORTED_FILE_FORMATThe request has an unsupported Content-Type (e.g., client sends XML when JSON is expected).
426Upgrade RequiredAPI_VERSION_DEPRECATED, API_VERSION_NOT_SUPPORTEDThe client must switch to a newer protocol version. Useful for enforcing API versioning.
429Too Many RequestsRATE_LIMIT_EXCEEDED, THROTTLE_LIMIT_REACHED, API_QUOTA_EXCEEDEDRate limiting triggered due to excessive requests.

Server Errors (5xx)

CodeStatus NameError CodeMeaning
500Internal Server ErrorINTERNAL_SERVER_ERRORA generic server error occurred.
502Bad GatewayBAD_GATEWAYReceived an invalid response from an upstream server.
503Service UnavailableSERVICE_UNAVAILABLE, MAINTENANCE_MODEThe server is temporarily overloaded or under maintenance.
504Gateway TimeoutGATEWAY_TIMEOUTThe server did not respond in time.

Example Error Responses

429 - Too Many Requests

{
"status": 429,
"success": false,
"error_code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later.",
"metadata": {
"retry_after": 60,
"request_id": "def789",
"throttle_info": {
"limit": 500,
"remaining": 0,
"reset_in": 60,
"policy": "500 requests per minute"
},
"timestamp": "2025-03-22T12:10:00Z"
}
}

401 - Unauthorized

{
"status": 401,
"success": false,
"error_code": "TOKEN_EXPIRED",
"message": "Invalid API token. Please authenticate.",
"metadata": {
"request_id": "abc123",
"timestamp": "2025-03-22T12:00:00Z"
}
}