# Autopilot

25 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## Autopilot's triggers, typed actions and tiers[#]

GET`/v1/bots/catalog`public

Public.

Responses

200

```
curl -s -X GET https://api.kosa8.com/v1/bots/catalog
```

## Bot templates, ranked for this organization[#]

GET`/v1/bot-templates`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/bot-templates \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One bot template[#]

GET`/v1/bot-templates/{id}`scope sandboxes:read

Parameters

`id`requiredpath · string

Template id

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/bot-templates/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Compile a bot without saving it: the plan, and with replay the last 7 days[#]

POST`/v1/bots/plan`scope sandboxes:read

JSON body

`template`string

A template id (spend-guard, …)

`spec`object

—

`spec.triggers`requiredarray of object

Each trigger's params beside event; see GET /v1/bots/catalog

`spec.actions`requiredarray of object

Typed actions only; the engine computes each tier. Never possible (400 forbidden_action): github.merge, github.approve, github.mark_ready, github.push_default_branch, github.force_push, token.widen, spend.past_cap, email.send, act_on_non_writer, protected.touch

`spec.scope`object

—

`spec.budget_usd`number

Monthly budget; steps that cost money need one. Guard bots cost nothing.

`spec.notify`object

—

`spec.dedup_s`integer

Once per subject per this many seconds (default 86400)

`spec.rate_per_hour`integer

Runs at most this many times an hour (default 30)

`spec.chain`boolean

Listen to events other bots caused (depth ≤ 2). Default false.

`name`string

—

`scope`object

—

`budget_usd`number

—

`notify`object

—

`replay`boolean

—

Responses

200400401403404

```
curl -s -X POST https://api.kosa8.com/v1/bots/plan \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Turn one sentence into a bot spec (never saved, never on)[#]

POST`/v1/bots/compile`scope sandboxes:read

Through kosa8's AI gateway, included at no charge, with a rules fallback; a person always sees the plan before a bot turns on.

JSON body

`text`requiredstring

≤ 500 characters

Responses

200400401403422

```
curl -s -X POST https://api.kosa8.com/v1/bots/compile \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Pause every bot in the organization[#]

POST`/v1/bots/pause-all`scope admin

Running work is left alone. Any admin credential, an agent's too.

Responses

200401403

```
curl -s -X POST https://api.kosa8.com/v1/bots/pause-all \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Resume every bot[#]

POST`/v1/bots/resume-all`scope admin

Needs a person: a dashboard session or an API key made for a member. Capability tokens, MCP sessions, org keys bound to no member and bots get 403 human_required.

Responses

200401403

```
curl -s -X POST https://api.kosa8.com/v1/bots/resume-all \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## The organization's bots[#]

GET`/v1/bots`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/bots \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Create a bot (always a draft)[#]

POST`/v1/bots`scope sandboxes:write

JSON body

`template`string

A template id (spend-guard, …)

`spec`object

—

`spec.triggers`requiredarray of object

Each trigger's params beside event; see GET /v1/bots/catalog

`spec.actions`requiredarray of object

Typed actions only; the engine computes each tier. Never possible (400 forbidden_action): github.merge, github.approve, github.mark_ready, github.push_default_branch, github.force_push, token.widen, spend.past_cap, email.send, act_on_non_writer, protected.touch

`spec.scope`object

—

`spec.budget_usd`number

Monthly budget; steps that cost money need one. Guard bots cost nothing.

`spec.notify`object

—

`spec.dedup_s`integer

Once per subject per this many seconds (default 86400)

`spec.rate_per_hour`integer

Runs at most this many times an hour (default 30)

`spec.chain`boolean

Listen to events other bots caused (depth ≤ 2). Default false.

`name`string

—

`scope`object

—

`budget_usd`number

—

`notify`object

—

`sponsor`string

A member's email; defaults to the person calling

Responses

201400401403404409

```
curl -s -X POST https://api.kosa8.com/v1/bots \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## One bot, with its spec and plan[#]

GET`/v1/bots/{id}`scope sandboxes:read

Parameters

`id`requiredpath · string

Bot id (bot_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/bots/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Change a bot; a new spec is a new version[#]

PATCH`/v1/bots/{id}`scope sandboxes:write

A spec changed by no person turns an enabled bot back into a draft.

Parameters

`id`requiredpath · string

Bot id (bot_…)

JSON body

`name`string

—

`spec`object

—

`spec.triggers`requiredarray of object

Each trigger's params beside event; see GET /v1/bots/catalog

`spec.actions`requiredarray of object

Typed actions only; the engine computes each tier. Never possible (400 forbidden_action): github.merge, github.approve, github.mark_ready, github.push_default_branch, github.force_push, token.widen, spend.past_cap, email.send, act_on_non_writer, protected.touch

`spec.scope`object

—

`spec.budget_usd`number

Monthly budget; steps that cost money need one. Guard bots cost nothing.

`spec.notify`object

—

`spec.dedup_s`integer

Once per subject per this many seconds (default 86400)

`spec.rate_per_hour`integer

Runs at most this many times an hour (default 30)

`spec.chain`boolean

Listen to events other bots caused (depth ≤ 2). Default false.

`sponsor`string

—

`budget_usd`number

—

`scope`object

—

`notify`object

—

Responses

200400401403404

```
curl -s -X PATCH https://api.kosa8.com/v1/bots/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Delete a bot (its runs stay)[#]

DELETE`/v1/bots/{id}`scope sandboxes:write

Parameters

`id`requiredpath · string

Bot id (bot_…)

Responses

200401403404

```
curl -s -X DELETE https://api.kosa8.com/v1/bots/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Turn a bot on[#]

POST`/v1/bots/{id}/enable`scope sandboxes:write

Needs a person: a dashboard session or an API key made for a member. Capability tokens, MCP sessions, org keys bound to no member and bots get 403 human_required.

Parameters

`id`requiredpath · string

Bot id (bot_…)

Responses

200401403404409

```
curl -s -X POST https://api.kosa8.com/v1/bots/$SBX/enable \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Turn a bot off[#]

POST`/v1/bots/{id}/disable`scope sandboxes:write

Parameters

`id`requiredpath · string

Bot id (bot_…)

Responses

200401403404

```
curl -s -X POST https://api.kosa8.com/v1/bots/$SBX/disable \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Run a bot now, or a dry run with a replay of the last 7 days[#]

POST`/v1/bots/{id}/runs`scope sandboxes:write

A dry run changes nothing and is never billed.

Parameters

`id`requiredpath · string

Bot id (bot_…)

JSON body

`dry_run`boolean

—

Responses

201401403404409423

```
curl -s -X POST https://api.kosa8.com/v1/bots/$SBX/runs \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## A bot's runs, newest first[#]

GET`/v1/bots/{id}/runs`scope sandboxes:read

Parameters

`id`requiredpath · string

Bot id (bot_…)

`limit`query · integer

Default 20

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/bots/$SBX/runs \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One run and its steps[#]

GET`/v1/bot-runs/{id}`scope sandboxes:read

Parameters

`id`requiredpath · string

Run id (brun_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/bot-runs/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Cancel a run (its pending approvals are rejected)[#]

POST`/v1/bot-runs/{id}/cancel`scope sandboxes:write

Parameters

`id`requiredpath · string

Run id (brun_…)

Responses

200401403404409

```
curl -s -X POST https://api.kosa8.com/v1/bot-runs/$SBX/cancel \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Undo a step (wake, unblock its own block, lift its own refusal)[#]

POST`/v1/bot-runs/{id}/steps/{key}/undo`scope sandboxes:write

Parameters

`id`requiredpath · string

Run id (brun_…)

`key`requiredpath · string

Step key

Responses

200401403404409

```
curl -s -X POST https://api.kosa8.com/v1/bot-runs/$SBX/steps/$KEY/undo \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Bot steps waiting for a person, and decided ones[#]

GET`/v1/approvals`scope sandboxes:read

Parameters

`state`query · "pending" | "decided" | "all"

Default pending

`limit`query · integer

Default 50

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/approvals \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One approval with its raw arguments[#]

GET`/v1/approvals/{id}`scope sandboxes:read

Parameters

`id`requiredpath · string

Approval id (appr_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/approvals/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Approve or reject a bot's step[#]

POST`/v1/approvals/{id}/decide`scope sandboxes:read

Needs a person: a dashboard session or an API key made for a member. Capability tokens, MCP sessions, org keys bound to no member and bots get 403 human_required. The person's role must cover the action (admin for billing, unblocking and freezing).

Parameters

`id`requiredpath · string

Approval id (appr_…)

JSON body

`decision`required"approve" | "reject"

—

`reason`string

—

`edited_args`object

Checked against the action's schema

Responses

200400401403404409

```
curl -s -X POST https://api.kosa8.com/v1/approvals/$SBX/decide \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Two-way channels: Slack (interactive approvals) and GitHub[#]

GET`/v1/connections`scope sandboxes:read

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/connections \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Start connecting the kosa8 Slack app[#]

POST`/v1/connections/slack/install`scope admin

Post-only: it never reads channel history.

Responses

200401403501

```
curl -s -X POST https://api.kosa8.com/v1/connections/slack/install \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Disconnect the kosa8 Slack app[#]

DELETE`/v1/connections/slack`scope admin

Responses

200401403

```
curl -s -X DELETE https://api.kosa8.com/v1/connections/slack \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

---
Source: https://docs.kosa8.com/api/autopilot/
