---
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. Carries one id per endpoint because the turn's endpoint is not known here — the serializer picks. `azure_file_id` is None for images uploaded before the Azure endpoint existed.
          - `type` 'image'
          - `fileId` string, required
          - `azureFileId` string, nullable
        - 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

## Changes

- **2026-09-16** `6d2ccd9ff8ca` — 1 info
  - added the new optional request property `messages/items/parts/anyOf[subschema #1]/items/anyOf[subschema #6: ImagePart]/azureFileId`

[Change history](https://skmtc.dev/stardrift/apis/fastapi/changes/chat/post.md)

---

[API](https://skmtc.dev/stardrift/apis/fastapi.md) · [All operations](https://skmtc.dev/stardrift/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc.dev/stardrift/apis/fastapi/revisions/6d2ccd9ff8ca?raw)
