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 automationTemplateListResponse = await client.automations.list();
console.log(automationTemplateListResponse.cursor);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
automation_template_list_response = client.automations.list()
print(automation_template_list_response.cursor)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"),
)
automationTemplateListResponse, err := client.Automations.List(context.TODO(), courier.AutomationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", automationTemplateListResponse.Cursor)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.automations.AutomationListParams;
import com.courier.models.automations.AutomationTemplateListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
AutomationTemplateListResponse automationTemplateListResponse = client.automations().list();
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
automation_template_list_response = courier.automations.list
puts(automation_template_list_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 {
$automationTemplateListResponse = $client->automations->list(
cursor: 'cursor', version: 'published'
);
var_dump($automationTemplateListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Automations;
CourierClient client = new();
AutomationListParams parameters = new();
var automationTemplateListResponse = await client.Automations.List(parameters);
Console.WriteLine(automationTemplateListResponse);courier automations list \
--api-key 'My API Key'curl --request GET \
--url https://api.courier.com/automations \
--header 'Authorization: Bearer <token>'{
"templates": [
{
"name": "Welcome Email Automation",
"id": "abc-123-def-456",
"version": "published",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-02T00:00:00Z"
},
{
"name": "Order Confirmation",
"id": "xyz-789-ghi-012",
"version": "published",
"createdAt": "2024-01-03T00:00:00Z",
"updatedAt": "2024-01-04T00:00:00Z"
}
],
"cursor": "eyJpZCI6InRlbXBsYXRlLTIifQ=="
}Automations
List Automations
Get the list of automations.
GET
/
automations
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 automationTemplateListResponse = await client.automations.list();
console.log(automationTemplateListResponse.cursor);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
automation_template_list_response = client.automations.list()
print(automation_template_list_response.cursor)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"),
)
automationTemplateListResponse, err := client.Automations.List(context.TODO(), courier.AutomationListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", automationTemplateListResponse.Cursor)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.automations.AutomationListParams;
import com.courier.models.automations.AutomationTemplateListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
AutomationTemplateListResponse automationTemplateListResponse = client.automations().list();
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
automation_template_list_response = courier.automations.list
puts(automation_template_list_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 {
$automationTemplateListResponse = $client->automations->list(
cursor: 'cursor', version: 'published'
);
var_dump($automationTemplateListResponse);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Automations;
CourierClient client = new();
AutomationListParams parameters = new();
var automationTemplateListResponse = await client.Automations.List(parameters);
Console.WriteLine(automationTemplateListResponse);courier automations list \
--api-key 'My API Key'curl --request GET \
--url https://api.courier.com/automations \
--header 'Authorization: Bearer <token>'{
"templates": [
{
"name": "Welcome Email Automation",
"id": "abc-123-def-456",
"version": "published",
"createdAt": "2024-01-01T00:00:00Z",
"updatedAt": "2024-01-02T00:00:00Z"
},
{
"name": "Order Confirmation",
"id": "xyz-789-ghi-012",
"version": "published",
"createdAt": "2024-01-03T00:00:00Z",
"updatedAt": "2024-01-04T00:00:00Z"
}
],
"cursor": "eyJpZCI6InRlbXBsYXRlLTIifQ=="
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
A cursor token for pagination. Use the cursor from the previous response to fetch the next page of results.
The version of templates to retrieve. Accepted values are published (for published templates) or draft (for draft templates). Defaults to published.
Available options:
published, draft ⌘I