Response Codes

Status codes, error bodies, retries and useful response headers.

Every response has a standard HTTP status code. Handle requests by the status code: 2xx succeeded, 4xx means the request needs changing, and 5xx means retry later.

StatusMeaning
200OK. The response body has the result
201Created. The resource was created
202Accepted. A background job has started, such as an import or bulk update
204No Content. The request succeeded and there's no body
400Bad Request. A parameter or the body is missing or invalid
401Unauthorized. The access token or subscription key is missing, invalid or expired, or the token isn't allowed to use this tenant ID
403Forbidden. The API application doesn't have access to this operation
404Not Found. The resource doesn't exist, or the path or HTTP method is wrong
409Conflict. The request clashes with the current state, for example a duplicate
429Too Many Requests. You've hit a rate limit or quota. See Rate Limiting & Quotas
500Internal Server Error. Something failed on Perspio's side

Error bodies

Errors return JSON with at least a statusCode and a message. Errors raised by an API also say which operation failed:

{
  "errorType": "UnauthorizedAccessException",
  "statusCode": 401,
  "request": "GET /api/assetsV2",
  "tenantId": "in-...",
  "message": "..."
}

Errors from the gateway in front of the APIs, such as a missing subscription key or an unknown path, are shorter:

{
  "statusCode": 401,
  "message": "Access denied due to missing subscription key."
}
📘

Don't depend on error messages

Messages can change at any time, so use them for logging and debugging only. Base your error handling on the status code. Occasional 502, 503 or 504 responses from the network edge may not be JSON, so check the Content-Type before parsing.

Retrying

  • 5xx and 429: retry with exponential backoff. For 429, wait at least as long as the rate limit needs. See Rate Limiting & Quotas.
  • 401: request a new access token and retry once. If it fails again, check your tenant ID and subscription key.
  • Other 4xx: don't retry the same request. Fix it first.

Response headers

HeaderWhat it's for
x-perspio-correlation-idA unique ID for the request. Include it when you contact support about a failed call
remaining-calls, total-callsYour rate-limit usage. See Rate Limiting & Quotas
TotalCount, ResultCount, ContinuationTokenPaging for lists. See Pagination