What responses does the API return?

Code
Scenario
200 Success The request was processed successfully.
201 Created
One (or multiple) resources were created.
400 Bad Request 
Cannot process request due to client error.
401 Unauthorised
Invalid bearer token provided.
404 Not Found
Endpoint not found.
422 Unprocessable Content
Payload failed validation.
500 Internal Server Error

Examples

200 Success

GET /api/orders/{id}
{
    "reference": "ABC123",
    "email": "acme@aerocommerce.com",
    "subtotal": {
        "amount": 84166.67,
        "tax": 16833.33
    },
    "shipping": {
        "amount": 83.33,
        "tax": 16.67
    },
    "discount": {
        "amount": 8416.67,
        "tax": 1683.33
    },
    "surcharge": {
        "amount": 0,
        "tax": 0
    },
    "ordered_at": "2023-09-01T09:29:41.000000Z",
    "deliver_on": null,
    "currency": "GBP",
    "status": {
        "id": 3,
        "name": "Successful",
        "state": "successful"
    },
    "customer": {
        "id": 1,
        "name": "Acme",
        "email": "acme@aerocommerce.com"
    },
    "shipping_method": {
        "id": 1,
        "name": "Standard"
    },
    "billing_address": {
        "id": 1,
        "first_name": "Aero",
        "last_name": "Commerce",
        "company": "Aero Commerce",
        "mobile": null,
        "phone": null,
        "line_1": "28-32 Albert Rd",
        "line_2": null,
        "city": "Middlesbrough",
        "zone": null,
        "postcode": "TS1 1QD",
        "reference": null,
        "country": "GB",
        "eori_number": null
    },
    "shipping_address": {
        "id": 1,
        "first_name": "Aero",
        "last_name": "Commerce",
        "company": "Aero Commerce",
        "mobile": null,
        "phone": null,
        "line_1": "28-32 Albert Rd",
        "line_2": null,
        "city": "Middlesbrough",
        "zone": null,
        "postcode": "TS1 1QD",
        "reference": null,
        "country": "GB",
        "eori_number": null
    },
    "items": [
        {
            "id": 1,
            "name": "Test",
            "sku": "TEST-S",
            "product_id": 4,
            "variant_id": 14,
            "shippable": true,
            "quantity": 2,
            "price": {
                "amount": 42083.33,
                "tax": 8416.67
            },
            "discount": {
                "amount": 8416.67,
                "tax": 1683.33
            },
            "full_price": {
                "amount": 42083.33,
                "tax": 8416.67
            },
            "weight": 0,
            "volume": 0
        }
    ]
}

201 Created

POS /api/orders
{
    "order": {
        "id": 15
    }
}

400 Bad Request

GET /api/orders/{id}
{
    "message": "Missing order ID"
}

401 Unauthorised

GET /api/orders/{id}
{
    "message": "Unauthorized: Bearer token missing."
}

404 Not Found

GET /api/orders/{id}
{
    "message": "The requested order with ID {id} could not be found."
}

422 Unprocessable Content

POST /api/orders
{
    "message": "The given data was invalid.",
    "errors": {
        "currency": ["The currency field is required."]
    }
}

500 Internal Server Error

{
    "message": "Exception message..."
}


Revision #2
Created 2026-09-29 12:40:44 UTC by Ethan Payne
Updated 2026-10-02 13:09:01 UTC by Ethan Payne