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

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message` from the Node SDK (`@trycourier/courier` v7 and later, where the client is the default import). Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# List preference changes

> Returns the history of preference changes in this environment, newest first. Each entry records one change a user made to one subscription topic, and carries the value before it where there was one. Supply user_id to read a single user's history instead of the whole environment.



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml get /preferences/logs
openapi: 3.0.1
info:
  title: Courier
  description: The Courier REST API for sending and managing notifications across channels.
  version: 0.0.1
servers:
  - url: https://api.courier.com
    description: Production
security: []
tags:
  - name: Send
    description: >-
      Send a message to one or more recipients — users, lists, audiences, or
      tenants — across every channel you have configured.
  - name: Templates
    description: >-
      Create, update, version, publish, and localize notification templates and
      their content.
  - name: Brands
    description: >-
      Manage the logos, colors, and layout that give the templates you send a
      consistent look.
  - name: Routing Strategies
    description: >-
      Define reusable channel routing and failover strategies, and see which
      templates use them.
  - name: Journeys
    description: >-
      Build, version, publish, invoke, and cancel multi-step notification
      workflows, along with the templates scoped to them.
  - name: Broadcasts
    description: >-
      Create a one-off send to a list or audience, author its content, then send
      it immediately or schedule it for later.
  - name: User Profiles
    description: >-
      Store the contact information Courier delivers to for each user — email,
      phone number, push tokens, and any custom data you send to.
  - name: Tenants
    description: >-
      Manage tenants — the organizations, teams, or accounts your users belong
      to — along with their users and default preferences.
  - name: Audiences
    description: >-
      Define filter-based groups whose membership Courier recalculates as user
      profiles change.
  - name: Lists
    description: >-
      Manage static groups of users that you subscribe explicitly, and send to
      them by list id or list pattern.
  - name: Providers
    description: >-
      Configure the channel providers Courier delivers through, and browse the
      provider types it supports.
  - name: Preference Topics
    description: >-
      Manage the workspace catalog of subscription topics, the sections that
      group them, and publishing the preference page.
  - name: User Preferences
    description: >-
      Read and write a single user's notification preferences, per topic and per
      channel.
  - name: Messages
    description: >-
      Look up the messages Courier has accepted, inspect their delivery history
      and rendered output, and cancel, resend, or archive them.
  - name: Device Tokens
    description: >-
      Register and manage the APNS and FCM device tokens Courier delivers push
      notifications to.
  - name: Tenant Memberships
    description: >-
      Associate a user with one or more tenants, and read or remove those
      associations.
  - name: Tenant Templates
    description: >-
      Manage the templates and template versions scoped to a single tenant,
      including the ones authored in the embedded designer.
  - name: Automations
    description: >-
      Invoke a stored automation template or an ad hoc automation defined in the
      request.
  - name: Digests
    description: >-
      Inspect what has accumulated in a digest schedule and release a digest
      ahead of its next scheduled delivery.
  - name: Translations
    description: >-
      Store and retrieve the translation strings Courier uses to render
      localized template content.
  - name: Track Events
    description: >-
      Record an inbound event that triggers the journeys and automations mapped
      to it.
  - name: Audit Events
    description: >-
      Read the audit trail of configuration and access changes in your
      workspace.
  - name: Authentication
    description: >-
      Issue scoped, short-lived JWTs so client-side SDKs — Inbox, Preferences,
      and the embedded designer — can call Courier as a single user. Server-side
      requests authenticate with your workspace API key instead.
paths:
  /preferences/logs:
    get:
      tags:
        - Preference Topics
      summary: List preference changes
      description: >-
        Returns the history of preference changes in this environment, newest
        first. Each entry records one change a user made to one subscription
        topic, and carries the value before it where there was one. Supply
        user_id to read a single user's history instead of the whole
        environment.
      operationId: workspacePreferences_listLogs
      parameters:
        - name: user_id
          in: query
          description: >-
            Return only this user's changes. Omit it to read every change in the
            environment.
          required: false
          schema:
            type: string
          examples:
            Example1:
              value: user_abc
        - name: tenant_id
          in: query
          description: >-
            Narrow to the changes this user made in one tenant context. Only
            valid together with user_id.
          required: false
          schema:
            type: string
        - name: since
          in: query
          description: >-
            Return only changes at or after this time, as an ISO-8601 date or
            date-time. A date alone is read as the start of that day in UTC.
          required: false
          schema:
            type: string
          examples:
            Example1:
              value: '2026-09-01T00:00:00Z'
        - name: limit
          in: query
          description: How many entries to return. Defaults to 25.
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: cursor
          in: query
          description: >-
            A cursor from a previous response's paging.cursor. Continue only
            while paging.more is true; the cursor is omitted on the last page.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreferenceLogsListResponse'
              examples:
                Example:
                  value:
                    paging:
                      cursor: MTpFWUNFRkRRN0c1WERTRTU2
                      more: true
                    items:
                      - id: 5f1b2c3d-0000-4000-8000-000000000001
                        timestamp: '2026-09-22T12:00:00.000Z'
                        user_id: user_abc
                        tenant_id: tenant_abc
                        topic_id: pt_01kx4h2jdafq8bk9a26x0kvd1t
                        topic_name: Product updates
                        status: OPTED_OUT
                        custom_routing: []
                        has_custom_routing: false
                        previous:
                          status: OPTED_IN
                          custom_routing:
                            - email
                          has_custom_routing: true
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
              examples:
                Example:
                  value:
                    message: Example message text
                    type: invalid_request_error
        '429':
          description: Too many requests; the client has been rate limited.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequests'
              examples:
                Example:
                  value:
                    message: Too Many Requests
                    type: rate_limit_error
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Courier from '@trycourier/courier';


            const client = new Courier({
              apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
            });


            const preferenceLogsListResponse = await
            client.workspacePreferences.listLogs();


            console.log(preferenceLogsListResponse.items);
        - lang: Python
          source: >-
            import os

            from courier import Courier


            client = Courier(
                api_key=os.environ.get("COURIER_API_KEY"),  # This is the default and can be omitted
            )

            preference_logs_list_response =
            client.workspace_preferences.list_logs()

            print(preference_logs_list_response.items)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/trycourier/courier-go/v4\"\n\t\"github.com/trycourier/courier-go/v4/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpreferenceLogsListResponse, err := client.WorkspacePreferences.ListLogs(context.TODO(), courier.WorkspacePreferenceListLogsParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", preferenceLogsListResponse.Items)\n}\n"
        - lang: Java
          source: >-
            package com.courier.example;


            import com.courier.client.CourierClient;

            import com.courier.client.okhttp.CourierOkHttpClient;

            import
            com.courier.models.workspacepreferences.PreferenceLogsListResponse;

            import
            com.courier.models.workspacepreferences.WorkspacePreferenceListLogsParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CourierClient client = CourierOkHttpClient.fromEnv();

                    PreferenceLogsListResponse preferenceLogsListResponse = client.workspacePreferences().listLogs();
                }
            }
        - lang: Ruby
          source: >-
            require "courier"


            courier = Courier::Client.new(api_key: "My API Key")


            preference_logs_list_response =
            courier.workspace_preferences.list_logs


            puts(preference_logs_list_response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Courier\Client;

            use Courier\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API
            Key');


            try {
              $preferenceLogsListResponse = $client->workspacePreferences->listLogs(
                cursor: 'cursor',
                limit: 1,
                since: 'since',
                tenantID: 'tenant_id',
                userID: 'user_id',
              );

              var_dump($preferenceLogsListResponse);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: >-
            using System;

            using TryCourier;

            using TryCourier.Models.WorkspacePreferences;


            CourierClient client = new();


            WorkspacePreferenceListLogsParams parameters = new();


            var preferenceLogsListResponse = await
            client.WorkspacePreferences.ListLogs(parameters);


            Console.WriteLine(preferenceLogsListResponse);
        - lang: CLI
          source: |-
            courier workspace-preferences list-logs \
              --api-key 'My API Key'
components:
  schemas:
    PreferenceLogsListResponse:
      title: PreferenceLogsListResponse
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/Paging'
        items:
          type: array
          items:
            $ref: '#/components/schemas/PreferenceChangeLogEntry'
          description: One entry per preference change, newest first.
      required:
        - paging
        - items
    BadRequest:
      title: BadRequest
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
      required:
        - type
      allOf:
        - $ref: '#/components/schemas/BaseError'
    TooManyRequests:
      title: TooManyRequests
      type: object
      properties:
        type:
          type: string
          enum:
            - rate_limit_error
      required:
        - type
      allOf:
        - $ref: '#/components/schemas/BaseError'
    Paging:
      title: Paging
      type: object
      properties:
        cursor:
          type: string
          nullable: true
        more:
          type: boolean
      required:
        - more
    PreferenceChangeLogEntry:
      title: PreferenceChangeLogEntry
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for this change.
        timestamp:
          type: string
          description: When the change was made, as an ISO-8601 date-time in UTC.
        user_id:
          type: string
          description: The user whose preference changed.
        tenant_id:
          type: string
          description: >-
            The tenant context the change was made in. Absent when the user set
            the preference outside any tenant.
        topic_id:
          type: string
          description: The subscription topic the change applies to.
        topic_name:
          type: string
          description: The display name of that topic when the change was made.
        status:
          allOf:
            - $ref: '#/components/schemas/PreferenceStatus'
          description: The subscription status the change set.
        custom_routing:
          type: array
          items:
            $ref: '#/components/schemas/ChannelClassification'
          description: >-
            The channels chosen for this topic, present only when
            has_custom_routing is true. Empty otherwise.
        has_custom_routing:
          type: boolean
          description: >-
            Whether specific delivery channels were chosen for this topic rather
            than the topic's default routing.
        previous:
          allOf:
            - $ref: '#/components/schemas/PreferenceChangeLogValue'
          description: The value before this change, where it was recorded.
      required:
        - id
        - timestamp
        - user_id
        - topic_id
        - topic_name
        - status
        - custom_routing
        - has_custom_routing
    BaseError:
      title: BaseError
      type: object
      properties:
        message:
          type: string
          description: A message describing the error that occurred.
      required:
        - message
    PreferenceStatus:
      title: PreferenceStatus
      type: string
      enum:
        - OPTED_IN
        - OPTED_OUT
        - REQUIRED
    ChannelClassification:
      title: ChannelClassification
      type: string
      enum:
        - direct_message
        - email
        - push
        - sms
        - webhook
        - inbox
    PreferenceChangeLogValue:
      title: PreferenceChangeLogValue
      type: object
      properties:
        status:
          allOf:
            - $ref: '#/components/schemas/PreferenceStatus'
          description: The subscription status before the change.
        custom_routing:
          type: array
          items:
            $ref: '#/components/schemas/ChannelClassification'
          description: The channels chosen before the change.
        has_custom_routing:
          type: boolean
          description: Whether custom routing was in effect before the change.
      required:
        - status
        - custom_routing
        - has_custom_routing
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````