> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcargo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream message

> Stream a new message in a chat



## OpenAPI

````yaml https://api.getcargo.io/openapi.json post /ai/messages/stream
openapi: 3.1.0
info:
  title: Cargo API
  version: 1.0.0
  description: Cargo Platform API v1
servers:
  - url: https://api.getcargo.io/v1
    description: Cargo API
security:
  - bearerAuth: []
paths:
  /ai/messages/stream:
    post:
      tags:
        - AI - Messages
      summary: Stream message
      description: Stream a new message in a chat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chatUuid:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                  title: Chat UUID
                  description: Chat identifier.
                chatTrigger:
                  anyOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          const: connector
                        connectorUuid:
                          type: string
                        meta:
                          type: object
                          propertyNames:
                            type: string
                          additionalProperties: {}
                      required:
                        - type
                        - connectorUuid
                        - meta
                    - type: object
                      properties:
                        type:
                          type: string
                          const: draft
                      required:
                        - type
                    - type: object
                      properties:
                        type:
                          type: string
                          const: web_extension
                        url:
                          anyOf:
                            - type: string
                              format: uri
                            - type: 'null'
                      required:
                        - type
                        - url
                    - type: object
                      properties:
                        type:
                          type: string
                          const: app
                      required:
                        - type
                    - type: object
                      properties:
                        type:
                          type: string
                          const: workflow
                        uuid:
                          type: string
                        nodeUuid:
                          type: string
                        runUuid:
                          anyOf:
                            - type: string
                            - type: 'null'
                      required:
                        - type
                        - uuid
                        - nodeUuid
                        - runUuid
                  title: Chat trigger
                  description: Chat trigger configuration.
                uuid:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                  title: Message UUID
                  description: Message identifier.
                parts:
                  type: array
                  items: {}
                  title: Parts
                  description: Message parts.
                agentUuid:
                  title: Agent UUID
                  description: Agent identifier.
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                actions:
                  title: Actions
                  description: Actions available for the message.
                  type: array
                  items:
                    allOf:
                      - type: object
                        properties:
                          name:
                            anyOf:
                              - type: string
                              - type: 'null'
                          slug:
                            type: string
                          description:
                            anyOf:
                              - type: string
                              - type: 'null'
                          isBulkAllowed:
                            type: boolean
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - name
                          - slug
                          - description
                          - isBulkAllowed
                          - config
                      - anyOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: tool
                              toolUuid:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                              templateSlug:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                              waitUntilFinished:
                                type: boolean
                            required:
                              - kind
                              - toolUuid
                              - templateSlug
                              - waitUntilFinished
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: agent
                              agentUuid:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                              templateSlug:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                              waitUntilFinished:
                                type: boolean
                            required:
                              - kind
                              - agentUuid
                              - templateSlug
                              - waitUntilFinished
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: connector
                              integrationSlug:
                                type: string
                              connectorUuid:
                                anyOf:
                                  - type: string
                                  - type: 'null'
                              actionSlug:
                                type: string
                            required:
                              - kind
                              - integrationSlug
                              - connectorUuid
                              - actionSlug
                mcpClients:
                  title: MCP clients
                  description: MCP clients to use for the message.
                  type: array
                  items:
                    oneOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            const: custom
                          name:
                            type: string
                          url:
                            type: string
                          authentication:
                            anyOf:
                              - type: object
                                properties:
                                  issuedAt:
                                    type: string
                                  accessToken:
                                    type: string
                                  expiresIn:
                                    type: number
                                  refreshToken:
                                    type: string
                                  scope:
                                    type: string
                                  tokenType:
                                    type: string
                                  clientId:
                                    type: string
                                  clientSecret:
                                    type: string
                                required:
                                  - issuedAt
                                  - accessToken
                              - type: 'null'
                          disabledToolSlugs:
                            type: array
                            items:
                              type: string
                        required:
                          - kind
                          - name
                          - url
                          - authentication
                          - disabledToolSlugs
                      - type: object
                        properties:
                          kind:
                            type: string
                            const: connector
                          name:
                            type: string
                          connectorUuid:
                            type: string
                          integrationSlug:
                            type: string
                          disabledToolSlugs:
                            type: array
                            items:
                              type: string
                        required:
                          - kind
                          - name
                          - connectorUuid
                          - integrationSlug
                          - disabledToolSlugs
                    type: object
                resources:
                  title: Resources
                  description: Resources available for the message.
                  type: array
                  items:
                    anyOf:
                      - type: object
                        properties:
                          kind:
                            type: string
                            const: model
                          name:
                            anyOf:
                              - type: string
                              - type: 'null'
                          slug:
                            type: string
                          description:
                            anyOf:
                              - type: string
                              - type: 'null'
                          integrationSlug:
                            anyOf:
                              - type: string
                              - type: 'null'
                          modelUuid:
                            anyOf:
                              - type: string
                              - type: 'null'
                          filter:
                            anyOf:
                              - type: object
                                properties:
                                  conjonction:
                                    type: string
                                    enum:
                                      - or
                                      - and
                                  groups:
                                    type: array
                                    items: {}
                                required:
                                  - conjonction
                                  - groups
                              - type: 'null'
                          selectedColumnSlugs:
                            anyOf:
                              - type: array
                                items:
                                  type: string
                              - type: 'null'
                          limit:
                            anyOf:
                              - type: number
                              - type: 'null'
                          prompt:
                            anyOf:
                              - type: string
                              - type: 'null'
                          isReadOnly:
                            type: boolean
                        required:
                          - kind
                          - name
                          - slug
                          - description
                          - integrationSlug
                          - modelUuid
                          - filter
                          - selectedColumnSlugs
                          - limit
                          - prompt
                          - isReadOnly
                      - type: object
                        properties:
                          kind:
                            type: string
                            const: file
                          name:
                            anyOf:
                              - type: string
                              - type: 'null'
                          slug:
                            type: string
                          description:
                            anyOf:
                              - type: string
                              - type: 'null'
                          items:
                            type: array
                            items:
                              anyOf:
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: file
                                    fileUuid:
                                      type: string
                                  required:
                                    - kind
                                    - fileUuid
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: folder
                                    folderUuid:
                                      type: string
                                  required:
                                    - kind
                                    - folderUuid
                          prompt:
                            anyOf:
                              - type: string
                              - type: 'null'
                        required:
                          - kind
                          - name
                          - slug
                          - description
                          - items
                          - prompt
                capabilities:
                  title: Capabilities
                  description: Capabilities available for the message.
                  type: array
                  items:
                    oneOf:
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: sandbox
                          config:
                            type: object
                            properties:
                              scope:
                                type: string
                                enum:
                                  - chat
                                  - agent
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: context
                          config:
                            type: object
                            properties:
                              isReadOnly:
                                type: boolean
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: app
                          config:
                            type: object
                            properties:
                              appUuid:
                                type: string
                              canPromote:
                                type: boolean
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: code
                          config:
                            type: object
                            properties:
                              connectorUuid:
                                type: string
                              repository:
                                type: string
                              defaultBranch:
                                type: string
                              rootDirectory:
                                type: string
                              env:
                                type: array
                                items:
                                  oneOf:
                                    - type: object
                                      properties:
                                        key:
                                          type: string
                                          minLength: 1
                                        type:
                                          type: string
                                          const: public
                                        value:
                                          type: string
                                      required:
                                        - key
                                        - type
                                        - value
                                    - type: object
                                      properties:
                                        key:
                                          type: string
                                          minLength: 1
                                        type:
                                          type: string
                                          const: secret
                                        secretValue:
                                          type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - encryption
                                            isEncrypted:
                                              type: boolean
                                            value:
                                              type: string
                                          required:
                                            - type
                                            - isEncrypted
                                            - value
                                      required:
                                        - key
                                        - type
                                        - secretValue
                                  type: object
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: document
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: webSearch
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: fileSearch
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: documentationSearch
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: codeInterpreter
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: memory
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                      - type: object
                        properties:
                          slug:
                            type: string
                            const: suggestedActions
                          config:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        required:
                          - slug
                          - config
                    type: object
                systemPrompt:
                  title: System prompt
                  description: System prompt for the message.
                  type: string
                contextPrompt:
                  title: Context prompt
                  description: Additional context for the message.
                  type: string
                withReasoning:
                  title: With reasoning
                  description: Whether to include reasoning.
                  type: boolean
                temperature:
                  title: Temperature
                  description: Sampling temperature.
                  type: number
                maxSteps:
                  title: Max steps
                  description: Maximum number of steps.
                  type: number
                languageModelSlug:
                  title: Language model slug
                  description: Language model identifier.
                  type: string
                integrationSlug:
                  title: Integration slug
                  description: Integration identifier.
                  type: string
                connectorUuid:
                  title: Connector UUID
                  description: Connector identifier.
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
              required:
                - chatUuid
                - chatTrigger
                - uuid
                - parts
              additionalProperties: false
              title: Request body
              description: Request body schema.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      errorMessage:
                        type: string
                        title: Error message
                        description: Error message when the request fails.
                    required:
                      - errorMessage
                    additionalProperties: false
                  - type: object
                    properties:
                      reason:
                        type: string
                        enum:
                          - lastMessageNotFinished
                        title: Reason
                        description: Failure reason.
                    required:
                      - reason
                    additionalProperties: false
                title: Response body
                description: Response body schema.
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````