---
title: Send Message
description: Sends a new message to an existing chat. Blocks until the model response is complete and returns the message response. Include designMode to apply element-scoped design edits; message may be omitted when edits are provided.
docs_index: /docs/llms.txt
lastUpdated: 2026-11-23
badge: "POST"
---

> For an index of all documentation, see [/docs/llms.txt](/docs/llms.txt).

Sends a new message to an existing chat. Blocks until the model response is complete and returns the message response. Include designMode to apply element-scoped design edits; message may be omitted when edits are provided.

#### `POST /v2/chats/{chatId}/messages`

Include `designMode` to apply element-scoped edits. A nonempty `message` is required unless at least one edit is supplied. Without edits, Design Mode instructions require an element selector or screenshot. Use `createDesignModeBridge` from `v0/browser` to connect an embedded preview editor. See [Design Mode](/docs/api/v2/guides/design-mode) for browser SDK integration, headless operations, screenshots, and authentication restrictions.

## Usage

```typescript
import { v0 } from 'v0'

const result = await v0.messages.send({
  chatId: 'chat_abc123',
  message: 'Hello, world!',
})

console.log(result)
```

```bash
curl -X POST "https://api.v0.dev/v2/chats/chat_abc123/messages"   -H "Authorization: Bearer $V0_API_KEY"   -H "Content-Type: application/json"   -d '{"message":"Hello, world!"}'
```

## API Signature

### Request

#### Path Parameters

- `chatId: string` The unique identifier of the chat.
  - **Minimum length:** 1

#### Request Body

- `message?: string` The prompt or instruction to send to the model. May be omitted when designMode contains edits.
  - **Minimum length:** 1
- `designMode?: object` Apply element-scoped design edits using Design Mode. Source changes are model-generated, not deterministic DOM patches. The Design Mode model is selected automatically, regardless of modelConfiguration.modelId.
  - `edits?: ('style' | 'deleteElement' | 'move' | 'fontInjection')[]` Element edits to apply to the source code. Maximum 100.
    - **Maximum items:** 100
    - **style**
      - `type: 'style'`
      - `element: object`
        - `selectorPath: string` CSS selector identifying the rendered element.
          - **Minimum length:** 1
        - `tagName: string` HTML tag name, such as h1 or button.
          - **Minimum length:** 1
        - `id?: string` Element ID, if present.
        - `classNames?: string[]` Element CSS classes.
        - `textContent?: string` Current text of the element, to help locate its source.
        - `reactComponentName?: string` React component name, if known.
      - `changes: Record<string, object>` CSS property names in camelCase mapped to old and new values. Use textContent for text replacement.
    - **deleteElement**
      - `type: 'deleteElement'`
      - `element: object`
        - `selectorPath: string` CSS selector identifying the rendered element.
          - **Minimum length:** 1
        - `tagName: string` HTML tag name, such as h1 or button.
          - **Minimum length:** 1
        - `id?: string` Element ID, if present.
        - `classNames?: string[]` Element CSS classes.
        - `textContent?: string` Current text of the element, to help locate its source.
        - `reactComponentName?: string` React component name, if known.
    - **move**
      - `type: 'move'`
      - `element: object`
        - `selectorPath: string` CSS selector identifying the rendered element.
          - **Minimum length:** 1
        - `tagName: string` HTML tag name, such as h1 or button.
          - **Minimum length:** 1
        - `id?: string` Element ID, if present.
        - `classNames?: string[]` Element CSS classes.
        - `textContent?: string` Current text of the element, to help locate its source.
        - `reactComponentName?: string` React component name, if known.
      - `toParentSelector?: string` Destination parent selector. Required when position is inside.
        - **Minimum length:** 1
      - `targetSelector?: string` Destination sibling selector. Required when position is before or after.
        - **Minimum length:** 1
      - `position: 'before' | 'after' | 'inside'` Placement relative to the destination.
    - **fontInjection**
      - `type: 'fontInjection'`
      - `fontName: string` Font to add to the project, such as Inter.
        - **Minimum length:** 1
  - `element?: string` CSS selector limiting the scope of the message instructions.
    - **Minimum length:** 1
  - `screenshot?: object` Screenshot providing visual context for the requested edits.
    - `url: string` HTTPS image URL or base64 image data URI. Counts toward the attachment limits. Not supported for Vercel OIDC principals.
      - **Minimum length:** 1
    - `anchorElement?: string` CSS selector anchoring the screenshot to a rendered element.
      - **Minimum length:** 1
