Getting Started

Authentication

Authentication model for legacy and public API endpoints.

Current State

Public API routes under /v1 require X-Api-Key and enforce per-key rate limit.

Legacy routes under /api/* are kept for backward compatibility and do not require X-Api-Key.

Required Headers

Route GroupHeaderRequired
/v1/*X-Api-KeyYes
/api/*NoneNo (legacy compatibility)

Server-side Only

  • Never expose X-Api-Key in browser code.
  • Call /v1 endpoints from backend routes or workers.
  • Use separate API keys per environment and integration.

Common Auth Errors

HTTPCodeMeaning
401missing_api_keyX-Api-Key header missing
401invalid_api_keyKey not recognized
404Job not foundJob id is invalid or not owned by this key

Production Readiness

  • Pin SDK/API versions in deployment manifests and release notes.
  • Record request_id/job_id in logs for every API interaction.
  • Run smoke tests after each deploy using a known short test video.
  • Separate dev/staging/prod keys and rotate keys regularly.
Tip: Treat docs examples as baseline templates; finalize payload defaults in your own backend policy layer.

Acceptance Checklist

  1. Validate one success path and one failure path end-to-end.
  2. Confirm credits, usage metrics, and output links are consistent.
  3. Set retry and timeout policy for 429/5xx response handling.
  4. Document rollback procedure for integration incidents.

Key Rotation Policy

  1. Create new key and deploy it in parallel.
  2. Shift traffic gradually to the new key.
  3. Monitor usage and errors for 24h.
  4. Disable old key only after stable verification.