Errors
The API uses standard HTTP status 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 with the parameters provided (like a missing parameter or a card decline). Codes in the 5xx range indicate an error in our infrastructure.
Invalid request (4xx) errors that can be handled programmatically include an enum code that allows you to respond to the error.
The Error object
An invalid request error indicates that the parameters, format, or nature of the request are invalid. Examples include missing required parameters or incorrect parameter types. Actions that conflict with the current state of a resource may also result in an invalid request error.
- Name
object
- Type
- "error",
- Name
error
- Type
- object,
- Child properties
- Name
type
- Type
- "invalid_request_error",
- Name
live
- Type
- boolean or null,
- Name
code
- Type
- enum or null,
- Array item properties
- Name
message
- Type
- string,
- Name
param
- Type
- string or null,
- Name
issues
- Type
- array or null,
or
Payment errors are indicate an issue with the payment method provided. Examples include an incorrect card number or insufficient funds. You can show the value of the message property to your customers.
- Name
object
- Type
- "error",
- Name
error
- Type
- object,
- Child properties
- Name
type
- Type
- "payment_error",
- Name
live
- Type
- boolean or null,
- Name
code
- Type
- null,
- Name
message
- Type
- string,
- Name
param
- Type
- string or null,
- Name
payment
- Type
- Payment or null,
- Child properties
- Name
decline_code
- Type
- enum or null,
- Array item properties
or
Idempotency errors are returned when a request is made with an invalid idempotency key. Examples include using an idempotency key that was previously used on one resource on another or sending multiple requests at the same time with a single idempotency key.
- Name
object
- Type
- "error",
- Name
error
- Type
- object,
- Child properties
- Name
type
- Type
- "idempotency_error",
- Name
live
- Type
- boolean or null,
- Name
code
- Type
- null,
- Name
message
- Type
- string,
- Name
param
- Type
- null,
or
Rate limit errors are returned when a request is made that exceeds the rate limit. An exponential backoff strategy is recommended when retrying requests. The rate limit for most resources is 1,000 requests every 10 seconds.
- Name
object
- Type
- "error",
- Name
error
- Type
- object,
- Child properties
- Name
type
- Type
- "rate_limit_error",
- Name
live
- Type
- boolean or null,
- Name
code
- Type
- null,
- Name
message
- Type
- string,
- Name
param
- Type
- null,
or
Server errors are internal errors in Bias infrastructure. These are rare and treated as incidents. Use the ID in the Request-ID header when communicating with support. When using idempotency keys, you can retry the request without the risk of duplicate side effects.
- Name
object
- Type
- "error",
- Name
error
- Type
- object,
- Child properties
- Name
type
- Type
- "server_error",
- Name
live
- Type
- boolean or null,
- Name
code
- Type
- null,
- Name
message
- Type
- string,
- Name
param
- Type
- null,
or
Handling errors
Errors of type server_error and rate_limit_error can be retried with reasonable backoffs. Errors of type payment_error can be retried by the user or automatically if the user is not present. Be mindful as additional authorization attempts will incur fees.
See Idempotency for best practices and information on making idempotent requests. These requests can safely be retried without additional consequences. They return the cached response for additional unretryable requests instead of creating a duplicate action.
Errors in the SDK
API responses in TypeScript SDK are typed as a union of the possible errors and the successful response: