> ## Documentation Index
> Fetch the complete documentation index at: https://architect-d889a35e-sync-pr-4286.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Send audience message

> Send a message to the audience draft editor.



## OpenAPI

````yaml /services/external-actor-gateway-service/openapi.yaml post /v0/pages/{page_id}/audiences/{audience_id}/messages
openapi: 3.1.0
info:
  contact:
    email: api-support@tryarchitect.com
    name: Architect
    url: https://tryarchitect.com
  description: >-
    The Customer API lets you manage pages, audiences, persons, accounts,
    topics, page links, analytics, and webhook subscriptions.


    ## Authentication

    Send your API key in the `x-api-key` header on every request.


    ## Terminology

    - **Page**: a top-level customer experience container.

    - **Audience**: a targeted experience that belongs to a Page.

    - **Version**: a generated or editable Audience state, including drafts and
    published versions.

    - **Person**: an individual contact record.


    ## Pagination

    Collection endpoints use `limit` and `cursor`. When another page is
    available, pass the returned `nextCursor` value back as `cursor`. When there
    are no more results, `nextCursor` is `null`.


    ## Webhooks

    Create subscriptions with `POST /v0/webhook_subscriptions`. The
    `signingSecret` is returned only once, when the subscription is created, so
    store it securely.


    Webhook deliveries are sent as `POST` requests with these headers:

    - `X-Webhook-Signature-256`: HMAC-SHA256 of the raw request body, prefixed
    with `sha256=`

    - `X-Webhook-Timestamp`: Unix timestamp in milliseconds used when the
    signature was generated


    Webhook deliveries are at-least-once. Use `eventId` for idempotency and
    return a `2xx` response quickly after persisting work.


    Example delivery body:

    ```json

    {
      "timestamp": "2024-01-15T10:30:00.000Z",
      "eventId": "event_01j5k9m7n8p9q2r3s4t5v6w7x8",
      "payload": {
        "type": "page.version.created",
        "pageId": "page_01j5k9m7n8p9q2r3s4t5v6w7x8",
        "versionId": "<audience_version_id>",
        "createdAt": "2024-01-15T10:30:00.000Z"
      }
    }

    ```


    Version webhook event names currently use the internal `page.version.*`
    namespace. In Customer API terms, these correspond to Audience version
    lifecycle events.
  title: Architect - Customer API
  version: 0.0.1
servers:
  - description: Production environment
    url: https://api.tryarchitect.com
  - description: Beta environment
    url: https://api.beta.tryarchitect.com
  - description: Local environment
    url: http://localhost:25001
security:
  - apiKey: []
tags:
  - name: Pages
    description: Page management operations
  - name: Analytics
    description: Analytics and session read operations
  - name: Audiences
    description: Audience management operations
  - name: Audience Versions
    description: Audience version management operations
  - name: Audience Messages
    description: Audience message editing operations
  - name: Page Links
    description: Page link management operations
  - name: Assets
    description: Asset management operations
  - name: Persons
    description: Person management operations
  - name: Person Logs
    description: Person log ingestion operations
  - name: Accounts
    description: Account management operations
  - name: Account Activity
    description: Merged account and linked person activity operations
  - name: Account Logs
    description: Account log ingestion operations
  - name: Topics
    description: Knowledge topic management operations
  - name: Topic Entries
    description: Knowledge topic entry management operations
  - name: Webhook Subscriptions
    description: Webhook subscription management operations
