# Keep chat

`POST /v1/ask/chats`

Keeps a chat for the signed-in person: a new one, or with an id the whole of an earlier one again. The fifty latest are kept.

Needs the scope: `workspace:read`

This method answers a person who is signed in to the dashboard. A request with an API key is refused with 403, so it cannot be tried from this page.

## Body parameters

- `id` (string): The id of the chat to save over. Without it a new chat is made. Up to 64 characters.
- `entries` (object[], required): The whole conversation, oldest first. Up to 80 items.
- `entries[].id` (string, required): An id for the entry, unique in the chat. Up to 64 characters.
- `entries[].role` (string, required): Who said it: `user` or `assistant`. One of: `user`, `assistant`.
- `entries[].text` (string): What was said. Up to 4,000 characters.
- `entries[].steps` (object[]): The methods that were run for this answer. Up to 20 items.
- `entries[].steps[].call` (string, required): The method that was run. Up to 80 characters.
- `entries[].steps[].title` (string, required): The method in a few words. Up to 500 characters.
- `entries[].steps[].ok` (boolean, required): Whether it worked.
- `entries[].change` (object): The change that was proposed with this answer.
- `entries[].change.call` (string, required): The method the assistant proposed. Up to 80 characters.
- `entries[].change.title` (string, required): The method in a few words. Up to 500 characters.
- `entries[].change.description` (string, required): What running it does. Up to 4,000 characters.
- `entries[].change.effect` (string, required): What it does to your data: `write`, `send` or `destroy`. One of: `read`, `write`, `send`, `destroy`.
- `entries[].change.input` (Record<string, unknown>, required): The input it is run with.
- `entries[].change.state` (string, required): Where the proposal stands: `waiting`, `busy`, `done`, `dismissed` or `failed`. One of: `waiting`, `busy`, `done`, `dismissed`, `failed`.
- `entries[].change.fault` (string): Why it failed, when it did. Up to 500 characters.
- `entries[].fault` (string): Why the answer failed, when it did. Up to 500 characters.
- `entries[].off` (boolean): Whether the assistant was not connected when this was asked.

## Returns

- `object` ("chat"): Always `chat`.
- `id` (string): The id of the chat.
- `title` (string): The first question, shortened.
- `updatedAt` (string): When the chat was last saved.
- `createdAt` (string): When the chat was started.

## Example

cURL:

```bash
curl -X POST "$OPENSEND_API_URL/v1/ask/chats" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "entries": [
    {
      "id": "prompt-1",
      "role": "user",
      "text": "Which domains are not verified yet?"
    }
  ]
}'
```

TypeScript:

```ts
await opensend.ask.save({
  entries: [
    {
      id: 'prompt-1',
      role: 'user',
      text: 'Which domains are not verified yet?',
    },
  ],
})
```

CLI:

```bash
opensend ask save \
  --entries '[{"id":"prompt-1","role":"user","text":"Which domains are not verified yet?"}]'
```

Answer:

```json
{
  "object": "chat",
  "id": "chat_02",
  "title": "Which domains are not verified yet?",
  "updatedAt": "2026-11-27T09:30:00.000Z",
  "createdAt": "2026-11-27T09:30:00.000Z"
}
```
