Auth
Todas las rutas /api/* exigen el mismo secreto de estudio (usuario único, local-first).
Variables
| Env | Dónde |
|---|---|
STUDIO_API_TOKEN | Servidor Next (obligatorio para /api/*) |
NEXT_PUBLIC_STUDIO_PUBLISHABLE_KEY | Cliente UI (mismo valor que el token) |
Si falta STUDIO_API_TOKEN, la API responde 503.
Cómo autenticarse
Preferido (mutaciones y JSON):
Authorization: Bearer <STUDIO_API_TOKEN>
Alternativa (media en <img> / <video> / descargas que no pueden enviar header):
GET /api/exports/{jobId}/output.mp4?token=<STUDIO_API_TOKEN>
Errores
| Status | Cuerpo típico | Causa |
|---|---|---|
| 503 | { "error": "STUDIO_API_TOKEN is not configured" } | Env ausente |
| 401 | { "error": "Unauthorized" } | Token ausente o incorrecto |
| 429 | { "error": "rate limit exceeded" } | Demasiadas mutaciones; respeta Retry-After |
Ejemplo
export TOKEN="$STUDIO_API_TOKEN"
export BASE="http://127.0.0.1:3000"
curl -sS -H "Authorization: Bearer $TOKEN" "$BASE/api/presets" | head
Las páginas /docs no requieren token (solo lectura de documentación).