replr
Errors
Log inGet Started

Documentation

OverviewQuick StartAuthentication
AuthCharactersConversationsVoiceMarketplaceStudioIntegrationsRoomsSocialKnowledgeImagesBillingWebSocket
WebhooksEmbeddingRate LimitsErrors

Error Handling

The REPLR API uses conventional HTTP status codes and returns consistent JSON error objects so you can programmatically detect and recover from failures.

Error Response Format

All errors return a consistent JSON structure. HTTP status codes are always meaningful -- a 4xx indicates a client error and a 5xx indicates a server-side issue.

{
  "error": "error_code",
  "message": "Human-readable description",
  "details": {},
  "request_id": "req_abc123"
}
FieldTypeDescription
errorstringMachine-readable error code (e.g. bad_request, unauthorized).
messagestringHuman-readable description of what went wrong.
detailsobjectAdditional context. Present for validation_error and some other codes.
request_idstringUnique identifier for the request. Include this when contacting support.

Error Codes

Every error response includes one of the following error codes. Use the code (not the message) for programmatic error handling.

HTTP StatusError CodeDescription
400bad_requestInvalid request body or parameters.
400validation_errorField validation failed (details includes field-level errors).
401unauthorizedMissing or invalid authentication.
401token_expiredAccess token has expired.
403forbiddenInsufficient permissions or scope.
403plan_limitFeature not available on current plan.
404not_foundResource does not exist.
409conflictResource already exists (e.g., duplicate email).
413payload_too_largeRequest body exceeds size limit.
422unprocessable_entityRequest understood but cannot be processed.
429rate_limit_exceededToo many requests.
500internal_errorServer error.
502upstream_errorAI provider temporarily unavailable.
503service_unavailableService under maintenance.

Validation Errors

When the error code is validation_error, the details object contains a fields map with per-field error messages. Use this to display inline form errors or build targeted retry logic.

{
  "error": "validation_error",
  "message": "Validation failed",
  "details": {
    "fields": {
      "email": "Must be a valid email address",
      "password": "Must be at least 8 characters"
    }
  }
}

The fields object keys correspond to request body parameter names. Each value is a human-readable string describing the validation failure for that field. Multiple fields can fail simultaneously.

Handling Errors

Always check the HTTP status code before parsing the response body. For transient errors (429, 502, 503), implement retry logic with exponential backoff. For client errors (400-422), fix the request before retrying.

async function replrFetch(url, options = {}) {
  const res = await fetch(url, {
    ...options,
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
      ...options.headers,
    },
  });

  if (!res.ok) {
    const error = await res.json();

    switch (error.error) {
      case "token_expired":
        // Refresh the token and retry
        await refreshToken();
        return replrFetch(url, options);

      case "rate_limit_exceeded":
        // Wait and retry with backoff
        const retryAfter = res.headers.get("Retry-After") || 5;
        await new Promise((r) => setTimeout(r, retryAfter * 1000));
        return replrFetch(url, options);

      case "validation_error":
        // Surface field-level errors to the UI
        console.error("Validation errors:", error.details.fields);
        throw new ValidationError(error.details.fields);

      default:
        throw new Error(`[${error.error}] ${error.message} (request: ${error.request_id})`);
    }
  }

  return res.json();
}

Troubleshooting

Common errors and how to resolve them.

unauthorized
  • •Verify your API key or Bearer token is correct and not truncated.
  • •Check that the Authorization header format is exactly: Bearer <token>.
  • •Confirm the token has not been revoked in the dashboard.
rate_limit_exceeded
  • •Implement exponential backoff with jitter between retries.
  • •Check the Retry-After header for the recommended wait time.
  • •Review your plan's rate limits at /billing and upgrade if needed.
upstream_error
  • •Retry the request with exponential backoff (the AI provider may be temporarily down).
  • •Check the REPLR status page for ongoing incidents.
  • •If the error persists, try switching to a different model.
plan_limit
  • •Upgrade your plan at /billing to unlock the feature.
  • •Review available features for each plan in the pricing page.

Request IDs

Every API response includes an X-Request-Id header with a unique identifier for that request. Error response bodies also include the ID in the request_id field.

Always log request IDs

When contacting support about a failed request, include the request_id. This allows the team to trace the exact request through the system and diagnose the issue faster.

const res = await fetch("https://api.replr.ai/v1/replrs", {
  headers: { Authorization: `Bearer ${API_KEY}` },
});

// Always available, even on success
const requestId = res.headers.get("X-Request-Id");
console.log("Request ID:", requestId);

if (!res.ok) {
  const error = await res.json();
  // Also available in the error body
  console.error("Error request ID:", error.request_id);
}
← AuthenticationAPI Reference →
replr
replr

Your AI, everywhere.

Product

  • Features
  • Explore
  • Discover
  • Pricing
  • API Docs

Safety

  • Safety Center
  • Community Guidelines
  • Content Moderation
  • Parental Insights
  • Reporting

Company

  • Company
  • Help Center
  • Contact
  • Legal
  • Privacy

Connect

  • Twitter
  • Discord
  • GitHub

© 2026 REPLR, Inc. All rights reserved.

PrivacyTerms