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

# Send a message to a debtor

> Send a message to a debtor



## OpenAPI

````yaml /openapi3.json post /v1/messages
openapi: 3.0.0
info:
  title: API Endpoints
  description: >-
    This page allows you to explore the available API endpoints. Select a
    resource (e.g. debtors) and an endpoint (e.g. /v1/debtors) to inspect an
    example response and available parameters. An authorization header
    containing a Bearer token is required, see
    [Authentication](/authentication/authorization).
  version: 1.0.0
servers:
  - url: https://api.paytsoftware.com
    description: Production
  - url: https://demo-api.paytsoftware.com
    description: Demo / testing
security:
  - bearerAuth: []
tags:
  - name: administrations
    description: Operations about administrations
  - name: companies
    description: Operations about companies
  - name: contacts
    description: Operations about contacts
  - name: credit_cases
    description: Operations about credit_cases
  - name: debtors
    description: Operations about debtors
  - name: files
    description: Operations about files
  - name: orders
    description: Operations about orders
  - name: order_lines
    description: Operations about order_lines
  - name: invoices
    description: Operations about invoices
  - name: messages
    description: Operations about messages
  - name: notes
    description: Operations about notes
  - name: notifications
    description: Operations about notifications
  - name: payments
    description: Operations about payments
  - name: payment_conditions
    description: Operations about payment_conditions
  - name: payment_plans
    description: Operations about payment_plans
  - name: psp_mandates
    description: Operations about psp_mandates
  - name: psp_transactions
    description: Operations about psp_transactions
  - name: sign_up
    description: Operations about sign_ups
  - name: tasks
    description: Operations about tasks
  - name: vat_rates
    description: Operations about vat_rates
paths:
  /v1/messages:
    post:
      tags:
        - messages
      summary: Send a message to a debtor
      description: Send a message to a debtor
      operationId: postV1Messages
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postV1Messages'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/postV1Messages'
        required: true
      responses:
        '200':
          description: Message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerApi_V1_MessageEntity'
        '401':
          description: Not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerApi_ErrorEntity'
        '403':
          description: Access not authorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerApi_ErrorEntity'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerApi_ErrorEntity'
        '422':
          description: Validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerApi_ErrorEntity'
components:
  schemas:
    postV1Messages:
      type: object
      properties:
        administration_id:
          type: string
          description: Administration identifier
        debtor_number:
          type: string
          description: Number of the debtor to send a message to
        debtor_identifier:
          type: string
          description: Identifier of the debtor to send a message to
        invoice_number:
          type: string
          description: Number of the invoice to send a message to
        invoice_identifier:
          type: string
          description: Identifier of the invoice to send a message to
        credit_case_number:
          type: string
          description: Number of the credit case to send a message to
        message:
          type: object
          properties:
            body:
              type: string
              description: Message body
            subject:
              type: string
              description: Subject of message
            email:
              type: string
              description: |-
                Email address the message is sent to. When not provided,
                                                                               the message will be sent to the debtor email address,
                                                                               if present
            cc_email:
              type: string
              description: CC email addresses separated by commas
            bcc_email:
              type: string
              description: BCC email addresses separated by commas
            attachments:
              type: array
              description: Multipart files containing message attachments
              items:
                type: string
                format: binary
          required:
            - body
            - subject
      required:
        - administration_id
        - message
      description: Send a message to a debtor
    CustomerApi_V1_MessageEntity:
      type: object
      properties:
        sender_type:
          type: string
          description: Sender type (creditor|debtor)
        subject:
          type: string
          description: Message subject
        read_by_user:
          allOf:
            - $ref: '#/components/schemas/CustomerApi_V1_UserEntity'
          description: User who marked the message as read
        administration_id:
          type: string
          description: Owning administration identifier
        credit_case_id:
          type: string
          description: Associated credit_case identifier
        debtor_id:
          type: string
          description: Associated debtor identifier
        id:
          type: string
          description: Unique identifier
        invoice_id:
          type: string
          description: Associated invoice identifier
        content:
          type: string
          description: The content of the message (request with the 'fields' parameter)
        sent_at:
          type: string
          format: date-time
          description: Timestamp at which the message was sent
        received_at:
          type: string
          format: date-time
          description: Timestamp at which the message was received
        read_at:
          type: string
          format: date-time
          description: >-
            Timestamp at which the message was first read (please note that for
            some mail clients this field is not filled when an email is read)
        updated_at:
          type: string
          format: date-time
          description: Timestamp at which the message was last updated
      required:
        - sender_type
        - administration_id
        - id
        - updated_at
      description: CustomerApi_V1_MessageEntity model
    CustomerApi_ErrorEntity:
      type: object
      properties:
        code:
          type: string
          description: Error code
        message:
          type: string
          description: Error message
      required:
        - code
        - message
      description: CustomerApi_ErrorEntity model
    CustomerApi_V1_UserEntity:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier
        name:
          type: string
          description: Name
        email_address:
          type: string
          description: Email address
      required:
        - id
        - name
        - email_address
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        OAuth2 access token or static API token. See
        [Authorization](/authentication/authorization) for how to obtain one.

````