> ## 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.

# Create a message



## OpenAPI

````yaml /openapi.yaml post /api/v1/chats/{chat_id}/messages
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/{chat_id}/messages:
    parameters:
      - name: chat_id
        in: path
        required: true
        description: Chat ID
        schema:
          type: string
    post:
      tags:
        - Chat Messages
      summary: Create a message
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                content:
                  type: string
                model:
                  type: string
              required:
                - content
        required: true
      responses:
        '201':
          description: message created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
        '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:
    MessageResponse:
      allOf:
        - $ref: '#/components/schemas/Message'
        - type: object
          required:
            - chat_id
          properties:
            chat_id:
              type: string
              format: uuid
            ai_response_status:
              type: string
              enum:
                - pending
                - complete
                - failed
              nullable: true
            ai_response_message:
              type: string
              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
    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
    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.

````