---
title: JSON API and webhooks · Kip docs
description: Start jobs and read runs, approvals and the activity log from other software.
url: https://www.quietrobot.ai/docs/kip/api
---

# JSON API and webhooks

Start jobs and read runs, approvals and the activity log from other software.

## JSON API

Set `KIP_API_TOKEN` in `.env` to any long random text, then send it on every request:

```http
Authorization: Bearer <KIP_API_TOKEN>
```

Without the setting, every `/api` request gets `401`.

| Request | Returns |
|---|---|
| `GET /api/jobs` | The jobs: `id`, `name`, `description`, `inputs`. |
| `POST /api/jobs/{id}/runs` | Starts a job. Body: `{ "input": { … }, "wait": false }`. Returns the run. |
| `GET /api/runs/{id}` | One run. |
| `GET /api/runs?since=…&limit=500` | Runs changed since an ISO 8601 time, oldest first, up to 1,000. For usage reports. |
| `GET /api/approvals` | Actions waiting for a person. |
| `GET /api/audit?limit=200` | The activity log, and whether its hash chain is intact. |

```bash
curl -s -X POST http://localhost:8484/api/jobs/ask/runs \
  -H "Authorization: Bearer $KIP_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"input":{"request":"What do we charge for a weekend service call?"},"wait":true}'
```

A run:

```json
{
  "id": "run_…",
  "job": "ask",
  "title": "What do we charge for a weekend service call?",
  "status": "done",
  "route": "cloud",
  "mode": "owner",
  "result": "A weekend service call is $185 (price sheet, line 4).",
  "error": null,
  "tokens": { "input": 5120, "output": 310 },
  "created_at": "…",
  "updated_at": "…"
}
```

`status` is `running`, `waiting_approval`, `done`, `failed` or `stopped`. With `"wait": true` the call returns when the run finishes or stops for an approval.

Work started through the API counts as the owner's request, so treat the token like the office password. Approvals still happen in the web app.

## Webhooks

A webhook lets a web form or another system start a job without a token header. Give the job a secret in `kip.config.json`:

```json
{ "webhooks": { "ask": "a-long-random-token-of-24-characters-or-more" } }
```

Then post JSON or a form to it:

```bash
curl -s -X POST "http://localhost:8484/hooks/ask/a-long-random-token-of-24-characters-or-more" \
  -H "Content-Type: application/json" \
  -d '{"name":"Sara","email":"sara@example.com","message":"Can you quote two service calls?"}'
```

It returns `{ "run": "run_…", "status": "…" }`. A wrong job or token returns `404`.

Webhook work is background work: what was posted is treated as outside information, never as instructions, and Kip asks before sending anything. Tokens shorter than 24 characters, or still starting with `replace-`, are refused.
