Adds organization-scoped Coder Agents instructions. Organization admins
set them in **Admin settings** > **AI** > **Coder Agents** >
**Organization settings**, or with `GET`/`PUT
/api/v2/organizations/{organization}/chats/config/system-prompt`.
Implements [CODAGT-984](https://linear.app/codercom/issue/CODAGT-984).
The instructions add to the deployment system prompt and never replace
it. When a chat is created, chatd stores the organization prompt as its
own system row right after the deployment row, only for chats in that
organization. Subagents resolve their parent organization's current
prompt when they spawn, and existing chats keep their stored rows.
Access reuses the organization `chat_model_config` permission: owners
and organization admins edit, auditors read, members get 404 on read and
403 on write. Writes reuse the deployment prompt's sanitization, size
limit (128 KiB by default), and audit behavior, with a new
`chat_organization_system_prompt` audit resource type. Migration
`000613` (the next number after `000612` on `main`) adds the
`chat_organization_system_prompts` table.
## Testing
- Go: enterprise authorization (including an update-only custom role),
validation, and audit tests; chatd row order and subagent tests.
- Frontend: Vitest interaction tests and stories for the card (loading,
load error, refetch error over the cached value, save error, read-only).
- Remote dogfood UAT, [evidence
chat](https://dogfood.cdr.dev/agents/b595a709-0709-44e6-9535-96a922974d61):
round 1 **PASS** on `b027cb5ca67` (permission matrix, validation, UI,
row order, cross-organization isolation, audit, subagents, regression).
Round 2 **PASS** on `618bff67c75` (loading and load-error states,
refetch error over the cached value with unsaved edits kept, update-only
custom role saves over the API, row order, the documented size limit,
rapid organization switching, double-click save).
- CI: rebased onto `main` (`98332c739b0`) as `3850fbaa922`; other commit
SHAs in this description are from before the rebase. Every check passed
on `3850fbaa922`, with `test-go-pg` green on the first attempt. After
the review fixes in item 7, `main` was merged in as `006c4951749` to
resolve new conflicts in generated files and renumber the migration to
`000613`. Every check passes on `006c4951749`. Before the rebase, every
check passed on `b4e76543df2`. `test-go-pg (ubuntu-latest)` passed on
its fourth attempt; the first three failed only the `cli` package
goroutine leak check, with every test passing. Two of those leaked a
coderd instance, which also happens intermittently on `main`:
`TestServer/Logging` cancels `coder server` during startup, and an early
return in `cli/server.go` skips closing coderd. That fix is in #30280.
The first attempt leaked an idle HTTP connection instead (not
investigated).
## Screenshots
From remote UAT on a test deployment (test data only).
| Organization admin saves instructions (`b027cb5ca67`) | Auditor sees
read-only instructions, no save actions (`b027cb5ca67`) |
|---|---|
| 
| 
|
| **Loading state while the first fetch is pending (`618bff67c75`)** |
**Refetch error shown above the field; the unsaved edit is kept and Save
stays enabled (`618bff67c75`)** |
| 
| 
|
## Review record
1. Codex,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387245297)
on `c42b5f9e05c`: 6 findings. Fixed the missing loading state, refetch
failures hiding cached instructions, and two docs style issues
(`58eab5603a4`, `cc73b714630`). Two were first declined in error, then
corrected: the read-only test now checks that typing leaves the value
unchanged (`cc73b714630`), and update-only custom roles no longer get a
500 on save (`618bff67c75`).
2. Independent security review by a clean-context agent,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5943505041)
on `c42b5f9e05c`: no P0 to P2 findings. A stale P3 comment was fixed in
`34c17aadb7f`; returning `err.Error()` in 500 details was kept to match
the deployment prompt handlers.
3. Codex,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387323380)
on `58eab5603a4`: 2 findings (refetch errors not surfaced, docs line
breaks), both fixed in `cc73b714630`.
4. Codex, blockers only,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5387462070)
on `618bff67c75`: 1 P2 (a failed refresh right after a successful save
shows the previous value). Not a blocker, deferred.
5. Final fresh advisory by a clean-context agent,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5944285083)
on `618bff67c75`: **READY**, no blockers and nothing to cut. It
independently checked authorization, audit, the migration, chatd row
insertion and subagent inheritance, the tests, and soft-deleted
organization handling, and agreed with every deferral. No code changes
followed: the snapshot behavior it suggested documenting is already
documented, and its docs wording note joins the deferred docs item.
6. Codex,
[comment](https://github.com/coder/coder/pull/30272#issuecomment-5952100918)
on `b4e76543df2` (the docs-only follow-up below): no major issues. Mike
asked for a passing Codex review loop after item 5, so this review goes
past the planned stop at the final advisory. No code changes followed.
7. ethanndickson,
[review](https://github.com/coder/coder/pull/30272#pullrequestreview-5409332502)
on `3850fbaa922`: approved with 4 comments. Fixed 3: the audit target is
now empty (`91e77d3fa8c`), the docs no longer re-explain audit logs
(`a0fb6891af5`), and the organization instructions stories went from 9
to 5 (`e836097f93f`). Not fixed: the organization prompt read fails open
on a database error, like the deployment prompt, and ethanndickson is
changing both after merge
([thread](https://github.com/coder/coder/pull/30272#discussion_r4180191267)).
UAT did not rerun for these changes.
Not counted as reviews: the pre-PR frontend self-review, simplify pass,
and test audit (`de8377e94e1`), and a second test audit of
`de8377e94e1..cc73b714630` (pass with nits; the update-only test case
was added after it).
Docs-only follow-up after the advisory, requested by Mike: `b4e76543df2`
adds audit log guidance for prompt changes to the platform controls page
and an update-only custom role note to the organizations page. Codex
reviewed it (item 6). No UAT covers it, and the code is unchanged since
`618bff67c75`. The deferred claim that the Instructions page path is
outdated was wrong, so it's dropped. Item 7 removed the audit log
guidance again; the custom role note stays.
## Soft-deleted organizations
UAT found that a soft-deleted organization's prompt stays readable and
writable by UUID. This is inherited behavior, not new exposure:
`ExtractOrganizationParam` resolves UUIDs without a deleted filter, so
the sibling organization chat routes (MCP servers, model overrides,
models) behave the same. The same `chat_model_config` RBAC still
applies, nobody gains access to another organization, and writes are
audited.
## Deferred (owner: Mike)
- A failed refresh right after a successful save shows the previous
value with an error alert, so a further edit from that view starts from
the old text (Codex round 4, UAT round 2). Trigger: reports of stale
values after saving on unreliable networks.
- Update-only custom roles can save over the API, but the card stays
hidden without read access. Trigger: a customer uses such a role.
- Soft-deleted organization access by UUID, above. Trigger: the platform
starts rejecting deleted organizations in `ExtractOrganizationParam` or
purging their configuration.
- A contrived "code word" instruction was refused as possible prompt
injection; neutral instructions work. Trigger: reports of ignored
organization instructions.
- UX polish: there is no retry action after a failed first load, the
save toast can cover Cancel, there is no unsaved-changes guard, the
oversize error omits the limit, and whitespace-only text clears the
prompt without notice. Trigger: the next settings UX pass.
- Docs: the 413 response and organization name paths are undocumented.
Trigger: the next Coder Agents docs pass.
- Test audit nits: a redundant `waitFor` and an optional read-only plus
refetch story. Trigger: the next change to these tests.
> Xum, an AI coding agent, implemented, tested, and opened this PR on
behalf of @ibetitsmike.
5495 lines
280 KiB
Markdown
Generated
5495 lines
280 KiB
Markdown
Generated
---
|
|
# Code generated by make gen. DO NOT EDIT.
|
|
title: Chats
|
|
description: "REST endpoints for Coder Agents Chats API (programmatic agent sessions)."
|
|
---
|
|
|
|
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
|
|
|
Programmatic API for Coder Agents (the user-facing "Coder Agents" / "Chats" product). Use these endpoints to create, list, and manage AI coding agent sessions.
|
|
|
|
## Connect to chat workspace desktop via WebSockets
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/experimental/chats/{chat}/stream/desktop \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/experimental/chats/{chat}/stream/desktop`
|
|
|
|
Raw binary WebSocket stream of the chat workspace desktop.
|
|
Experimental: this endpoint is subject to change.
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|--------------------------------------------------------------------------|---------------------|--------|
|
|
| 101 | [Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) | Switching Protocols | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List chats
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------|-------|---------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| `q` | query | string | false | Search query. Supports `title:<substring>` (case-insensitive, quote multi-word values), `archived:bool` (`archived:any` matches archived and active chats), `has_unread:bool`, `status:<waiting\|running\|error\|requires_action\|interrupting>` (chat status, repeated or comma-separated), `pr_status:<draft\|open\|merged\|closed\|none>` (none matches chats with no pull request) as repeated or comma-separated values, `source:<created_by_me\|shared_with_me>`, `diff_url:<url>` (quote values containing colons), `pr:<number>` (exact PR number match), `repo:<owner/repo>` (case-insensitive substring match against git remote origin or URL), `pr_title:<text>` (case-insensitive PR title substring), `search:<text>` (full-text search across chat titles, PR titles, PR numbers, and message bodies; message bodies match English word stems, e.g. `refactor` matches `refactoring`, and ignore English stopwords; titles and PR titles match whole words case-insensitively without stemming; quote multi-word values; cannot be combined with title, pr_title, or pr; a value that tokenizes to no searchable words, e.g. punctuation only, returns an empty list). Bare terms are not supported; use `title:<value>` or `search:<value>`. |
|
|
| `label` | query | array[string] | false | Filter by label as key:value. Repeat for multiple (AND logic). |
|
|
| `after_id` | query | string(uuid) | false | After ID |
|
|
| `limit` | query | integer | false | Page limit |
|
|
| `offset` | query | integer | false | Page offset |
|
|
| `automation_id` | query | string(uuid) | false | Filter to chats the automation created or sent messages to. Ignored unless the chat-automations experiment is enabled for the caller. |
|
|
| `project_id` | query | string(uuid) | false | Only chats in this project. Requires the chat-projects experiment. |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
[
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
]
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|---------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.Chat](schemas.md#codersdkchat) |
|
|
|
|
<h3 id="list-chats-responseschema">Response Schema</h3>
|
|
|
|
Status Code **200**
|
|
|
|
| Name | Type | Required | Restrictions | Description |
|
|
|--------------------------------|------------------------------------------------------------------------------------|----------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| `[array item]` | array | false | | |
|
|
| `» agent_id` | string(uuid) | false | | |
|
|
| `» archived` | boolean | false | | |
|
|
| `» build_id` | string(uuid) | false | | |
|
|
| `» children` | [codersdk.Chat](schemas.md#codersdkchat) | false | | Children holds child (subagent) chats nested under this root chat. Always initialized to an empty slice so the JSON field is present as []. Child chats cannot create their own subagents, so nesting depth is capped at 1 and this slice is always empty for child chats. |
|
|
| `» client_type` | [codersdk.ChatClientType](schemas.md#codersdkchatclienttype) | false | | |
|
|
| `» context` | [codersdk.ChatContext](schemas.md#codersdkchatcontext) | false | | Context reports the chat's pinned workspace-context state and whether it has drifted from the agent's latest pushed snapshot. Nil when the chat has no pinned context yet. |
|
|
| `»» dirty` | boolean | false | | Dirty is true when the agent's latest snapshot hash differs from the chat's pinned hash. |
|
|
| `»» dirty_since` | string(date-time) | false | | Dirty since is when drift was first detected; nil when not dirty. |
|
|
| `»» error` | string | false | | Error is the snapshot-level error copied from the pinned snapshot (empty when healthy). |
|
|
| `»» resources` | array | false | | Resources is the chat's pinned context (instruction files and skills) the prompt is built from, metadata only (no bodies). It is populated only on the single-chat GET response; list and watch payloads leave it nil to stay lightweight. |
|
|
| `»»» error` | string | false | | Error explains a non-ok Status; empty when healthy. May also carry a non-fatal warning when Status is ok. |
|
|
| `»»» kind` | [codersdk.ChatContextResourceKind](schemas.md#codersdkchatcontextresourcekind) | false | | |
|
|
| `»»» size_bytes` | integer | false | | Size bytes is the original payload size in bytes. |
|
|
| `»»» skill_description` | string | false | | |
|
|
| `»»» skill_name` | string | false | | Skill name and SkillDescription are populated only for skill kinds. |
|
|
| `»»» source` | string | false | | Source is the resource locator: the canonical file path for an instruction file, the skill directory for a skill, the file path for an MCP config, or the server name for an MCP server. |
|
|
| `»»» status` | [codersdk.ChatContextResourceStatus](schemas.md#codersdkchatcontextresourcestatus) | false | | Status is the resource's health. Non-ok resources (invalid, unreadable, oversize, excluded) are still reported so the UI can surface why a resource was dropped from the prompt instead of silently omitting it; their body-specific fields (skill name, tools) are empty. |
|
|
| `»»» tools` | array | false | | Tools lists the tools exposed by an MCP server. Populated only for the mcp_server kind; nil otherwise. |
|
|
| `»»»» description` | string | false | | Description is the tool's human-readable summary; may be empty. |
|
|
| `»»»» name` | string | false | | Name is the tool name with the `<server>__` prefix the agent adds stripped, so it reads as the server exposes it. |
|
|
| `» created_at` | string(date-time) | false | | |
|
|
| `» diff_status` | [codersdk.ChatDiffStatus](schemas.md#codersdkchatdiffstatus) | false | | Diff status is the primary pull request. It is the ref with the most recent git report. |
|
|
| `»» additions` | integer | false | | |
|
|
| `»» approved` | boolean | false | | |
|
|
| `»» author_avatar_url` | string | false | | |
|
|
| `»» author_login` | string | false | | |
|
|
| `»» base_branch` | string | false | | |
|
|
| `»» changed_files` | integer | false | | |
|
|
| `»» changes_requested` | boolean | false | | |
|
|
| `»» chat_id` | string(uuid) | false | | |
|
|
| `»» commits` | integer | false | | |
|
|
| `»» deletions` | integer | false | | |
|
|
| `»» git_branch` | string | false | | |
|
|
| `»» head_branch` | string | false | | |
|
|
| `»» pr_number` | integer | false | | |
|
|
| `»» pull_request_draft` | boolean | false | | |
|
|
| `»» pull_request_state` | string | false | | |
|
|
| `»» pull_request_title` | string | false | | |
|
|
| `»» refreshed_at` | string(date-time) | false | | |
|
|
| `»» remote_origin` | string | false | | |
|
|
| `»» reviewer_count` | integer | false | | |
|
|
| `»» stale_at` | string(date-time) | false | | |
|
|
| `»» url` | string | false | | |
|
|
| `» diff_statuses` | array | false | | Diff statuses lists every ref the chat tracks. The order is stable and follows the first report of each ref. DiffStatus marks the primary. |
|
|
| `»» additions` | integer | false | | |
|
|
| `»» approved` | boolean | false | | |
|
|
| `»» author_avatar_url` | string | false | | |
|
|
| `»» author_login` | string | false | | |
|
|
| `»» base_branch` | string | false | | |
|
|
| `»» changed_files` | integer | false | | |
|
|
| `»» changes_requested` | boolean | false | | |
|
|
| `»» chat_id` | string(uuid) | false | | |
|
|
| `»» commits` | integer | false | | |
|
|
| `»» deletions` | integer | false | | |
|
|
| `»» git_branch` | string | false | | |
|
|
| `»» head_branch` | string | false | | |
|
|
| `»» pr_number` | integer | false | | |
|
|
| `»» pull_request_draft` | boolean | false | | |
|
|
| `»» pull_request_state` | string | false | | |
|
|
| `»» pull_request_title` | string | false | | |
|
|
| `»» refreshed_at` | string(date-time) | false | | |
|
|
| `»» remote_origin` | string | false | | |
|
|
| `»» reviewer_count` | integer | false | | |
|
|
| `»» stale_at` | string(date-time) | false | | |
|
|
| `»» url` | string | false | | |
|
|
| `» files` | array | false | | |
|
|
| `»» created_at` | string(date-time) | false | | |
|
|
| `»» id` | string(uuid) | false | | |
|
|
| `»» mime_type` | string | false | | |
|
|
| `»» name` | string | false | | |
|
|
| `»» organization_id` | string(uuid) | false | | |
|
|
| `»» owner_id` | string(uuid) | false | | |
|
|
| `»» size_bytes` | integer | false | | |
|
|
| `» has_unread` | boolean | false | | Has unread is true when assistant messages exist beyond the owner's read cursor, which updates on stream connect and disconnect and via UpdateChatRequest.Read. |
|
|
| `» id` | string(uuid) | false | | |
|
|
| `» inline_mcp_servers` | array | false | | Inline mcp servers lists the inline MCP servers declared on the chat, without headers. Only the single-chat GET sets it. Experimental. |
|
|
| `»» allow_in_subagents` | boolean | false | | |
|
|
| `»» created_at` | string(date-time) | false | | |
|
|
| `»» forward_coder_headers` | boolean | false | | |
|
|
| `»» has_custom_headers` | boolean | false | | |
|
|
| `»» id` | string(uuid) | false | | |
|
|
| `»» slug` | string | false | | |
|
|
| `»» tool_allow_list` | array | false | | |
|
|
| `»» tool_deny_list` | array | false | | |
|
|
| `»» updated_at` | string(date-time) | false | | |
|
|
| `»» url` | string | false | | URL is empty unless the chat owner makes the request. |
|
|
| `» labels` | object | false | | |
|
|
| `»» [any property]` | string | false | | |
|
|
| `» last_error` | [codersdk.ChatError](schemas.md#codersdkchaterror) | false | | |
|
|
| `»» detail` | string | false | | Detail is optional provider-specific context shown alongside the normalized error message when available. |
|
|
| `»» kind` | [codersdk.ChatErrorKind](schemas.md#codersdkchaterrorkind) | false | | Kind classifies the error for consistent client rendering. |
|
|
| `»» message` | string | false | | Message is the normalized, user-facing error message. |
|
|
| `»» provider` | string | false | | Provider identifies the upstream model provider when known. |
|
|
| `»» retryable` | boolean | false | | Retryable reports whether the underlying error is transient. |
|
|
| `»» status_code` | integer | false | | Status code is the best-effort upstream HTTP status code. |
|
|
| `» last_model_config_id` | string(uuid) | false | | |
|
|
| `» last_reasoning_effort` | string | false | | |
|
|
| `» last_turn_summary` | string | false | | |
|
|
| `» manage_automations_enabled` | boolean | false | | Manage automations enabled offers the manage_automations tool to this chat's agent. Experimental. |
|
|
| `» mcp_server_ids` | array | false | | |
|
|
| `» organization_id` | string(uuid) | false | | |
|
|
| `» owner_id` | string(uuid) | false | | |
|
|
| `» owner_name` | string | false | | |
|
|
| `» owner_username` | string | false | | |
|
|
| `» parent_chat_id` | string(uuid) | false | | |
|
|
| `» pin_order` | integer | false | | |
|
|
| `» plan_mode` | [codersdk.ChatPlanMode](schemas.md#codersdkchatplanmode) | false | | |
|
|
| `» project_id` | string(uuid) | false | | |
|
|
| `» queued_for_capacity` | boolean | false | | Queued for capacity reports that the chat is waiting for a concurrent agent slot. Single-chat reads derive it; list responses leave it false. |
|
|
| `» root_chat_id` | string(uuid) | false | | |
|
|
| `» shared` | boolean | false | | Shared is true when this chat's root chat has explicit user or group ACL entries. |
|
|
| `» status` | [codersdk.ChatStatus](schemas.md#codersdkchatstatus) | false | | |
|
|
| `» summary` | string | false | | Summary is the persisted whole-chat summary, generated in the background. It is nil until the first summary has been produced. |
|
|
| `» title` | string | false | | |
|
|
| `» title_source` | [codersdk.ChatTitleSource](schemas.md#codersdkchattitlesource) | false | | Title source is where Title came from. A title write applies only when the current source ranks the same as or lower than the incoming one, in the order fallback, generated, user. |
|
|
| `» title_updated_at` | string(date-time) | false | | Title updated at orders title changes. Title writes do not change UpdatedAt. |
|
|
| `» updated_at` | string(date-time) | false | | |
|
|
| `» warnings` | array | false | | |
|
|
| `» workspace_id` | string(uuid) | false | | |
|
|
|
|
#### Enumerated Values
|
|
|
|
| Property | Value(s) |
|
|
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| `client_type` | `api`, `ui` |
|
|
| `kind` | `auth`, `config`, `content_filter`, `generic`, `hook_denied`, `hook_dispatch_failed`, `instruction_file`, `mcp_config`, `mcp_server`, `missing_key`, `overloaded`, `provider_disabled`, `rate_limit`, `skill`, `stream_silence_timeout`, `timeout`, `usage_limit` |
|
|
| `status` | `error`, `excluded`, `interrupting`, `invalid`, `ok`, `oversize`, `requires_action`, `running`, `unreadable`, `waiting` |
|
|
| `plan_mode` | `plan` |
|
|
| `title_source` | `fallback`, `generated`, `user` |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Create chat
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"client_type": "ui",
|
|
"content": [
|
|
{
|
|
"content": "string",
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"type": "text",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"forward_coder_headers": true,
|
|
"headers": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"reasoning_effort": "string",
|
|
"system_prompt": "string",
|
|
"title": "string",
|
|
"unsafe_dynamic_tools": [
|
|
{
|
|
"description": "string",
|
|
"input_schema": [
|
|
0
|
|
],
|
|
"name": "string"
|
|
}
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------|----------|---------------------|
|
|
| `body` | body | [codersdk.CreateChatRequest](schemas.md#codersdkcreatechatrequest) | true | Create chat request |
|
|
|
|
### Example responses
|
|
|
|
> 201 Response
|
|
|
|
```json
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-------------------------------------------------------------------------|------------------------------|--------------------------------------------------|
|
|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.Chat](schemas.md#codersdkchat) |
|
|
| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 413 | [Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) | Request body exceeds 256 KiB | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List chats by workspace
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/by-workspace \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/by-workspace`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------|-------|--------|----------|-------------------------------|
|
|
| `workspace_ids` | query | string | false | Comma-separated workspace IDs |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"property1": "string",
|
|
"property2": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [coderd.chatsByWorkspaceResponse](schemas.md#coderdchatsbyworkspaceresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat auto archive days
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/auto-archive-days \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/auto-archive-days`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"auto_archive_days": 0
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatAutoArchiveDaysResponse](schemas.md#codersdkchatautoarchivedaysresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat auto archive days
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/auto-archive-days \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/auto-archive-days`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"auto_archive_days": 0
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatAutoArchiveDaysRequest](schemas.md#codersdkupdatechatautoarchivedaysrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat debug logging setting
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/debug-logging \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/debug-logging`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"allow_users": true,
|
|
"forced_by_deployment": true
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatDebugLoggingAdminSettings](schemas.md#codersdkchatdebugloggingadminsettings) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat debug logging setting
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/debug-logging \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/debug-logging`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"allow_users": true
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|----------------------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatDebugLoggingAllowUsersRequest](schemas.md#codersdkupdatechatdebugloggingallowusersrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat debug retention days
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/debug-retention-days \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/debug-retention-days`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"debug_retention_days": 0
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatDebugRetentionDaysResponse](schemas.md#codersdkchatdebugretentiondaysresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat debug retention days
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/debug-retention-days \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/debug-retention-days`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"debug_retention_days": 0
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatDebugRetentionDaysRequest](schemas.md#codersdkupdatechatdebugretentiondaysrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat personal model override settings
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/personal-model-overrides \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/personal-model-overrides`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"allow_users": true
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatPersonalModelOverridesAdminSettings](schemas.md#codersdkchatpersonalmodeloverridesadminsettings) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat personal model override settings
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/personal-model-overrides \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/personal-model-overrides`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"allow_users": true
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|------------------------------------------------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatPersonalModelOverridesAdminSettingsRequest](schemas.md#codersdkupdatechatpersonalmodeloverridesadminsettingsrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat plan mode instructions
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/plan-mode-instructions \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/plan-mode-instructions`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"plan_mode_instructions": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatPlanModeInstructionsResponse](schemas.md#codersdkchatplanmodeinstructionsresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat plan mode instructions
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/plan-mode-instructions \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/plan-mode-instructions`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"plan_mode_instructions": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|------------------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatPlanModeInstructionsRequest](schemas.md#codersdkupdatechatplanmodeinstructionsrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat system prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/system-prompt \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/system-prompt`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"default_system_prompt": "string",
|
|
"include_default_system_prompt": true,
|
|
"system_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatSystemPromptResponse](schemas.md#codersdkchatsystempromptresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat system prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/system-prompt \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/system-prompt`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"include_default_system_prompt": true,
|
|
"system_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatSystemPromptRequest](schemas.md#codersdkupdatechatsystempromptrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get user chat debug logging setting
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/user-debug-logging \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/user-debug-logging`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"debug_logging_enabled": true,
|
|
"forced_by_deployment": true,
|
|
"user_toggle_allowed": true
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UserChatDebugLoggingSettings](schemas.md#codersdkuserchatdebugloggingsettings) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update user chat debug logging setting
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/user-debug-logging \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/user-debug-logging`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"debug_logging_enabled": true
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|----------------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateUserChatDebugLoggingRequest](schemas.md#codersdkupdateuserchatdebugloggingrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get user chat custom prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/user-prompt \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/user-prompt`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"custom_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UserChatCustomPrompt](schemas.md#codersdkuserchatcustomprompt) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update user chat custom prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/user-prompt \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/user-prompt`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"custom_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UserChatCustomPrompt](schemas.md#codersdkuserchatcustomprompt) | true | Request body |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"custom_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UserChatCustomPrompt](schemas.md#codersdkuserchatcustomprompt) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat workspace time to live
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/config/workspace-ttl \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/config/workspace-ttl`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"workspace_ttl_ms": 0
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatWorkspaceTTLResponse](schemas.md#codersdkchatworkspacettlresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat workspace time to live
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/config/workspace-ttl \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/config/workspace-ttl`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"workspace_ttl_ms": 0
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------------------------------|----------|--------------|
|
|
| `body` | body | [codersdk.UpdateChatWorkspaceTTLRequest](schemas.md#codersdkupdatechatworkspacettlrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Upload chat file
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/files?organization=497f6eca-6276-4993-bfeb-53cbbbba6f08 \
|
|
-H 'Content-Type: image/png' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Content-Disposition: attachment; filename="image.png"' \
|
|
-H 'Coder-Session-Token: API_KEY' \
|
|
--data-binary '@image.png'
|
|
```
|
|
|
|
`POST /api/v2/chats/files`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------------|--------|--------------|----------|-----------------------------------------------|
|
|
| `organization` | query | string(uuid) | true | Organization ID |
|
|
| `Content-Disposition` | header | string | true | Attachment disposition carrying the file name |
|
|
| `body` | body | string | true | Raw file binary data |
|
|
|
|
### Example responses
|
|
|
|
> 201 Response
|
|
|
|
```json
|
|
{
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-------------------------------------------------------------------------|-----------------------------|------------------------------------------------------------------------------|
|
|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.UploadChatFileResponse](schemas.md#codersdkuploadchatfileresponse) |
|
|
| 413 | [Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) | Request body exceeds 10 MiB | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat file
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/files/{file} \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/files/{file}`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `file` | path | string(uuid) | true | File ID |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Watch chat events for a user via WebSockets
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/watch \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/watch`
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"changed_diff_status": {
|
|
"ref": {
|
|
"git_branch": "string",
|
|
"remote_origin": "string"
|
|
},
|
|
"status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
},
|
|
"chat": {
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
},
|
|
"kind": "status_change",
|
|
"tool_calls": [
|
|
{
|
|
"args": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatWatchEvent](schemas.md#codersdkchatwatchevent) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat by ID
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat} \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Chat](schemas.md#codersdkchat) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update chat
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PATCH http://coder-server:8080/api/v2/chats/{chat} \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: */*' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PATCH /api/v2/chats/{chat}`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"archived": true,
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"manage_automations_enabled": true,
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"read": true,
|
|
"title": "string",
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------------------------------------------------------------|----------|---------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `body` | body | [codersdk.UpdateChatRequest](schemas.md#codersdkupdatechatrequest) | true | Update chat request |
|
|
|
|
### Example responses
|
|
|
|
> 400 Response
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|------------------------------------------------------------------|-------------|--------------------------------------------------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Refresh chat context
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/chats/{chat}/context \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/chats/{chat}/context`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Chat](schemas.md#codersdkchat) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat cost
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/cost \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/cost`
|
|
|
|
Cost covers the whole chat tree: the root chat plus every
|
|
subagent chat beneath it. Requesting cost for a subagent chat
|
|
returns that same total.
|
|
|
|
Cost is derived from AI Gateway data, which is subject to its
|
|
own retention period, 60 days by default, configured
|
|
independently of chat retention. Spend for requests older than
|
|
that period is no longer reported, so a chat whose requests
|
|
have all been purged reports zero cost.
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"request_count": 0,
|
|
"total_cost_micros": 0,
|
|
"unpriced_request_count": 0
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatCost](schemas.md#codersdkchatcost) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get chat diff contents
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/diff \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/diff`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|----------|-------|--------------|----------|-----------------------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `origin` | query | string | false | Remote origin selecting the ref to diff |
|
|
| `branch` | query | string | false | Git branch selecting the ref to diff |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"branch": "string",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"diff": "string",
|
|
"provider": "string",
|
|
"pull_request_url": "string",
|
|
"remote_origin": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatDiffContents](schemas.md#codersdkchatdiffcontents) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Interrupt chat
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/interrupt \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/interrupt`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Chat](schemas.md#codersdkchat) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List chat messages
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/messages \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/messages`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-------------|-------|--------------|----------|--------------------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `before_id` | query | integer | false | Return messages with id < before_id |
|
|
| `after_id` | query | integer | false | Return messages with id > after_id |
|
|
| `limit` | query | integer | false | Page size, 1 to 200. Defaults to 50. |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"has_more": true,
|
|
"messages": [
|
|
{
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
}
|
|
],
|
|
"queued_messages": [
|
|
{
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatMessagesResponse](schemas.md#codersdkchatmessagesresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Send chat message
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/messages \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/messages`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"busy_behavior": "queue",
|
|
"content": [
|
|
{
|
|
"content": "string",
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"type": "text",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"forward_coder_headers": true,
|
|
"headers": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"url": "string"
|
|
}
|
|
],
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"plan_mode": "plan",
|
|
"reasoning_effort": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|----------------------------------------------------------------------------------|----------|-----------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `body` | body | [codersdk.CreateChatMessageRequest](schemas.md#codersdkcreatechatmessagerequest) | true | Create chat message request |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"message": {
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
},
|
|
"messages": [
|
|
{
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
}
|
|
],
|
|
"queued": true,
|
|
"queued_message": {
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
|
|
},
|
|
"warnings": [
|
|
"string"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.CreateChatMessageResponse](schemas.md#codersdkcreatechatmessageresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Edit chat message
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PATCH http://coder-server:8080/api/v2/chats/{chat}/messages/{message} \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PATCH /api/v2/chats/{chat}/messages/{message}`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"content": [
|
|
{
|
|
"content": "string",
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"type": "text",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"reasoning_effort": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------|------|------------------------------------------------------------------------------|----------|---------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `message` | path | integer | true | Message ID |
|
|
| `body` | body | [codersdk.EditChatMessageRequest](schemas.md#codersdkeditchatmessagerequest) | true | Edit chat message request |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"deleted_message_ids": [
|
|
0
|
|
],
|
|
"message": {
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
},
|
|
"messages": [
|
|
{
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
}
|
|
],
|
|
"warnings": [
|
|
"string"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.EditChatMessageResponse](schemas.md#codersdkeditchatmessageresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List chat user prompts
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/prompts \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/prompts`
|
|
|
|
Returns the user-authored prompts in a chat, newest first,
|
|
with each prompt's text parts concatenated in the order they
|
|
were authored. Used by the composer to power the up/down
|
|
arrow prompt-history cycle without paging through every
|
|
message in the chat.
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|---------|-------|--------------|----------|-----------------------------------------------------------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `limit` | query | integer | false | Page size, 0 to 2000. 0 (the default) means the server-side default of 500. |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"prompts": [
|
|
{
|
|
"id": 0,
|
|
"text": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ChatPromptsResponse](schemas.md#codersdkchatpromptsresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Delete chat queued message
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X DELETE http://coder-server:8080/api/v2/chats/{chat}/queue/{queuedMessage} \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`DELETE /api/v2/chats/{chat}/queue/{queuedMessage}`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------|------|--------------|----------|-------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `queuedMessage` | path | integer | true | Queued message ID |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Promote chat queued message
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/queue/{queuedMessage}/promote \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/queue/{queuedMessage}/promote`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------|------|--------------|----------|-------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `queuedMessage` | path | integer | true | Queued message ID |
|
|
|
|
### Example responses
|
|
|
|
> 202 Response
|
|
|
|
```json
|
|
{
|
|
"detail": "string",
|
|
"message": "string",
|
|
"validations": [
|
|
{
|
|
"detail": "string",
|
|
"field": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------------|-------------|--------------------------------------------------|
|
|
| 202 | [Accepted](https://tools.ietf.org/html/rfc7231#section-6.3.3) | Accepted | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Reconcile invalid chat state
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/reconcile-invalid \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/reconcile-invalid`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [
|
|
{
|
|
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
|
|
"archived": true,
|
|
"build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",
|
|
"children": [],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
],
|
|
"client_type": "ui",
|
|
"context": {
|
|
"dirty": true,
|
|
"dirty_since": "2019-08-24T14:15:22Z",
|
|
"error": "string",
|
|
"resources": [
|
|
{
|
|
"error": "string",
|
|
"kind": "instruction_file",
|
|
"size_bytes": 0,
|
|
"skill_description": "string",
|
|
"skill_name": "string",
|
|
"source": "string",
|
|
"status": "ok",
|
|
"tools": [
|
|
{
|
|
"description": "string",
|
|
"name": "string"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"diff_status": {
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
},
|
|
"diff_statuses": [
|
|
{
|
|
"additions": 0,
|
|
"approved": true,
|
|
"author_avatar_url": "string",
|
|
"author_login": "string",
|
|
"base_branch": "string",
|
|
"changed_files": 0,
|
|
"changes_requested": true,
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"commits": 0,
|
|
"deletions": 0,
|
|
"git_branch": "string",
|
|
"head_branch": "string",
|
|
"pr_number": 0,
|
|
"pull_request_draft": true,
|
|
"pull_request_state": "string",
|
|
"pull_request_title": "string",
|
|
"refreshed_at": "2019-08-24T14:15:22Z",
|
|
"remote_origin": "string",
|
|
"reviewer_count": 0,
|
|
"stale_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"files": [
|
|
{
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"mime_type": "string",
|
|
"name": "string",
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"size_bytes": 0
|
|
}
|
|
],
|
|
"has_unread": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"inline_mcp_servers": [
|
|
{
|
|
"allow_in_subagents": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"forward_coder_headers": true,
|
|
"has_custom_headers": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"slug": "string",
|
|
"tool_allow_list": [
|
|
"string"
|
|
],
|
|
"tool_deny_list": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"url": "string"
|
|
}
|
|
],
|
|
"labels": {
|
|
"property1": "string",
|
|
"property2": "string"
|
|
},
|
|
"last_error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",
|
|
"last_reasoning_effort": "string",
|
|
"last_turn_summary": "string",
|
|
"manage_automations_enabled": true,
|
|
"mcp_server_ids": [
|
|
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
|
|
],
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",
|
|
"owner_name": "string",
|
|
"owner_username": "string",
|
|
"parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",
|
|
"pin_order": 0,
|
|
"plan_mode": "plan",
|
|
"project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",
|
|
"queued_for_capacity": true,
|
|
"root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",
|
|
"shared": true,
|
|
"status": "waiting",
|
|
"summary": "string",
|
|
"title": "string",
|
|
"title_source": "fallback",
|
|
"title_updated_at": "2019-08-24T14:15:22Z",
|
|
"updated_at": "2019-08-24T14:15:22Z",
|
|
"warnings": [
|
|
"string"
|
|
],
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.Chat](schemas.md#codersdkchat) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Stream chat events via WebSockets
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/stream \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/stream`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|------------|-------|--------------|----------|---------------------------------------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `after_id` | query | integer | false | Skip snapshot messages with id at or before this cursor |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
[
|
|
{
|
|
"action_required": {
|
|
"tool_calls": [
|
|
{
|
|
"args": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string"
|
|
}
|
|
]
|
|
},
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"error": {
|
|
"detail": "string",
|
|
"kind": "generic",
|
|
"message": "string",
|
|
"provider": "string",
|
|
"retryable": true,
|
|
"status_code": 0
|
|
},
|
|
"message": {
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",
|
|
"queued_message_id": 0,
|
|
"role": "system",
|
|
"usage": {
|
|
"cache_creation_tokens": 0,
|
|
"cache_read_tokens": 0,
|
|
"context_limit": 0,
|
|
"input_tokens": 0,
|
|
"output_tokens": 0,
|
|
"reasoning_tokens": 0,
|
|
"total_tokens": 0
|
|
}
|
|
},
|
|
"message_part": {
|
|
"generation_attempt": 0,
|
|
"history_version": 0,
|
|
"part": {
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
},
|
|
"role": "system",
|
|
"seq": 0
|
|
},
|
|
"queued_messages": [
|
|
{
|
|
"automation_id": "64fb5f73-6415-4f56-8e9e-ca06539f09ac",
|
|
"chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",
|
|
"content": [
|
|
{
|
|
"args": [
|
|
0
|
|
],
|
|
"args_delta": "string",
|
|
"completed_at": "2019-08-24T14:15:22Z",
|
|
"content": "string",
|
|
"context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",
|
|
"context_file_content": "string",
|
|
"context_file_directory": "string",
|
|
"context_file_os": "string",
|
|
"context_file_path": "string",
|
|
"context_file_skill_meta_file": "string",
|
|
"context_file_truncated": true,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"data": [
|
|
0
|
|
],
|
|
"end_line": 0,
|
|
"file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",
|
|
"file_name": "string",
|
|
"hook_rewritten": true,
|
|
"is_error": true,
|
|
"is_media": true,
|
|
"mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"parsed_commands": [
|
|
[
|
|
"string"
|
|
]
|
|
],
|
|
"provider_executed": true,
|
|
"provider_metadata": [
|
|
0
|
|
],
|
|
"reasoning_delta": "string",
|
|
"result": [
|
|
0
|
|
],
|
|
"result_delta": "string",
|
|
"result_reset": true,
|
|
"skill_description": "string",
|
|
"skill_dir": "string",
|
|
"skill_name": "string",
|
|
"source_id": "string",
|
|
"start_line": 0,
|
|
"text": "string",
|
|
"title": "string",
|
|
"tool_call_id": "string",
|
|
"tool_name": "string",
|
|
"type": "text",
|
|
"url": "string",
|
|
"workspace_file_media_type": "string",
|
|
"workspace_file_name": "string",
|
|
"workspace_file_path": "string",
|
|
"workspace_file_size": 0,
|
|
"workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"
|
|
}
|
|
],
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"id": 0,
|
|
"input_id": "a7cf618d-a4a2-48f0-8b07-9196b264ab17",
|
|
"model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"
|
|
}
|
|
],
|
|
"retry": {
|
|
"attempt": 0,
|
|
"delay_ms": 0,
|
|
"error": "string",
|
|
"kind": "generic",
|
|
"provider": "string",
|
|
"retrying_at": "2019-08-24T14:15:22Z",
|
|
"status_code": 0
|
|
},
|
|
"status": {
|
|
"status": "waiting"
|
|
},
|
|
"type": "message_part"
|
|
}
|
|
]
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.ChatStreamEvent](schemas.md#codersdkchatstreamevent) |
|
|
|
|
<h3 id="stream-chat-events-via-websockets-responseschema">Response Schema</h3>
|
|
|
|
Status Code **200**
|
|
|
|
| Name | Type | Required | Restrictions | Description |
|
|
|------------------------------------|----------------------------------------------------------------------------------|----------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| `[array item]` | array | false | | |
|
|
| `» action_required` | [codersdk.ChatStreamActionRequired](schemas.md#codersdkchatstreamactionrequired) | false | | |
|
|
| `»» tool_calls` | array | false | | |
|
|
| `»»» args` | string | false | | |
|
|
| `»»» tool_call_id` | string | false | | |
|
|
| `»»» tool_name` | string | false | | |
|
|
| `» chat_id` | string(uuid) | false | | |
|
|
| `» error` | [codersdk.ChatError](schemas.md#codersdkchaterror) | false | | |
|
|
| `»» detail` | string | false | | Detail is optional provider-specific context shown alongside the normalized error message when available. |
|
|
| `»» kind` | [codersdk.ChatErrorKind](schemas.md#codersdkchaterrorkind) | false | | Kind classifies the error for consistent client rendering. |
|
|
| `»» message` | string | false | | Message is the normalized, user-facing error message. |
|
|
| `»» provider` | string | false | | Provider identifies the upstream model provider when known. |
|
|
| `»» retryable` | boolean | false | | Retryable reports whether the underlying error is transient. |
|
|
| `»» status_code` | integer | false | | Status code is the best-effort upstream HTTP status code. |
|
|
| `» message` | [codersdk.ChatMessage](schemas.md#codersdkchatmessage) | false | | |
|
|
| `»» automation_id` | string(uuid) | false | | Automation ID is the chat automation that delivered this message, if any. The automation may since have been deleted. |
|
|
| `»» chat_id` | string(uuid) | false | | |
|
|
| `»» content` | array | false | | |
|
|
| `»»» args` | array | false | | |
|
|
| `»»» args_delta` | string | false | | |
|
|
| `»»» completed_at` | string(date-time) | false | | Completed at is the time a reasoning part finished streaming, so reasoning duration can be computed as completed_at minus created_at. For interrupted reasoning, this is the interruption time. Absent when reasoning timestamp data was not recorded (e.g. messages persisted before this feature was added). |
|
|
| `»»» content` | string | false | | The code content from the diff that was commented on. |
|
|
| `»»» context_file_agent_id` | string(uuid) | false | | Context file agent ID is the workspace agent that provided this context file. Used to detect when the agent changes (e.g. workspace rebuilt) so instruction files can be re-persisted with fresh content. |
|
|
| `»»» context_file_content` | string | false | | Context file content holds the file content sent to the LLM. Internal only: stripped before API responses to keep payloads small. The backend reads it when building the prompt via partsToMessageParts. |
|
|
| `»»» context_file_directory` | string | false | | Context file directory is the working directory of the workspace agent. Internal only: same purpose as ContextFileOS. |
|
|
| `»»» context_file_os` | string | false | | Context file os is the operating system of the workspace agent. Internal only: used during prompt expansion so the LLM knows the OS even on turns where InsertSystem is not called. |
|
|
| `»»» context_file_path` | string | false | | Context file path is the absolute path of a file loaded into the LLM context (e.g. an AGENTS.md instruction file). |
|
|
| `»»» context_file_skill_meta_file` | string | false | | Context file skill meta file is the basename of the skill meta file (e.g. "SKILL.md") at the time of persistence. Internal only: restored on subsequent turns so the read_skill tool uses the correct filename even when the agent configured a non-default value. |
|
|
| `»»» context_file_truncated` | boolean | false | | Context file truncated indicates the file exceeded the 64KiB instruction file limit and was truncated. |
|
|
| `»»» created_at` | string(date-time) | false | | Created at is the timestamp this part carries. The semantics depend on the part type: for tool-call and tool-result parts it is the time the call was emitted or the result was produced (tool duration is the result's created_at minus the call's created_at); for reasoning parts it is the time reasoning started streaming. |
|
|
| `»»» data` | array | false | | |
|
|
| `»»» end_line` | integer | false | | |
|
|
| `»»» file_id` | string(uuid) | false | | |
|
|
| `»»» file_name` | string | false | | |
|
|
| `»»» hook_rewritten` | boolean | false | | Hook rewritten indicates that a lifecycle hook replaced model-proposed tool input. |
|
|
| `»»» is_error` | boolean | false | | |
|
|
| `»»» is_media` | boolean | false | | |
|
|
| `»»» mcp_server_config_id` | string(uuid) | false | | |
|
|
| `»»» media_type` | string | false | | |
|
|
| `»»» name` | string | false | | |
|
|
| `»»» parsed_commands` | array | false | | Parsed commands holds parsed programs from an execute tool call's shell command, one entry per simple command in source order. Each entry is [program] or [program, arg] where arg is the first non-flag positional argument. Program names are normalized to their base name (e.g. /usr/bin/go becomes go). Only populated when ToolName is "execute" and the command parses successfully; nil otherwise. |
|
|
| `»»» provider_executed` | boolean | false | | Provider executed indicates the tool call was executed by the provider (e.g. Anthropic computer use). |
|
|
| `»»» provider_metadata` | array | false | | Provider metadata holds provider-specific response metadata (e.g. Anthropic cache control hints) as raw JSON. Internal only: stripped by db2sdk before API responses. |
|
|
| `»»» reasoning_delta` | string | false | | |
|
|
| `»»» result` | array | false | | |
|
|
| `»»» result_delta` | string | false | | |
|
|
| `»»» result_reset` | boolean | false | | |
|
|
| `»»» skill_description` | string | false | | Skill description is the short description from the skill's SKILL.md frontmatter. |
|
|
| `»»» skill_dir` | string | false | | Skill dir is the absolute path to the skill directory inside the workspace filesystem. Internal only: used by read_skill/read_skill_file tools to locate skill files. |
|
|
| `»»» skill_name` | string | false | | Skill name is the kebab-case name of a discovered skill from the workspace's .agents/skills/ directory. |
|
|
| `»»» source_id` | string | false | | |
|
|
| `»»» start_line` | integer | false | | |
|
|
| `»»» text` | string | false | | |
|
|
| `»»» title` | string | false | | |
|
|
| `»»» tool_call_id` | string | false | | |
|
|
| `»»» tool_name` | string | false | | |
|
|
| `»»» type` | [codersdk.ChatMessagePartType](schemas.md#codersdkchatmessageparttype) | false | | |
|
|
| `»»» url` | string | false | | |
|
|
| `»»» workspace_file_media_type` | string | false | | Workspace file media type is the best-effort declared MIME type. |
|
|
| `»»» workspace_file_name` | string | false | | Workspace file name is the sanitized basename of a workspace upload. |
|
|
| `»»» workspace_file_path` | string | false | | Workspace file path is the absolute path of a workspace upload. The bytes live on the workspace filesystem; only metadata is persisted on the message. |
|
|
| `»»» workspace_file_size` | integer | false | | Workspace file size is the byte size of a workspace upload. |
|
|
| `»»» workspace_file_workspace_id` | string(uuid) | false | | Workspace file workspace ID identifies the workspace whose filesystem holds the uploaded bytes. References are only readable while the chat stays bound to that workspace. |
|
|
| `»» created_at` | string(date-time) | false | | |
|
|
| `»» created_by` | string(uuid) | false | | |
|
|
| `»» id` | integer | false | | |
|
|
| `»» input_id` | string(uuid) | false | | Input ID identifies the automation input that produced this message: a webhook delivery or a schedule occurrence. It is set only when AutomationID is set. |
|
|
| `»» model_config_id` | string(uuid) | false | | |
|
|
| `»» queued_message_id` | integer | false | | Queued message ID is the ID of the queued message this message was promoted from. It matches ChatQueuedMessage.ID in the response that queued the message. It is nil when the message was not promoted from the queue (edits create a new message without it) or when a server version that did not record the link created it. |
|
|
| `»» role` | [codersdk.ChatMessageRole](schemas.md#codersdkchatmessagerole) | false | | |
|
|
| `»» usage` | [codersdk.ChatMessageUsage](schemas.md#codersdkchatmessageusage) | false | | |
|
|
| `»»» cache_creation_tokens` | integer | false | | |
|
|
| `»»» cache_read_tokens` | integer | false | | |
|
|
| `»»» context_limit` | integer | false | | |
|
|
| `»»» input_tokens` | integer | false | | |
|
|
| `»»» output_tokens` | integer | false | | |
|
|
| `»»» reasoning_tokens` | integer | false | | |
|
|
| `»»» total_tokens` | integer | false | | |
|
|
| `» message_part` | [codersdk.ChatStreamMessagePart](schemas.md#codersdkchatstreammessagepart) | false | | |
|
|
| `»» generation_attempt` | integer | false | | |
|
|
| `»» history_version` | integer | false | | |
|
|
| `»» part` | [codersdk.ChatMessagePart](schemas.md#codersdkchatmessagepart) | false | | |
|
|
| `»» role` | [codersdk.ChatMessageRole](schemas.md#codersdkchatmessagerole) | false | | |
|
|
| `»» seq` | integer | false | | |
|
|
| `» queued_messages` | array | false | | |
|
|
| `»» automation_id` | string(uuid) | false | | Automation ID is the chat automation that queued this message, if any. The automation may since have been deleted. |
|
|
| `»» chat_id` | string(uuid) | false | | |
|
|
| `»» content` | array | false | | |
|
|
| `»» created_at` | string(date-time) | false | | |
|
|
| `»» id` | integer | false | | |
|
|
| `»» input_id` | string(uuid) | false | | Input ID identifies the automation input that produced this message: a webhook delivery or a schedule occurrence. It is set only when AutomationID is set. |
|
|
| `»» model_config_id` | string(uuid) | false | | |
|
|
| `» retry` | [codersdk.ChatStreamRetry](schemas.md#codersdkchatstreamretry) | false | | |
|
|
| `»» attempt` | integer | false | | Attempt is the 1-indexed retry attempt number. |
|
|
| `»» delay_ms` | integer | false | | Delay ms is the backoff delay in milliseconds before the retry. |
|
|
| `»» error` | string | false | | Error is the normalized error message from the failed attempt. |
|
|
| `»» kind` | [codersdk.ChatErrorKind](schemas.md#codersdkchaterrorkind) | false | | Kind classifies the retry reason for consistent client rendering. |
|
|
| `»» provider` | string | false | | Provider identifies the upstream model provider when known. |
|
|
| `»» retrying_at` | string(date-time) | false | | Retrying at is the timestamp when the retry will be attempted. |
|
|
| `»» status_code` | integer | false | | Status code is the best-effort upstream HTTP status code. |
|
|
| `» status` | [codersdk.ChatStreamStatus](schemas.md#codersdkchatstreamstatus) | false | | |
|
|
| `»» status` | [codersdk.ChatStatus](schemas.md#codersdkchatstatus) | false | | |
|
|
| `» type` | [codersdk.ChatStreamEventType](schemas.md#codersdkchatstreameventtype) | false | | |
|
|
|
|
#### Enumerated Values
|
|
|
|
| Property | Value(s) |
|
|
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| `kind` | `auth`, `config`, `content_filter`, `generic`, `hook_denied`, `hook_dispatch_failed`, `missing_key`, `overloaded`, `provider_disabled`, `rate_limit`, `stream_silence_timeout`, `timeout`, `usage_limit` |
|
|
| `type` | `action_required`, `context-file`, `error`, `file`, `file-reference`, `history_reset`, `hook-context`, `hook-notice`, `message`, `message_part`, `preview_reset`, `queue_update`, `reasoning`, `retry`, `skill`, `source`, `status`, `text`, `tool-call`, `tool-result`, `workspace-file-reference` |
|
|
| `role` | `assistant`, `system`, `tool`, `user` |
|
|
| `status` | `error`, `interrupting`, `requires_action`, `running`, `waiting` |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Watch chat workspace git state via WebSockets
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/chats/{chat}/stream/git \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/chats/{chat}/stream/git`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"message": "string",
|
|
"repositories": [
|
|
{
|
|
"branch": "string",
|
|
"remote_origin": "string",
|
|
"removed": true,
|
|
"repo_root": "string",
|
|
"unified_diff": "string"
|
|
}
|
|
],
|
|
"scanned_at": "2019-08-24T14:15:22Z",
|
|
"type": "changes"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceAgentGitServerMessage](schemas.md#codersdkworkspaceagentgitservermessage) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Propose chat title
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/title/propose \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/title/propose`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------------|----------|-------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"title": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.ProposeChatTitleResponse](schemas.md#codersdkproposechattitleresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Submit chat tool results
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/tool-results \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/tool-results`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"results": [
|
|
{
|
|
"is_error": true,
|
|
"output": [
|
|
0
|
|
],
|
|
"tool_call_id": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|----------------------------------------------------------------------------------|----------|--------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `body` | body | [codersdk.SubmitToolResultsRequest](schemas.md#codersdksubmittoolresultsrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Upload a file to a chat's workspace
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/chats/{chat}/workspace-files \
|
|
-H 'Content-Type: */*' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Content-Disposition: string' \
|
|
-H 'Coder-Session-Token: API_KEY' \
|
|
--data-binary '@archive.zip'
|
|
```
|
|
|
|
`POST /api/v2/chats/{chat}/workspace-files`
|
|
|
|
Streams the request body into the chat workspace's
|
|
upload directory. The request Content-Type header is
|
|
recorded as the file's media type. There is no
|
|
server-imposed size cap; client cancellation aborts the
|
|
stream and the agent leaves no partial target file behind.
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|-----------------------|--------|--------------|----------|-------------------------------------------------|
|
|
| `chat` | path | string(uuid) | true | Chat ID |
|
|
| `Content-Disposition` | header | string | true | Filename of the file (attachment; filename=...) |
|
|
| `body` | body | string | true | Raw file binary data |
|
|
|
|
### Example responses
|
|
|
|
> 201 Response
|
|
|
|
```json
|
|
{
|
|
"media_type": "string",
|
|
"name": "string",
|
|
"path": "string",
|
|
"size": 0,
|
|
"workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|----------------------------------------------------------------------------|-----------------------|------------------------------------------------------------------------------------------------|
|
|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.UploadChatWorkspaceFileResponse](schemas.md#codersdkuploadchatworkspacefileresponse) |
|
|
| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 403 | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) | Forbidden | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 409 | [Conflict](https://tools.ietf.org/html/rfc7231#section-6.5.8) | Conflict | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 429 | [Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4) | Too Many Requests | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 500 | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal Server Error | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
| 502 | [Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3) | Bad Gateway | [codersdk.Response](schemas.md#codersdkresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Get organization chat system prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/chats/config/system-prompt \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/organizations/{organization}/chats/config/system-prompt`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|----------------|------|--------------|----------|-----------------|
|
|
| `organization` | path | string(uuid) | true | Organization ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"system_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.OrganizationChatSystemPromptResponse](schemas.md#codersdkorganizationchatsystempromptresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update organization chat system prompt
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/organizations/{organization}/chats/config/system-prompt \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/organizations/{organization}/chats/config/system-prompt`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"system_prompt": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|----------------|------|--------------------------------------------------------------------------------------------------------------------|----------|-----------------|
|
|
| `organization` | path | string(uuid) | true | Organization ID |
|
|
| `body` | body | [codersdk.UpdateOrganizationChatSystemPromptRequest](schemas.md#codersdkupdateorganizationchatsystempromptrequest) | true | Request body |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List AI models and provider descriptors in an organization
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/organizations/{organization}/chats/models \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/organizations/{organization}/chats/models`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|----------------|------|--------|----------|-------------------------|
|
|
| `organization` | path | string | true | Organization name or ID |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"models": [
|
|
{
|
|
"ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819",
|
|
"compression_threshold": 0,
|
|
"context_limit": 0,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"is_default": true,
|
|
"model": "string",
|
|
"model_config": {
|
|
"frequency_penalty": 0,
|
|
"max_output_tokens": 0,
|
|
"openai_config": {
|
|
"reasoning_model": true,
|
|
"use_responses_api": true
|
|
},
|
|
"presence_penalty": 0,
|
|
"provider_options": {
|
|
"anthropic": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"blocked_domains": [
|
|
"string"
|
|
],
|
|
"context_1m_enabled": true,
|
|
"disable_parallel_tool_use": true,
|
|
"send_reasoning": true,
|
|
"thinking": {
|
|
"budget_tokens": 0
|
|
},
|
|
"thinking_display": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"google": {
|
|
"cached_content": "string",
|
|
"safety_settings": [
|
|
{
|
|
"category": "string",
|
|
"threshold": "string"
|
|
}
|
|
],
|
|
"thinking_config": {
|
|
"include_thoughts": true,
|
|
"thinking_budget": 0,
|
|
"thinking_level": "string"
|
|
},
|
|
"threshold": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openai": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"include": [
|
|
"string"
|
|
],
|
|
"instructions": "string",
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"max_completion_tokens": 0,
|
|
"max_tool_calls": 0,
|
|
"metadata": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"prediction": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"prompt_cache_key": "string",
|
|
"reasoning_mode": "string",
|
|
"reasoning_summary": "string",
|
|
"safety_identifier": "string",
|
|
"search_context_size": "string",
|
|
"service_tier": "string",
|
|
"store": true,
|
|
"strict_json_schema": true,
|
|
"structured_outputs": true,
|
|
"text_verbosity": "string",
|
|
"top_log_probs": 0,
|
|
"user": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openaicompat": {
|
|
"user": "string"
|
|
},
|
|
"openrouter": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"include_usage": true,
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"provider": {
|
|
"allow_fallbacks": true,
|
|
"data_collection": "string",
|
|
"ignore": [
|
|
"string"
|
|
],
|
|
"only": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
],
|
|
"quantizations": [
|
|
"string"
|
|
],
|
|
"require_parameters": true,
|
|
"sort": "string"
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"user": "string"
|
|
},
|
|
"vercel": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"logprobs": true,
|
|
"parallel_tool_calls": true,
|
|
"providerOptions": {
|
|
"models": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
]
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"top_logprobs": 0,
|
|
"user": "string"
|
|
}
|
|
},
|
|
"reasoning_effort": {
|
|
"default": "string",
|
|
"max": "string"
|
|
},
|
|
"temperature": 0,
|
|
"top_k": 0,
|
|
"top_p": 0
|
|
},
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"reasoning_efforts": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z"
|
|
}
|
|
],
|
|
"providers": [
|
|
{
|
|
"allow_user_api_key": true,
|
|
"available": true,
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"has_api_key": true,
|
|
"has_effective_api_key": true,
|
|
"has_user_api_key": true,
|
|
"icon": "string",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"type": "string",
|
|
"unavailable_reason": "missing_api_key"
|
|
}
|
|
],
|
|
"unsupported_providers": [
|
|
{
|
|
"display_name": "string",
|
|
"provider": "string"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.OrganizationChatModelsResponse](schemas.md#codersdkorganizationchatmodelsresponse) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Create an AI model in an organization
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X POST http://coder-server:8080/api/v2/organizations/{organization}/chats/models \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`POST /api/v2/organizations/{organization}/chats/models`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819",
|
|
"compression_threshold": 0,
|
|
"context_limit": 0,
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"is_default": true,
|
|
"model": "string",
|
|
"model_config": {
|
|
"frequency_penalty": 0,
|
|
"max_output_tokens": 0,
|
|
"openai_config": {
|
|
"reasoning_model": true,
|
|
"use_responses_api": true
|
|
},
|
|
"presence_penalty": 0,
|
|
"provider_options": {
|
|
"anthropic": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"blocked_domains": [
|
|
"string"
|
|
],
|
|
"context_1m_enabled": true,
|
|
"disable_parallel_tool_use": true,
|
|
"send_reasoning": true,
|
|
"thinking": {
|
|
"budget_tokens": 0
|
|
},
|
|
"thinking_display": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"google": {
|
|
"cached_content": "string",
|
|
"safety_settings": [
|
|
{
|
|
"category": "string",
|
|
"threshold": "string"
|
|
}
|
|
],
|
|
"thinking_config": {
|
|
"include_thoughts": true,
|
|
"thinking_budget": 0,
|
|
"thinking_level": "string"
|
|
},
|
|
"threshold": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openai": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"include": [
|
|
"string"
|
|
],
|
|
"instructions": "string",
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"max_completion_tokens": 0,
|
|
"max_tool_calls": 0,
|
|
"metadata": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"prediction": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"prompt_cache_key": "string",
|
|
"reasoning_mode": "string",
|
|
"reasoning_summary": "string",
|
|
"safety_identifier": "string",
|
|
"search_context_size": "string",
|
|
"service_tier": "string",
|
|
"store": true,
|
|
"strict_json_schema": true,
|
|
"structured_outputs": true,
|
|
"text_verbosity": "string",
|
|
"top_log_probs": 0,
|
|
"user": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openaicompat": {
|
|
"user": "string"
|
|
},
|
|
"openrouter": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"include_usage": true,
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"provider": {
|
|
"allow_fallbacks": true,
|
|
"data_collection": "string",
|
|
"ignore": [
|
|
"string"
|
|
],
|
|
"only": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
],
|
|
"quantizations": [
|
|
"string"
|
|
],
|
|
"require_parameters": true,
|
|
"sort": "string"
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"user": "string"
|
|
},
|
|
"vercel": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"logprobs": true,
|
|
"parallel_tool_calls": true,
|
|
"providerOptions": {
|
|
"models": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
]
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"top_logprobs": 0,
|
|
"user": "string"
|
|
}
|
|
},
|
|
"reasoning_effort": {
|
|
"default": "string",
|
|
"max": "string"
|
|
},
|
|
"temperature": 0,
|
|
"top_k": 0,
|
|
"top_p": 0
|
|
}
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|----------------|------|------------------------------------------------------------------------------|----------|-------------------------|
|
|
| `organization` | path | string | true | Organization name or ID |
|
|
| `body` | body | [codersdk.CreateChatModelRequest](schemas.md#codersdkcreatechatmodelrequest) | true | Model |
|
|
|
|
### Example responses
|
|
|
|
> 201 Response
|
|
|
|
```json
|
|
{
|
|
"ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819",
|
|
"compression_threshold": 0,
|
|
"context_limit": 0,
|
|
"created_at": "2019-08-24T14:15:22Z",
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"is_default": true,
|
|
"model": "string",
|
|
"model_config": {
|
|
"frequency_penalty": 0,
|
|
"max_output_tokens": 0,
|
|
"openai_config": {
|
|
"reasoning_model": true,
|
|
"use_responses_api": true
|
|
},
|
|
"presence_penalty": 0,
|
|
"provider_options": {
|
|
"anthropic": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"blocked_domains": [
|
|
"string"
|
|
],
|
|
"context_1m_enabled": true,
|
|
"disable_parallel_tool_use": true,
|
|
"send_reasoning": true,
|
|
"thinking": {
|
|
"budget_tokens": 0
|
|
},
|
|
"thinking_display": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"google": {
|
|
"cached_content": "string",
|
|
"safety_settings": [
|
|
{
|
|
"category": "string",
|
|
"threshold": "string"
|
|
}
|
|
],
|
|
"thinking_config": {
|
|
"include_thoughts": true,
|
|
"thinking_budget": 0,
|
|
"thinking_level": "string"
|
|
},
|
|
"threshold": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openai": {
|
|
"allowed_domains": [
|
|
"string"
|
|
],
|
|
"include": [
|
|
"string"
|
|
],
|
|
"instructions": "string",
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"max_completion_tokens": 0,
|
|
"max_tool_calls": 0,
|
|
"metadata": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"prediction": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"prompt_cache_key": "string",
|
|
"reasoning_mode": "string",
|
|
"reasoning_summary": "string",
|
|
"safety_identifier": "string",
|
|
"search_context_size": "string",
|
|
"service_tier": "string",
|
|
"store": true,
|
|
"strict_json_schema": true,
|
|
"structured_outputs": true,
|
|
"text_verbosity": "string",
|
|
"top_log_probs": 0,
|
|
"user": "string",
|
|
"web_search_enabled": true
|
|
},
|
|
"openaicompat": {
|
|
"user": "string"
|
|
},
|
|
"openrouter": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"include_usage": true,
|
|
"log_probs": true,
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"parallel_tool_calls": true,
|
|
"provider": {
|
|
"allow_fallbacks": true,
|
|
"data_collection": "string",
|
|
"ignore": [
|
|
"string"
|
|
],
|
|
"only": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
],
|
|
"quantizations": [
|
|
"string"
|
|
],
|
|
"require_parameters": true,
|
|
"sort": "string"
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"user": "string"
|
|
},
|
|
"vercel": {
|
|
"extra_body": {
|
|
"property1": null,
|
|
"property2": null
|
|
},
|
|
"logit_bias": {
|
|
"property1": 0,
|
|
"property2": 0
|
|
},
|
|
"logprobs": true,
|
|
"parallel_tool_calls": true,
|
|
"providerOptions": {
|
|
"models": [
|
|
"string"
|
|
],
|
|
"order": [
|
|
"string"
|
|
]
|
|
},
|
|
"reasoning": {
|
|
"enabled": true,
|
|
"exclude": true,
|
|
"max_tokens": 0
|
|
},
|
|
"top_logprobs": 0,
|
|
"user": "string"
|
|
}
|
|
},
|
|
"reasoning_effort": {
|
|
"default": "string",
|
|
"max": "string"
|
|
},
|
|
"temperature": 0,
|
|
"top_k": 0,
|
|
"top_p": 0
|
|
},
|
|
"organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",
|
|
"reasoning_efforts": [
|
|
"string"
|
|
],
|
|
"updated_at": "2019-08-24T14:15:22Z"
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|--------------------------------------------------------------|-------------|----------------------------------------------------|
|
|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.ChatModel](schemas.md#codersdkchatmodel) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## List user AI provider key configurations
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X GET http://coder-server:8080/api/v2/users/{user}/ai-provider-keys \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`GET /api/v2/users/{user}/ai-provider-keys`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------|------|--------|----------|--------------------------|
|
|
| `user` | path | string | true | User ID, username, or me |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
[
|
|
{
|
|
"byok_enabled": true,
|
|
"has_provider_api_key": true,
|
|
"has_user_api_key": true,
|
|
"provider": {
|
|
"deleted": true,
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"icon": "string",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"name": "string",
|
|
"type": "openai"
|
|
}
|
|
}
|
|
]
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.UserAIProviderKeyConfig](schemas.md#codersdkuseraiproviderkeyconfig) |
|
|
|
|
<h3 id="list-user-ai-provider-key-configurations-responseschema">Response Schema</h3>
|
|
|
|
Status Code **200**
|
|
|
|
| Name | Type | Required | Restrictions | Description |
|
|
|--------------------------|--------------------------------------------------------------------|----------|--------------|-------------|
|
|
| `[array item]` | array | false | | |
|
|
| `» byok_enabled` | boolean | false | | |
|
|
| `» has_provider_api_key` | boolean | false | | |
|
|
| `» has_user_api_key` | boolean | false | | |
|
|
| `» provider` | [codersdk.AIProviderSummary](schemas.md#codersdkaiprovidersummary) | false | | |
|
|
| `»» deleted` | boolean | false | | |
|
|
| `»» display_name` | string | false | | |
|
|
| `»» enabled` | boolean | false | | |
|
|
| `»» icon` | string | false | | |
|
|
| `»» id` | string(uuid) | false | | |
|
|
| `»» name` | string | false | | |
|
|
| `»» type` | [codersdk.AIProviderType](schemas.md#codersdkaiprovidertype) | false | | |
|
|
|
|
#### Enumerated Values
|
|
|
|
| Property | Value(s) |
|
|
|----------|---------------------------------------------------------------------------------------------------------|
|
|
| `type` | `anthropic`, `azure`, `bedrock`, `copilot`, `google`, `openai`, `openai-compat`, `openrouter`, `vercel` |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Update user AI provider key
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X PUT http://coder-server:8080/api/v2/users/{user}/ai-provider-keys/{aiProvider} \
|
|
-H 'Content-Type: application/json' \
|
|
-H 'Accept: application/json' \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`PUT /api/v2/users/{user}/ai-provider-keys/{aiProvider}`
|
|
|
|
> Body parameter
|
|
|
|
```json
|
|
{
|
|
"api_key": "string"
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------------|------|----------------------------------------------------------------------------------------------|----------|--------------------------|
|
|
| `user` | path | string | true | User ID, username, or me |
|
|
| `aiProvider` | path | string(uuid) | true | AI provider ID |
|
|
| `body` | body | [codersdk.CreateUserAIProviderKeyRequest](schemas.md#codersdkcreateuseraiproviderkeyrequest) | true | Request body |
|
|
|
|
### Example responses
|
|
|
|
> 200 Response
|
|
|
|
```json
|
|
{
|
|
"byok_enabled": true,
|
|
"has_provider_api_key": true,
|
|
"has_user_api_key": true,
|
|
"provider": {
|
|
"deleted": true,
|
|
"display_name": "string",
|
|
"enabled": true,
|
|
"icon": "string",
|
|
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
|
"name": "string",
|
|
"type": "openai"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------------------------------|
|
|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UserAIProviderKeyConfig](schemas.md#codersdkuseraiproviderkeyconfig) |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
|
|
|
## Delete user AI provider key
|
|
|
|
### Code samples
|
|
|
|
```sh
|
|
# Example request using curl
|
|
curl -X DELETE http://coder-server:8080/api/v2/users/{user}/ai-provider-keys/{aiProvider} \
|
|
-H 'Coder-Session-Token: API_KEY'
|
|
```
|
|
|
|
`DELETE /api/v2/users/{user}/ai-provider-keys/{aiProvider}`
|
|
|
|
### Parameters
|
|
|
|
| Name | In | Type | Required | Description |
|
|
|--------------|------|--------------|----------|--------------------------|
|
|
| `user` | path | string | true | User ID, username, or me |
|
|
| `aiProvider` | path | string(uuid) | true | AI provider ID |
|
|
|
|
### Responses
|
|
|
|
| Status | Meaning | Description | Schema |
|
|
|--------|-----------------------------------------------------------------|-------------|--------|
|
|
| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | |
|
|
|
|
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|