Skip to content

ErrorsΒΆ

Afi uses conventional HTTP response status codes to indicate the success or failure of an API request. In general:

  • Status codes in the 2xx range indicate success.
  • Status codes in the 4xx range indicate an error that occurred given the information provided and current state (e.g., a required parameter was omitted, an invalid value was sent, etc.).
  • Status codes in the 5xx range indicate an error with the Afi services (these errors are rare).

HTTP status codes summary:

HTTP status codeDescription
200 OKCall succeeded.
400 Bad RequestThe request failed, often due to a missing required parameter, an invalid parameter, or a combination of both.
401 UnauthorizedNo valid API key provided.
403 ForbiddenThe API key doesn't have permissions to perform the request.
404 Not FoundThe requested resource doesn't exist.
429 Too Many RequestsToo many requests hit the API too quickly. The caller should use exponential backoff of its requests.
5xx - Internal Server ErrorSomething went wrong on the Afi side (these errors are rare). The request can be retried with an exponential backoff.

Note that status codes 429 and 5xx can be retried with an exponential backoff.

To enable troubleshooting and automatic error handling in the application logic, errors include a JSON body with the following details:

Error JSON fieldDescription
status (integer)HTTP status code.
code (string)An error code string that uniquely identifies the error type reported.
message (string)Human-readable error message.