HTTP Status

Along with the HTTP methods that the API responds to, it will also return standard HTTP statuses, including error codes.

In the case of a problem, the status contains the error code, while the body of the response will usually contain additional information about the problem that was encountered.


Successful

In general, if the status returned is in the 200 range, it indicates that the request was fulfilled successfully and that no error was encountered.

Client error

Return codes in the 400 range typically indicate that there was an issue with the request that was sent. Among other things, this could mean that you did not authenticate correctly, that you are requesting an action that you do not have authorization for, that the object you are requesting does not exist, or that your request is malformed.

Server Error

If you receive a status in the 500 range, this generally indicates a server-side problem. This means that we are having an issue on our end and cannot fulfill your request currently.

The following table summarizes the typical status codes:

Codes

Code Description
200 - OK Everything works as expected.
201 - Created The resource was created successfully.
202 - Accepted The request was accepted and is processed in the background.
204 - No Content The resource was successfully deleted.
400 - Bad Request Valid data was specified, but the request failed.
401 - Unauthorized No valid Api Key has been specified.
404 - Not Found The requested resource does not exist.
422 - Unprocessable Entity The payload has missing required parameters or invalid data.
429 - Too Many Requests Too many requests in a short time.
500 - Internal Server Error Request failed due to an internal error in Smake.
503 - Service Unavailable Smake is offline for maintenance.

{warning} We recommend writing code that gracefully handles all possible API exceptions. Please handle the status codes and not the message or errors. These only contain additional information for you to analyze the problem.

Examples

{danger} Generic Errors

HTTP/1.1 401 Unauthenticated

{
  "status_code": 401,
  "message":  "API Key is invalid.",
  "errors": []
}

{danger} Validation Errors

HTTP/1.1 422 Unprocessable Entity

{
    "status_code": 422,
    "message": "The request data you sent is not valid.",
    "errors": {
        "shipping_address": {
            "first_name": [
                "The firstname field is required."
            ]
        },
        "items": [
            {
                "quantity": [
                    "The items.0.quantity must be at least 1."
                ]
            }
        ]
    }
}