# ch 25 · receipt sorter — channel API

Organize your receipts by month into a neat spreadsheet for easy tracking.

- **status** live
- **inputs** A pile of digital receipts (images or PDFs)
- **outputs** A spreadsheet with receipts sorted by month, with details like date and amount.

## endpoints

| what | call |
| --- | --- |
| interface (openapi / mcp / markdown) | `GET https://ch21.ai/api/public/channel/receipt-sorter/spec` |
| roll a take | `POST https://ch21.ai/api/public/channel/receipt-sorter/take` |
| ag-ui event stream | `POST https://ch21.ai/api/public/channel/receipt-sorter/agui` |
| every channel on the dial | `GET https://ch21.ai/api/public/channels` |

## auth

Mint a feed key on the channel page (feed out → mint key) and send it as a bearer token.
Keys are scoped to one channel unless you mint a station key, which works on every channel you own.

## roll a take

```bash
curl -X POST https://ch21.ai/api/public/channel/receipt-sorter/take \
  -H "authorization: Bearer $CH21_FEED_KEY" \
  -H "content-type: application/json" \
  -d '{"notes":"A pile of digital receipts (images or PDFs)"}'
```

The response carries `output`, `grade`, `links`, `plan`, `lifecycle` and `asks`. When
`asks` is non-empty the channel needs data from you: answer it in the next call's `notes`.
To continue a take instead of starting over, pass `prior` with the previous brief, output and links.

## ag-ui

This channel speaks the **Agent-User Interaction protocol**. Point any AG-UI client at
`POST https://ch21.ai/api/public/channel/receipt-sorter/agui` with an AG-UI `RunAgentInput` and read the run back as a typed
server-sent event stream — `RUN_STARTED`, `STEP_STARTED`/`STEP_FINISHED`,
`TOOL_CALL_START`/`ARGS`/`END`/`RESULT`, `TEXT_MESSAGE_START`/`CONTENT`/`END`,
`STATE_SNAPSHOT`, `CUSTOM` (`ch21.ask`) and `RUN_FINISHED` or `RUN_ERROR`.
`GET` the same URL for the unauthenticated handshake.

```bash
curl -N -X POST https://ch21.ai/api/public/channel/receipt-sorter/agui \
  -H "authorization: Bearer $CH21_FEED_KEY" \
  -H "content-type: application/json" \
  -H "accept: text/event-stream" \
  -d '{"messages":[{"role":"user","content":"A pile of digital receipts (images or PDFs)"}]}'
```
