# API: Your agent

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/agent/conversations` | Your conversations with the assistant, newest activity first (web app only) | `agents:read` |
| POST | `/v1/agent/conversations` | Start a conversation with the assistant (web app only) | `agents:read` |
| GET | `/v1/agent/conversations/:id` | One page of a conversation (web app only) | `agents:read` |
| PATCH | `/v1/agent/conversations/:id` | Rename, change the mode or credit limit of, make repeat, archive or bring back a conversation (web app only) | `agents:read` |
| GET | `/v1/agent/conversations/:id/events` | A conversation's events as they happen (server-sent events, resumable) (web app only) | `agents:read` |
| POST | `/v1/agent/conversations/:id/messages` | Send the assistant a message (web app only) | `agents:read` |
| POST | `/v1/agent/conversations/:id/stop` | Stop: nothing new starts; a call already running finishes and is reported (web app only) | `agents:read` |
| POST | `/v1/agent/conversations/search` | Look for your conversations by title (read only; the words stay out of the address) (web app only) | `agents:read` |
| POST | `/v1/agent/requests` | Ask your marketing agent to do something, in your own words | `agents:write` |
| GET | `/v1/agent/requests/:id` | Where a request to your agent stands: its answer, question, or what waits for a person | `agents:read` |
| POST | `/v1/agent/requests/:id/answer` | Answer your agent's question; it carries on | `agents:write` |
| POST | `/v1/agent/requests/:id/stop` | Stop a request; anything of it still waiting is withdrawn | `agents:write` |
| GET | `/v1/agent/skills` | The jobs your agent knows how to do (its skills) | `agents:read` |
| GET | `/v1/agent/skills/:name` | One of your agent's skills, with its instructions | `agents:read` |
| GET | `/v1/agent/standing` | Your standing requests (repeating work you asked your agent for) | `agents:read` |
| POST | `/v1/agent/standing/:id/start` | Start a standing request your agent proposed (web app only) | `agents:write` |
| POST | `/v1/agent/standing/:id/stop` | Pause or stop a standing request | `agents:write` |
| GET | `/v1/agent/thread` | Your conversation with your agent, newest last (30 a page) | `agents:read` |

## Examples

### POST /v1/agent/requests

Ask your marketing agent to do something, in your own words

```bash
curl -s -X POST "https://api.scheeleworks.com/v1/agent/requests" \
  -H "Authorization: Bearer $MA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/requests`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/agent/requests/$ID

Where a request to your agent stands: its answer, question, or what waits for a person

```bash
curl -s "https://api.scheeleworks.com/v1/agent/requests/$ID" \
  -H "Authorization: Bearer $MA_API_KEY"
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/requests/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/agent/requests/$ID/answer

Answer your agent's question; it carries on

```bash
curl -s -X POST "https://api.scheeleworks.com/v1/agent/requests/$ID/answer" \
  -H "Authorization: Bearer $MA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/requests/${id}/answer`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/agent/requests/$ID/stop

Stop a request; anything of it still waiting is withdrawn

```bash
curl -s -X POST "https://api.scheeleworks.com/v1/agent/requests/$ID/stop" \
  -H "Authorization: Bearer $MA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/requests/${id}/stop`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/agent/skills

The jobs your agent knows how to do (its skills)

```bash
curl -s "https://api.scheeleworks.com/v1/agent/skills" \
  -H "Authorization: Bearer $MA_API_KEY"
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/skills`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/agent/skills/$NAME

One of your agent's skills, with its instructions

```bash
curl -s "https://api.scheeleworks.com/v1/agent/skills/$NAME" \
  -H "Authorization: Bearer $MA_API_KEY"
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/skills/${name}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/agent/standing

Your standing requests (repeating work you asked your agent for)

```bash
curl -s "https://api.scheeleworks.com/v1/agent/standing" \
  -H "Authorization: Bearer $MA_API_KEY"
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/standing`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/agent/standing/$ID/stop

Pause or stop a standing request

```bash
curl -s -X POST "https://api.scheeleworks.com/v1/agent/standing/$ID/stop" \
  -H "Authorization: Bearer $MA_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/standing/${id}/stop`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/agent/thread

Your conversation with your agent, newest last (30 a page)

```bash
curl -s "https://api.scheeleworks.com/v1/agent/thread" \
  -H "Authorization: Bearer $MA_API_KEY"
```

```js
const res = await fetch(`https://api.scheeleworks.com/v1/agent/thread`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.MA_API_KEY}` },
});
const data = await res.json();
```

Request and response schemas: [https://www.scheeleworks.com/openapi.json](https://www.scheeleworks.com/openapi.json). All resources: [API reference](https://www.scheeleworks.com/docs/api).
