Integrations
19 endpoints at https://api.kosa8.com, sent with Authorization: Bearer $KOSA8_API_KEY. Generated from the API's own OpenAPI description, which a test holds to the router.
GitHub Actions runners: linked installations and the link to install the kosa8 GitHub App#
/v1/integrations/githubscope adminJobs whose runs-on includes the kosa8 label then run on an ephemeral self-hosted runner in a persistent sandbox of this org; a kosa8-4x8 (2x4, 8x16, 16x32) label picks the size.
Responsescurl -s -X GET https://api.kosa8.com/v1/integrations/github \ -H "Authorization: Bearer $KOSA8_API_KEY"
GitHub Actions runners: the repositories the linked installations can see, and which run on kosa8#
/v1/integrations/github/reposscope adminRunners are opt-in per repository: a workflow_job from a repository not turned on is ignored.
Responsescurl -s -X GET https://api.kosa8.com/v1/integrations/github/repos \ -H "Authorization: Bearer $KOSA8_API_KEY"
Turn kosa8 runners on or off for a repository#
/v1/integrations/github/reposscope adminreporequiredstringenabledrequiredbooleancurl -s -X POST https://api.kosa8.com/v1/integrations/github/repos \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Stop taking this installation's jobs#
/v1/integrations/github/{installation_id}scope admininstallation_idrequiredpath · integercurl -s -X DELETE https://api.kosa8.com/v1/integrations/github/$INSTALLATION_ID \ -H "Authorization: Bearer $KOSA8_API_KEY"
GitHub Actions jobs that ran on kosa8 runners, newest first, with this month's CI minutes#
/v1/ci/jobsscope sandboxes:readstatequery · "queued" | "booting" | "launched" | "busy" | "done" | "failed" | "cancelled"repoquery · stringlimitquery · integercurl -s -X GET https://api.kosa8.com/v1/ci/jobs \ -H "Authorization: Bearer $KOSA8_API_KEY"
GitHub: is it connected, its installations, and what permissions they lack#
/v1/githubscope sandboxes:readinstall_url (admins only) installs the kosa8 GitHub App and links it to this organization. missing_permissions lists which of contents:write, pull_requests:write, metadata:read, checks:write and statuses:write an installation lacks: open its manage_url to accept them (checks and statuses only show results on commits; without them kosa8 still works). An installation limited to picked repositories (repository_selection selected) carries add_repos_url and a hint: choose "All repositories" there (recommended) or add the ones you want. Errors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Responsescurl -s -X GET https://api.kosa8.com/v1/github \ -H "Authorization: Bearer $KOSA8_API_KEY"
GitHub: the repositories this organization's installations can see, most recently pushed first#
/v1/github/reposscope sandboxes:writeEvery repository of every linked installation, all pages (up to 2000 per installation; past that truncated: true), cached 60 s. Errors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Parametersqquery · stringpagequery · integerper_pagequery · integerfreshquery · "1"curl -s -X GET https://api.kosa8.com/v1/github/repos \ -H "Authorization: Bearer $KOSA8_API_KEY"
GitHub: a repository's branches (first 100, the default first)#
/v1/github/repos/{owner}/{repo}/branchesscope sandboxes:writeErrors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Parametersownerrequiredpath · stringreporequiredpath · stringcurl -s -X GET https://api.kosa8.com/v1/github/repos/$OWNER/$REPO/branches \ -H "Authorization: Bearer $KOSA8_API_KEY"
The sandbox's GitHub repo and its changes since the clone#
/v1/sandboxes/{id}/reposcope sandboxes:readA pending clone is tried again here. changes (while the sandbox runs, with sandboxes:write): files_changed, insertions, deletions, commits_ahead; null otherwise. The block's fields are also under repo. Errors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Parametersidrequiredpath · stringcurl -s -X GET https://api.kosa8.com/v1/sandboxes/$SBX/repo \ -H "Authorization: Bearer $KOSA8_API_KEY"
Commit every change in the sandbox's repo and push it to a branch#
/v1/sandboxes/{id}/github/pushscope sandboxes:writeCommits as kosa8 <bot@kosa8.com> (Co-authored-by the member, when known) in a command with no token, then pushes with a contents:write token for that one repository, revoked right after. Audited as github.push. Errors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Parametersidrequiredpath · stringbranchstringmessagestringpathstringcurl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/github/push \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Push the sandbox's changes and open a pull request#
/v1/sandboxes/{id}/github/pull-requestscope sandboxes:writeA draft by default (opened ready where the repository has no drafts). An open pull request for the branch already: 200 with existing: true. Audited as github.pr. Errors (error field): 409 github_not_connected {connect_url}, 404 repo_not_found (not visible to this organization's installations), 409 github_permissions {missing, settings_url}, 409 no_changes, 502 github_unavailable (retry_after_s when GitHub rate-limits).
Parametersidrequiredpath · stringtitlestringbodystringbasestringbranchstringdraftbooleantrue.messagestringcurl -s -X POST https://api.kosa8.com/v1/sandboxes/$SBX/github/pull-request \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Work from GitHub: @kosa8 comment triggers and check-run settings#
/v1/github/automationscope sandboxes:readNeeds the sandboxes:read scope. Comment @kosa8 run <command> on a pull request (runs at its head commit; on an issue: the default branch) or @kosa8 agent <task> (the org's coding agent makes the change in a sandbox and opens a draft pull request on a kosa8/ branch). Only people with write, maintain or admin permission on the repository trigger; bots and GitHub Apps never do; edits never do; quoted lines, code and hidden HTML comments are ignored. kosa8 reacts with eyes, keeps one reply comment updated (status, sandbox, duration, cost, egress, then pass or fail) and, on a pull request, posts a check run named kosa8.
curl -s -X GET https://api.kosa8.com/v1/github/automation \ -H "Authorization: Bearer $KOSA8_API_KEY"
Change the GitHub automation settings (send only what changes; {"triggers": true} turns triggers on)#
/v1/github/automationscope adminNeeds the admin scope. 400 invalid_automation names the bad field; 404 unknown_secret when agent.secret does not exist (with an example secret for that kit).
triggersbooleancommands"any" | "allowlist" | "off"allowed_commandsarray of stringagentobject | nullmax_runtime_sintegerbudget_usdnumbersizestringegress"registries" | "open"check_runsbooleancurl -s -X PUT https://api.kosa8.com/v1/github/automation \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json
Recent @kosa8 comment triggers, newest first#
/v1/github/triggersscope sandboxes:readNeeds the sandboxes:read scope.
limitquery · integerrepoquery · stringcurl -s -X GET https://api.kosa8.com/v1/github/triggers \ -H "Authorization: Bearer $KOSA8_API_KEY"
One pull request of a connected repository: its head and base, to continue it in a sandbox#
/v1/github/repos/{owner}/{repo}/pulls/{number}scope sandboxes:writeNeeds the sandboxes:write scope and an unrestricted key. Read with a token for that one repository (metadata and pull_requests read), revoked after. head.fork is true when the head branch is on another repository: a sandbox can clone it (repo {name, pr}) but never push to it. 409 github_permissions when the installation lacks Pull requests: read; 404 pr_not_found.
ownerrequiredpath · stringreporequiredpath · stringnumberrequiredpath · integercurl -s -X GET https://api.kosa8.com/v1/github/repos/$OWNER/$REPO/pulls/$NUMBER \ -H "Authorization: Bearer $KOSA8_API_KEY"
The token ledger: every GitHub token kosa8 minted, for which repo, for what and until when#
/v1/github/activityscope sandboxes:readNeeds sandboxes:read or audit:read. Read from the audit log; never a token (none is stored). Repository look-ups (purpose list or lookup, metadata:read) are left out unless lookups=1. format=csv downloads up to 5000 rows.
repoquery · stringpurposequery · stringactorquery · stringsandbox_idquery · stringsincequery · stringuntilquery · stringlookupsquery · "1"before_seqquery · integerlimitquery · integerformatquery · "json" | "csv"curl -s -X GET https://api.kosa8.com/v1/github/activity \ -H "Authorization: Bearer $KOSA8_API_KEY"
Pull requests opened from this organization's sandboxes, newest first#
/v1/github/pull-requestsscope sandboxes:readNeeds the sandboxes:read scope.
repoquery · stringstatequery · "open" | "draft" | "closed" | "merged"limitquery · integercurl -s -X GET https://api.kosa8.com/v1/github/pull-requests \ -H "Authorization: Bearer $KOSA8_API_KEY"
Preview moving a repository's GitHub Actions workflows to kosa8 runners#
/v1/github/repos/{owner}/{repo}/runners/migrationscope adminNeeds the admin scope. Reads .github/workflows/*.yml at the default branch with a read-only token for that one repository and answers the diff (runs-on: ubuntu-* to a kosa8 label); changes nothing. Jobs chosen by an expression, multi-line runs-on lists, macOS and Windows are left alone and listed under skipped. missing_permissions lists what the App installation still needs to open the pull request (contents:write, pull_requests:write, workflows:write), with settings_url.
ownerrequiredpath · stringreporequiredpath · stringlabelquery · "kosa8" | "kosa8-2x4" | "kosa8-4x8" | "kosa8-8x16" | "kosa8-16x32"curl -s -X GET https://api.kosa8.com/v1/github/repos/$OWNER/$REPO/runners/migration \ -H "Authorization: Bearer $KOSA8_API_KEY"
Open a pull request that moves the workflows to kosa8 runners (branch kosa8/runners; kosa8 never merges it)#
/v1/github/repos/{owner}/{repo}/runners/migrationscope adminNeeds the admin scope. Commits each changed workflow file to kosa8/runners (started again from the default branch) through GitHub's contents API with a token for that one repository (contents, pull_requests and workflows write), revoked right after, and opens a draft pull request; an open one from kosa8/runners is updated and answered 200 with existing: true. 409 github_permissions {missing, settings_url} when the installation lacks Workflows: write (or another); 409 no_changes when no job runs on a GitHub-hosted Ubuntu runner. Audited as github.runners_pr.
ownerrequiredpath · stringreporequiredpath · stringlabel"kosa8" | "kosa8-2x4" | "kosa8-4x8" | "kosa8-8x16" | "kosa8-16x32"pathsarray of stringcurl -s -X POST https://api.kosa8.com/v1/github/repos/$OWNER/$REPO/runners/migration \ -H "Authorization: Bearer $KOSA8_API_KEY" \ -H 'Content-Type: application/json' -d @body.json