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

# Add Document Note

> Agrega una nota con comentario y/o archivo adjunto a un documento.



## OpenAPI

````yaml POST /documents/{reference}/notes
openapi: 3.1.0
info:
  title: Payana Accounts Payable API
  description: >-
    API pública para gestionar cuentas por pagar (payments) y beneficiarios
    (beneficiaries) en Payana, incluyendo notificaciones por webhooks cuando se
    procesan pagos.
  version: 1.0.0
servers:
  - url: https://api.prod.payana.cloud/public/api/v1
    description: Production
  - url: https://api.develop.payana.cloud/public/api/v1
    description: Develop
security:
  - apiKeyAuth: []
tags:
  - name: Payments
    description: Crear y listar pagos
  - name: Beneficiaries
    description: Crear, listar y consultar beneficiarios
  - name: Webhooks
    description: Eventos de webhooks enviados por Payana
  - name: Banks
    description: Listar y consultar bancos
  - name: Transactions In
    description: Transacciones entrantes (polling, mismo formato que webhooks)
  - name: Documents
    description: Listar, consultar y operar documentos (cuentas por pagar)
  - name: DIAN Events
    description: >-
      Encolar eventos DIAN (030 Acuse de recibo, 031 Reclamo, 032 Recibo del
      bien, 033 Aceptación expresa, 034 Aceptación tácita) para documentos
      identificados por CUFE. El procesamiento es asíncrono.
  - name: Fiscal Sync
    description: >-
      Disparar y consultar sincronización de documentos fiscales desde el SAT
      (México) o la DIAN (Colombia).
  - name: Workflow Steps
    description: >-
      Resolver el paso en que está parado un documento dentro de su flujo:
      aprobación, clasificación o etiquetado.
paths:
  /documents/{reference}/notes:
    post:
      tags:
        - Documents
      summary: Add note to a document
      description: >-
        Agrega una nota a un documento. Una nota puede tener un comentario de
        texto, un archivo adjunto, o ambos.


        Hay dos formas de enviar la nota:


        - **JSON (`application/json`):** enviá `comment` y/o un `file_path` (URL
        pública de un archivo ya alojado).

        - **Multipart (`multipart/form-data`):** enviá `comment` y/o el archivo
        binario en el campo `file`; el archivo se sube y su URL se devuelve en
        `file_path`.


        Reglas:


        - Debés enviar al menos `comment` o un archivo (`file_path` o `file`);
        de lo contrario se devuelve `422`.

        - Si enviás `file_name` también debés enviar `file_path`.

        - Extensiones permitidas para adjuntos: `pdf`, `jpg`, `jpeg`, `png`.

        - Tamaño máximo del archivo: 5 MB.

        - `comment` admite hasta 5000 caracteres.


        Las notas creadas se devuelven en `GET /documents/{reference}` (siempre)
        y en `GET /documents` cuando pides `fields=notes`.
      parameters:
        - name: reference
          in: path
          required: true
          description: >-
            Referencia interna del documento en Payana (UUID, ej.
            `aaea7db4-647c-4d92-9f86-89e34a68e1aa`).
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentNoteRequest'
            example:
              comment: Documento revisado y aprobado por el área contable.
              file_path: https://storage.payana.cloud/documents/notes/soporte.pdf
          multipart/form-data:
            schema:
              type: object
              properties:
                comment:
                  type: string
                  maxLength: 5000
                  description: Comentario de texto de la nota.
                file:
                  type: string
                  format: binary
                  description: Archivo adjunto (pdf, jpg, jpeg, png; máx. 5 MB).
      responses:
        '201':
          description: Note created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicNote'
              example:
                comment: Documento revisado y aprobado por el área contable.
                file_path: https://storage.payana.cloud/documents/notes/soporte.pdf
                file_name: soporte.pdf
                created_by:
                  name: Integración ERP
                created_at: '2026-06-12T13:05:00.000+00:00'
                updated_at: '2026-06-12T13:05:00.000+00:00'
        '400':
          description: >-
            Bad request / validation error (ej. `file_path` con un esquema o URL
            inválida)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Document not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Unprocessable entity (ej. ni `comment` ni archivo; extensión no
            soportada; `file_name` sin `file_path`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateDocumentNoteRequest:
      type: object
      description: >-
        Cuerpo para crear una nota en formato JSON. Debe incluir al menos
        `comment` o `file_path`.
      properties:
        comment:
          type: string
          maxLength: 5000
          description: Comentario de texto de la nota.
        file_path:
          type: string
          format: uri
          maxLength: 2048
          description: >-
            URL pública (http/https) de un archivo ya alojado. Extensiones
            permitidas: `pdf`, `jpg`, `jpeg`, `png`.
        file_name:
          type: string
          maxLength: 255
          description: >-
            Nombre del archivo. Si se provee, `file_path` es obligatorio. Si se
            omite, se infiere desde `file_path`.
    PublicNote:
      type: object
      description: Nota pública de un documento (comentario y/o archivo adjunto).
      properties:
        comment:
          type:
            - string
            - 'null'
          description: Comentario de texto de la nota.
        file_path:
          type:
            - string
            - 'null'
          description: URL del archivo adjunto, si la nota tiene uno.
        file_name:
          type:
            - string
            - 'null'
          description: Nombre del archivo adjunto, si la nota tiene uno.
        created_by:
          type: object
          description: Autor de la nota.
          properties:
            name:
              type:
                - string
                - 'null'
              description: Nombre del autor de la nota.
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorObject'
      example:
        success: false
        error:
          code: VALIDATION_ERROR
          message: The request contains invalid data
          details:
            amount:
              - Amount must be greater than 0
            beneficiary_id:
              - Beneficiary does not exist
    ErrorObject:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
        details:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetails'
            - type: 'null'
    ErrorCode:
      type: string
      enum:
        - VALIDATION_ERROR
        - UNAUTHORIZED
        - FORBIDDEN
        - NOT_FOUND
        - CONFLICT
        - RATE_LIMITED
        - INTERNAL_ERROR
    ErrorDetails:
      type: object
      additionalProperties:
        type: array
        items:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: api-key
      description: API key provista por Payana.

````