paths:
  /v0/pages/{page_id}/audiences/{audience_id}/messages:
    post:
      tags:
        - Audience Messages
      summary: Send audience message
      description: Send a message to the audience draft editor.
      operationId: sendAudienceMessage
      parameters:
        - $ref: '#/components/parameters/PageIdPath'
        - $ref: '#/components/parameters/AudienceIdPath'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
        required: true
      responses:
        '202':
          description: Request accepted for processing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostMessage'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '409':
          $ref: '#/components/responses/ConflictError'
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailableError'
components:
  parameters:
    PageIdPath:
      in: path
      name: page_id
      description: page_id parameter
      required: true
      schema:
        type: string
    AudienceIdPath:
      in: path
      name: audience_id
      description: audience_id parameter
      required: true
      schema:
        type: string
  schemas:
    CreateMessageRequest:
      type: object
      properties:
        message:
          type: string
          minLength: 1
          maxLength: 50000
        clientMessageId:
          type: string
          minLength: 1
          maxLength: 100
        selectedElement:
          type: object
          properties:
            blockId:
              type: string
              maxLength: 200
            elementId:
              type: string
              maxLength: 200
            elementType:
              type: string
              maxLength: 100
            blockTitle:
              anyOf:
                - type: string
                  maxLength: 1000
                - type: 'null'
            content:
              anyOf:
                - type: string
                  maxLength: 1000
                - type: 'null'
            selectedText:
              anyOf:
                - type: string
                  maxLength: 1000
                - type: 'null'
            componentIndex:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            jsonPath:
              anyOf:
                - type: string
                  maxLength: 500
                - type: 'null'
          required:
            - blockId
            - elementId
            - elementType
            - blockTitle
            - content
          additionalProperties: false
      required:
        - message
      additionalProperties: false
    PostMessage:
      type: object
      properties:
        accepted:
          type: boolean
          const: true
        audienceId:
          type: string
        clientMessageId:
          type: string
        versionId:
          type: string
      required:
        - accepted
        - audienceId
        - clientMessageId
        - versionId
      additionalProperties: false
    Error:
      properties:
        code:
          enum:
            - UNAUTHORIZED
            - FORBIDDEN
            - NOT_FOUND
            - VALIDATION_ERROR
            - CONFLICT
            - RATE_LIMITED
            - INTERNAL
            - SERVICE_UNAVAILABLE
          examples:
            - VALIDATION_ERROR
            - UNAUTHORIZED
            - NOT_FOUND
          type: string
        detail:
          examples:
            - Authentication is required
            - Audience not found
            - Default topic titles cannot be updated
          type: string
        details:
          description: >-
            Optional structured details about the error, such as validation
            issues or rate-limit metadata.
          examples:
            - - field: body
                issues:
                  - code: validation_failed
                    message: 'name: Name is required'
                    path:
                      - name
            - limit: 100
              remaining: 0
              resetTime: 1713225600000
              retryAfter: 60
          oneOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - additionalProperties: true
              type: object
        requestId:
          examples:
            - req_01j5k9m7n8p9q2r3s4t5v6w7x8
          type: string
        status:
          example: 400
          type: number
        title:
          examples:
            - Bad Request
            - Unauthorized
            - Not Found
          type: string
        type:
          examples:
            - https://api.tryarchitect.com/errors/validation_error
            - https://api.tryarchitect.com/errors/not_found
          type: string
      required:
        - code
        - detail
        - requestId
        - status
        - title
        - type
      type: object
  responses:
    ValidationError:
      content:
        application/json:
          examples:
            default:
              value:
                code: VALIDATION_ERROR
                detail: 'body - name: Name is required; email: Invalid email address'
                details:
                  - field: body
                    issues:
                      - code: validation_failed
                        message: 'name: Name is required'
                        path:
                          - name
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 400
                title: Bad Request
                type: https://api.tryarchitect.com/errors/validation_error
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The request could not be processed because the path, query string, or
        JSON body was invalid.
    UnauthorizedError:
      content:
        application/json:
          examples:
            default:
              value:
                code: UNAUTHORIZED
                detail: Authentication is required
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 401
                title: Unauthorized
                type: https://api.tryarchitect.com/errors/unauthorized
          schema:
            $ref: '#/components/schemas/Error'
      description: The request did not include valid authentication credentials.
    ForbiddenError:
      content:
        application/json:
          examples:
            default:
              value:
                code: FORBIDDEN
                detail: Multi-tenant API keys are not supported
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 403
                title: Forbidden
                type: https://api.tryarchitect.com/errors/forbidden
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The caller is authenticated but does not have access to the requested
        tenant or operation.
    NotFoundError:
      content:
        application/json:
          examples:
            default:
              value:
                code: NOT_FOUND
                detail: Audience not found
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 404
                title: Not Found
                type: https://api.tryarchitect.com/errors/not_found
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The referenced resource does not exist, is not owned by the requested
        parent, or is not visible to the authenticated tenant.
    ConflictError:
      content:
        application/json:
          examples:
            default:
              value:
                code: CONFLICT
                detail: Default topic titles cannot be updated
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 409
                title: Conflict
                type: https://api.tryarchitect.com/errors/conflict
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The request conflicts with current resource state, lifecycle rules, or
        uniqueness constraints.
    RateLimitError:
      content:
        application/json:
          examples:
            default:
              value:
                code: RATE_LIMITED
                detail: Rate limit exceeded
                details:
                  limit: 100
                  remaining: 0
                  resetTime: 1713225600000
                  retryAfter: 60
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 429
                title: Too Many Requests
                type: https://api.tryarchitect.com/errors/rate_limited
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The authenticated caller has exceeded the current request rate limit
        window.
    InternalServerError:
      content:
        application/json:
          examples:
            default:
              value:
                code: INTERNAL
                detail: An unexpected error occurred
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 500
                title: Internal Server Error
                type: https://api.tryarchitect.com/errors/internal
          schema:
            $ref: '#/components/schemas/Error'
      description: The server encountered an unexpected error while processing the request.
    ServiceUnavailableError:
      content:
        application/json:
          examples:
            default:
              value:
                code: SERVICE_UNAVAILABLE
                detail: The service is temporarily unavailable
                requestId: req_01j5k9m7n8p9q2r3s4t5v6w7x8
                status: 503
                title: Service Unavailable
                type: https://api.tryarchitect.com/errors/service_unavailable
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The service is temporarily unavailable. Retry the request after a short
        delay.
  securitySchemes:
    apiKey:
      description: API key authentication for the External Actor Gateway
      in: header
      name: x-api-key
      type: apiKey

````