Letta Conversations API

Conversational session threads anchored to an agent.

Documentation

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-agent-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-block-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-tool-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-source-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-run-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-group-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-identity-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-message-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-passage-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-archive-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-job-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-llm-config-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-embedding-config-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/json-schema/letta-provider-schema.json

Other Resources

OpenAPI Specification

letta-conversations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Letta Admin Conversations API
  version: 1.0.0
  description: REST API for Letta, the stateful agents platform. Manage agents, memory blocks, archival passages, sources, custom tools, MCP servers, multi-agent groups, runs, and streaming responses. Available as Letta Cloud (managed) at https://api.letta.com/v1 and as the self-hosted open-source server (Apache-2.0) typically run at http://localhost:8283.
  contact:
    name: Letta
    url: https://www.letta.com/
    email: support@letta.com
  license:
    name: Apache-2.0
    url: https://github.com/letta-ai/letta/blob/main/LICENSE
  x-logo:
    url: https://www.letta.com/favicon.ico
servers:
- url: https://api.letta.com
  description: Letta Cloud (managed)
- url: https://app.letta.com
  description: Letta Cloud (app)
- url: http://localhost:8283
  description: Self-hosted Letta server
security:
- bearerAuth: []
tags:
- name: Conversations
  description: Conversational session threads anchored to an agent.
