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

# Reply to the client

> Sends a message in the request's conversation, as from Messages in the portal: the client sees it in the conversation and gets the same notifications. With `Idempotency-Key`, a request repeated within 10 minutes returns the message sent the first time (200) and sends nothing else. Replies count toward the same limit as the portal's: 20 per minute and 200 per hour per account. Requires the `leads:read` and `leads:write` abilities.



## OpenAPI

````yaml en/openapi.json POST /leads/{lead}/messages
openapi: 3.1.2
info:
  title: Housera API
  version: 1.0.0
  description: >-
    Publish and manage real estate listings on Housera from your CRM or your own
    application, under the same rules as the form on the Housera portal.
servers:
  - url: https://staging.housera.ro/api/v1
    description: 'Sandbox (staging): test data, same rules as production.'
  - url: https://housera.ro/api/v1
    description: 'Production: the real listings on housera.ro.'
security:
  - bearer: []
tags:
  - name: Your listings
  - name: Photos
  - name: Events
  - name: Vocabulary
  - name: Connect with Housera
  - name: Client requests
  - name: The company and its team
  - name: Marketing mandates
  - name: Viewings
  - name: Projects
  - name: Partnerships
  - name: API key
  - name: Statistics
paths:
  /leads/{lead}/messages:
    post:
      tags:
        - Client requests
      summary: Reply to the client
      description: >-
        Sends a message in the request's conversation, as from Messages in the
        portal: the client sees it in the conversation and gets the same
        notifications. With `Idempotency-Key`, a request repeated within 10
        minutes returns the message sent the first time (200) and sends nothing
        else. Replies count toward the same limit as the portal's: 20 per minute
        and 200 per hour per account. Requires the `leads:read` and
        `leads:write` abilities.
      operationId: v1.leads.messages.store
      parameters:
        - name: lead
          in: path
          required: true
          schema:
            type: integer
          description: >-
            The request ID, from the list or from a `lead.created` or
            `lead.updated` event.
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
          description: >-
            A unique value for this creation (for example a UUID). A request
            repeated with the same value within 10 minutes returns what the
            first one created, without creating anything else: the listing for
            `POST /listings`, the contact for `POST /leads`, the message for
            `POST /leads/{lead}/messages`. For listings and messages, only the
            first 64 characters count.
        - name: locale
          in: query
          required: false
          schema:
            type: string
            enum:
              - ro
              - en
            default: en
          example: en
          description: >-
            The response language, `ro` or `en`. It changes error messages
            (`title`, `detail`), labels and, when the listing has an approved
            translation in that language, its title and description. Codes are
            the same in every language. It takes precedence over
            `Accept-Language` and over the account's language.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  maxLength: 2000
                  description: Message.
              required:
                - body
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/LeadMessageApiResource'
                    description: The result of the request.
                required:
                  - data
          description: >-
            The message had already been sent with the same `Idempotency-Key`.
            The response holds it.
        '201':
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/LeadMessageApiResource'
                    description: The result of the request.
                required:
                  - data
          description: The message was sent. The response holds it.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request body is not valid JSON (`malformed_json`).
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The key is missing, revoked or expired (`unauthenticated`).
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The key lacks the abilities required (`missing_ability`), or the
            conversation belongs to another account (`conversation_not_held`).
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The request does not exist or the key has no access to it
            (`not_found`).
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The request has no conversation (`no_conversation`), the
            conversation is read only (`conversation_closed`), one side blocked
            the other (`conversation_blocked`), or the same message was just
            sent (`message_duplicate`).
        '413':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request body is larger than 1 MB (`payload_too_large`).
        '415':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            The request body isn't declared as JSON (`unsupported_media_type`).
            Send it with `Content-Type: application/json`.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ValidationProblem'
          description: >-
            The data fails the rules: one entry per field in `errors[]`, each
            with a stable `code`.
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            Too many requests. Try again after the number of seconds in
            `Retry-After`.
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            Housera has temporarily paused writes through the API
            (`api_writes_paused`). Try again after the number of seconds in
            `Retry-After`.
components:
  schemas:
    LeadMessageApiResource:
      type: object
      properties:
        id:
          type: integer
          description: >-
            The message's id. It is the same in the `lead.message_received`
            event (`message_id`).
        direction:
          type: string
          enum:
            - out
            - in
          description: >-
            `in` for a message from the client, `out` for one sent from the
            listing's side (by you or by a colleague who handled the listing
            before).
        author:
          type:
            - object
            - 'null'
          properties:
            name:
              type: string
              description: Name.
          required:
            - name
          description: >-
            Who wrote the message, with the name as the portal's conversation
            shows it.
        body:
          type:
            - string
            - 'null'
          description: The message's text. `null` for a deleted message.
        kind:
          type:
            - string
            - 'null'
          enum:
            - viewing_request
            - null
          description: >-
            `viewing_request` for the message with which the client asked for a
            viewing, otherwise `null`.
        deleted:
          type: boolean
          description: >-
            `true` when the author deleted the message. The message keeps its
            place, with no text.
        edited_at:
          type:
            - string
            - 'null'
          description: >-
            When the message was last edited (ISO 8601), `null` if it was never
            edited.
        read_at:
          type:
            - string
            - 'null'
          description: >-
            When the other side read the message (ISO 8601), `null` until they
            read it.
        created_at:
          type:
            - string
            - 'null'
          description: When the message was sent (ISO 8601).
      required:
        - id
        - direction
        - author
        - body
        - kind
        - deleted
        - edited_at
        - read_at
        - created_at
      title: LeadMessageApiResource
    Problem:
      type: object
      title: Problem
      properties:
        type:
          type: string
          format: uri
          description: The URL of the problem type (RFC 9457).
        title:
          type: string
          description: A short summary of the problem, in the request's language.
        status:
          type: integer
          description: The HTTP status code.
        code:
          type: string
          description: >-
            The stable code of the refusal, the one to handle the error by (the
            list is on the Errors page).
        detail:
          type: string
          description: The explanation, in the request's language.
        existing:
          type: object
          properties:
            code:
              type: string
              description: The existing listing's public code.
            external_ref:
              type:
                - string
                - 'null'
              description: >-
                Your ID for the existing listing, if you set it with `PUT
                /listings/ref/{ref}`. Otherwise `null`.
          required:
            - code
            - external_ref
          description: >-
            Only on `409 duplicate_listing`: the listing you already have for
            the same property.
      required:
        - type
        - title
        - status
        - code
        - detail
    ValidationProblem:
      type: object
      title: ValidationProblem
      properties:
        type:
          type: string
          format: uri
          description: The URL of the problem type (RFC 9457).
        title:
          type: string
          description: A short summary of the problem, in the request's language.
        status:
          type: integer
          description: 'The HTTP status code: `422`.'
        errors:
          type: array
          items:
            type: object
            properties:
              pointer:
                type: string
                description: The field it refers to, as a JSON Pointer (`/features/2`).
              code:
                type: string
                description: >-
                  The rule that failed, as a stable code (the list is on the
                  Errors page).
              detail:
                type: string
                description: >-
                  The explanation, in the request's language. The wording can
                  change, so handle the error by `code`.
            required:
              - pointer
              - code
              - detail
          description: One entry for each field that fails the rules.
      required:
        - type
        - title
        - status
        - errors
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <key>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.