Skip to main content
GET
/
preferences
/
sections
/
{section_id}
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 workspacePreferenceGetResponse = await client.workspacePreferences.retrieve('section_id');

console.log(workspacePreferenceGetResponse.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
)
workspace_preference_get_response = client.workspace_preferences.retrieve(
"section_id",
)
print(workspace_preference_get_response.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"),
)
workspacePreferenceGetResponse, err := client.WorkspacePreferences.Get(context.TODO(), "section_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", workspacePreferenceGetResponse.ID)
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.workspacepreferences.WorkspacePreferenceGetResponse;
import com.courier.models.workspacepreferences.WorkspacePreferenceRetrieveParams;

public final class Main {
private Main() {}

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

WorkspacePreferenceGetResponse workspacePreferenceGetResponse = client.workspacePreferences().retrieve("section_id");
}
}
require "courier"

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

workspace_preference_get_response = courier.workspace_preferences.retrieve("section_id")

puts(workspace_preference_get_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 {
$workspacePreferenceGetResponse = $client->workspacePreferences->retrieve(
'section_id'
);

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

CourierClient client = new();

WorkspacePreferenceRetrieveParams parameters = new()
{
SectionID = "section_id"
};

var workspacePreferenceGetResponse = await client.WorkspacePreferences.Retrieve(parameters);

Console.WriteLine(workspacePreferenceGetResponse);
courier workspace-preferences retrieve \
--api-key 'My API Key' \
--section-id section_id
curl --request GET \
--url https://api.courier.com/preferences/sections/{section_id} \
--header 'Authorization: Bearer <token>'
{
  "id": "ps_01kx4h2jdafq8bk9b6w3knrezh",
  "name": "Account Notifications",
  "routing_options": [
    "direct_message"
  ],
  "has_custom_routing": true,
  "created": "2024-01-15T10:30:00.000Z",
  "creator": "user_123",
  "updated": "2024-01-15T10:30:00.000Z",
  "updater": "user_123",
  "topics": [
    {
      "id": "pt_01kx4h2jdafq8bk99mj9q2gsa2",
      "name": "Product Updates",
      "default_status": "OPTED_OUT",
      "routing_options": [
        "direct_message"
      ],
      "allowed_preferences": [
        "snooze"
      ],
      "include_unsubscribe_header": true,
      "topic_data": {},
      "created": "2024-01-15T10:30:00.000Z",
      "creator": "user_123",
      "updated": "2024-01-15T10:30:00.000Z",
      "updater": "user_123"
    }
  ]
}
{
"type": "invalid_request_error",
"message": "Workspace preference not found"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

section_id
string
required

Id of the workspace preference.

Response

A workspace preference in your workspace, including its topics.

id
string
required

The workspace preference id.

name
string
required

Human-readable name.

routing_options
enum<string>[]
required

Default channels for the workspace preference. May be empty.

Available options:
direct_message,
email,
push,
sms,
webhook,
inbox
has_custom_routing
boolean
required

Whether the workspace preference defines custom routing for its topics.

created
string
required

ISO-8601 timestamp of when the workspace preference was created.

topics
WorkspacePreferenceTopicGetResponse · object[]
required

The topics contained in this workspace preference.

description
string | null

Optional description shown under the section on the hosted preferences page.

creator
string | null

Id of the creator.

updated
string | null

ISO-8601 timestamp of the last update.

updater
string | null

Id of the last updater.