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

# Post a merchant message on a case



## OpenAPI

````yaml https://api.prets.io/v1/openapi.json post /v1/cases/{caseId}/messages
openapi: 3.1.0
info:
  title: Prets API
  version: 1.0.0
servers:
  - url: https://api.prets.app
security:
  - bearerAuth: []
paths:
  /v1/cases/{caseId}/messages:
    post:
      summary: Post a merchant message on a case
      parameters:
        - schema:
            type: string
            pattern: ^cas_[0-9A-HJKMNP-TV-Z]{26}$
            description: Platform case id (`cas_{ULID}`)
            example: cas_01ARZ3NDEKTSV4RRFFQ69G5AV
          required: true
          description: Platform case id (`cas_{ULID}`)
          name: caseId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCaseMessage'
      responses:
        '201':
          description: Message posted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostCaseMessageResponse'
        '400':
          description: Bad request — invalid path parameters
        '401':
          description: Unauthorized - authentication required
        '403':
          description: Forbidden
        '404':
          description: Case not found
        '409':
          description: Case is closed and cannot accept new messages
        '422':
          description: Validation error — invalid JSON body
        '500':
          description: Internal server error
components:
  schemas:
    CreateCaseMessage:
      type: object
      properties:
        messageId:
          type: string
          pattern: ^csmsg_[0-9A-HJKMNP-TV-Z]{26}$
          description: >-
            Client-generated id (`csmsg_{ULID}`). When provided the server uses
            it as the canonical message id, enabling optimistic UI.
          example: csmsg_01K3P7YQ35N9VZC6SD1WYPEJG2
        body:
          type: string
          minLength: 1
          maxLength: 32000
          description: >-
            Plain-text message body (max 32,000 characters, per Salesforce long
            text area)
          example: The customer asked to move the appointment to next week.
      required:
        - body
      additionalProperties: false
      description: >-
        Opening or reply message body. Optional client ULID for idempotent
        create.
    PostCaseMessageResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CaseMessage'
      required:
        - data
      description: The message that was posted
    CaseMessage:
      type: object
      properties:
        messageId:
          type: string
          pattern: ^csmsg_[0-9A-HJKMNP-TV-Z]{26}$
          description: Platform case message id (`csmsg_{ULID}`)
          example: csmsg_01ARZ3NDEKTSV4RRFFQ69G5AV
        body:
          type: string
          description: Plain-text message body. Tombstones use `[verwijderd]`.
          example: We have received your request.
        author:
          $ref: '#/components/schemas/CaseMessageAuthor'
        createdAt:
          type: string
          format: date-time
          description: When the message was posted (ISO 8601)
          example: '2024-12-31T14:30:00.000Z'
        redactedAt:
          type: string
          format: date-time
          description: When ops erased the body in Salesforce. Present only on tombstones.
          example: '2026-08-16T07:10:00.000Z'
      required:
        - messageId
        - body
        - author
        - createdAt
      additionalProperties: false
      description: >-
        One message in a Case conversation. Immutable through the API; erasure
        is a tombstone.
    CaseMessageAuthor:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CaseMessageAuthorType'
        contactId:
          type: string
          pattern: ^con_[0-9A-HJKMNP-TV-Z]{26}$
          description: Platform contact id of a merchant author; omitted for Prets replies
          example: con_01HYQ4R7T0WKM2XB8ZFPC3NDV9
        name:
          type: string
          description: Display name of a merchant author; omitted for Prets replies
          example: Jane Advisor
      required:
        - type
      additionalProperties: false
      description: >-
        Who wrote a Case message. Merchant authors are identifiable; Prets
        replies are institutional.
    CaseMessageAuthorType:
      type: string
      enum:
        - merchant
        - prets
      description: >-
        Which side wrote the message. `agent` and `system` are reserved for
        later additive values.
      example: merchant
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````