> ## Documentation Index
> Fetch the complete documentation index at: https://docs.app.strix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat

> Start and continue Strix chat sessions programmatically

export const ScarfPixel = () => <img referrerPolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=831669b6-b4bd-42cb-8832-2122c03e1d5f" alt="" width="1" height="1" style={{
  position: "absolute",
  width: 0,
  height: 0,
  opacity: 0,
  pointerEvents: "none"
}} />;

<ScarfPixel />

Use chat to send messages to a Strix agent and get replies. You can attach repositories and files to give context. Chat is available on the Cloud plan and on Enterprise plans.

## What the chat agent can do in Strix

The agent can run the operations of the Strix API for you: list, read, create, update, and delete scans, findings, schedules, assets, domains, repositories, integrations, knowledge entries, members, webhooks, and pull request reviews. It can also read the agent traces and repositories of your workspace to answer questions about them, and read the Strix documentation to answer questions about the product.

The operations are grouped into tools per API area (for example `strix_scans`, `strix_test_users`). The agent calls an area tool with an `operation` name and an `arguments` object, and asks `strix_api_operation_schema` for the exact argument shape of an operation when it needs it.

The agent acts as the member whose message it is working on. Your role and your asset scopes apply to every operation, so a member with the viewer role cannot make changes. When another member sends a message, the current turn stops and the agent continues as that member. A subagent acts only when a member messages that subagent directly; it then acts as that member. If you use an API token to start a chat or send it a message, the operation scopes of that token also apply: when you message through a token without `vulnerabilities:write`, the agent cannot change findings. The agent cannot manage chats, API tokens, billing, or credentials. Strix records each change the same as a change in the dashboard.

### Approval for dangerous operations

Some operations wait for a member to approve them before they run: deletes, cancel, revoke, disconnect, remove, share, changes to member roles or the organization, and actions that start work or reach outside Strix such as scans, retests, fix pull requests, ticket pushes, and member invites. When the agent calls one of these, the chat shows an **Approve** / **Deny** card. Nothing runs until a member clicks a decision. An approval expires 30 minutes after the agent requests it.

API users read and decide approvals through the API:

```bash theme={null}
curl -X GET "https://app.strix.ai/api/v1/chat/<CHAT_ID>/approvals/<APPROVAL_ID>" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

**Required scope:** `chat:read`

```bash theme={null}
curl -X POST "https://app.strix.ai/api/v1/chat/<CHAT_ID>/approvals/<APPROVAL_ID>" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"decision": "approve"}'
```

**Required scope:** `chat:write`

The body `decision` accepts `approve` or `deny`. On `approve` the operation runs as the token's user inside the token's scopes, and the result arrives in the chat as a new message. A request on an approval that is decided or expired returns HTTP `409`.

## Credits

On the Cloud plan, Chat uses prepaid credits from the same wallet as scans. One credit costs \$1.00. Chat bills 1.2 credits for each dollar of model cost. Strix deducts the credits after each agent tool call, not after each message. Enterprise chats do not consume credits.

Read the spendable Chat balance with `GET /api/v1/billing/credits`. The `chat_balance` field gives whole credits only. A credit that Chat has only partly used counts as one.

### Chat credit usage

A chat uses part of a credit for each agent step. Read the exact usage with `GET /api/v1/chat/usage`.

```bash theme={null}
curl -X GET "https://app.strix.ai/api/v1/chat/usage?chat_id=<CHAT_ID>" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

**Required scope:** `chat:read`

The response gives amounts in microcredits. One credit is 1,000,000 microcredits.

* `available_microcredits`: the credits that Chat can still spend.
* `typical_chat_microcredits`: the median total cost of the recent chats in the workspace, or `null` when the workspace has no charged chat yet.
* `sampled_chats`: the number of chats in that sample.
* `chat_microcredits`: the total that the chat in `chat_id` has used. Zero when you omit `chat_id`.
* `chat_auto_topup_credits`: the whole credits that automatic top-up bought for that chat.
* `chat_auto_topup_cap_lifted`: `true` when an admin lifted the per-chat automatic top-up limit for that chat.

When the workspace has no credits, `POST /api/v1/chat` and `POST /api/v1/chat/<CHAT_ID>/message` return HTTP `402 Payment Required` with code `chat_credit_limit_reached`. The request starts no turn and consumes no credits. The body has the same `hint`, `topup_url`, and `topup_options` fields as the scan paywall response. When automatic top-up is on and did not refill the wallet, the body also has a `reason` field. See [Billing and credits](/guides/billing) for the recovery steps.

