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

# Enviar mensagem

> Mismo contrato PIV1 (`type` + `payload`). El id de la conversación va en la URL. Con API Key, `senderExternalUserId` es obligatorio. Alcance: **chat:messages:send**. Prefiera `POST /v1/chat/messages` si quiere `to`.



## OpenAPI

````yaml /es/chat-api/api-reference/openapi-chat.json post /v1/chat/conversations/{id}/messages
openapi: 3.0.3
info:
  title: Notifique API Chat
  description: >-
    Chat in-app: apps, usuarios, JWT, conversaciones y mensajes. Autentica con
    `Authorization: Bearer sk_live_...` (backend) o JWT del usuario. No envíes
    `x-workspace-id`.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Produção
security:
  - ntfChatBearerAuth: []
  - ntfChatApiKeyHeader: []
tags:
  - name: Chat Apps
    description: CRUD de Chat Apps e rotação do signing secret
  - name: Chat Users
    description: Usuários, JWT e agentes
  - name: Chat Conversations
    description: Conversas 1:1, grupos e membros
  - name: Chat Messages
    description: Envio, listagem e exclusão
  - name: Chat Blocks
    description: Bloqueo entre usuarios de la misma Chat App
paths:
  /v1/chat/conversations/{id}/messages:
    post:
      tags:
        - Chat Messages
      summary: Enviar mensagem
      description: >-
        Mismo contrato PIV1 (`type` + `payload`). El id de la conversación va en
        la URL. Con API Key, `senderExternalUserId` es obligatorio. Alcance:
        **chat:messages:send**. Prefiera `POST /v1/chat/messages` si quiere
        `to`.
      operationId: ntfChat_postV1ChatConversationsIdMessages
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfChat_SendMessageScopedRequest'
            examples:
              text:
                summary: Texto
                value:
                  type: text
                  payload:
                    message: Hola Alice, tu pedido salió a entrega.
                  senderExternalUserId: agent:clxxuser...
                  clientMessageId: msg_text_001
              image:
                summary: Imagen
                value:
                  type: image
                  payload:
                    mediaUrl: https://cdn.tusitio.com/comprobante.png
                    message: Comprobante de entrega
                  senderExternalUserId: user_alice
              audio:
                summary: Audio
                value:
                  type: audio
                  payload:
                    mediaUrl: https://cdn.tusitio.com/nota.ogg
                  senderExternalUserId: user_bob
              file:
                summary: Archivo
                value:
                  type: file
                  payload:
                    mediaUrl: https://cdn.tusitio.com/contrato.pdf
                    message: Contrato firmado
                  senderExternalUserId: agent:clxxuser...
              jwt:
                summary: JWT del miembro
                value:
                  type: text
                  payload:
                    message: Ya llegué
              reply:
                summary: Respuesta (reply)
                value:
                  type: text
                  payload:
                    message: De acuerdo, gracias
                  senderExternalUserId: agent:clxxuser...
                  replyToId: clxxmsg...
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/NtfChat_Message'
                  idempotent:
                    type: boolean
        '401':
          description: API Key ou JWT ausente/inválido.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
        '402':
          description: Workspace bloqueado ou créditos insuficientes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
        '403':
          description: >-
            Sem escopo, origem não permitida ou JWT sem permissão
            (CHAT_CLIENT_CREATE_DISABLED).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfChat_ErrorResponse'
components:
  schemas:
    NtfChat_SendMessageScopedRequest:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
            - image
            - audio
            - file
          example: text
        payload:
          type: object
          description: Contenido PIV1. Texto en message; media en mediaUrl (HTTPS).
          properties:
            message:
              type: string
              example: Olá
            caption:
              type: string
            mediaUrl:
              type: string
              format: uri
              example: https://cdn.example.com/a.png
            replyToId:
              type: string
            clientMessageId:
              type: string
        senderExternalUserId:
          type: string
          description: Obligatorio con API Key. externalUserId de USER o AGENT.
          example: user_alice
        clientMessageId:
          type: string
          example: msg_001
        replyToId:
          type: string
        body:
          type: string
          description: Legado. Prefiera payload.message.
        mediaUrl:
          type: string
          description: Legado. Prefiera payload.mediaUrl.
    NtfChat_Message:
      type: object
      properties:
        id:
          type: string
          example: clxxmsg...
        conversationId:
          type: string
          example: cnv_xxxxx
        type:
          type: string
          enum:
            - TEXT
            - IMAGE
            - AUDIO
            - FILE
          example: TEXT
        body:
          type: string
          example: Oi, Alice
        createdAt:
          type: string
          format: date-time
        senderId:
          type: string
        mediaUrl:
          type: string
          nullable: true
          example: null
        replyToId:
          type: string
          nullable: true
        clientMessageId:
          type: string
          nullable: true
          example: msg_text_001
        deletedAt:
          type: string
          format: date-time
          nullable: true
        sender:
          type: object
          properties:
            id:
              type: string
            externalUserId:
              type: string
              example: user_alice
            name:
              type: string
              nullable: true
            kind:
              type: string
              enum:
                - USER
                - AGENT
              example: USER
    NtfChat_ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        code:
          type: string
        message:
          type: string
  securitySchemes:
    ntfChatBearerAuth:
      type: http
      scheme: bearer
      description: API Key `sk_live_…` / `sk_test_…` ou JWT do usuário do chat (`eyJ…`).
    ntfChatApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````