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 lists = await client.lists.list();
console.log(lists.items);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
lists = client.lists.list()
print(lists.items)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"),
)
lists, err := client.Lists.List(context.TODO(), courier.ListListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", lists.Items)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.lists.ListListParams;
import com.courier.models.lists.ListListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ListListResponse lists = client.lists().list();
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
lists = courier.lists.list
puts(lists)<?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 {
$lists = $client->lists->list(cursor: 'cursor', pattern: 'pattern');
var_dump($lists);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Lists;
CourierClient client = new();
ListListParams parameters = new();
var lists = await client.Lists.List(parameters);
Console.WriteLine(lists);courier lists list \
--api-key 'My API Key'curl --request GET \
--url https://api.courier.com/lists \
--header 'Authorization: Bearer <token>'{
"paging": {
"cursor": "MTpFWUNFRkRRN0c1WERTRTU2",
"more": true
},
"items": [
{
"id": "example.list.id",
"name": "Example List",
"created": "2024-01-15T10:30:00.000Z",
"updated": "2024-01-15T10:30:00.000Z"
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Lists
Get all lists
Returns all of the lists, with the ability to filter based on a pattern.
GET
/
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 lists = await client.lists.list();
console.log(lists.items);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
lists = client.lists.list()
print(lists.items)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"),
)
lists, err := client.Lists.List(context.TODO(), courier.ListListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", lists.Items)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.lists.ListListParams;
import com.courier.models.lists.ListListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
ListListResponse lists = client.lists().list();
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
lists = courier.lists.list
puts(lists)<?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 {
$lists = $client->lists->list(cursor: 'cursor', pattern: 'pattern');
var_dump($lists);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Lists;
CourierClient client = new();
ListListParams parameters = new();
var lists = await client.Lists.List(parameters);
Console.WriteLine(lists);courier lists list \
--api-key 'My API Key'curl --request GET \
--url https://api.courier.com/lists \
--header 'Authorization: Bearer <token>'{
"paging": {
"cursor": "MTpFWUNFRkRRN0c1WERTRTU2",
"more": true
},
"items": [
{
"id": "example.list.id",
"name": "Example List",
"created": "2024-01-15T10:30:00.000Z",
"updated": "2024-01-15T10:30:00.000Z"
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
A unique identifier that allows for fetching the next page of lists.
"A pattern used to filter the list items returned. Pattern types supported: exact match on list_id or a pattern of one or more pattern parts. you may replace a part with either: * to match all parts in that position, or ** to signify a wildcard endsWith pattern match."
⌘I