---
title: "Send a chat message"
method: POST
path: "/chats/{chat_id}/messages"
tags: ["Chats"]
---

# Send a chat message

`POST /chats/{chat_id}/messages`

## Request

- Base URL: `https://api.crevio.co/v1`
- URL: `https://api.crevio.co/v1/chats/{chat_id}/messages`
- Auth: API key in header `Authorization`

Continues a chat: the agent keeps its context. Resumes a run waiting in `needs_input`, or starts a new run in the same chat when the last one finished. `409 run_busy` while a run is still working. Returns the run like POST /chats. Needs the `agent` scope.

## Path parameters

- `chat_id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `message` string, required: The follow-up.
  - `response_format` object, nullable: Ask for a JSON reply instead of prose: a JSON Schema, or OpenAI's `{type: "json_schema", json_schema: {schema}}` (or `{type: "json_object"}`). The settled run carries the parsed value in `json`, validated against the schema, or why it failed in `json_error`.
  - `wait_seconds` integer: Hold the response until the run settles, up to this many seconds. 200 with the reply when it settled in time, 202 with the run still going otherwise: poll GET /task_runs/{id}.
  - `callback_url` string, uri: A public https URL to POST the finished run to, with its reply, once the run ends (`completed`, `failed`, `unknown` or `cancelled`), so you need not hold the request open or poll. A run in `needs_input` has not ended. Failed deliveries retry for about three days; a 4xx stops them. The request is not signed, so use an unguessable URL.

## Response `200`

The run settled within wait_seconds, with its reply

- AiTaskRun
  - `id` string, required
  - `object` string, required
  - `task_id` string, required
  - `task_name` string, required
  - `chat_id` string, nullable, required: The run's own conversation (`aichat_...`): what it read, called and said. Read it with `search_chats`.
  - `status` 'pending' | 'running' | 'completed' | 'failed' | 'needs_input' | 'unknown' | 'skipped' | 'cancelled', required
  - `summary` string, nullable, required
  - `error_message` string, nullable, required
  - `test_run` boolean, required
  - `input_tokens` integer, required
  - `output_tokens` integer, required
  - `credits_consumed` integer, required
  - `cancel_requested_at` string, nullable, required: When a stop was requested. The run stays `running` until it reaches its next step, then settles as `cancelled`.
  - `tool_calls_count` integer, required
  - `duration_ms` integer, nullable, required
  - `started_at` string, date-time, nullable, required
  - `completed_at` string, date-time, nullable, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `skip_reason` 'condition' | 'no_paid_plan_or_credits' | 'no_recent_activity' | 'no_task_activity' | 'no_personal_sources' | 'rate_limited' | 'misfire' | 'task_busy' | 'account_at_capacity' | 'member_credit_cap' | 'agent_archived' | 'null', nullable, required
  - `skip_count` integer, required
  - `delivery_status` 'delivered' | 'not_delivered' | 'not_requested' | 'unknown', required
  - `completion` 'verified' | 'recorded' | 'recovered' | 'null', nullable, required: How the agent closed a completed run: `verified` (it re-checked the result), `recorded` (it reported without re-checking), or `recovered` (it never reported; `summary` is its last message). Null unless an agent turn completed the run.
  - `trigger_source` 'scheduled' | 'event' | 'manual', required
  - `trigger_event` object, nullable, required: The event that started this run, `{type, data}`, exactly as the run received it; `data` matches the event's webhook payload. Events that waited while the task was busy start one run together as `{type, events: [{type, data}, ...]}`, oldest first. Null for a run no event started. POST /task_runs/{id}/replay runs the task again on it.
  - `replay_of` string, nullable, required: The run (`trun_...`) whose event this run replays. Null unless started by POST /task_runs/{id}/replay.
  - `captured_deliveries` unknown[], required
    - unknown
  - `result` string, nullable: The agent's final reply, once the run settled. Present on single-run responses, not in lists.
  - `json` unknown
  - `json_error` string, nullable: Why the reply did not parse or validate against `response_format`.
  - `artifacts` Artifact[]
    - `object` string, required
    - `id` string, required
    - `filename` string, required
    - `content_type` string, nullable, required
    - `size` integer, required
  - `pending_approval_ids` unknown[], required
    - unknown

## Other responses

- `202`: The run is still working
- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `409`: Conflict
- `422`: Validation error
- `429`: Rate limit exceeded, or the account already has 5 runs going (`account_at_capacity`). A slot frees as a run settles: retry after the number of seconds in `Retry-After`.
- `500`: Internal server error

## Changes

- **2026-11-15** `56c22ab9b282`: 8 warning
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `400`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `401`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `403`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `404`
  - …4 more
- **2026-11-14** `28fa634b2190`: 6 info
  - removed the `timed_out` enum value from the `status` response property for the response status `200`
  - removed the `timed_out` enum value from the `status` response property for the response status `202`
  - removed the `wake_gate` enum value from the `skip_reason` response property for the response status `200`
  - removed the `wake_gate` enum value from the `skip_reason` response property for the response status `202`
  - …2 more
- **2026-10-30** `5d778525853c`: 1 info
  - added the new optional request property `callback_url`
- **2026-10-30** `37a0a6a0934c`: 2 warning
  - added the new `agent_archived` enum value to the `skip_reason` response property for the response status `200`
  - added the new `agent_archived` enum value to the `skip_reason` response property for the response status `202`
- **2026-10-23** `bf736a72ee9c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/crevio/apis/crevio-api-v1/changes/chats/:chat_id/messages/post.md)

---

[API](https://skmtc.dev/crevio/apis/crevio-api-v1.md) - [All operations](https://skmtc.dev/crevio/apis/crevio-api-v1/llms.txt) - [OpenAPI document](https://skmtc.dev/crevio/apis/crevio-api-v1/revisions/ccbd8fcbd6d7?raw)
