Error handling & request limiting

Authentication errors

ScenarioHTTP StatusError Code
Missing or empty Authorization header401INVALID_AUTHENTICATION
Invalid or expired access token401INVALID_AUTHENTICATION
Malformed credentials401INVALID_AUTHENTICATION

Example:

{
  "meta": {
    "status": "FAILURE"
  },
  "data": [],
  "errors": [
    {
      "code": "INVALID_AUTHENTICATION",
      "message": "Access token is invalid, expired, or missing."
    }
  ]
}

Request limit

📘

Note that the request limit does not indicate the rate limit in availability Search. This only indicates the query request limit for Content 2.0 API.

  • When rate limited:
    • HTTP status: 429 Too Many Requests
    • Response includes a Retry-After header indicating how many seconds to wait before retrying.
      Example rate limit response:
  • Example:
{  
  "meta": {  
    "status": "FAILURE"  
  },  
  "data": [],  
  "errors": [  
    {  
      "code": "RATE_LIMIT_EXCEEDED",  
      "message": "Rate limit exceeded, please retry after some time",  
      "retryAfter": 5  
    }  
  ]  
}
  • Best practices:
    • Implement exponential backoff with jitter when you receive a 429.
    • Spread requests evenly over time rather than bursting.
    • If you need higher throughput, contact your Agoda account manager to discuss your requirements.

HTTP status codes

Status CodeMeaningAction
200Success (or partial success)Process response. Inspect meta.status.
400Bad Request — invalid parametersDo not retry. Fix the request.
401Unauthorized — invalid tokenObtain a new access token.
429Rate limit exceededWait for Retry-After duration, then retry.
500Internal server errorRetry with exponential backoff.
503Service temporarily unavailableRetry with exponential backoff.

Application-level error codes

Error CodeHTTPMeaningAction
AUTHENTICATION_FAILED401Token is invalid or expiredVerify or refresh token
RATE_LIMIT_EXCEEDED429Too many requestsWait and retry
INVALID_PARAMETER400Validation errorCheck error message
INVALID_PROPERTY_IDS400IDs are malformedEnsure positive integers
PROPERTY_FETCH_ERROR200*Some properties failedRetry failed IDs separately
INTERNAL_ERROR500Unexpected server errorRetry after a wait time

*PROPERTY_FETCH_ERROR returns HTTP 200 with meta.status: "PARTIAL_SUCCESS"

Partial success

A response with meta.status: "PARTIAL_SUCCESS" means some properties were fetched successfully while others failed. You can handle this scenario with the following steps.

  • Process and store the successful properties from data.
  • Collect the failed property IDs from errors[].ids.
  • Retry the failed IDs in a separate request after a short delay.

Did this page help you?