OneBalance uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with OneBalance’s servers.

HTTP Status Codes

Status CodeTypeDescription
200OKEverything worked as expected.
400Bad RequestThe request was unacceptable, often due to missing a required parameter.
401UnauthorizedNo valid API key provided.
402Request FailedThe parameters were valid but the request failed.
403ForbiddenThe API key doesn’t have permissions to perform the request.
404Not FoundThe requested resource doesn’t exist.
429Too Many RequestsToo many requests hit the API too quickly. We recommend an exponential backoff of your requests.
500, 502, 503, 504Server ErrorsSomething went wrong on OneBalance’s end.

Error Response Format

Both 400 and 500 level errors return a JSON object in the response body, containing specific attributes detailing the error.

NameTypeDescription
errorstringA short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be “not_found.”
messagestringA message providing additional information about the error, including details to help resolve it when possible.
statusCodenumberHTTP status code.
timestampstringTimestamp of the error.
pathstringPath of the request that caused the error.

Example Error Response

HTTP/1.1 401 Unauthorized

Unauthorized
{
  "error": "UnauthorizedException",
  "message": "Invalid or missing API key",
  "statusCode": 401,
  "timestamp": "2024-12-18T14:38:24.793Z",
  "path": "/api/xxx/xxx"
}

Error Handling Best Practices

  • Always check for error responses in your API integrations
  • Use the statusCode to determine the type of error
  • Look at the message field for specific details on how to resolve the issue
  • Include the error id when contacting support about any API issues