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

> ## Agent Instructions
> Every Lath operation is POST https://platform.trylath.com/<operation name with dots replaced by slashes>, with a JSON body and `Authorization: Bearer <key>`. `email.send` is POST /email/send.
> Branch on `error.code`, never on `error.message`. Every refusal also carries `error.fix`, which names the next step.
> Send an `Idempotency-Key` header on any operation that is not retry-safe, so a retry cannot run it twice.
> A `lath_test_` key emails only the account's own members and sends no SMS; a `lath_live_` key reaches real recipients and is billed.
> The OpenAPI document, generated from the same registry as the routes, is at https://platform.trylath.com/openapi.json.

# audience.preferences.set

> Public, for the hosted preferences page and one-click unsubscribe: given the token from a message's link, subscribes or unsubscribes the contact per topic on either channel, or unsubscribes from all marketing on one. Every change is an appended consent record naming the preference page as its source. Subscribing here is the only thing that lifts a bounce or complaint suppression, because the token proves the person holds the address.



## OpenAPI

````yaml /api-reference/openapi.json post /audience/preferences/set
openapi: 3.1.0
info:
  title: Lath API
  version: 0.1.0
  description: >-
    Every operation is one POST. The same set is reachable over MCP, the SDK and
    the CLI; nothing is dashboard-only.
servers:
  - url: https://platform.trylath.com
    description: This deployment
security: []
paths:
  /audience/preferences/set:
    post:
      tags:
        - audience
      summary: audience.preferences.set
      description: >-
        Public, for the hosted preferences page and one-click unsubscribe: given
        the token from a message's link, subscribes or unsubscribes the contact
        per topic on either channel, or unsubscribes from all marketing on one.
        Every change is an appended consent record naming the preference page as
        its source. Subscribing here is the only thing that lifts a bounce or
        complaint suppression, because the token proves the person holds the
        address.
      operationId: audience.preferences.set
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
          description: >-
            Replays the stored response for the same key and input; refuses
            different input.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                token:
                  type: string
                  pattern: ^lath_pt_[0-9A-Za-z]{43}$
                  description: The token from an unsubscribe or preferences link
                email:
                  type: object
                  properties:
                    topics:
                      description: topic key → subscribed
                      type: object
                      propertyNames:
                        type: string
                        minLength: 1
                        maxLength: 64
                      additionalProperties:
                        type: boolean
                    unsubscribeAll:
                      description: >-
                        true: revoke every topic on this channel and suppress
                        the address for marketing; a later explicit subscribe
                        lifts it
                      type: boolean
                  additionalProperties: false
                sms:
                  type: object
                  properties:
                    topics:
                      description: topic key → subscribed
                      type: object
                      propertyNames:
                        type: string
                        minLength: 1
                        maxLength: 64
                      additionalProperties:
                        type: boolean
                    unsubscribeAll:
                      description: >-
                        true: revoke every topic on this channel and suppress
                        the address for marketing; a later explicit subscribe
                        lifts it
                      type: boolean
                  additionalProperties: false
              required:
                - token
              additionalProperties: false
      responses:
        '200':
          description: '{ activityId, result }. activityId is empty for reads.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  activityId:
                    type: string
                    description: The activity this call created, or empty for a read.
                  result:
                    $schema: https://json-schema.org/draft/2020-12/schema
                    type: object
                    properties:
                      activityId:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      environmentId:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                      projectName:
                        type: string
                      email:
                        type:
                          - string
                          - 'null'
                      phone:
                        type:
                          - string
                          - 'null'
                      channels:
                        type: object
                        properties:
                          email:
                            type: object
                            properties:
                              topics:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    key:
                                      type: string
                                    name:
                                      type: string
                                    description:
                                      type:
                                        - string
                                        - 'null'
                                    subscribed:
                                      type: boolean
                                  required:
                                    - key
                                    - name
                                    - description
                                    - subscribed
                                  additionalProperties: {}
                              unsubscribedAll:
                                type: boolean
                              suppressionReason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - topics
                              - unsubscribedAll
                              - suppressionReason
                            additionalProperties: {}
                          sms:
                            type: object
                            properties:
                              topics:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    key:
                                      type: string
                                    name:
                                      type: string
                                    description:
                                      type:
                                        - string
                                        - 'null'
                                    subscribed:
                                      type: boolean
                                  required:
                                    - key
                                    - name
                                    - description
                                    - subscribed
                                  additionalProperties: {}
                              unsubscribedAll:
                                type: boolean
                              suppressionReason:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - topics
                              - unsubscribedAll
                              - suppressionReason
                            additionalProperties: {}
                        required:
                          - email
                          - sms
                        additionalProperties: {}
                    required:
                      - activityId
                      - environmentId
                      - projectName
                      - email
                      - phone
                      - channels
                    additionalProperties: {}
                required:
                  - activityId
                  - result
        '400':
          description: invalid_input or invalid_json
        '401':
          description: unauthenticated
        '403':
          description: forbidden
        '404':
          description: not_found
        '409':
          description: 'conflict: idempotency_mismatch, email_taken, last_key'
        '413':
          description: body_too_large
        '429':
          description: rate_limited
      security: []

````