paths:
  /v1/conversations/:
    post:
      tags:
      - Conversations
      summary: Create Conversation
      description: Create a new conversation for an agent.
      operationId: create_conversation
      parameters:
      - name: agent_id
        in: query
        required: true
        schema:
          type: string
          description: The agent ID to create a conversation for
          title: Agent Id
        description: The agent ID to create a conversation for
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConversation'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Conversations
      summary: List Conversations
      description: List all conversations for an agent (or all conversations if agent_id not provided).
      operationId: list_conversations
      parameters:
      - name: agent_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: The agent ID to list conversations for (optional - returns all conversations if not provided)
          title: Agent Id
        description: The agent ID to list conversations for (optional - returns all conversations if not provided)
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Maximum number of conversations to return
          default: 50
          title: Limit
        description: Maximum number of conversations to return
      - name: after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Cursor for pagination (conversation ID)
          title: After
        description: Cursor for pagination (conversation ID)
      - name: summary_search
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Search for text within conversation summaries
          title: Summary Search
        description: Search for text within conversation summaries
      - name: order
        in: query
        required: false
        schema:
          enum:
          - asc
          - desc
          type: string
          description: Sort order for conversations. 'asc' for oldest first, 'desc' for newest first
          default: desc
          title: Order
        description: Sort order for conversations. 'asc' for oldest first, 'desc' for newest first
      - name: order_by
        in: query
        required: false
        schema:
          enum:
          - created_at
          - last_run_completion
          - last_message_at
          type: string
          description: Field to sort by
          default: created_at
          title: Order By
        description: Field to sort by
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Conversation'
                title: Response List Conversations
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}:
    get:
      tags:
      - Conversations
      summary: Retrieve Conversation
      description: Retrieve a specific conversation.
      operationId: retrieve_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the conv in the format 'conv-<uuid4>'
          examples:
          - conv-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The ID of the conv in the format 'conv-<uuid4>'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Conversations
      summary: Update Conversation
      description: Update a conversation.
      operationId: update_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the conv in the format 'conv-<uuid4>'
          examples:
          - conv-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The ID of the conv in the format 'conv-<uuid4>'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConversation'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Conversations
      summary: Delete Conversation
      description: 'Delete a conversation (soft delete).


        This marks the conversation as deleted but does not permanently remove it from the database.

        The conversation will no longer appear in list operations.

        Any isolated blocks associated with the conversation will be permanently deleted.'
      operationId: delete_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 41
          maxLength: 41
          pattern: ^conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
          description: The ID of the conv in the format 'conv-<uuid4>'
          examples:
          - conv-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The ID of the conv in the format 'conv-<uuid4>'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/fork:
    post:
      tags:
      - Conversations
      summary: Fork Conversation
      description: 'Fork an existing conversation.


        Creates a new conversation that shares the same in-context messages as the source

        conversation, but with a newly compiled system message reflecting the latest memory

        block values. The forked conversation belongs to the same agent as the source.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id query parameter

        to fork the agent''s default (agent-direct) message history into a new conversation.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: fork_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      - name: agent_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Agent ID for agent-direct mode with 'default' conversation
          title: Agent Id
        description: Agent ID for agent-direct mode with 'default' conversation
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/messages:
    get:
      tags:
      - Conversations
      summary: List Conversation Messages
      description: 'List all messages in a conversation.


        Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all

        messages in the conversation, with support for cursor-based pagination.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id parameter

        to list messages from the agent''s default conversation.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: list_conversation_messages
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      - name: agent_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Agent ID for agent-direct mode with 'default' conversation
          title: Agent Id
        description: Agent ID for agent-direct mode with 'default' conversation
      - name: before
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Message ID cursor for pagination. Returns messages that come before this message ID in the specified sort order
          title: Before
        description: Message ID cursor for pagination. Returns messages that come before this message ID in the specified sort order
      - name: after
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Message ID cursor for pagination. Returns messages that come after this message ID in the specified sort order
          title: After
        description: Message ID cursor for pagination. Returns messages that come after this message ID in the specified sort order
      - name: limit
        in: query
        required: false
        schema:
          anyOf:
          - type: integer
          - type: 'null'
          description: Maximum number of messages to return
          default: 100
          title: Limit
        description: Maximum number of messages to return
      - name: order
        in: query
        required: false
        schema:
          enum:
          - asc
          - desc
          type: string
          description: Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
          default: desc
          title: Order
        description: Sort order for messages by creation time. 'asc' for oldest first, 'desc' for newest first
      - name: order_by
        in: query
        required: false
        schema:
          const: created_at
          type: string
          description: Field to sort by
          default: created_at
          title: Order By
        description: Field to sort by
      - name: group_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Group ID to filter messages by.
          title: Group Id
        description: Group ID to filter messages by.
      - name: include_err
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Whether to include error messages and error statuses. For debugging purposes only.
          title: Include Err
        description: Whether to include error messages and error statuses. For debugging purposes only.
      - name: include_return_message_types
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              $ref: '#/components/schemas/MessageType'
          - type: 'null'
          description: Message types to include in response. When null, all message types are returned.
          title: Include Return Message Types
        description: Message types to include in response. When null, all message types are returned.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LettaMessageUnion'
                title: Response List Conversation Messages
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Conversations
      summary: Send Conversation Message
      description: 'Send a message to a conversation and get a response.


        This endpoint sends a message to an existing conversation.

        By default (streaming=true), returns a streaming response (Server-Sent Events).

        Set streaming=false to get a complete JSON response.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id in request body

        to send messages to the agent''s default conversation with locking.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: send_conversation_message
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConversationMessageRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LettaResponse'
              description: JSON response (when streaming=false)
            text/event-stream:
              description: Server-Sent Events stream (default, when streaming=true)
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/messages/preview-raw-payload:
    post:
      tags:
      - Conversations
      summary: Preview Conversation Model Request
      description: 'Inspect the raw LLM request payload for a conversation message without sending it.


        This endpoint processes the message through the same path as send_conversation_message

        (including conversation-scoped messages, isolated blocks, model overrides, and

        client tools/skills) but stops before the LLM call and returns the raw request

        payload. Useful for debugging and verifying what the LLM will actually see.'
      operationId: preview_conversation_model_request
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConversationMessageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Preview Conversation Model Request
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/stream:
    post:
      tags:
      - Conversations
      summary: Retrieve Conversation Stream
      description: 'Resume the stream for the most recent active run in a conversation.


        This endpoint allows you to reconnect to an active background stream

        for a conversation, enabling recovery from network interruptions.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id in request body

        to retrieve the stream for the agent''s most recent active run.


        **Direct run access**: Pass run_id directly to skip run lookup entirely.

        Useful for recovery from duplicate request 409 errors.


        **OTID lookup**: Pass otid to look up the run_id from Redis.

        Useful when you have the otid from a 409 error response.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: retrieve_conversation_stream
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RetrieveStreamRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema: {}
            text/event-stream:
              description: Server-Sent Events stream
              schema:
                oneOf:
                - $ref: '#/components/schemas/SystemMessage'
                - $ref: '#/components/schemas/UserMessage'
                - $ref: '#/components/schemas/ReasoningMessage'
                - $ref: '#/components/schemas/HiddenReasoningMessage'
                - $ref: '#/components/schemas/ToolCallMessage'
                - $ref: '#/components/schemas/ToolReturnMessage'
                - $ref: '#/components/schemas/AssistantMessage'
                - $ref: '#/components/schemas/ApprovalRequestMessage'
                - $ref: '#/components/schemas/ApprovalResponseMessage'
                - $ref: '#/components/schemas/LettaPing'
                - $ref: '#/components/schemas/LettaErrorMessage'
                - $ref: '#/components/schemas/LettaStopReason'
                - $ref: '#/components/schemas/LettaUsageStatistics'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/cancel:
    post:
      tags:
      - Conversations
      summary: Cancel Conversation
      description: 'Cancel runs associated with a conversation.


        Note: To cancel active runs, Redis is required.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id query parameter

        to cancel runs for the agent''s default conversation.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: cancel_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      - name: agent_id
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Agent ID for agent-direct mode with 'default' conversation
          title: Agent Id
        description: Agent ID for agent-direct mode with 'default' conversation
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Cancel Conversation
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/recompile:
    post:
      tags:
      - Conversations
      summary: Recompile Conversation
      description: Manually trigger system prompt recompilation for a conversation.
      operationId: recompile_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      - name: dry_run
        in: query
        required: false
        schema:
          type: boolean
          description: If True, do not persist changes; still returns the compiled system prompt.
          default: false
          title: Dry Run
        description: If True, do not persist changes; still returns the compiled system prompt.
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/letta__server__rest_api__routers__v1__conversations__CompactionRequest'
              - type: 'null'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                title: Response Recompile Conversation
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/conversations/{conversation_id}/compact:
    post:
      tags:
      - Conversations
      summary: Compact Conversation
      description: 'Compact (summarize) a conversation''s message history.


        This endpoint summarizes the in-context messages for a specific conversation,

        reducing the message count while preserving important context.


        **Agent-direct mode**: Pass conversation_id="default" with agent_id in request body

        to compact the agent''s default conversation messages.


        **Deprecated**: Passing an agent ID as conversation_id still works but will be removed.'
      operationId: compact_conversation
      parameters:
      - name: conversation_id
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 42
          pattern: ^(default|conv-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|agent-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$
          description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
          examples:
          - default
          - conv-123e4567-e89b-42d3-8456-426614174000
          - agent-123e4567-e89b-42d3-8456-426614174000
          title: Conversation Id
        description: The conversation identifier. Can be a conversation ID ('conv-<uuid4>'), 'default' for agent-direct mode (with agent_id parameter), or an agent ID ('agent-<uuid4>') for backwards compatibility (deprecated).
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
              - $ref: '#/components/schemas/letta__server__rest_api__routers__v1__conversations__CompactionRequest'
              - type: 'null'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompactionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateConversation:
      properties:
        summary:
          anyOf:
          - type: string
          - type: 'null'
          title: Summary
          description: A summary of the conversation.
        model:
          anyOf:
          - type: string
          - type: 'null'
          title: Model
          description: 'The model handle for this conversation (overrides agent''s model). Format: provider/model-name.'
        model_settings:
          anyOf:
          - oneOf:
            - $ref: '#/components/schemas/OpenAIModelSettings'
            - $ref: '#/components/schemas/SGLangModelSettings'
            - $ref: '#/components/schemas/AnthropicModelSettings'
            - $ref: '#/components/schemas/GoogleAIModelSettings'
            - $ref: '#/components/schemas/GoogleVertexModelSettings'
            - $ref: '#/components/schemas/AzureModelSettings'
            - $ref: '#/components/schemas/XAIModelSettings'
            - $ref: '#/components/schemas/ZAIModelSettings'
            - $ref: '#/components/schemas/GroqModelSettings'
            - $ref: '#/components/schemas/DeepseekModelSettings'
            - $ref: '#/c

# --- truncated at 32 KB (144 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/letta/refs/heads/main/openapi/letta-conversations-api-openapi.yml