Documentation: HTTP Response Status Codes

HTTP Status Codes

A successful optimization run will result in the 200 OK HTTP status code:

{
    "data": {
        "items": [
            {
                "original_size": 50464,
                "optimized_size": 40208,
                "saved_bytes": 10256,
                "saved_percent": 20.32,
                "url": "https://example.com/image_path.jpg",
                "optimization_status": "success",
                "web_p_url": null,
                "valid_till": "2021-01-08T18:13:10.945773Z",
                "message": null,
                "width": 1024,
                "height": 435
            }
        ],
        "transaction_id": "d679b-6c89-467d-872e-cf0175f"
    }
}

Sending invalid JSON will result in a 400 Bad Request response:

{
    "error": {
        "type": "ValidationException",
        "message": [
            {
                "attribute": "compression",
                "text": "The compression field is required."
            }
        ]
    }
}

Sending an invalid API Key or API Secret will result in a 401 Unauthorized response:

 "error": {
     "type": "AuthorizationException",
     "message": "Unauthorized."
 }

Uploading a file with a file size larger than that set by your plan’s limit will result in a 413 Request Entity Too Large response:

"error": {
     "type": "FileValidationException",
     "message": "Requested file size too large (15728640kb). Upgrade your plan."
 }

Uploading an unsupported image type will result in a 415 Unsupported Media Type response:

"error": {
     "type": "AuthorizationException",
     "message": "Unauthorized."
 }

Any unexpected server error will result in a standard 500 Internal Server Error response:

{
    "success": false,
    "message": "Something went wrong and CheetahO cannot fulfill your request"
}