> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-docs-cloudflare-tunnel-self-hosting.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a chat



## OpenAPI

````yaml /openapi.yaml patch /api/v1/chats/{id}
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation for the Sure API.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/chats/{id}:
    parameters:
      - name: id
        in: path
        required: true
        description: Chat ID
        schema:
          type: string
    patch:
      tags:
        - Chats
      summary: Update a chat
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  example: Updated chat title
        required: true
      responses:
        '200':
          description: chat updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatDetail'
        '404':
          description: chat not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ChatDetail:
      allOf:
        - $ref: '#/components/schemas/ChatResource'
        - type: object
          required:
            - messages
          properties:
            messages:
              type: array
              items:
                $ref: '#/components/schemas/Message'
            pagination:
              $ref: '#/components/schemas/Pagination'
              nullable: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
    ChatResource:
      type: object
      required:
        - id
        - title
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
        error:
          type: string
          nullable: true
          description: >
            User-friendly error message describing the most recent failure of
            the

            assistant for this chat, or `null` when no error is present. Errors

            are classified into a small set of presentable messages so clients

            can display them directly without exposing raw provider details:
              * Rate limited — "The AI provider is rate limited right now. Please try again in a few minutes."
              * Temporarily unavailable — "The AI provider is temporarily unavailable right now. Please try again in a few minutes."
              * Misconfigured — "The AI provider is not configured correctly. Please contact your administrator."
              * Default fallback — "Failed to generate a response. Please try again."
            Successful chats always return `null` for this field.
          example: >-
            The AI provider is rate limited right now. Please try again in a few
            minutes.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Message:
      type: object
      required:
        - id
        - type
        - role
        - content
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - user_message
            - assistant_message
        role:
          type: string
          enum:
            - user
            - assistant
        content:
          type: string
        model:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
          nullable: true
    Pagination:
      type: object
      required:
        - page
        - per_page
        - total_count
        - total_pages
      properties:
        page:
          type: integer
          minimum: 1
        per_page:
          type: integer
          minimum: 1
        total_count:
          type: integer
          minimum: 0
        total_pages:
          type: integer
          minimum: 0
    ToolCall:
      type: object
      required:
        - id
        - function_name
        - function_arguments
        - created_at
      properties:
        id:
          type: string
          format: uuid
        function_name:
          type: string
        function_arguments:
          type: object
          additionalProperties: true
        function_result:
          type: object
          additionalProperties: true
          nullable: true
        created_at:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````