Translate API

Error Reference

API error codes and troubleshooting guide.

Error Reference

All API errors return a JSON response with an error field describing the issue.

{
  "error": "Error message here"
}

HTTP Status Codes

StatusErrorCause
400text is required and must be non-emptyMissing or empty text field
400text must not exceed 5000 charactersInput too long
400workspace is required because this operator token can access multiple workspacesToken spans multiple workspaces; pass workspace
400project_slug "..." exists in multiple accessible workspacesAmbiguous project slug; pass workspace
400This operator token is restricted to specific projects; pass project_slugToken is project-narrowed
401Missing Authorization headerNo Bearer token provided
401Invalid or expired operator tokenToken not found, revoked, or expired
401Legacy API keys are retiredOld sk- key used after the operator-token cutover
403Workspace "..." is not in this operator token's scopeWorkspace outside the token's scope
403Only workspace owners and admins can translate with an operator tokenCaller's workspace role lacks write access
403This operator token has no accessible workspacesMembership removed or scope emptied
404Project "..." was not found in ...Unknown project slug or id
429Rate limit exceededPer-operator rate limit hit
429Monthly character quota exceededWorkspace quota used up
400Pass either text or texts, not both./detect received both fields
400texts must not contain more than 100 items/detect batch too large
400texts[N] must be a non-empty string/detect batch item empty or not a string
500Translation failedUpstream provider error
500Language detection failedUnexpected detection error

Handling Errors

Rate Limiting (429)

When you receive a 429 error, implement exponential backoff:

async function translateWithRetry(text, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const res = await fetch("/api/v1/translate", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${apiKey}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ text }),
    });

    if (res.status === 429) {
      const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
      await new Promise(r => setTimeout(r, delay));
      continue;
    }

    return res.json();
  }
  throw new Error("Max retries exceeded");
}

Quota Exceeded

When your monthly quota is exhausted:

  1. Check your current usage via GET /usage
  2. Upgrade your plan in Settings → Billing
  3. Wait for the next billing period

Authentication Errors

If you receive a 401 error:

  1. Verify your operator token is correct
  2. Check if the token has been revoked or expired under Account → Operator tokens
  3. Ensure the Authorization header format is Bearer opt_your-token
  4. Legacy sk- keys no longer work; create an operator token instead

Scope and Permission Errors

If you receive a 403 error:

  1. Pass workspace when the token can access multiple workspaces
  2. Confirm you still hold the owner or admin role where the token translates (detection and usage only need membership)
  3. Confirm the workspace or project is inside the token's scope

On this page