# ch 42 · deal ranker — channel API

Visits store category pages and ranks all listed items by value for money.

- **status** live
- **inputs** A store category page link and an optional budget target
- **outputs** A ranked table with exact titles, prices, stock status, links, and value notes

## endpoints

| what | call |
| --- | --- |
| interface (openapi / mcp / markdown) | `GET https://ch21.ai/api/public/channel/deal-ranker/spec` |
| roll a take | `POST https://ch21.ai/api/public/channel/deal-ranker/take` |
| ag-ui event stream | `POST https://ch21.ai/api/public/channel/deal-ranker/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/deal-ranker/take \
  -H "authorization: Bearer $CH21_FEED_KEY" \
  -H "content-type: application/json" \
  -d '{"notes":"A store category page link and an optional budget target"}'
```

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/deal-ranker/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/deal-ranker/agui \
  -H "authorization: Bearer $CH21_FEED_KEY" \
  -H "content-type: application/json" \
  -H "accept: text/event-stream" \
  -d '{"messages":[{"role":"user","content":"A store category page link and an optional budget target"}]}'
```
