> ## 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.

# Publish Preferences Page

> Publish the workspace's preferences page. Takes a snapshot of every workspace preference with its topics under a new published version, making the current state visible on the hosted preferences page (non-draft).



## OpenAPI

````yaml /openapi-specs/openapi.documented.yml post /preferences/publish
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: []
paths:
  /preferences/publish:
    post:
      tags:
        - Workspace Preferences
      summary: Publish Preferences Page
      description: >-
        Publish the workspace's preferences page. Takes a snapshot of every
        workspace preference with its topics under a new published version,
        making the current state visible on the hosted preferences page
        (non-draft).
      operationId: workspacePreferences_publish
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishPreferencesResponse'
              examples:
                Example:
                  value:
                    page_id: page_default
                    published_at: '2024-01-15T10:30:00.000Z'
                    published_by: user_123
                    published_version: 1
                    preview_url: https://example.com
      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 publishPreferencesResponse = await
            client.workspacePreferences.publish();


            console.log(publishPreferencesResponse.page_id);
        - 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
            )

            publish_preferences_response =
            client.workspace_preferences.publish()

            print(publish_preferences_response.page_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/trycourier/courier-go\"\n\t\"github.com/trycourier/courier-go/option\"\n)\n\nfunc main() {\n\tclient := courier.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpublishPreferencesResponse, err := client.WorkspacePreferences.Publish(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", publishPreferencesResponse.PageID)\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.PublishPreferencesResponse;

            import
            com.courier.models.workspacepreferences.WorkspacePreferencePublishParams;


            public final class Main {
                private Main() {}

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

                    PublishPreferencesResponse publishPreferencesResponse = client.workspacePreferences().publish();
                }
            }
        - lang: Ruby
          source: |-
            require "courier"

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

            publish_preferences_response = courier.workspace_preferences.publish

            puts(publish_preferences_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 {
              $publishPreferencesResponse = $client->workspacePreferences->publish();

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

            using TryCourier;

            using TryCourier.Models.WorkspacePreferences;


            CourierClient client = new();


            WorkspacePreferencePublishParams parameters = new();


            var publishPreferencesResponse = await
            client.WorkspacePreferences.Publish(parameters);


            Console.WriteLine(publishPreferencesResponse);
        - lang: CLI
          source: |-
            courier workspace-preferences publish \
              --api-key 'My API Key'
components:
  schemas:
    PublishPreferencesResponse:
      title: PublishPreferencesResponse
      type: object
      description: Result of publishing the workspace's preferences page.
      properties:
        page_id:
          type: string
          description: Id of the published page snapshot.
        published_at:
          type: string
          description: ISO-8601 timestamp of the publish.
        published_by:
          type: string
          nullable: true
          description: Id of the publisher.
        published_version:
          type: number
          description: Monotonic published version (epoch milliseconds).
        preview_url:
          type: string
          nullable: true
          description: Draft-mode hosted preferences page URL for previewing.
      required:
        - page_id
        - published_at
        - published_version
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````