{"openapi":"3.1.0","info":{"title":"Kajiya API","version":"1.0.0","description":"Run GitHub Actions jobs on Kajiya runners (label `kajiya-2`, `kajiya-4`, `kajiya-8`). Authenticate with `Authorization: Bearer kjk_...` (create keys in the dashboard or via POST /api/v1/keys). Every key has a scope: read < write < admin. Rate limit: 1,200 requests per minute per account; 429 responses carry Retry-After. Errors are JSON objects with one `error` string. Times are ISO 8601 in UTC; money is US dollars as numbers. Guide: https://kajiya.app/docs/api","contact":{"email":"hello@vetter-ai.com","url":"https://kajiya.app/docs"}},"externalDocs":{"description":"Kajiya documentation","url":"https://kajiya.app/docs"},"servers":[{"url":"https://kajiya.app"}],"security":[{"bearer":[]}],"tags":[{"name":"Account","description":"Balance, spend, limits and the live queue."},{"name":"Jobs","description":"Jobs Kajiya ran or is running, and cancelling them."},{"name":"Usage","description":"Usage and cost reports."},{"name":"Repositories","description":"Connected repositories, caps and pausing."},{"name":"API keys","description":"Named, scoped keys for scripts and agents."},{"name":"Settings","description":"Spend caps, low-balance alert and webhook URL."},{"name":"Webhooks","description":"Webhook secret, test events and delivery log."},{"name":"Payments","description":"Compute pack purchases."}],"paths":{"/api/v1/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Balance, spend, concurrency, caps","description":"One call that tells a script or agent how much it may run: balance, the concurrency limit and what is in use, spend so far and the caps.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"},"example":{"id":42,"email":"dev@acme.dev","github_login":"acme-dev","balance_usd":18.734512,"vcpu_hours_left":4163.22,"rate_per_vcpu_hour_usd":0.0045,"spend":{"today_usd":0.4215,"month_usd":6.2655,"last_7d_usd":3.1185,"last_30d_usd":6.2655,"avg_daily_7d_usd":0.4455,"est_days_left":42},"concurrency":{"limit_vcpu":32,"in_use_vcpu":6,"active_jobs":2,"waiting_jobs":1},"limits":{"max_vcpu":32,"daily_pack_usd":500,"established":true,"has_repo":true},"caps":{"daily_usd":25,"monthly_usd":400,"low_balance_usd":5},"auth":{"via":"key","scope":"read"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/queue":{"get":{"operationId":"getQueue","tags":["Account"],"summary":"Running jobs and jobs waiting to start, with the reason","description":"Use this to see why a job is not starting (concurrency limit, repository cap, paused repository, prepaid compute, spend cap, or no free runner). Waiting jobs stay queued on GitHub and start by themselves when the reason clears.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Queue","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Queue"},"example":{"limit_vcpu":32,"in_use_vcpu":6,"fleet":{"sellable_vcpu":96,"free_vcpu":40},"active":[{"id":1290,"repo":"acme/api","name":"build","label":"kajiya-4","state":"running","created_at":"2026-12-04T09:20:01.000Z","started_at":"2026-12-04T09:20:07.000Z","github_url":"https://github.com/acme/api/actions/runs/12045570001/job/33861290001"},{"id":1291,"repo":"acme/web","name":"lint","label":"kajiya-2","state":"dispatched","created_at":"2026-12-04T09:20:12.000Z","started_at":null,"github_url":"https://github.com/acme/web/actions/runs/12045571234/job/33861299870"}],"waiting":[{"repo":"acme/web","name":"e2e (1)","label":"kajiya-8","reason":"repo_limit","message":"This repository's concurrency cap is reached; starts when its running jobs finish.","waiting_since":"2026-12-04T09:20:15.000Z","last_checked":"2026-12-04T09:21:05.000Z","github_url":"https://github.com/acme/web/actions/runs/12045571234/job/33861299871"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/jobs":{"get":{"operationId":"listJobs","tags":["Jobs"],"summary":"List jobs (newest first)","description":"Cursor pagination: pass `next_before` from a page as `before` to get the next (older) page; it is null on the last page.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"state","in":"query","schema":{"type":"string"},"description":"`active` (reserved, dispatched, running), or a comma list of reserved, dispatched, running, done, failed","example":"done,failed"},{"name":"repo","in":"query","schema":{"type":"string"},"description":"Only this repository, `owner/name` (case-insensitive)","example":"acme/api"},{"name":"since","in":"query","schema":{"type":"string"},"description":"Created at or after: `YYYY-MM-DD` (UTC midnight) or an ISO timestamp","example":"2026-12-01"},{"name":"until","in":"query","schema":{"type":"string"},"description":"Created before: `YYYY-MM-DD` or an ISO timestamp"},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":500},"description":"Page size (JSON). With format=csv: up to 10,000, default 10,000"},{"name":"before","in":"query","schema":{"type":"integer"},"description":"Cursor: only jobs with a smaller id; pass `next_before` from the previous page"},{"name":"format","in":"query","schema":{"enum":["json","csv"],"default":"json"},"description":"`csv` returns a file with one row per job"}],"responses":{"200":{"description":"Jobs","content":{"application/json":{"schema":{"type":"object","required":["jobs","next_before"],"properties":{"jobs":{"type":"array","items":{"$ref":"#/components/schemas/Job"}},"next_before":{"type":["integer","null"],"description":"Pass as `before` for the next page; null on the last page"}}},"example":{"jobs":[{"id":1287,"repo":"acme/api","name":"test (3)","label":"kajiya-4","vcpu":4,"state":"done","runtime_seconds":412,"billed_seconds":420,"cost_usd":0.0021,"not_billed":false,"created_at":"2026-12-04T09:12:03.000Z","started_at":"2026-12-04T09:12:09.000Z","finished_at":"2026-12-04T09:19:01.000Z","github_run_id":12045567890,"github_job_id":33861234567,"github_url":"https://github.com/acme/api/actions/runs/12045567890/job/33861234567"}],"next_before":1286}},"text/csv":{"schema":{"type":"string"},"example":"id,created_at,finished_at,repo,name,label,state,runtime_seconds,billed_seconds,cost_usd,not_billed,github_url\n1287,2026-12-04T09:12:03.000Z,2026-12-04T09:19:01.000Z,acme/api,test (3),kajiya-4,done,412,420,0.0021,false,https://github.com/acme/api/actions/runs/12045567890/job/33861234567\n"}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/jobs/{id}":{"get":{"operationId":"getJob","tags":["Jobs"],"summary":"One job","description":"Requires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Job id"}],"responses":{"200":{"description":"Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"},"example":{"id":1287,"repo":"acme/api","name":"test (3)","label":"kajiya-4","vcpu":4,"state":"done","runtime_seconds":412,"billed_seconds":420,"cost_usd":0.0021,"not_billed":false,"created_at":"2026-12-04T09:12:03.000Z","started_at":"2026-12-04T09:12:09.000Z","finished_at":"2026-12-04T09:19:01.000Z","github_run_id":12045567890,"github_job_id":33861234567,"github_url":"https://github.com/acme/api/actions/runs/12045567890/job/33861234567"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/jobs/{id}/cancel":{"post":{"operationId":"cancelJob","tags":["Jobs"],"summary":"Cancel a job's workflow run on GitHub","description":"GitHub cancels the whole workflow run (GitHub has no per-job cancel). A job no runner machine has received yet is released and never billed (`billed: false`); otherwise the VM is billed for the minutes it ran. Needs the repository token to have Actions: Read and write (or the GitHub App installation).\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Job id"}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelResult"},"example":{"ok":true,"cancelled_run_id":12045570001,"billed":false,"note":"GitHub cancels the whole workflow run. This job had not reached a machine and is not billed."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/BadGateway"}}}},"/api/v1/usage":{"get":{"operationId":"getUsage","tags":["Usage"],"summary":"Usage and cost, grouped by day, repository or label","description":"Counts jobs that finished in [since, until). The range can be at most 400 days. Rows are sorted by day, or by cost (highest first) for repo and label.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"since","in":"query","schema":{"type":"string"},"description":"`YYYY-MM-DD` or ISO time. Default: 30 days before `until`","example":"2026-11-01"},{"name":"until","in":"query","schema":{"type":"string"},"description":"`YYYY-MM-DD` or ISO time (exclusive). Default: end of today (UTC)"},{"name":"group_by","in":"query","schema":{"enum":["day","repo","label"],"default":"day"},"description":"Row key: UTC day, `owner/name`, or `kajiya-N`"},{"name":"format","in":"query","schema":{"enum":["json","csv"],"default":"json"},"description":"`csv` returns the rows (no total) as a file"}],"responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"},"example":{"since":"2026-11-04T00:00:00.000Z","until":"2026-12-05T00:00:00.000Z","group_by":"repo","rows":[{"key":"acme/api","jobs":412,"failed_jobs":1,"billed_minutes":3120,"vcpu_hours":208,"cost_usd":0.936},{"key":"acme/web","jobs":160,"failed_jobs":0,"billed_minutes":900,"vcpu_hours":30,"cost_usd":0.135}],"total":{"jobs":572,"failed_jobs":1,"billed_minutes":4020,"vcpu_hours":238,"cost_usd":1.071}}},"text/csv":{"schema":{"type":"string"},"example":"key,jobs,failed_jobs,billed_minutes,vcpu_hours,cost_usd\nacme/api,412,1,3120,208,0.936\nacme/web,160,0,900,30,0.135\n"}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/repos":{"get":{"operationId":"listRepos","tags":["Repositories"],"summary":"Connected repositories with dispatch mode, caps and 30-day cost","description":"Requires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Repositories","content":{"application/json":{"schema":{"type":"object","properties":{"repos":{"type":"array","items":{"$ref":"#/components/schemas/Repo"}}}},"example":{"repos":[{"id":3,"full_name":"acme/api","dispatch":"webhook","dispatch_note":null,"paused":false,"max_vcpu":16,"running_vcpu":4,"waiting_jobs":0,"jobs_30d":412,"cost_30d_usd":0.936,"last_event_at":"2026-12-04T09:20:01.000Z","last_polled_at":"2026-12-04T09:17:44.000Z","last_error":null,"connected_at":"2026-11-02T03:15:22.000Z"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"connectRepos","tags":["Repositories"],"summary":"Connect one, many, or all repositories with one GitHub token","description":"Send `github_token` and exactly one of `repo`, `repos` (up to 200), `owner` (every repository of an organization the token administers) or `all: true` (everything the token administers). The token needs Administration: Read and write (to register one-time runners); with Webhooks: Read and write Kajiya also installs a workflow_job webhook so jobs start within seconds. Re-sending a connected repository updates its token. Status: 201 when at least one repository was connected or updated, 400 when the single `repo` failed, otherwise 200 with per-repository results.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["github_token"],"properties":{"github_token":{"type":"string","description":"Fine-grained personal access token (github_pat_...)"},"repo":{"type":"string","description":"One repository, owner/name"},"repos":{"type":"array","items":{"type":"string"},"maxItems":200,"description":"A list of owner/name"},"owner":{"type":"string","description":"Every repository of this organization the token administers"},"all":{"type":"boolean","description":"Every repository the token administers"}}},"example":{"github_token":"github_pat_11ABCDEFG0123456789_abcdefghijklmnopqrstuvwxyz","owner":"acme"}}}},"responses":{"200":{"description":"Nothing connected; see results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectResults"},"example":{"summary":{"connected":0,"updated":0,"skipped":1,"error":1},"results":[{"repo":"acme/docs","status":"skipped","message":"Token has no admin permission here."},{"repo":"acme/private","status":"error","message":"GitHub 404: Not Found"}]}}}},"201":{"description":"At least one connected or updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectResults"},"example":{"summary":{"connected":2,"updated":0,"skipped":2,"error":0},"results":[{"repo":"acme/api","status":"connected","id":3,"dispatch":"webhook"},{"repo":"acme/web","status":"connected","id":4,"dispatch":"webhook"},{"repo":"acme/docs","status":"skipped","message":"Token has no admin permission here."},{"repo":"acme/legacy","status":"skipped","message":"Archived."}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/BadGateway"}}}},"/api/v1/repos/{id}":{"patch":{"operationId":"updateRepo","tags":["Repositories"],"summary":"Pause/resume or cap a repository's concurrent vCPUs","description":"Send either field or both. `max_vcpu: null` removes the cap. Waiting jobs are re-checked on the next poll.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Repository id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paused":{"type":"boolean"},"max_vcpu":{"type":["integer","null"],"minimum":2,"maximum":10000}}},"example":{"max_vcpu":16}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"full_name":{"type":"string"},"paused":{"type":"boolean"},"max_vcpu":{"type":["integer","null"]}}},"example":{"id":3,"full_name":"acme/api","paused":false,"max_vcpu":16}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"operationId":"disconnectRepo","tags":["Repositories"],"summary":"Disconnect a repository (history is kept)","description":"Stops dispatching for the repository and deletes the webhook Kajiya created on it, when the token still allows that. Job history stays.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Repository id"}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"},"example":{"ok":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/repos/{id}/sync":{"post":{"operationId":"syncRepo","tags":["Repositories"],"summary":"Check GitHub for queued jobs now","description":"Polls this repository immediately instead of waiting for the next scheduled check, for example after replacing its token.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Repository id"}],"responses":{"200":{"description":"Polled","content":{"application/json":{"schema":{"type":"object","properties":{"dispatched":{"type":"integer"},"last_error":{"type":["string","null"]}}},"example":{"dispatched":1,"last_error":null}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/keys":{"get":{"operationId":"listKeys","tags":["API keys"],"summary":"List active API keys","description":"Requires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"200":{"description":"Keys","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}},"example":{"keys":[{"id":7,"name":"agent-07","prefix":"kjk_Zp3LqA9x","scope":"write","created_at":"2026-12-04T08:00:00.000Z","last_used_at":"2026-12-04T09:21:40.000Z","expires_at":null}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"operationId":"createKey","tags":["API keys"],"summary":"Create an API key (returned once)","description":"Give every agent or machine its own named key so you can see its last use and revoke it alone. At most 100 active keys per account. The secret `key` is in this response only.\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","scope"],"properties":{"name":{"type":"string","maxLength":80,"description":"Who uses the key, e.g. the agent or machine"},"scope":{"enum":["read","write","admin"]},"expires_in_days":{"type":"integer","minimum":1,"maximum":3650,"description":"Omit for a key that does not expire"}}},"example":{"name":"agent-07","scope":"write","expires_in_days":90}}}},"responses":{"201":{"description":"Key with secret","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ApiKey"},{"type":"object","properties":{"key":{"type":"string"},"note":{"type":"string"}}}]},"example":{"id":7,"name":"agent-07","prefix":"kjk_Zp3LqA9x","scope":"write","created_at":"2026-12-04T08:00:00.000Z","last_used_at":null,"expires_at":"2027-03-04T08:00:00.000Z","key":"kjk_Zp3LqA9xR2mT7vW1cN8bY4kH6sJ0dF5gQ3eU9iO2aL7","note":"Store the key now; it is shown only once."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/keys/{id}":{"delete":{"operationId":"revokeKey","tags":["API keys"],"summary":"Revoke an API key","description":"Takes effect immediately. A key cannot revoke itself (409); use another admin key or the dashboard.\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"API key id"}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"},"example":{"ok":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/settings":{"get":{"operationId":"getSettings","tags":["Settings"],"summary":"Spend caps, low-balance threshold, webhook URL","description":"Requires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"},"example":{"daily_cap_usd":25,"monthly_cap_usd":400,"low_balance_usd":5,"webhook_url":"https://ci.acme.dev/kajiya","webhook_secret_set":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"operationId":"updateSettings","tags":["Settings"],"summary":"Update spend caps, low-balance threshold or webhook URL","description":"Dollar amounts from 0 to 1,000,000; null removes a cap or the threshold, and a cap of 0 holds every new job. When a cap would be exceeded new jobs wait (reason daily_cap / monthly_cap); running jobs finish. The webhook URL must be public https. Setting a webhook URL when none was set before returns its signing secret once (`webhook_secret`). Unknown fields are rejected.\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingsPatch"},"example":{"daily_cap_usd":25,"monthly_cap_usd":400,"low_balance_usd":5,"webhook_url":"https://ci.acme.dev/kajiya"}}}},"responses":{"200":{"description":"Settings","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Settings"},{"type":"object","properties":{"webhook_secret":{"type":"string"},"note":{"type":"string"}}}]},"example":{"daily_cap_usd":25,"monthly_cap_usd":400,"low_balance_usd":5,"webhook_url":"https://ci.acme.dev/kajiya","webhook_secret_set":true,"webhook_secret":"whsec_7Hc2pQx9LmV4tRb8NwZ1sKd6Fy3Ja0Ue5Go2Mi7Xq4","note":"Store the webhook secret now; it is shown only once."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhook/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","tags":["Webhooks"],"summary":"Issue a new webhook signing secret (returned once)","description":"The old secret stops working at once: every delivery from now on, including retries, is signed with the new one.\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"200":{"description":"Secret","content":{"application/json":{"schema":{"type":"object","properties":{"webhook_secret":{"type":"string"},"note":{"type":"string"}}},"example":{"webhook_secret":"whsec_7Hc2pQx9LmV4tRb8NwZ1sKd6Fy3Ja0Ue5Go2Mi7Xq4","note":"Store the webhook secret now; it is shown only once."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhook/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Queue a `test` event to your webhook","description":"Requires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"202":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"queued":{"type":"boolean"},"event_id":{"type":"string"}}},"example":{"queued":true,"event_id":"evt_Ck5Nw0Ef3Gh8Jq2Lr6Ts9Vx1Yz"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/webhook/deliveries":{"get":{"operationId":"listDeliveries","tags":["Webhooks"],"summary":"Last 50 webhook deliveries with status and errors","description":"Deliveries are kept for 7 days.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Deliveries","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}}}},"example":{"deliveries":[{"event_id":"evt_9bXr5MtA2qWc7UeLs0DkHy3vNj","type":"job.finished","status":"delivered","attempts":1,"last_status":200,"last_error":null,"created_at":"2026-12-04T09:19:01.000Z","delivered_at":"2026-12-04T09:19:01.000Z","next_attempt_at":null},{"event_id":"evt_Pz6Fs1oKa8GmV3xQe5TcLw0rYd","type":"job.waiting","status":"pending","attempts":2,"last_status":502,"last_error":"HTTP 502","created_at":"2026-12-04T09:20:15.000Z","delivered_at":null,"next_attempt_at":"2026-12-04T09:22:46.000Z"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/payments":{"get":{"operationId":"listPayments","tags":["Payments"],"summary":"Compute pack purchases","description":"Completed and refunded purchases, newest first. Receipts and invoices come from Paddle by email.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Payments","content":{"application/json":{"schema":{"type":"object","properties":{"payments":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}}}},"example":{"payments":[{"method":"card","reference":"txn_01jeh7q4x0k9m2c8v5b3n6r1t","usd":100,"refunded_usd":0,"status":"completed","paid_at":"2026-11-02T03:20:10.000Z"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/usage/daily":{"get":{"operationId":"getDailyUsage","tags":["Usage"],"summary":"Cost per UTC day, split by repository or label","description":"One row per day of the range (days without jobs included, with zeros), each with the cost per repository or label in `by`. `keys` lists every repository or label of the range, most expensive first. Only finished jobs count.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":400,"default":30},"description":"Days up to and including today (UTC)"},{"name":"group_by","in":"query","schema":{"enum":["repo","label"],"default":"repo"}}],"responses":{"200":{"description":"Daily usage","content":{"application/json":{"schema":{"type":"object","properties":{"since":{"type":"string"},"until":{"type":"string"},"group_by":{"type":"string"},"keys":{"type":"array","items":{"type":"object"}},"days":{"type":"array","items":{"type":"object"}},"total_usd":{"type":"number"}}},"example":{"since":"2026-12-03T00:00:00.000Z","until":"2026-12-05T00:00:00.000Z","group_by":"repo","keys":[{"key":"acme/api","cost_usd":0.4185},{"key":"acme/web","cost_usd":0.072}],"days":[{"day":"2026-12-03","jobs":31,"vcpu_hours":52,"cost_usd":0.234,"by":{"acme/api":0.198,"acme/web":0.036}},{"day":"2026-12-04","jobs":27,"vcpu_hours":57,"cost_usd":0.2565,"by":{"acme/api":0.2205,"acme/web":0.036}}],"total_usd":0.4905}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/concurrency":{"get":{"operationId":"getConcurrency","tags":["Account"],"summary":"vCPUs in use over the last hours","description":"Average number of vCPUs running in each time bucket (about 120 buckets, at least one minute each). Running jobs count up to now.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"hours","in":"query","schema":{"type":"integer","minimum":1,"maximum":72,"default":6}}],"responses":{"200":{"description":"Concurrency","content":{"application/json":{"schema":{"type":"object","properties":{"since":{"type":"string"},"until":{"type":"string"},"step_seconds":{"type":"integer"},"limit_vcpu":{"type":"integer"},"running_vcpu":{"type":"integer"},"points":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"vcpu":{"type":"number"}}}}}},"example":{"since":"2026-12-04T03:21:00.000Z","until":"2026-12-04T09:21:40.000Z","step_seconds":180,"limit_vcpu":32,"running_vcpu":6,"points":[{"t":"2026-12-04T09:15:00.000Z","vcpu":4.5},{"t":"2026-12-04T09:18:00.000Z","vcpu":6}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/activity":{"get":{"operationId":"getActivity","tags":["Jobs"],"summary":"Recent job events and current waits","description":"Newest first: `job.dispatched`, `job.started`, `job.finished` (with runtime and cost) for your latest 500 jobs, and `job.waiting` for jobs that wait right now (with the reason).\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":30}}],"responses":{"200":{"description":"Activity","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object"}}}},"example":{"events":[{"type":"job.finished","at":"2026-12-04T09:19:01.000Z","job_id":1042,"repo":"acme/api","name":"test (3)","label":"kajiya-4","state":"done","runtime_seconds":402,"cost_usd":0.0021,"not_billed":false,"github_url":"https://github.com/acme/api/actions/runs/7001/job/9001"},{"type":"job.waiting","at":"2026-12-04T09:18:40.000Z","job_id":null,"repo":"acme/web","name":"e2e","label":"kajiya-8","state":"waiting","reason":"limit","message":"Account concurrency limit reached; starts when your running jobs finish.","github_url":"https://github.com/acme/web/actions/runs/7002/job/9002"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/repos/{id}/workflows":{"get":{"operationId":"listWorkflows","tags":["Repositories"],"summary":"The repository's workflow files, with links to edit them on GitHub","description":"Use the links to change `runs-on` to a Kajiya label. When the repository has no workflow yet, `new_workflow_url` opens GitHub's editor with a starter workflow. If GitHub cannot be reached, `workflows` is empty and `error` says why.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Repository id"}],"responses":{"200":{"description":"Workflows","content":{"application/json":{"schema":{"type":"object","properties":{"repo":{"type":"string"},"workflows":{"type":"array","items":{"type":"object"}},"new_workflow_url":{"type":["string","null"]},"actions_url":{"type":"string"},"error":{"type":"string"}}},"example":{"repo":"acme/api","workflows":[{"name":"CI","path":".github/workflows/ci.yml","html_url":"https://github.com/acme/api/blob/main/.github/workflows/ci.yml","edit_url":"https://github.com/acme/api/edit/main/.github/workflows/ci.yml"}],"new_workflow_url":null,"actions_url":"https://github.com/acme/api/actions"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/github/installations":{"get":{"operationId":"listInstallations","tags":["Repositories"],"summary":"GitHub App installations linked to your account","description":"Installations of the Kajiya CI GitHub App that this account uses, with how many repositories each connects. `app.enabled` is false when the server has no GitHub App; connect with a token then.\n\nRequires an API key with the `read` scope or higher.","x-scope":"read","responses":{"200":{"description":"Installations","content":{"application/json":{"schema":{"type":"object","properties":{"app":{"type":"object"},"installations":{"type":"array","items":{"type":"object"}}}},"example":{"app":{"enabled":true,"slug":"kajiya-ci","url":"https://github.com/apps/kajiya-ci"},"installations":[{"id":58123401,"account_login":"acme","account_type":"Organization","repository_selection":"selected","suspended":false,"repos":12,"linked_at":"2026-12-04T08:02:11.000Z","manage_url":"https://github.com/organizations/acme/settings/installations/58123401"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/github/installations/{id}":{"delete":{"operationId":"unlinkInstallation","tags":["Repositories"],"summary":"Stop using a GitHub App installation","description":"Disconnects the installation's repositories from this account (job history stays). The app stays installed on GitHub until its owner uninstalls it there.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Installation id"}],"responses":{"200":{"description":"Unlinked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"disconnected":{"type":"array","items":{"type":"string"}}}},"example":{"ok":true,"disconnected":["acme/api","acme/web"]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/github/installations/{id}/sync":{"post":{"operationId":"syncInstallation","tags":["Repositories"],"summary":"Re-read an installation's repositories from GitHub now","description":"Kajiya follows installation changes from GitHub's events; use this if a repository you just granted is missing.\n\nRequires an API key with the `write` scope or higher.","x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Installation id"}],"responses":{"200":{"description":"Synced","content":{"application/json":{"schema":{"type":"object","properties":{"installation":{"type":"integer"},"account":{"type":"string"},"connected":{"type":"array","items":{"type":"string"}},"skipped":{"type":"array","items":{"type":"object"}},"removed":{"type":"array","items":{"type":"string"}}}},"example":{"installation":58123401,"account":"acme","connected":["acme/api","acme/web"],"skipped":[{"repo":"acme/legacy","reason":"Archived."}],"removed":[]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/sessions":{"delete":{"operationId":"signOutEverywhere","tags":["API keys"],"summary":"Sign out everywhere","description":"Ends every browser session of the account, including the one making the call. API keys and the account token keep working; revoke those separately.\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"200":{"description":"Signed out","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"sessions_ended":{"type":"integer"}}},"example":{"ok":true,"sessions_ended":3}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/account/token":{"post":{"operationId":"rotateAccountToken","tags":["API keys"],"summary":"Replace the legacy account token (returned once)","description":"Issues a new `kjt_...` account token; the previous one stops working at once. Call it with a browser session or an admin API key: the account token cannot replace itself (409).\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"200":{"description":"New token","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"note":{"type":"string"}}},"example":{"token":"kjt_Q7wE2rT9yU4iO1pA6sD3fG8hJ5kL0zX2cV7bN4mQ9wE","note":"Store the token now; it is shown only once. The previous account token no longer works."}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"operationId":"revokeAccountToken","tags":["API keys"],"summary":"Revoke the legacy account token","description":"The account token stops working at once. Call it with a browser session or an admin API key: the account token cannot revoke itself (409).\n\nRequires an API key with the `admin` scope or higher.","x-scope":"admin","responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"},"example":{"ok":true}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"webhooks":{"event":{"post":{"summary":"Event sent to your webhook URL","description":"Headers: `Kajiya-Event` (type), `Kajiya-Delivery` (event id; retries reuse it, so de-duplicate on it), `Kajiya-Signature: t=<unix>,v1=<hex>` where v1 = HMAC-SHA256(secret, `<t>.<raw body>`). Reject timestamps older than 5 minutes. Answer 2xx within 10 s; redirects are not followed. Failures are retried after 30 s, 2 min, 10 min, 1 h, 6 h. Guide: https://kajiya.app/docs/webhooks","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"},"examples":{"job_dispatched":{"summary":"job.dispatched","value":{"id":"evt_3vQm8KcR0yJb1TfWzAa9sLx2pN","type":"job.dispatched","created_at":"2026-12-04T09:12:04.000Z","data":{"id":1287,"repo":"acme/api","name":"test (3)","label":"kajiya-4","vcpu":4,"state":"dispatched","github_run_id":12045567890,"github_job_id":33861234567,"github_url":"https://github.com/acme/api/actions/runs/12045567890/job/33861234567","runtime_seconds":null,"billed_seconds":null,"cost_usd":null}}},"job_started":{"summary":"job.started","value":{"id":"evt_Hq2LwZ7nVd4cEo8RkT1mYb6uSa","type":"job.started","created_at":"2026-12-04T09:12:09.000Z","data":{"id":1287,"repo":"acme/api","name":"test (3)","label":"kajiya-4","vcpu":4,"state":"running","github_run_id":12045567890,"github_job_id":33861234567,"github_url":"https://github.com/acme/api/actions/runs/12045567890/job/33861234567","runtime_seconds":null,"billed_seconds":null,"cost_usd":null}}},"job_finished":{"summary":"job.finished","value":{"id":"evt_9bXr5MtA2qWc7UeLs0DkHy3vNj","type":"job.finished","created_at":"2026-12-04T09:19:01.000Z","data":{"id":1287,"repo":"acme/api","name":"test (3)","label":"kajiya-4","vcpu":4,"state":"done","github_run_id":12045567890,"github_job_id":33861234567,"github_url":"https://github.com/acme/api/actions/runs/12045567890/job/33861234567","runtime_seconds":412,"billed_seconds":420,"cost_usd":0.0021}}},"job_waiting":{"summary":"job.waiting","value":{"id":"evt_Pz6Fs1oKa8GmV3xQe5TcLw0rYd","type":"job.waiting","created_at":"2026-12-04T09:20:15.000Z","data":{"repo":"acme/web","name":"e2e (1)","label":"kajiya-8","github_run_id":12045571234,"github_job_id":33861299871,"reason":"repo_limit","message":"This repository's concurrency cap is reached; starts when its running jobs finish."}}},"balance_low":{"summary":"balance.low","value":{"id":"evt_Lm4Tq9Wz2Xc6Va1Rb8Nd3Ke7Ys","type":"balance.low","created_at":"2026-12-04T11:02:47.000Z","data":{"balance_usd":4.93,"threshold_usd":5}}},"spend_cap_reached":{"summary":"spend_cap.reached","value":{"id":"evt_Ry1Ud7Bk4Wq9Zs2Xm6Lc8Pv3Ta","type":"spend_cap.reached","created_at":"2026-12-04T17:45:30.000Z","data":{"cap":"daily","message":"Your daily spend cap is reached. Raise it in Settings or wait for the next UTC day."}}},"test":{"summary":"test","value":{"id":"evt_Ck5Nw0Ef3Gh8Jq2Lr6Ts9Vx1Yz","type":"test","created_at":"2026-12-04T10:00:00.000Z","data":{"message":"Test event from Kajiya."}}}}}}},"responses":{"200":{"description":"Received"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"kjk_... API key (or a dashboard session token)"}},"responses":{"BadRequest":{"description":"Invalid parameter or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"limit must be an integer from 1 to 500."}}}},"Unauthorized":{"description":"Missing, unknown, revoked or expired key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Invalid token."}}}},"Forbidden":{"description":"The key's scope is too small","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"This API key has the \"read\" scope; this action needs \"write\"."}}}},"NotFound":{"description":"No such object on this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Job not found."}}}},"Conflict":{"description":"The object is in a state that does not allow this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Job is already done."}}}},"RateLimited":{"description":"Too many requests this minute","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit: 1,200 requests per minute per account."}}},"headers":{"Retry-After":{"description":"Seconds until the next minute window","schema":{"type":"integer"}}}},"BadGateway":{"description":"GitHub could not be reached or refused the call","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Marked as cancelled in Kajiya, but GitHub did not cancel the run: GitHub 403: Resource not accessible by personal access token"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable message"}}},"Ok":{"type":"object","properties":{"ok":{"const":true}}},"Account":{"type":"object","properties":{"id":{"type":"integer"},"email":{"type":"string"},"github_login":{"type":["string","null"]},"balance_usd":{"type":"number","description":"Remaining prepaid compute in USD, exact to the micro-dollar"},"vcpu_hours_left":{"type":"number"},"rate_per_vcpu_hour_usd":{"type":"number"},"spend":{"type":"object","description":"Cost of finished jobs. today/month are UTC calendar periods; last_7d/last_30d are rolling.","properties":{"today_usd":{"type":"number"},"month_usd":{"type":"number"},"last_7d_usd":{"type":"number"},"last_30d_usd":{"type":"number"},"avg_daily_7d_usd":{"type":"number"},"est_days_left":{"type":["integer","null"],"description":"Balance divided by the 7-day average; null without recent spend"}}},"concurrency":{"type":"object","properties":{"limit_vcpu":{"type":"integer"},"in_use_vcpu":{"type":"integer"},"active_jobs":{"type":"integer"},"waiting_jobs":{"type":"integer"}}},"limits":{"type":"object","properties":{"max_vcpu":{"type":"integer"},"daily_pack_usd":{"type":"number","description":"Compute packs you may buy per 24 hours"},"established":{"type":"boolean","description":"False while the new-account limits apply"},"has_repo":{"type":"boolean"}}},"caps":{"type":"object","properties":{"daily_usd":{"type":["number","null"]},"monthly_usd":{"type":["number","null"]},"low_balance_usd":{"type":["number","null"]}}},"auth":{"type":"object","properties":{"via":{"enum":["key","token","session"]},"scope":{"enum":["read","write","admin"]}}}}},"Job":{"type":"object","properties":{"id":{"type":"integer"},"repo":{"type":"string"},"name":{"type":"string"},"label":{"type":"string","examples":["kajiya-2"]},"vcpu":{"type":"integer"},"state":{"enum":["reserved","dispatched","running","done","failed"],"description":"reserved: machine chosen; dispatched: runner registered, VM booting; running: VM started (billing runs); done: VM powered off and billed; failed: never started or released, not billed"},"runtime_seconds":{"type":["integer","null"],"description":"VM start to power-off"},"billed_seconds":{"type":["integer","null"],"description":"Runtime rounded up to whole minutes, at least 60"},"cost_usd":{"type":["number","null"]},"not_billed":{"type":"boolean","description":"True when the job was released before a machine received it"},"created_at":{"type":"string","format":"date-time"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"github_run_id":{"type":"integer"},"github_job_id":{"type":"integer"},"github_url":{"type":"string"}}},"Queue":{"type":"object","properties":{"limit_vcpu":{"type":"integer"},"in_use_vcpu":{"type":"integer"},"fleet":{"type":"object","description":"All Kajiya machines online now","properties":{"sellable_vcpu":{"type":"integer"},"free_vcpu":{"type":"integer"}}},"active":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"repo":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"state":{"enum":["reserved","dispatched","running"]},"created_at":{"type":"string"},"started_at":{"type":["string","null"]},"github_url":{"type":"string"}}}},"waiting":{"type":"array","items":{"type":"object","properties":{"repo":{"type":"string"},"name":{"type":"string"},"label":{"type":"string"},"reason":{"enum":["limit","repo_limit","paused","no_credit","daily_cap","monthly_cap","no_host"]},"message":{"type":"string"},"waiting_since":{"type":"string"},"last_checked":{"type":"string"},"github_url":{"type":"string"}}}}}},"Usage":{"type":"object","properties":{"since":{"type":"string"},"until":{"type":"string"},"group_by":{"enum":["day","repo","label"]},"rows":{"type":"array","items":{"$ref":"#/components/schemas/UsageRow"}},"total":{"type":"object","properties":{"jobs":{"type":"integer"},"failed_jobs":{"type":"integer"},"billed_minutes":{"type":"integer"},"vcpu_hours":{"type":"number"},"cost_usd":{"type":"number"}}}}},"UsageRow":{"type":"object","properties":{"key":{"type":"string"},"jobs":{"type":"integer"},"failed_jobs":{"type":"integer"},"billed_minutes":{"type":"integer"},"vcpu_hours":{"type":"number"},"cost_usd":{"type":"number"}}},"Repo":{"type":"object","properties":{"id":{"type":"integer"},"full_name":{"type":"string"},"dispatch":{"enum":["webhook","webhook_pending","polling"],"description":"How Kajiya learns about queued jobs"},"dispatch_note":{"type":["string","null"],"description":"Why the webhook is not in use, if it is not"},"paused":{"type":"boolean"},"max_vcpu":{"type":["integer","null"]},"running_vcpu":{"type":"integer"},"waiting_jobs":{"type":"integer"},"jobs_30d":{"type":"integer"},"cost_30d_usd":{"type":"number"},"last_event_at":{"type":["string","null"],"description":"Last webhook delivery from GitHub"},"last_polled_at":{"type":["string","null"]},"last_error":{"type":["string","null"],"description":"Last error talking to GitHub, e.g. an expired token"},"connected_at":{"type":"string"}}},"ConnectResults":{"type":"object","properties":{"summary":{"type":"object","properties":{"connected":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"error":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","properties":{"repo":{"type":"string"},"status":{"enum":["connected","updated","skipped","error"]},"id":{"type":"integer"},"dispatch":{"enum":["webhook","polling"]},"message":{"type":"string"}}}}}},"CancelResult":{"type":"object","properties":{"ok":{"const":true},"cancelled_run_id":{"type":"integer"},"billed":{"type":"boolean"},"note":{"type":"string"}}},"ApiKey":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string","description":"First 12 characters of the key"},"scope":{"enum":["read","write","admin"]},"created_at":{"type":"string"},"last_used_at":{"type":["string","null"],"description":"Updated at most once a minute"},"expires_at":{"type":["string","null"]}}},"Settings":{"type":"object","properties":{"daily_cap_usd":{"type":["number","null"]},"monthly_cap_usd":{"type":["number","null"]},"low_balance_usd":{"type":["number","null"]},"webhook_url":{"type":["string","null"]},"webhook_secret_set":{"type":"boolean"}}},"SettingsPatch":{"type":"object","additionalProperties":false,"properties":{"daily_cap_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"Per UTC day"},"monthly_cap_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"Per UTC calendar month"},"low_balance_usd":{"type":["number","null"],"minimum":0,"maximum":1000000,"description":"Send balance.low when the balance drops below this"},"webhook_url":{"type":["string","null"],"description":"Public https URL; null or empty removes it"}}},"Delivery":{"type":"object","properties":{"event_id":{"type":"string"},"type":{"type":"string"},"status":{"enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"last_status":{"type":["integer","null"]},"last_error":{"type":["string","null"]},"created_at":{"type":"string"},"delivered_at":{"type":["string","null"]},"next_attempt_at":{"type":["string","null"]}}},"Payment":{"type":"object","properties":{"method":{"type":"string","examples":["card"]},"reference":{"type":["string","null"],"description":"Paddle transaction id"},"usd":{"type":"number"},"refunded_usd":{"type":"number"},"status":{"type":"string","examples":["completed","refunded"]},"paid_at":{"type":"string"}}},"Event":{"type":"object","required":["id","type","created_at","data"],"properties":{"id":{"type":"string","description":"Same as the Kajiya-Delivery header"},"type":{"enum":["job.dispatched","job.started","job.finished","job.waiting","balance.low","spend_cap.reached","test"]},"created_at":{"type":"string"},"data":{"type":"object","description":"job.*: the job (job.waiting: repo, name, label, reason, message). balance.low: balance_usd, threshold_usd. spend_cap.reached: cap, message. test: message."}}}}}}