- `systemPrompt?: string` System-level context for the chat, such as frameworks or development environment details.
- `modelConfiguration?: object` Overrides for the model behavior.
  - `modelId: 'v0-mini' | 'v0-pro' | 'v0-max' | 'v0-max-fast' | string` Model to use for the generation. Use a v0 model ID, or an [AI Gateway](https://vercel.com/ai-gateway/models) model ID in `creator/model` format. Gateway models must support tool calling and Zero Data Retention, and are subject to team model policy; unsupported IDs are rejected.
  - `imageGenerations: boolean` Enables image generations to generate up to 5 images per version.
- `mcpServerIds?: string[]` MCP server IDs to enable. When omitted, uses default enabled servers.
- `attachments?: (object | object)[]` Files or assets to include with the message. Provide either a URL or data URI, or inline UTF-8 text content.
- `skills?: ('remote' | 'memory' | 'project')[]` Skills to force-attach to the message. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.
  - **Maximum items:** 3
  - **remote**
    - `type: 'remote'` Discriminator: a skills.sh skill.
    - `id: string` Skill ID from skills.sh.
  - **memory**
    - `type: 'memory'` Discriminator: a user- or team-scoped memory skill.
    - `scope: 'user' | 'team'` Whether the skill lives in user or team memory.
    - `skillName: string` Name of the memory skill to attach.
  - **project**
    - `type: 'project'` Discriminator: a skill defined in the project repo.
    - `skillName: string` Name of the project skill to attach.

### Response

- `id: string` Unique message identifier.
- `chatId: string` ID of the chat this message belongs to.
- `role: 'user' | 'assistant'` Who produced this message.
- `createdAt: string` ISO timestamp when the message was created.
- `updatedAt: string` ISO timestamp when the message was last updated.
- `content: string` The trailing prose of the message — the agent’s closing summary, or the user’s message text. Empty string when there is no closing prose.
- `parts: ('text' | 'thinking' | 'file-read' | 'file-edit' | 'search' | 'bash' | 'tool-call' | 'agent-action')[]` Ordered list of parts that make up the message. Iterate to render the full narrative including thinking, file operations, tool calls, and prose.
  - **text** A block of text output by the agent.
    - `type: 'text'`
    - `text: string` Markdown prose written by the agent or user.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **thinking** Extended thinking output by the agent.
    - `type: 'thinking'`
    - `text: string` The agent's reasoning trace.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **file-read** Files read by the agent.
    - `type: 'file-read'`
    - `paths: string[]` The file paths the agent read in this step.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **file-edit** The agent created, modified, deleted, renamed, or patched a file.
    - `type: 'file-edit'`
    - `operation: 'create' | 'update' | 'delete' | 'rename' | 'patch'` The type of file edit performed.
    - `path: string` The target file path.
    - `toPath?: string` The new path when operation is "rename".
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **search** The agent searched for something.
    - `type: 'search'`
    - `scope: 'repo' | 'web'` Whether the agent searched the repository or the web.
    - `query: string` The search query.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **bash** The agent ran a shell command.
    - `type: 'bash'`
    - `command: string` The shell command that was executed.
    - `output?: string` Combined stdout/stderr captured from the terminal. May be empty if the command produced no output.
    - `exitCode?: integer | null` Process exit code, when available. Reserved for future use; currently always omitted.
    - `isDangerous?: boolean` True if the command was flagged as potentially dangerous and required explicit user approval.
    - `timeoutMs?: integer` Command timeout in milliseconds, when configured.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **tool-call** The agent invoked a tool (MCP, integration, or other dynamic tool). For shell commands, use the "bash" part instead.
    - `type: 'tool-call'`
    - `name: string` The identifier the tool was invoked under. For MCP/integration tools this is a normalized identifier derived from the tool name — prefer `toolDisplayName` for display when present.
    - `toolDisplayName?: string | null` The tool's original human-readable name (an MCP/integration tool's server-side name), when `name` is a normalized identifier. Display-only.
    - `input?: unknown` The arguments passed to the tool. Schema depends on the specific tool.
    - `output?: unknown` The result returned by the tool. Schema depends on the specific tool.
    - `status: 'ok' | 'error'` Whether the tool call succeeded or returned an error.
    - `suggestedPermissions?: object[]` Present when the agent is blocked waiting for you to approve this tool call (for example, running a setup or migration script). Pass these objects back unchanged as the `permissions` of a `confirmed-permissions` task to approve. Omitted once the tool has run.
      - `item: object` A permission the agent is waiting for you to grant. Pass these objects back unchanged as the `permissions` of a `confirmed-permissions` task.
        - `type: 'ALLOW_DYNAMIC_TOOL_STRICT'` Permission grant type.
        - `toolName: string` The tool this permission authorizes.
        - `input?: unknown` The tool input this permission authorizes. Pass back unchanged when resolving.
        - `toolDisplayName?: string | null` The tool's original human-readable name (an MCP/integration tool's server name), when `toolName` is a normalized identifier. Display-only; pass back unchanged.
        - `taskNameActive?: string | null` Internal label for the in-progress task. Pass back unchanged.
        - `taskNameComplete?: string | null` Internal label for the completed task. Pass back unchanged.
        - `userMessage?: string` Optional message associated with the permission.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
  - **agent-action** A typed escape hatch for agent actions that don’t fit the other part types. Forward-compatible: new action types may appear without API version changes.
    - `type: 'agent-action'`
    - `name: string` Stable identifier for the action (e.g. "generate\_image", "manage\_todos", "diagnostics"). See documentation for the registry of known names.
    - `summary: string` A short human-readable summary of what happened. Always populated so clients can render something even without knowing the action name.
    - `data?: object | object | object | object | object | object | object | object | object | object | object` Structured payload for actions that carry data. Present on `ask_user_questions`, `exit_plan_mode`, `get_or_request_integration`, and `configure_vercel_connect` parts when the agent is waiting on you, and on `show_artifact` and `security_review` parts. Narrow by the part `name`: the presence of `data` alone does not mean the agent is waiting on you. Omitted for actions that do not carry structured data.
      - `questions: object[]` The questions the agent is waiting for answers to. Resolve with an `answered-questions` task.
        - `item: object`
          - `id: string` Question identifier. Pass back as `questionId` when resolving with an `answered-questions` task.
          - `question: string` The full question text.
          - `header: string` Short label for the question.
          - `multiSelect: boolean` Whether more than one option may be selected.
          - `options: object[]` The available answer options.
            - `item: object`
              - `id: string` Option identifier.
              - `label: string` Display label. Pass matching labels back in `selectedLabels` when resolving.
              - `description?: string` Optional longer explanation of the option.
    - `startedAt?: string` ISO timestamp when this part began.
    - `finishedAt?: string` ISO timestamp when this part completed.
