Error & Status Codes

alfred status codes throughout our API products

Status Codes:

alfred 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.).

Some 4xx errors that could be handled programmatically (e.g., a card is declined) include an error code that briefly explains the error reported.

Error Types

Status Code
Status Response
Description

202

ACCEPTED

Everything worked as expected.

404

NOT FOUND

The requested resource doesn't exist.


Error Handling:

Here is an example of making a request to my-info endpoint with a required property in the body missing:

https://api-dev-services.alfredpay.app/api/v1/third-party-service/my-info

bashCopy codecurl --request POST \
  --url https://api-dev-services.alfredpay.app/api/v1/third-party-service/my-info \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: Insomnia/2023.5.7' \
  --header 'api-key: alfredpay.fbm1lIK_Pdi7G1buBEMXyIcp4CPX6a38' \
  --header 'api-secret: s8MhbbRKrWDIilV~nBtpDgnKqpTRwYyv' \
  --data '{
   "type": "in",
   "currency": "USDC",
   "user": "0x0DD967bb17aB6cfaA4Aafdaed70d8f1DaFf22222",
   "chain" : "polygon"
}
'

The error response would be:

Now, this would be an example of making the same request with an incorrect api-key.

The response would be:

The same response above would occur if the api-secret is passed incorrectly.

These same error responses apply to all other endpoints.


https://api-dev-services.alfredpay.app/api/v1/third-party-service/login-sof-kyc

In the following curl, we will omit the firstname field in the body.

Example curl:

The response is:

Now, in this example, lastname will not be passed, which is a required property.

And the response will be:


https://api-dev-services.alfredpay.app/api/v1/third-party-service/payment-method

Here's an example of trying to execute the endpoint with an invalid token, this often can be an expired token:

The response would be:

When an internal server error occurs, the response would be:

These same error handling responses apply to all other endpoints.

Last updated