{"openapi":"3.1.0","info":{"title":"Passive Coordinator — public API","version":"0.1.0","description":"Operations callable with an API key. Authenticate with `Authorization: Bearer pvk_...`."},"paths":{"/jobs":{"post":{"summary":"Submit Job","description":"Submit a job for distributed execution.","operationId":"submit_job_jobs_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobSubmission"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Submit Job Jobs Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["jobs:write"]},{"SessionToken":[]}],"x-required-scopes":["jobs:write"]},"get":{"summary":"List Jobs","description":"List all jobs visible to the authenticated user (theirs + their org's).","operationId":"list_jobs_jobs_get","parameters":[{"name":"sort","in":"query","required":false,"schema":{"type":"string","pattern":"^(submitted_at|status|job_type)$","default":"submitted_at","title":"Sort"}},{"name":"order","in":"query","required":false,"schema":{"type":"string","pattern":"^(asc|desc)$","default":"desc","title":"Order"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Jobs Jobs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["jobs:read"]},{"SessionToken":[]}],"x-required-scopes":["jobs:read"]}},"/jobs/{job_id}":{"get":{"summary":"Get Job Status","description":"Return current status of a job.\n\nFor demo jobs (whose meta carries a ``demo_id``), the response also\nincludes ``passive_cost_usd`` derived from completed-unit execution\ntime and an ``aws_cost_usd`` / ``aws_service_name`` comparison from\n``demo_costs.AWS_COSTS``. Real prod jobs get ``null`` for the AWS\nfields and a real (small) ``passive_cost_usd``.","operationId":"get_job_status_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Job Status Jobs  Job Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["jobs:read"]},{"SessionToken":[]}],"x-required-scopes":["jobs:read"]}},"/jobs/{job_id}/results":{"get":{"summary":"Get Job Results","description":"Return aggregated output for a completed job.","operationId":"get_job_results_jobs__job_id__results_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Job Results Jobs  Job Id  Results Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["jobs:read"]},{"SessionToken":[]}],"x-required-scopes":["jobs:read"]}},"/jobs/upload":{"post":{"summary":"Upload Job","description":"Submit a job with file uploads (multipart/form-data).\n\nAccepts zip files (sent as-is, extracted server-side) or individual files.\nMax total upload size: 50 MB.","operationId":"upload_job_jobs_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_job_jobs_upload_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Upload Job Jobs Upload Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["jobs:write"]},{"SessionToken":[]}],"x-required-scopes":["jobs:write"]}},"/crons":{"get":{"summary":"List Cron Jobs","operationId":"list_cron_jobs_crons_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Cron Jobs Crons Get"}}}}},"security":[{"ApiKey":["crons:write"]},{"SessionToken":[]}],"x-required-scopes":["crons:write"]},"post":{"summary":"Create Cron Job","operationId":"create_cron_job_crons_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCronRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Cron Job Crons Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["crons:write"]},{"SessionToken":[]}],"x-required-scopes":["crons:write"]}},"/crons/{cron_id}":{"patch":{"summary":"Update Cron Job","operationId":"update_cron_job_crons__cron_id__patch","parameters":[{"name":"cron_id","in":"path","required":true,"schema":{"type":"string","title":"Cron Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CronUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Cron Job Crons  Cron Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["crons:write"]},{"SessionToken":[]}],"x-required-scopes":["crons:write"]},"delete":{"summary":"Delete Cron Job","operationId":"delete_cron_job_crons__cron_id__delete","parameters":[{"name":"cron_id","in":"path","required":true,"schema":{"type":"string","title":"Cron Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["crons:write"]},{"SessionToken":[]}],"x-required-scopes":["crons:write"]}},"/workers":{"get":{"summary":"List Workers","description":"Connected workers: every one for a superadmin, the caller's own otherwise.\n\nAnonymous until PAS-220, and it returned every worker's ``observed_ip``.","operationId":"list_workers_workers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Workers Workers Get"}}}}},"security":[{"ApiKey":["workers:read"]},{"SessionToken":[]}],"x-required-scopes":["workers:read"]}},"/workers/{worker_id}/credits":{"get":{"summary":"Get Worker Credits","description":"Return total compute credits earned by a worker (owner or superadmin).","operationId":"get_worker_credits_workers__worker_id__credits_get","parameters":[{"name":"worker_id","in":"path","required":true,"schema":{"type":"string","title":"Worker Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Worker Credits Workers  Worker Id  Credits Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["workers:read"]},{"SessionToken":[]}],"x-required-scopes":["workers:read"]}},"/workers/{worker_id}/credits/history":{"get":{"summary":"Get Worker Credits History","description":"Return daily credits earned over the last N days (owner or superadmin).","operationId":"get_worker_credits_history_workers__worker_id__credits_history_get","parameters":[{"name":"worker_id","in":"path","required":true,"schema":{"type":"string","title":"Worker Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Worker Credits History Workers  Worker Id  Credits History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["workers:read"]},{"SessionToken":[]}],"x-required-scopes":["workers:read"]}},"/metrics":{"get":{"summary":"Get Metrics","description":"Return system-wide performance metrics.\n\nAnonymous until PAS-226, though ``ROUTE_SCOPES`` listed it under ``workers:read``:\na scope on a route anyone can call gates nothing. A signed-in user or a key with\nthat scope may read it.","operationId":"get_metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Metrics Metrics Get"}}}}},"security":[{"ApiKey":["workers:read"]},{"SessionToken":[]}],"x-required-scopes":["workers:read"]}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","parameters":[{"name":"domain","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"}},{"name":"worker","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Worker"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Health Health Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":[]},{"SessionToken":[]}],"x-required-scopes":[]}},"/apps":{"get":{"summary":"List Apps","description":"List deployed apps visible to the authenticated user.\n\nIncludes everything in the user's currently-active org PLUS legacy apps\n(deployed before PAS-34 migration) that the user personally owns. A\nsuperadmin session also sees Passive's own apps, which have no owner\n(PAS-246).","operationId":"list_apps_apps_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Apps Apps Get"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]},"post":{"summary":"Deploy App","description":"Deploy a hosted app to available workers.\n\nWith ``with_database`` a database named after the app is created first and\nthe app deploys with its ``DATABASE_URL`` set (PAS-99).","operationId":"deploy_app_apps_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/upload":{"post":{"summary":"Deploy Static App","description":"Deploy a static site from a zip upload.\n\nThe worker-side port is auto-allocated from the static-app port range;\ncallers do not need to (and can not) specify it. ``with_database`` creates a\ndatabase named after the app and deploys with its ``DATABASE_URL`` set, and\nis refused when the zip turns out to be a static site (PAS-99).","operationId":"deploy_static_app_apps_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_deploy_static_app_apps_upload_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/detect":{"get":{"summary":"Detect App Framework","description":"Detect the framework for a GitHub repo without deploying.\n\nReturns pre-filled build settings the client can show to the user before\nthey confirm the deploy.  All fields can be overridden in deploy-git.","operationId":"detect_app_framework_apps_detect_get","parameters":[{"name":"repo_full_name","in":"query","required":true,"schema":{"type":"string","description":"GitHub repo as 'owner/repo'","title":"Repo Full Name"},"description":"GitHub repo as 'owner/repo'"},{"name":"branch","in":"query","required":false,"schema":{"type":"string","description":"Branch to read; empty is the repository's default","default":"","title":"Branch"},"description":"Branch to read; empty is the repository's default"},{"name":"root_directory","in":"query","required":false,"schema":{"type":"string","description":"Repo-relative folder to treat as the root","default":"","title":"Root Directory"},"description":"Repo-relative folder to treat as the root"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Detect App Framework Apps Detect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/deploy-git":{"post":{"summary":"Deploy From Git","description":"Deploy an app from a GitHub repo with auto-detected (or overridden) build settings.\n\nWith ``Prefer: respond-async`` it answers ``202`` once the deploy is accepted and\nbuilds in the background (PAS-225); see ``build_tasks``.","operationId":"deploy_from_git_apps_deploy_git_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitDeployRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/env":{"get":{"summary":"Get App Env","description":"Return env values in the clear, for someone who explicitly asked.\n\nSeparate from GET /apps/{name} so reading an app's details — which the\ndashboard does constantly — does not hand out its secrets as a side effect.\nSame access check; the difference is intent.","operationId":"get_app_env_apps__app_name__env_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get App Env Apps  App Name  Env Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:secrets"]},{"SessionToken":[]}],"x-required-scopes":["apps:secrets"]},"put":{"summary":"Update App Env","description":"Replace an app's environment map and redeploy so the change takes effect.\n\nAdd, edit, and delete all arrive as a complete replacement map. The redeploy\nreuses the artifact already in Redis rather than re-fetching from GitHub —\nsame trade-off as rollback. Build-from-source apps do get a fresh `docker\nbuild` on the worker, which is what bakes `VITE_*`-style vars into the bundle.","operationId":"update_app_env_apps__app_name__env_put","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEnvRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update App Env Apps  App Name  Env Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:secrets","apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:secrets","apps:write"]}},"/apps/{app_name}":{"get":{"summary":"Get App","description":"Get details for a single deployed app (owner or legacy only).","operationId":"get_app_apps__app_name__get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get App Apps  App Name  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]},"delete":{"summary":"Undeploy App","description":"Stop and remove a deployed app (owner or legacy only).\n\nAuthorization rules (PAS-34):\n- Org Owner can delete any app in the org.\n- Org Member can delete only apps where their email is the deployer.\n- Legacy apps (no ``org_id``) can be deleted only by the original deployer.\n- Apps with no org and no owner (Passive's own) only by a superadmin\n  session (PAS-246).","operationId":"undeploy_app_apps__app_name__delete","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/metrics":{"get":{"summary":"Get App Metrics","description":"Return per-deployment request metrics (PAS-60).\n\nRequest count, status-code breakdown, response times, availability, and a\nshort hourly time-series — captured at the coordinator proxy. Access is\nguarded exactly like the other per-app routes.","operationId":"get_app_metrics_apps__app_name__metrics_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":48,"minimum":1,"default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get App Metrics Apps  App Name  Metrics Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/domains":{"get":{"summary":"List Domains","description":"List an app's custom domains plus the DNS setup targets.","operationId":"list_domains_apps__app_name__domains_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Domains Apps  App Name  Domains Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]},"post":{"summary":"Add Domain","description":"Register a custom domain for an app (starts pending; verified if DNS\nalready points at us and shows the domain is the caller's).\n\nA domain another app has claimed is moved to this one when the caller's\nTXT record (or a CNAME to this app) is in place: a claim is not ownership,\nand the real owner could not recover a squatted domain (PAS-289 finding\n58). Without it, the 409 says which record to add.","operationId":"add_domain_apps__app_name__domains_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Domain Apps  App Name  Domains Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/domains/{domain}/verify":{"post":{"summary":"Verify Domain","description":"Re-run the DNS check for a domain. Flips status both ways — a verified\ndomain whose DNS moved away goes back to pending.","operationId":"verify_domain_apps__app_name__domains__domain__verify_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Verify Domain Apps  App Name  Domains  Domain  Verify Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/domains/{domain}":{"delete":{"summary":"Remove Domain","description":"Remove a custom domain from an app.","operationId":"remove_domain_apps__app_name__domains__domain__delete","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/logs":{"get":{"summary":"Tail Logs","description":"Recent log lines over plain HTTP, for callers that cannot hold a WebSocket.\n\nReturns the last ``lines`` lines, then optionally keeps listening for\n``follow_seconds`` more. ``state`` is ``streaming`` when a worker answered,\n``worker_offline`` when none is available (build lines may still appear), or\n``timeout``. Each call starts and stops a stream on the app's worker, so poll\nsparingly (PAS-199).","operationId":"tail_logs_apps__app_name__logs_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"lines","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Lines"}},{"name":"follow_seconds","in":"query","required":false,"schema":{"type":"number","maximum":30,"minimum":0,"default":0,"title":"Follow Seconds"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Tail Logs Apps  App Name  Logs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/requests":{"get":{"summary":"List Requests","description":"The app's recent requests, newest first (PAS-289 finding 11).\n\nOne entry per request the proxy answered for the app: time, method, path\n(no query string), status, duration, ``origin`` (``app`` when the app\nwrote the status line, ``platform`` when Passive did), and the client's\n/24 or /48 network, never its address. Kept for the last 2,000 requests\nand seven days.","operationId":"list_requests_apps__app_name__requests_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"status_class","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":5,"minimum":1},{"type":"null"}],"description":"4 for 4xx","title":"Status Class"},"description":"4 for 4xx"},{"name":"method","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":10},{"type":"null"}],"title":"Method"}},{"name":"contains","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"description":"Path substring","title":"Contains"},"description":"Path substring"},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"description":"An id from the previous page","title":"Before"},"description":"An id from the previous page"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Requests Apps  App Name  Requests Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/logs/token":{"post":{"summary":"Mint Logs Token","description":"Mint a short-lived token for the app's log-stream WebSocket.\n\nThe browser can't present its httpOnly session cookie on a cross-origin\nWebSocket, so it exchanges it (via the Next.js proxy) for this scoped\ntoken and connects to WS /apps/{app_name}/logs?token=...","operationId":"mint_logs_token_apps__app_name__logs_token_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mint Logs Token Apps  App Name  Logs Token Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/deployments":{"get":{"summary":"List Deployment History","description":"Return recent deployments — what shipped, what triggered it, how it went.\n\nFailed and in-flight deploys are included deliberately: \"did last night's\npush break?\" is the main reason to open this, and filtering to successes is\nwhat made that unanswerable. Callers that need a rollback or A/B source must\nfilter on ``outcome == \"succeeded\"`` (the endpoints enforce it too).\n\n``provenance`` says whether the live record runs the commit it names\n(PAS-181, ``build_provenance.assess``), and each entry's\n``commit_verified`` says the same of that entry. The dashboard must not\npresent ``commit_sha`` as what runs where either is false.","operationId":"list_deployment_history_apps__app_name__deployments_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Deployment History Apps  App Name  Deployments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/deployments/{deployment_id}/build-log":{"get":{"summary":"Get Deployment Build Log","description":"The build output of one deployment, kept after later deploys replace the live log.\n\n``lines`` is empty for a deploy that built nothing (a rollback or a replay of\na stored image) or whose log has aged out with its history entry.","operationId":"get_deployment_build_log_apps__app_name__deployments__deployment_id__build_log_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string","title":"Deployment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Deployment Build Log Apps  App Name  Deployments  Deployment Id  Build Log Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/events":{"get":{"summary":"List App Events","description":"The app's timeline, newest first: every placement and status write (PAS-157).\n\nWhere ``/deployments`` answers \"what shipped\", this answers \"what happened\nto it since\" — the failovers, re-dispatches, refusals and status changes\nthat no deploy started. ``source: \"worker\"`` marks an event that rests on a\nworker's report about itself; the dashboard labels it as a claim.\n\n``before`` is the ``id`` of the last event already shown, and the response's\n``next`` is the cursor for the page after this one (empty at the end).","operationId":"list_app_events_apps__app_name__events_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"before","in":"query","required":false,"schema":{"type":"string","default":"","title":"Before"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List App Events Apps  App Name  Events Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/deployments/drift":{"get":{"summary":"Deployment Drift","description":"How far the running commit is behind its branch head.\n\nAlways 200 — see `_compute_drift`.","operationId":"deployment_drift_apps__app_name__deployments_drift_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Deployment Drift Apps  App Name  Deployments Drift Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]}},"/apps/{app_name}/rollback":{"post":{"summary":"Rollback App","description":"Re-deploy from a previous successful deployment snapshot (no rebuild).\n\nA rollback changes the code that runs, never the app's saved environment:\nthe old build runs with the env the app has now. This dispatch becomes the\napp's record once it serves, and that record is what GET /apps/{app}/env\nreads, so restoring the snapshot's env deleted every variable saved after\nit without a word (PAS-289 finding 44).","operationId":"rollback_app_apps__app_name__rollback_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RollbackRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Rollback App Apps  App Name  Rollback Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/traffic":{"get":{"summary":"Get Traffic","description":"Current blue/green state plus each variant's A/B results.","operationId":"get_traffic_apps__app_name__traffic_get","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Traffic Apps  App Name  Traffic Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:read"]},{"SessionToken":[]}],"x-required-scopes":["apps:read"]},"put":{"summary":"Set Traffic","description":"Set the A/B weights across the app's variants.","operationId":"set_traffic_apps__app_name__traffic_put","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrafficSplitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Traffic Apps  App Name  Traffic Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/variants":{"post":{"summary":"Create Variant","description":"Boot a second version of the app into its idle slot at 0% traffic.\n\nSource is either a past deployment (instant — the artifact is already in\nRedis) or a git branch (builds like any other deploy). Either way the new\nversion starts serving no production traffic; verify it at its own URL,\nthen dial weights up with PUT /apps/{app}/traffic.","operationId":"create_variant_apps__app_name__variants_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVariantRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Variant Apps  App Name  Variants Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/traffic/promote":{"post":{"summary":"Promote Variant","description":"Send 100% of traffic to *color*. The loser stays warm for a while so the\npromotion can be undone by promoting the other color straight back.","operationId":"promote_variant_apps__app_name__traffic_promote_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"color","in":"query","required":true,"schema":{"type":"string","pattern":"^(blue|green)$","title":"Color"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Promote Variant Apps  App Name  Traffic Promote Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/variants/{color}":{"delete":{"summary":"Delete Variant","description":"Abort an experiment: all traffic back to the active variant, candidate torn down.","operationId":"delete_variant_apps__app_name__variants__color__delete","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}},{"name":"color","in":"path","required":true,"schema":{"type":"string","title":"Color"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Variant Apps  App Name  Variants  Color  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/redeploy":{"post":{"summary":"Redeploy App Endpoint","description":"Re-run the app's current artifact; ``Prefer: respond-async`` answers before the build.","operationId":"redeploy_app_endpoint_apps__app_name__redeploy_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/deploy-latest":{"post":{"summary":"Deploy Latest Endpoint","description":"Deploy the branch head; ``Prefer: respond-async`` answers before the build.","operationId":"deploy_latest_endpoint_apps__app_name__deploy_latest_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/branch":{"put":{"summary":"Change Branch Endpoint","description":"Switch branch; ``Prefer: respond-async`` answers before the build (PAS-225).","operationId":"change_branch_endpoint_apps__app_name__branch_put","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeBranchRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/apps/{app_name}/database":{"post":{"summary":"Attach Database","description":"Inject a database's DATABASE_URL into an app's env and redeploy.\n\nGoes through the same env path as the editor, so the value survives every\nredeploy, reconnect and rollback. Returns 409 while an A/B split is active,\ninherited from _deploy_into_idle_slot: injecting a URL into only one side of\na live experiment is exactly the silent divergence that guard exists for.","operationId":"attach_database_apps__app_name__database_post","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachDatabaseRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Attach Database Apps  App Name  Database Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]},"delete":{"summary":"Detach Database","description":"Remove DATABASE_URL from an app's env and redeploy. The database survives.","operationId":"detach_database_apps__app_name__database_delete","parameters":[{"name":"app_name","in":"path","required":true,"schema":{"type":"string","title":"App Name"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Detach Database Apps  App Name  Database Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["apps:write"]},{"SessionToken":[]}],"x-required-scopes":["apps:write"]}},"/databases":{"get":{"tags":["databases"],"summary":"List Databases","description":"This org's databases, each with ``stats``: size, connections, limit, as of when.","operationId":"list_databases_databases_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Databases Databases Get"}}}}},"security":[{"ApiKey":["db:read"]},{"SessionToken":[]}],"x-required-scopes":["db:read"]},"post":{"tags":["databases"],"summary":"Create Database","description":"Provision a database and return its connection string, once.\n\nNot to an API key without ``db:credentials`` (PAS-224): ``db:write`` creates a\ndatabase, and the password is what ``db:credentials`` exists to guard. Such a key\ngets the record and where to fetch the URL, and the idempotency cache, which\nreplays this response for 24 hours, holds no password for it either.","operationId":"create_database_databases_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDatabaseRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Database Databases Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]}},"/databases/{database_id}":{"get":{"tags":["databases"],"summary":"Get Database","description":"One database, with ``stats``: size, connections, limit, as of when.","operationId":"get_database_databases__database_id__get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Database Databases  Database Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:read"]},{"SessionToken":[]}],"x-required-scopes":["db:read"]},"patch":{"tags":["databases"],"summary":"Update Database","description":"Change the database role's connection limit, without recreating anything.\n\nRuns ``ALTER ROLE … CONNECTION LIMIT`` as the server superuser, then stores\nthe record. A limit above the server's ceiling (its ``max_connections`` less\nthe superuser slots and ``pg_admin.ROLE_LIMIT_HEADROOM``) is a 400 naming the\nceiling. A lower limit closes no open connection; it applies as they end.","operationId":"update_database_databases__database_id__patch","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDatabaseRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Database Databases  Database Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]},"delete":{"tags":["databases"],"summary":"Delete Database","description":"Drop a database and its role. Refuses while any app is attached.","operationId":"delete_database_databases__database_id__delete","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]}},"/databases/{database_id}/url":{"get":{"tags":["databases"],"summary":"Get Database Url","description":"Re-issue the connection string for a database the caller can already see.","operationId":"get_database_url_databases__database_id__url_get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Database Url Databases  Database Id  Url Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:credentials"]},{"SessionToken":[]}],"x-required-scopes":["db:credentials"]}},"/databases/{database_id}/schema":{"get":{"tags":["databases"],"summary":"Get Database Schema","description":"The database's structure, from the catalog.\n\nIts own endpoint rather than a SQL string the frontend sends, so the browser\nworks with no SQL typed and the frontend never composes a query.","operationId":"get_database_schema_databases__database_id__schema_get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Database Schema Databases  Database Id  Schema Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:read"]},{"SessionToken":[]}],"x-required-scopes":["db:read"]}},"/databases/{database_id}/rows":{"get":{"tags":["databases"],"summary":"Get Database Rows","description":"One page of a relation's rows.\n\n*schema* and *table* are query parameters rather than path segments: a\nrelation name may legitimately contain a slash, and a path would need\ndouble-encoding on both sides to survive it.","operationId":"get_database_rows_databases__database_id__rows_get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}},{"name":"schema","in":"query","required":true,"schema":{"type":"string","title":"Schema"}},{"name":"table","in":"query","required":true,"schema":{"type":"string","title":"Table"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Database Rows Databases  Database Id  Rows Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:data"]},{"SessionToken":[]}],"x-required-scopes":["db:data"]}},"/databases/{database_id}/query":{"post":{"tags":["databases"],"summary":"Execute Database Sql","description":"Run a statement as the database's own role.\n\nAudited whatever the outcome. Only this endpoint is audited, not the schema\nand row endpoints: paging a table would evict the statements the log exists\nto keep, and reading structure is not what anyone needs a record of.","operationId":"execute_database_sql_databases__database_id__query_post","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteSqlRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Execute Database Sql Databases  Database Id  Query Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]}},"/databases/{database_id}/history":{"get":{"tags":["databases"],"summary":"Get Database History","description":"Recent executions against this database, newest first.\n\nThe console's history and the audit log are one store, so a statement cannot\nbe in a user's history and missing from the audit. Org-scoped, not\nper-user: the database belongs to the org, and so does what was run on it.","operationId":"get_database_history_databases__database_id__history_get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Database History Databases  Database Id  History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:data"]},{"SessionToken":[]}],"x-required-scopes":["db:data"]}},"/databases/{database_id}/backups":{"get":{"tags":["databases"],"summary":"List Database Backups","description":"This database's backups, newest first, the one running, and recent restores.\n\nA backup's ``sha256_source`` says who vouches for its checksum: ``verified``\n(the bucket computed it), ``worker_reported`` (the database host's report,\nits size confirmed by the bucket) or ``coordinator_hashed`` (the coordinator hashed the\nstored object). Never a URL or an object key.","operationId":"list_database_backups_databases__database_id__backups_get","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Database Backups Databases  Database Id  Backups Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:read"]},{"SessionToken":[]}],"x-required-scopes":["db:read"]},"post":{"tags":["databases"],"summary":"Create Database Backup","description":"Back this database up now. 202: it runs in the background.\n\nThe database's creator or an org Owner, once an hour per database (429\nwith ``Retry-After`` otherwise), and not while a backup of it is running\n(409). Watch ``GET /databases/{id}/backups`` for the result.","operationId":"create_database_backup_databases__database_id__backups_post","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Database Backup Databases  Database Id  Backups Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]}},"/databases/{database_id}/restore":{"post":{"tags":["databases"],"summary":"Restore Database","description":"Restore one of this database's backups into a **new** database named *name*.\n\nNever in place: an app attached to the source keeps its data, and attaching\nthe restored one is a deliberate step. A name already taken in the org is a\n409, with no suffix. The new database is created at once and answered here,\nwith its URL on the same terms as ``POST /databases``; it reads ``creating``\nuntil the restore lands, then ``ready``. If the restore fails it is dropped,\nand the restore's ``error`` is in ``GET /databases/{id}/backups``.\n\nAlways 202, whether or not the request says ``Prefer: respond-async``. The\ndatabase host may take up to two hours to download a dump and two more to\nload it, far past Caddy's 330 s, and a synchronous wait cut short would\nhave to either fail a restore that was going to succeed or drop a database\nthe host was still writing.","operationId":"restore_database_databases__database_id__restore_post","parameters":[{"name":"database_id","in":"path","required":true,"schema":{"type":"string","title":"Database Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreDatabaseRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Restore Database Databases  Database Id  Restore Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"ApiKey":["db:write"]},{"SessionToken":[]}],"x-required-scopes":["db:write"]}}},"components":{"schemas":{"AttachDatabaseRequest":{"properties":{"database_id":{"type":"string","title":"Database Id"}},"type":"object","required":["database_id"],"title":"AttachDatabaseRequest"},"Body_deploy_static_app_apps_upload_post":{"properties":{"app_name":{"type":"string","title":"App Name"},"env":{"type":"string","title":"Env","default":"{}"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"proxy_timeout_s":{"anyOf":[{"type":"integer","maximum":300.0,"minimum":1.0},{"type":"null"}],"title":"Proxy Timeout S"},"with_database":{"type":"boolean","title":"With Database","default":false}},"type":"object","required":["app_name","file"],"title":"Body_deploy_static_app_apps_upload_post"},"Body_upload_job_jobs_upload_post":{"properties":{"job_type":{"type":"string","title":"Job Type","default":"shell"},"command":{"type":"string","title":"Command","default":""},"chunks":{"type":"integer","title":"Chunks","default":4},"timeout":{"type":"integer","title":"Timeout","default":60},"split_strategy":{"type":"string","title":"Split Strategy","default":"file"},"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"Body_upload_job_jobs_upload_post"},"ChangeBranchRequest":{"properties":{"branch":{"type":"string","title":"Branch"}},"type":"object","required":["branch"],"title":"ChangeBranchRequest"},"CreateCronRequest":{"properties":{"name":{"type":"string","title":"Name"},"job_type":{"type":"string","enum":["shell","python"],"title":"Job Type","default":"shell"},"command":{"type":"string","title":"Command"},"schedule":{"type":"string","enum":["every_5_minutes","hourly","daily","weekly"],"title":"Schedule"},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["name","command","schedule"],"title":"CreateCronRequest"},"CreateDatabaseRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"CreateDatabaseRequest"},"CreateVariantRequest":{"properties":{"deployment_id":{"type":"string","title":"Deployment Id","default":""},"branch":{"type":"string","title":"Branch","default":""},"label":{"type":"string","title":"Label","default":""}},"type":"object","title":"CreateVariantRequest","description":"Create the candidate variant from a past deployment or a git branch."},"CronUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"command":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Command"},"schedule":{"anyOf":[{"type":"string","enum":["every_5_minutes","hourly","daily","weekly"]},{"type":"null"}],"title":"Schedule"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"CronUpdate"},"DeployRequest":{"properties":{"app_name":{"type":"string","title":"App Name"},"image":{"type":"string","title":"Image"},"port":{"type":"integer","title":"Port"},"env":{"additionalProperties":{"type":"string"},"type":"object","title":"Env"},"proxy_timeout_s":{"anyOf":[{"type":"integer","maximum":300.0,"minimum":1.0},{"type":"null"}],"title":"Proxy Timeout S"},"with_database":{"type":"boolean","title":"With Database","default":false}},"type":"object","required":["app_name","image","port"],"title":"DeployRequest"},"DomainRequest":{"properties":{"domain":{"type":"string","title":"Domain"}},"type":"object","required":["domain"],"title":"DomainRequest"},"ExecuteSqlRequest":{"properties":{"sql":{"type":"string","title":"Sql"},"write":{"type":"boolean","title":"Write","default":false}},"type":"object","required":["sql"],"title":"ExecuteSqlRequest"},"GitDeployRequest":{"properties":{"app_name":{"type":"string","title":"App Name"},"repo_full_name":{"type":"string","title":"Repo Full Name"},"branch":{"type":"string","title":"Branch","default":""},"env":{"additionalProperties":{"type":"string"},"type":"object","title":"Env"},"port":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Port"},"framework":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Framework"},"build_cmd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Build Cmd"},"install_cmd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Install Cmd"},"output_dir":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Dir"},"root_directory":{"type":"string","title":"Root Directory","default":""},"enable_pr_previews":{"type":"boolean","title":"Enable Pr Previews","default":false},"proxy_timeout_s":{"anyOf":[{"type":"integer","maximum":300.0,"minimum":1.0},{"type":"null"}],"title":"Proxy Timeout S"},"with_database":{"type":"boolean","title":"With Database","default":false}},"type":"object","required":["app_name","repo_full_name"],"title":"GitDeployRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JobSubmission":{"properties":{"job_id":{"type":"string","title":"Job Id"},"job_type":{"type":"string","enum":["shell","python","transform"],"title":"Job Type"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"chunks":{"type":"integer","title":"Chunks"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["job_id","job_type","payload","config","chunks","created_at"],"title":"JobSubmission"},"RestoreDatabaseRequest":{"properties":{"backup_id":{"type":"string","title":"Backup Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["backup_id","name"],"title":"RestoreDatabaseRequest"},"RollbackRequest":{"properties":{"deployment_id":{"type":"string","title":"Deployment Id"}},"type":"object","required":["deployment_id"],"title":"RollbackRequest"},"TrafficSplitRequest":{"properties":{"weights":{"additionalProperties":{"type":"integer"},"type":"object","title":"Weights"},"sticky":{"type":"boolean","title":"Sticky","default":true}},"type":"object","required":["weights"],"title":"TrafficSplitRequest"},"UpdateDatabaseRequest":{"properties":{"connection_limit":{"type":"integer","minimum":1.0,"title":"Connection Limit"}},"type":"object","required":["connection_limit"],"title":"UpdateDatabaseRequest"},"UpdateEnvRequest":{"properties":{"env":{"additionalProperties":{"type":"string"},"type":"object","title":"Env"}},"type":"object","title":"UpdateEnvRequest","description":"Full replacement of an app's environment map (PAS-74).\n\nAdd, edit, and delete are all expressed as \"here is the new complete map\",\nwhich keeps the update atomic and matches the frontend editor's shape."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","bearerFormat":"pvk_<kid>_<secret>","description":"Scoped, revocable API key sent as `Authorization: Bearer pvk_...`. Each operation lists the scopes it needs in `security` and in `x-required-scopes`. Mint one with `POST /api-keys` (session only)."},"SessionToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Browser session token from the OAuth login. Accepted everywhere; required on routes that do not accept API keys."}}}}