---
title: "Handle Chat Data"
method: POST
path: "/chat"
---

# Handle Chat Data

`POST /chat`

## Request body

- ChatRequest
  - `messages` ProviderMessage[], required
    - `role` string, required
    - `attachments` ClientAttachment[], nullable
      - `name` string, required
      - `contentType` string, required
      - `url` string, required
    - `parts` union[], nullable
      - union
        - TextPart — A text part of a message.
          - `type` 'text'
          - `text` string, required
        - ReasoningPart — A reasoning part of a message.
          - `type` 'reasoning'
          - `details` ReasoningDetails[]
            - `type` 'text'
            - `text` string, required
            - `signature` string, nullable
        - ToolInvocationPart — A tool invocation part of a message.
          - `type` string, required
          - `toolCallId` string, required
          - `toolName` string, required
          - `state` string, required
          - `input` unknown, required
          - `output` unknown
        - SourcePart — A source part of a message.
          - `type` 'source'
          - `source` object, required
        - FilePart — A file part of a message.
          - `type` 'file'
          - `mimeType` string, required
          - `data` string, required
        - ImagePart — An image the user attached, addressed by the provider's file id. Built server-side from a stored `chat_attachments` row, never accepted from a client: the id refers to bytes we uploaded and hardened ourselves.
          - `type` 'image'
          - `fileId` string, required
        - StepStartPart — A step boundary part of a message.
          - `type` 'step-start'
        - DataPart — A data part from streaming (ignored during processing). These are ephemeral parts used for real-time skeleton/hydration updates during streaming. They're stored by the AI SDK but not used by the backend.
          - `type` string, required
          - `id` string, nullable
          - `data` unknown
  - `trip_id` string, nullable
  - `conversation_id` string, nullable
  - `model_choice` 'fast' | 'deep', nullable
  - `mentioned_trips` MentionedTrip[], nullable
    - `trip_id` string, required
    - `title` string, nullable
  - `attachment_ids` string[], nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/stardrift/apis/fastapi.md) · [All operations](https://skmtc.dev/stardrift/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stardrift/fastapi/revisions/00746572572a/schema)