- `finishReason: 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | null` Why generation ended. Null while the agent is still generating; once non-null, the message is final and safe to consume.
- `filesStatus: 'pending' | 'ready' | 'failed' | null` Whether `GET /chats/{chatId}/files` reflects this assistant message. `pending` while the agent is generating or its changes are still being saved, which can continue for a few seconds after `finishReason` is set; `ready` once they are saved; `failed` if saving them failed, in which case the files are those of the previous version. Null on user messages.
- `restorable: boolean` True when this is an assistant message that produced restorable code and is not the currently active code.
- `attachments?: object[]` Files attached to this message.
  - `item: object`
    - `url: string` URL to the attachment.
    - `name?: string` Original filename, when available.
    - `contentType?: string` MIME type.
    - `size?: integer` Size in bytes.
- `authorId: string | null` ID of the user who authored a user message; null for assistant messages.
- `usage: object` Model identifier, token usage, and credit cost. Token and credit values are zero on user messages and on assistant messages that have not yet generated tokens.
  - `model: string | null` Model identifier used for the assistant message, or null when not applicable or unavailable.
  - `tokens: object` Token counts for this message.
    - `input: number` Prompt input value (non-cached).
    - `output: number` Completion output value.
    - `cacheRead: number` Cache-read input value.
    - `cacheWrite: number` Cache-write input value.
    - `total: number` Sum of input, output, cacheRead, and cacheWrite.
  - `creditsCost: object` Credit cost for this message.
    - `input: number` Prompt input value (non-cached).
    - `output: number` Completion output value.
    - `cacheRead: number` Cache-read input value.
    - `cacheWrite: number` Cache-write input value.
    - `total: number` Sum of input, output, cacheRead, and cacheWrite.

---

For a semantic overview of all documentation, see [/docs/sitemap.md](/docs/sitemap.md)

For an index of all available documentation, see [/docs/llms.txt](/docs/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/docs/agents.md](/docs/agents.md)