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

# Create a comment

> Create a comment attached to a client, invoice, or credit note. At least one of clientId, invoiceId, or creditNoteId must be provided. If invoiceId or creditNoteId is provided, the clientId is resolved automatically. The comment author is the account linked to the API key.



## OpenAPI

````yaml https://public.leanpay.fr/openapi/leanpay_api_documentation.swagger.yaml post /comments
openapi: 3.1.1
info:
  version: 1.0.0
  title: LeanPay Api documentation
  contact:
    email: integration@leanpay.fr
servers:
  - url: https://api.leanpay.fr/v1/public
security: []
tags:
  - name: clients
    description: Routes related to clients
  - name: invoices
    description: Routes related to invoices
  - name: credit-notes
    description: Routes related to credit notes
  - name: misc-operations
    description: Routes related to misc operations
  - name: contacts
    description: Routes related to client contacts
  - name: addresses
    description: Routes related to client addresses
  - name: payments
    description: Routes related to invoice payments
  - name: portal-payments
    description: >-
      Routes related to portal payments (online payments made by debtors from
      the customer portal)
  - name: paybacks
    description: Routes related to credit note paybacks
  - name: links
    description: Routes related to invoice/credit note links
  - name: comments
    description: Routes related to comments
  - name: deleted-elements
    description: Routes related to deleted elements
  - name: client-properties
    description: Routes related to client properties
paths:
  /comments:
    post:
      tags:
        - comments
      summary: Create a comment
      description: >-
        Create a comment attached to a client, invoice, or credit note. At least
        one of clientId, invoiceId, or creditNoteId must be provided. If
        invoiceId or creditNoteId is provided, the clientId is resolved
        automatically. The comment author is the account linked to the API key.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCommentRequest'
      responses:
        '201':
          description: Created comment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCommentResponse'
        '400':
          description: >-
            Invalid request body. Possible causes: missing target (clientId,
            invoiceId, or creditNoteId), empty text, invalid UUID, mentioned
            email does not resolve to any account in the tenant, or mentioned
            account manager is not assigned to the target client.
        '403':
          description: API key has no linked account — regenerate the API key
        '404':
          description: Referenced client, invoice, or credit note not found
      security:
        - authorization: []
components:
  schemas:
    CreateCommentRequest:
      type: object
      properties:
        text:
          type: string
          description: >-
            Plain text content of the comment. Use @user@example.com to mention
            an active and notify them. The mentioned email must resolve to an
            active account for the client. Example: "Relance effectuée par
            @alice@example.com".
          examples:
            - Relance effectuée par @alice@example.com
        clientId:
          type: string
          format: uuid
          description: ID of the client to attach the comment to
        invoiceId:
          type: string
          format: uuid
          description: >-
            ID of the invoice to attach the comment to (clientId is resolved
            from the invoice)
        creditNoteId:
          type: string
          format: uuid
          description: >-
            ID of the credit note to attach the comment to (clientId is resolved
            from the credit note)
      required:
        - text
    CreateCommentResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
  securitySchemes:
    authorization:
      type: apiKey
      name: Authorization
      in: header

````