API Status Codes

Response status codes (http) provide insight into the outcome of your AgentSync API request:

  • 2xx – SuccessIndicates that the request was successful.
  • 4xx – Client ErrorIndicates an issue with the request, such as invalid parameters, authentication failure, or insufficient permissions
  • 5xx – Server ErrorIndicates a problem on the server side. These are typically temporary and may resolve if retried after some time.

Success Reponses

A successful API request will return an appropriate HTTP status code, and the response body will vary depending on the endpoint.

The following status codes indicate a successful request:

CodeDescription
200OK - The request was successful and the response contains the requested data.
202Accepted - The request has been accepted for processing, but the operation is still in progress. Results will be available asynchronously.

Failure Responses

When a request fails, AgentSync APIs return a structured error response to help developers identify and resolve issues quickly.

Standard Error Format

Most errors follow this standardized format:

{
  "timestamp": 1613510729601,
  "status": 500,
  "error": "Internal Server Error",
  "message": "Error message describing why this was an error.",
  "path": "/v2/{endpoint}"
}
FieldDescription
timestampThe exact date and time when the error occurred (in ISO 8601 format).
statusThe HTTP status code associated with the error (e.g., 400, 404, 500).
errorA short description of the HTTP status (e.g., "Bad Request", "Not Found").
messageA human-readable explanation of what went wrong.
pathThe API endpoint or resource path that triggered the error.

⚠️ While this is the most common error format returned by the AgentSync API, there may be exceptions depending on the endpoint or specific error scenario.

Common AgentSync Errors & Troubleshooting

400 - Bad Request

This typically occurs due to invalid parameters or malformed requests.

{
  "timestamp": 1742929112,
  "status": 400,
  "error": "Bad Request",
  "message": "Invalid parameter values provided - {parameter}:[{invalid values}]",
  "path": "{endpoint_path}"
}

How to troubleshoot:

  • Double-check the parameter names and values in your request body or query string.
  • Ensure all required fields are present and properly formatted.

401 - Unauthorized

Returned when the request is missing valid authentication credentials.

{
    "message": "Unauthorized"
}

How to troubleshoot:

  • Confirm you're including the Authorization header with a valid Bearer token.
  • If your token has expired, retrieve a new one using the client credentials flow.
  • Ensure the correct client_id and client_secret are being used with the correct token URL.

404 - Not Found

This indicates that the requested resource could not be found.

{
  "timestamp": 1742929112,
  "status": 404,
  "error": "Not Found",
  "message": "Error message describing what was not found",
  "path": "{requested endpoint}"
}

How to troubleshoot:

  • If querying by an NPN or external ID, confirm that the value is correct.
  • Ensure the endpoint path is spelled correctly.

⚠️ Requests that return a 404 for a non-existent NPN will not be billed.

429 - Too Many Request

This error indicates you've exceeded the API rate limit.

{
  "messsage": "API rate limit exceeded"
}

How to troubleshoot:

  • Reduce the frequency of your requests.
  • Implement rate limiting or exponential backoff in your integration.
  • If receiving on the token endpoint, be sure you are re-using your tokens
  • If you need additional support, contact AgentSync support.

500 - Internal Server Error

An unexpected error occurred on AgentSync’s side. Please do not retry 500 requests.

{
  "timestamp": 1613510729601,
  "status": 500,
  "error": "Internal Server Error",
  "message": "Error message describing why this was a server error.",
  "path": "{requested endpoint}"
}

How to troubleshoot:

  • Do NOT retry 500 errors immediately.
  • These are usually transient issues and the AgentSync team is automatically alerted.
  • If the issue persists, contact AgentSync support with the X-Trace-ID from the response headers.

Possible HTTP Error Status Codes

HTTP Status CodeDescription
400Bad Request – validation error with parameters or request body
401Unauthorized – invalid or missing API credentials
403Forbidden – the request is understood but not allowed
404Not Found – no resource matches the provided endpoint or ID
405Method Not Allowed – unsupported HTTP method on this endpoint
429Too Many Requests – rate limit exceeded
500Internal Server Error – contact support@agentsync.io if the issue persists
502Bad Gateway – received an invalid response from an upstream server
504Gateway Timeout – the server didn’t receive a timely response