chat

Send chat message

Sends a chat message and receives a complete AI response (non-streaming)

post/api/chat

Request

  • Base URL: https://localhost:8080
  • URL: https://localhost:8080/api/chat
  • Auth: none declared

Request body

messagestring

Single message string (alternative to messages array)

modelstring

AI model to use

temperaturenumber

Temperature for AI response (0-2)

sessionIdstring

Session ID for conversation continuity

clientIdstring

Client ID for tracking

clientMessageIdstring

Stable id the client generates for THIS user message. Makes agent dispatch idempotent: a reconnect/retry that re-delivers the same chat:stream is ignored instead of spawning a second run. Absent for older clients.

conversationIdstring

Conversation ID to link message to existing conversation

selectedFileIdsstring[]

Document IDs to include in AI context

attachmentIdsstring[]

Attachment IDs to include as inline chat attachments

documentContentstring

Current Word document content (sent by client, injected into user prompt)

countrystring

Jurisdiction: 2-letter country code (e.g. US, UK). Overrides user profile when set.

circuitNamesstring[]

Jurisdiction: circuit display names (e.g. "9th Circuit"). Overrides profile when set.

stateNamesstring[]

Jurisdiction: state display names (e.g. "California"). Overrides profile when set.

subdivisionNamesstring[]

Jurisdiction: subdivision names for non-US (e.g. "England & Wales"). Overrides profile when set.

documentSnapshotobject

Lightweight snapshot of the current Word document (text + structure + indices). Used for reasoning and edit targeting. Optional and currently behind a feature flag.

appContext'word' | 'outlook' | 'web' | 'docs' | 'email' | 'slack' | 'telegram' | 'whatsapp' | 'teams' | 'imessage' | 'mobile'

Client application context — determines which tool set and system prompt the AI uses.

docIdstring

Host document identifier (for example, Google Docs docId when appContext = "docs").

hostContextobject

Host/editor context from client (host, docId). When appContext is "docs", docId is normalized from here at entry if not set at top level.

clientVersionstring

Add-in client version (e.g. Word add-in APP_VERSION). Sent only by clients that strip [[case:]] citation tags before display; gates whether the agent emits those tags. Absent ⇒ treated as an old client (no tags).

editMode'auto' | 'approve' | 'answers_only'

Editing posture for this turn. "answers_only" tells the backend to withhold the document-editing tools so the agent answers and researches in chat without modifying the document. Omitted/"auto"/"approve" leave editing available.

openProposalsobject[]

Word approval mode: the versioned suggested-edit cards still waiting in the panel when this message was sent (OpenProposalCard). Sent by add-in bundles that can revise an earlier turn's card; absent from older bundles. Read structurally by readOpenProposals.

otherPendingSuggestionsnumber

Sent with openProposals: how many other suggested edits are waiting in the panel that cannot be revised in a later turn (formatting, document-end and pre-versioning cards).

Example request

{
  "messages": [
    {
      "role": "user",
      "content": "Hello, how can you help me?",
      "toolCalls": [
        {
          "toolCallId": "call_abc123",
          "toolName": "suggest_changes",
          "args": {
            "text": "example"
          }
        }
      ],
      "toolResults": [
        {
          "toolCallId": "call_abc123",
          "error": "Tool execution failed",
          "executionTimeMs": 150
        }
      ]
    }
  ],
  "message": "Hello, how can you help me?",
  "model": "gpt-4",
  "temperature": 0.7,
  "sessionId": "session-123",
  "clientId": "client-456",
  "clientMessageId": "a1b2c3d4-e5f6-7890-abcd-ef0123456789",
  "conversationId": "conversation-uuid",
  "selectedFileIds": [
    "doc-123",
    "doc-456"
  ],
  "attachmentIds": [
    "attachment-123",
    "attachment-456"
  ],
  "documentContent": "This is my document content...",
  "country": "US",
  "circuitNames": [
    "9th Circuit"
  ],
  "stateNames": [
    "California"
  ],
  "subdivisionNames": [
    "England & Wales"
  ],
  "appContext": "outlook",
  "docId": "1A2B3C4D-doc-id",
  "hostContext": {
    "host": "docs",
    "docId": "1A2B3C4D-doc-id"
  },
  "clientVersion": "1.2.9",
  "editMode": "answers_only"
}

Response

Chat response received successfully

textstring required

AI generated text response

finishReasonstring

Reason for finishing the response

Example response

{
  "text": "Hello! How can I assist you today?",
  "toolCalls": [
    {
      "toolCallId": "call_abc123",
      "toolName": "suggest_changes",
      "args": {
        "text": "example"
      }
    }
  ],
  "finishReason": "stop"
}

Changes

No recorded changes to this operation across all 1 revision of this API.