When the wallet runs out during an agent turn, Strix pauses the chat and writes a system notice to the thread. Buy credits, then send a message to continue. If automatic top-up is enabled for the workspace, Strix refills the wallet before it pauses the chat.

### Lift the per-chat automatic top-up limit

When the `reason` is `chat_cap_reached`, the automatic top-ups for this chat reached the `chat_cap_credits` limit of the workspace. An admin can lift that limit for this one chat. The chat can then buy credits automatically past the per-chat limit. The monthly cap of the workspace still applies. In the dashboard, the out-of-credits dialog shows the **Lift the limit for this chat** action. Strix sends the held message when the limit is lifted.

```bash theme={null}
curl -X PUT "https://app.strix.ai/api/v1/chat/<CHAT_ID>/auto-topup-limit" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"lifted": true}'
```

**Required scope:** `billing:write`

The response contains `chat_id` and `lifted`. Send `{"lifted": false}` to apply the workspace limit to the chat again. The request requires an admin role on the workspace. A chat that the token cannot reach returns HTTP `404`.

## List chats

```bash theme={null}
curl -X GET "https://app.strix.ai/api/v1/chat?limit=20" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

**Required scope:** `chat:read`

## Start a chat

```bash theme={null}
curl -X POST "https://app.strix.ai/api/v1/chat" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Review the auth flow in my-org/my-repo for IDOR risks",
    "repos": [{"repoId": "<REPO_ID>", "branch": "main"}]
  }'
```

To attach files, send `multipart/form-data` instead of JSON. Use the same fields and add the file parts.

**Required scope:** `chat:write`

## Get a chat

```bash theme={null}
curl -X GET "https://app.strix.ai/api/v1/chat/<CHAT_ID>" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

**Required scope:** `chat:read`

## Send a message

```bash theme={null}
curl -X POST "https://app.strix.ai/api/v1/chat/<CHAT_ID>/message" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"message": "Now check the password reset endpoint"}'
```

To stop an active agent turn before you send the message, set `"cancel_current": true`.

`message` can be omitted for a control-only request when either `cancel_current` or `stop_agent` is `true`. `cancel_current` cancels the in-flight turn; `stop_agent` parks the target agent and its descendants:

```bash theme={null}
curl -X POST "https://app.strix.ai/api/v1/chat/<CHAT_ID>/message" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"stop_agent": true}'
```

**Required scope:** `chat:write`

## Export workspace files

Chat artifacts live under `/workspace` in the running agent sandbox.

List exportable files:

```bash theme={null}
curl "https://app.strix.ai/api/v1/chat/<CHAT_ID>/files" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

The listing is capped at 10,000 entries and 2 MiB before the sandbox response is
parsed and normalized. An oversized listing returns `413`.

Download one file. The API accepts either an absolute path under `/workspace`
or a convenient relative path such as `report.md`; relative paths resolve from
`/workspace`. Traversal and absolute paths outside `/workspace` are rejected.
An individual export is limited to 50 MiB.

```bash theme={null}
curl --get "https://app.strix.ai/api/v1/chat/<CHAT_ID>/files/download" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  --data-urlencode "path=/workspace/report.md" \
  --output report.md
```

Or stream the whole workspace as a ZIP:

```bash theme={null}
curl "https://app.strix.ai/api/v1/chat/<CHAT_ID>/files/archive" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>" \
  --output workspace.zip
```

Archive export preflights the same 2 MiB / 10,000-entry listing limit, a 50 MiB per-file limit, and 512 MiB of uncompressed content, with a 30-second archive deadline. ZIP entries must be safe relative POSIX paths. The service bounds sandbox JSON and base64 responses before parsing or decoding them, streams with response backpressure, and cancels in-flight sandbox work if the client disconnects.

An empty workspace returns `404`, and oversized listings or files return `413`. Invalid listing, export, or file data from the sandbox returns `502`; an unavailable, unready, or timed-out sandbox returns `503`. A file read failure or actual-byte overflow fails the stream instead of returning a valid-looking partial ZIP.

**Required scope:** `chat:read`

The CLI adds safe file handling and refuses to replace an existing output unless `--force` is explicit:

```bash theme={null}
strix cloud chat files <CHAT_ID>
strix cloud chat files download <CHAT_ID> --path report.md --output report.md
strix cloud chat files archive <CHAT_ID> --output workspace.zip
```

## Create a share link

```bash theme={null}
curl -X POST "https://app.strix.ai/api/v1/chat/<CHAT_ID>/share" \
  -H "Authorization: Bearer <YOUR_API_TOKEN>"
```

**Required scope:** `chat:write`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.