kosa8 docs Dashboard
esc
↑ ↓ move↵ openRuns in your browser; nothing you type is sent anywhere.

HTTP API / Functions

Functions

20 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.

List functions#

GET/v1/functionsscope functions:invoke
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/functions \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Deploy or replace a function (bumps version)#

PUT/v1/functions/{name}scope functions:deploy

201 when the name is new (version 1); 200 when it replaces a deployed function. Give code, or repo {name, ref?, path} to deploy that file of a GitHub repository; the function's source then says which commit.

Parameters
namerequiredpath · string
Function name
JSON body
runtimerequired"python3.12" | "node22"
—
coderequiredstring
The source, at most 1 MiB
envobject
Names not starting with K8_; 16 KiB in all
timeout_sinteger
Default 30. Min 1. Max 90.
web"off" | "public" | "key"
Default "off".
schedulestring | null
A five-field cron expression (UTC), or null for none
repostring | object
A GitHub repository of the organization's connection to take the function's code from: "owner/name", "owner/name@ref", or {name, ref, path}. path is the file inside the repository, such as src/handler.py (required). Read by kosa8 at one commit with a read-only token for that one repository, revoked right after (audited as github.token and github.read); the answer's source (or repo) says which commit. Errors as for sandboxes: 409 github_not_connected, 404 repo_not_found, 404 ref_not_found, 404 path_not_found, 409 github_permissions, 413 too_large.
Responses
200201400401403413
curl -s -X PUT https://api.kosa8.com/v1/functions/$NAME \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Get a function with its code#

GET/v1/functions/{name}scope functions:deploy
Parameters
namerequiredpath · string
Function name
Responses
200401403404
curl -s -X GET https://api.kosa8.com/v1/functions/$NAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Delete a function#

DELETE/v1/functions/{name}scope functions:deploy
Parameters
namerequiredpath · string
Function name
Responses
200401403404
curl -s -X DELETE https://api.kosa8.com/v1/functions/$NAME \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Call a function: {event} → result, logs, timings#

POST/v1/functions/{name}/invokescope functions:invoke
Parameters
namerequiredpath · string
Function name
JSON body
eventobject
—
Responses
200401402403404
curl -s -X POST https://api.kosa8.com/v1/functions/$NAME/invoke \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Call a function on up to 100 events#

POST/v1/functions/{name}/mapscope functions:invoke
Parameters
namerequiredpath · string
Function name
JSON body
eventsrequiredarray of object
—
concurrencyinteger
Max 16.
Responses
200401402403404
curl -s -X POST https://api.kosa8.com/v1/functions/$NAME/map \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Recent calls, newest first#

GET/v1/functions/{name}/invocationsscope functions:invoke
Parameters
namerequiredpath · string
Function name
limitquery · integer
How many
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/functions/$NAME/invocations \
  -H "Authorization: Bearer $KOSA8_API_KEY"

The versions kept (the last 20), newest first, without code; env names only#

GET/v1/functions/{name}/versionsscope functions:deploy
Parameters
namerequiredpath · string
Function name
Responses
200401403404
curl -s -X GET https://api.kosa8.com/v1/functions/$NAME/versions \
  -H "Authorization: Bearer $KOSA8_API_KEY"

One kept version, with its code#

GET/v1/functions/{name}/versions/{version}scope functions:deploy
Parameters
namerequiredpath · string
Function name
versionrequiredpath · string
Version number
Responses
200401403404
curl -s -X GET https://api.kosa8.com/v1/functions/$NAME/versions/$VERSION \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Deploy a kept version again (its code, runtime, env, timeout, web and schedule) as a new version#

POST/v1/functions/{name}/rollbackscope functions:deploy
Parameters
namerequiredpath · string
Function name
JSON body
versionrequiredinteger
Min 1.
Responses
200400401403404409
curl -s -X POST https://api.kosa8.com/v1/functions/$NAME/rollback \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Run code or a command in a fresh sandbox, one call: output, exit code and files back, sandbox deleted#

POST/v1/runscope sandboxes:write

Billed per second like any sandbox. A command that exits non-zero is a 200 with status failed; 4xx/5xx carry hint (the next step) and docs.

