Skip to main content
POST
/
preferences
/
publish
JavaScript
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);
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)
package main

import (
"context"
"fmt"

"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)

func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
publishPreferencesResponse, err := client.WorkspacePreferences.Publish(context.TODO(), courier.WorkspacePreferencePublishParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", publishPreferencesResponse.PageID)
}
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();
}
}
require "courier"

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

publish_preferences_response = courier.workspace_preferences.publish

puts(publish_preferences_response)
<?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(
brandID: 'brand_id', description: 'description', heading: 'heading'
);

var_dump($publishPreferencesResponse);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using TryCourier;
using TryCourier.Models.WorkspacePreferences;

CourierClient client = new();

WorkspacePreferencePublishParams parameters = new();

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

Console.WriteLine(publishPreferencesResponse);
courier workspace-preferences publish \
--api-key 'My API Key'
curl --request POST \
--url https://api.courier.com/preferences/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"heading": "<string>",
"description": "<string>",
"brand_id": "<string>"
}
'
{
  "page_id": "page_default",
  "published_at": "2024-01-15T10:30:00.000Z",
  "published_by": "user_123",
  "published_version": 1,
  "preview_url": "https://example.com"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Optional page metadata to apply when publishing the workspace's preferences page. All fields are optional; omitted fields fall back to the page defaults (and the workspace default brand).

heading
string | null

Heading shown at the top of the hosted preferences page.

description
string | null

Description shown under the heading on the hosted preferences page.

brand_id
string | null

Brand for the hosted page - "default" (workspace default brand), "none" (no brand), or a specific brand id. Defaults to "default".

Response

200 - application/json

Result of publishing the workspace's preferences page.

page_id
string
required

Id of the published page snapshot.

published_at
string
required

ISO-8601 timestamp of the publish.

published_version
number
required

Monotonic published version (epoch milliseconds).

published_by
string | null

Id of the publisher.

preview_url
string | null

Draft-mode hosted preferences page URL for previewing.