Skip to content

Errors

The Replicer API uses standard HTTP status codes and returns consistent JSON error responses.

Error response format

json
{
  "error": {
    "code": "validation_error",
    "message": "agentId, toNumber, and fromNumber are required",
    "details": null
  },
  "requestId": "req-abc123"
}
FieldTypeDescription
error.codestringMachine-readable error code
error.messagestringHuman-readable description
error.detailsobject | nullAdditional context (when available)
requestIdstringUnique identifier for debugging

Error codes

Client errors (4xx)

HTTP StatusCodeDescription
400bad_requestMalformed JSON or invalid request body
400validation_errorMissing or invalid field values
401unauthorizedMissing or invalid API key
403forbiddenAPI key is inactive or expired
403insufficient_scopeAPI key doesn't have the required scope
404not_foundResource doesn't exist or doesn't belong to your organization
429rate_limit_exceededToo many requests — check Retry-After header

Server errors (5xx)

HTTP StatusCodeDescription
500internal_errorSomething went wrong on our end
503not_implementedEndpoint is planned but not yet available

Handling errors

javascript
const response = await fetch('https://api.replicer.ai/v1/calls', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer rpl_live_your_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ agentId, toNumber, fromNumber }),
})

if (!response.ok) {
  const { error, requestId } = await response.json()
  
  switch (error.code) {
    case 'rate_limit_exceeded':
      const retryAfter = response.headers.get('Retry-After')
      // Wait and retry
      break
    case 'unauthorized':
      // Check your API key
      break
    case 'validation_error':
      // Fix the request body
      console.error(error.message)
      break
    default:
      // Log requestId for support
      console.error(`Error ${error.code}: ${error.message} (${requestId})`)
  }
}

Request IDs

Every response includes a requestId field. When contacting support about an error, include this ID to help us investigate.

Replicer API Documentation