ScriptBase

Errors

Error codes and handling

Errors

All errors return JSON with an error field:

{ "error": "Error message here" }

Error Codes

StatusErrorWhat to do
400url query parameter is requiredAdd url param
400format must be json, srt, text, or vttUse a supported format
400Unsupported URLUse a supported platform URL
401Missing X-API-Key headerAdd X-API-Key header
401Invalid API keyCheck your key is correct and active
401API key expiredCreate a new key in the dashboard
402Insufficient creditsBuy more credits or upgrade plan
404This video isn't available for transcription.Source removed/private — try another URL
422No spoken audio detected in this video.Video has no speech — nothing to transcribe
429Rate limited. Try again in a moment.Back off and retry
499Transcript request was cancelled.Client or server cancelled before completion
502Failed to dispatch job / Could not reach the video. Try again or use a different URL. / Transcript generation failed. Try again.Retry — upstream/pipeline issue. Credit was refunded.
503Transcription service is temporarily unavailable. Try again.Provider downtime — retry with backoff
504Transcript generation timed out. Try again.Retry — video may be long or service is slow. Credit was refunded.

Failed requests (5xx) refund the deducted credit.

Retry Strategy

  • 4xx errors — Fix the request, don't retry blindly (except 429)
  • 402 — Buy credits, then retry
  • 429 — Back off and retry
  • 502/503/504 — Retry with exponential backoff
async function transcribe(url: string, apiKey: string, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    const response = await fetch(
      `https://scriptbase.app/api/v1/transcribe?url=${encodeURIComponent(url)}`,
      { headers: { "X-API-Key": apiKey } }
    );

    if (response.ok) return response.json();

    // Retry 429 (rate limited) and 5xx; bail on other client errors.
    if (response.status < 500 && response.status !== 429) {
      throw new Error(await response.text());
    }

    // Exponential backoff for server errors
    await new Promise((r) => setTimeout(r, 2 ** attempt * 1000));
  }
  throw new Error("Max retries exceeded");
}