JSON body
codestring
Source to run; written to filename (main.<ext>) in /workspace
commandstring | array of string
A shell string, or a list of strings; with code, runs instead of the language's own command
language"python" | "node" | "typescript" | "bash" | "sh"
Default: from filename, else python
filenamestring
—
templatestring
Default: the language's (python, node, base)
filesobject | array of object
{path: text} or [{path, content, encoding: utf8|base64}]; paths are under /workspace
envobject
—
sizestring
—
timeout_sinteger
Default 60. Min 1. Max 3600.
streamboolean | "ndjson" | "sse"
true or ndjson: NDJSON frames as it prints; sse: server-sent events (or send Accept: text/event-stream)
outputsarray of string
Files to send back, base64, 4 MiB together
shareboolean | object
true: a public read-only run card (command, output, duration; never env or files). {public, code} also shows the code.
repostring | object
A GitHub repository of the organization's connection (GET /v1/github/repos) to clone into the sandbox: "owner/name", "owner/name@ref" (branch, tag or 40-character sha), or {name, ref, path, depth}, or {name, pr} to continue pull request pr (its head branch, or for a fork its head commit; a fork's head is read only: push and pull-request answer 409 fork_pull_request; for one of the repository's own, push goes to the pull request's branch by default). path defaults to /workspace/<name>; depth to 1 (0: the whole history). Checked before anything is made (409 github_not_connected, 404 repo_not_found, 409 github_permissions). git in the sandbox clones through kosa8's git proxy with a read-only capability for that one repository and that one command; the proxy adds the GitHub token on kosa8's side, so no GitHub token ever enters the sandbox, and the sandbox needs to reach only kosa8's API host (added to its egress for the clone alone), never github.com.
github_checkboolean | string
With repo: true (named kosa8/run) or a check name. When the run ends its result goes on the cloned commit as a GitHub check run (or a commit status), linking to the run's page; shows on the pull request of that branch.
Responses
200400401402403413429
curl -s -X POST https://api.kosa8.com/v1/run \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Run it: this visitor's free time left (15 minutes of run time per 24 hours by default)#

GET/v1/trypublic
Responses
200
curl -s -X GET https://api.kosa8.com/v1/try

Run it with no account: up to 8 KiB of code, 60 s a run, no network, 15 free minutes per 24 hours; a public run card and a claim token back#

POST/v1/trypublic
JSON body
language"python" | "node" | "bash"
Default "python".
coderequiredstring
Max length 8192.
turnstile_tokenstring
Sent when a 403 challenge_required asked for it
claim_tokenstring
The last run's claim token, echoed into signup_url when the free minutes are used up
Responses
200400402403413429503
curl -s -X POST https://api.kosa8.com/v1/try \
  -H 'Content-Type: application/json' -d @body.json

Move a run made with Run it (POST /v1/try) into this org, by its claim token#

POST/v1/try/claimscope sandboxes:write
JSON body
tokenrequiredstring
The claim token (k8t_…), valid 7 days
Responses
200400401403404
curl -s -X POST https://api.kosa8.com/v1/try/claim \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

The org's recent runs, newest first (kept 30 days)#

GET/v1/runsscope sandboxes:read
Parameters
limitquery · integer
How many, up to 100
repoquery · string
owner/name: only runs that cloned it
Responses
200401403
curl -s -X GET https://api.kosa8.com/v1/runs \
  -H "Authorization: Bearer $KOSA8_API_KEY"

One run, with the saved tail of its output#

GET/v1/runs/{id}scope sandboxes:read
Parameters
idrequiredpath · string
Run id (sr_…)
Responses
200401403404
curl -s -X GET https://api.kosa8.com/v1/runs/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Publish or unpublish a run's read-only card#

POST/v1/runs/{id}/sharescope sandboxes:write
Parameters
idrequiredpath · string
Run id (sr_…)
JSON body
publicrequiredboolean
—
codeboolean
—
Responses
200400401403404
curl -s -X POST https://api.kosa8.com/v1/runs/$SBX/share \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

A run card's model (serverless run, job or RL run) for the org's members#

GET/v1/cards/{id}scope sandboxes:read
Parameters
idrequiredpath · string
sr_…, job_… or run_…
Responses
200401403404
curl -s -X GET https://api.kosa8.com/v1/cards/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Publish or unpublish a job's read-only card#

POST/v1/jobs/{id}/sharescope sandboxes:write
Parameters
idrequiredpath · string
Job id
JSON body
publicrequiredboolean
—
Responses
200400401403404
curl -s -X POST https://api.kosa8.com/v1/jobs/$SBX/share \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

Publish or unpublish an RL run's read-only card#

POST/v1/rl/runs/{id}/sharescope sandboxes:write
Parameters
idrequiredpath · string
RL run id
JSON body
publicrequiredboolean
—
Responses
200400401403404
curl -s -X POST https://api.kosa8.com/v1/rl/runs/$SBX/share \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json

The kosa8 weekly

Agent security news, one industry deep-dive and a hands-on challenge, every Monday. Unsubscribe in one click.

© 2026 kosa8 · kosa8.com · Zero Trust cybersecurity infrastructure for AI agents · Local models served by llamay · Agent gateway: MAQPNA