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 list = await client.profiles.lists.retrieve('user_id');
console.log(list.paging);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
list = client.profiles.lists.retrieve(
user_id="user_id",
)
print(list.paging)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"),
)
list, err := client.Profiles.Lists.Get(
context.TODO(),
"user_id",
courier.ProfileListGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", list.Paging)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.profiles.lists.ListRetrieveParams;
import com.courier.models.profiles.lists.ListRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ListRetrieveResponse list = client.profiles().lists().retrieve("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
list = courier.profiles.lists.retrieve("user_id")
puts(list)<?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 {
$list = $client->profiles->lists->retrieve('user_id', cursor: 'cursor');
var_dump($list);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Profiles.Lists;
CourierClient client = new();
ListRetrieveParams parameters = new() { UserID = "user_id" };
var list = await client.Profiles.Lists.Retrieve(parameters);
Console.WriteLine(list);courier profiles:lists retrieve \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/profiles/{user_id}/lists \
--header 'Authorization: Bearer <token>'{
"paging": {
"cursor": "MTpFWUNFRkRRN0c1WERTRTU2",
"more": true
},
"results": [
{
"id": "example.list.id",
"name": "Example List",
"created": "2024-01-15T10:30:00.000Z",
"updated": "2024-01-15T10:30:00.000Z",
"preferences": {
"categories": {
"categories_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
},
"notifications": {
"notifications_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
}
}
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}User Profiles
Get list subscriptions
Returns the subscribed lists for a specified user.
GET
/
profiles
/
{user_id}
/
lists
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 list = await client.profiles.lists.retrieve('user_id');
console.log(list.paging);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
list = client.profiles.lists.retrieve(
user_id="user_id",
)
print(list.paging)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"),
)
list, err := client.Profiles.Lists.Get(
context.TODO(),
"user_id",
courier.ProfileListGetParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", list.Paging)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.profiles.lists.ListRetrieveParams;
import com.courier.models.profiles.lists.ListRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ListRetrieveResponse list = client.profiles().lists().retrieve("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
list = courier.profiles.lists.retrieve("user_id")
puts(list)<?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 {
$list = $client->profiles->lists->retrieve('user_id', cursor: 'cursor');
var_dump($list);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Profiles.Lists;
CourierClient client = new();
ListRetrieveParams parameters = new() { UserID = "user_id" };
var list = await client.Profiles.Lists.Retrieve(parameters);
Console.WriteLine(list);courier profiles:lists retrieve \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/profiles/{user_id}/lists \
--header 'Authorization: Bearer <token>'{
"paging": {
"cursor": "MTpFWUNFRkRRN0c1WERTRTU2",
"more": true
},
"results": [
{
"id": "example.list.id",
"name": "Example List",
"created": "2024-01-15T10:30:00.000Z",
"updated": "2024-01-15T10:30:00.000Z",
"preferences": {
"categories": {
"categories_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
},
"notifications": {
"notifications_key": {
"status": "OPTED_IN",
"rules": [
{
"start": "string",
"until": "string"
}
],
"channel_preferences": [
{
"channel": "direct_message"
}
]
}
}
}
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
A unique identifier representing the user associated with the requested user profile.
Query Parameters
A unique identifier that allows for fetching the next set of message statuses.
⌘I