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 deviceSet = await client.previews.createDeviceSet({
device_ids: ['pvd_1w6dgafr3aaycvv9a8bm996pkc'],
name: 'Mobile',
});
console.log(deviceSet.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
)
device_set = client.previews.create_device_set(
device_ids=["pvd_1w6dgafr3aaycvv9a8bm996pkc"],
name="Mobile",
)
print(device_set.id)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
deviceSet, err := client.Previews.NewDeviceSet(context.TODO(), courier.PreviewNewDeviceSetParams{
CreateDeviceSetRequest: courier.CreateDeviceSetRequestParam{
DeviceIDs: []string{"pvd_1w6dgafr3aaycvv9a8bm996pkc"},
Name: "Mobile",
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deviceSet.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.previews.CreateDeviceSetRequest;
import com.courier.models.previews.DeviceSet;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
CreateDeviceSetRequest params = CreateDeviceSetRequest.builder()
.addDeviceId("pvd_1w6dgafr3aaycvv9a8bm996pkc")
.name("Mobile")
.build();
DeviceSet deviceSet = client.previews().createDeviceSet(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
device_set = courier.previews.create_device_set(device_ids: ["pvd_1w6dgafr3aaycvv9a8bm996pkc"], name: "Mobile")
puts(device_set)<?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 {
$deviceSet = $client->previews->createDeviceSet(
deviceIDs: ['pvd_1w6dgafr3aaycvv9a8bm996pkc'], name: 'Mobile'
);
var_dump($deviceSet);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Previews;
CourierClient client = new();
PreviewCreateDeviceSetParams parameters = new()
{
DeviceIds =
[
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
],
Name = "Mobile",
};
var deviceSet = await client.Previews.CreateDeviceSet(parameters);
Console.WriteLine(deviceSet);courier previews create-device-set \
--api-key 'My API Key' \
--device-id pvd_1w6dgafr3aaycvv9a8bm996pkc \
--name Mobilecurl --request POST \
--url https://api.courier.com/previews/device-sets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mobile",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
]
}
'{
"id": "pvs_01kx4h2jdafq8bk9amzvy6hbv0",
"name": "Mobile",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
],
"is_default": false,
"status": "ACTIVE",
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"created_by": "user_01kx4h2jdafq8bk9amzvy6hbv0",
"updated_by": "user_01kx4h2jdafq8bk9amzvy6hbv0"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "validation_error",
"message": "unknown device id: pvd_01nope"
}Previews
Create Device Set
Create a named, reusable set of preview devices. Every id must be one listed by GET /previews/devices; any other is a 422.
POST
/
previews
/
device-sets
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 deviceSet = await client.previews.createDeviceSet({
device_ids: ['pvd_1w6dgafr3aaycvv9a8bm996pkc'],
name: 'Mobile',
});
console.log(deviceSet.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
)
device_set = client.previews.create_device_set(
device_ids=["pvd_1w6dgafr3aaycvv9a8bm996pkc"],
name="Mobile",
)
print(device_set.id)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go/v4"
"github.com/trycourier/courier-go/v4/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
deviceSet, err := client.Previews.NewDeviceSet(context.TODO(), courier.PreviewNewDeviceSetParams{
CreateDeviceSetRequest: courier.CreateDeviceSetRequestParam{
DeviceIDs: []string{"pvd_1w6dgafr3aaycvv9a8bm996pkc"},
Name: "Mobile",
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", deviceSet.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.previews.CreateDeviceSetRequest;
import com.courier.models.previews.DeviceSet;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
CreateDeviceSetRequest params = CreateDeviceSetRequest.builder()
.addDeviceId("pvd_1w6dgafr3aaycvv9a8bm996pkc")
.name("Mobile")
.build();
DeviceSet deviceSet = client.previews().createDeviceSet(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
device_set = courier.previews.create_device_set(device_ids: ["pvd_1w6dgafr3aaycvv9a8bm996pkc"], name: "Mobile")
puts(device_set)<?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 {
$deviceSet = $client->previews->createDeviceSet(
deviceIDs: ['pvd_1w6dgafr3aaycvv9a8bm996pkc'], name: 'Mobile'
);
var_dump($deviceSet);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Previews;
CourierClient client = new();
PreviewCreateDeviceSetParams parameters = new()
{
DeviceIds =
[
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
],
Name = "Mobile",
};
var deviceSet = await client.Previews.CreateDeviceSet(parameters);
Console.WriteLine(deviceSet);courier previews create-device-set \
--api-key 'My API Key' \
--device-id pvd_1w6dgafr3aaycvv9a8bm996pkc \
--name Mobilecurl --request POST \
--url https://api.courier.com/previews/device-sets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Mobile",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
]
}
'{
"id": "pvs_01kx4h2jdafq8bk9amzvy6hbv0",
"name": "Mobile",
"device_ids": [
"pvd_1w6dgafr3aaycvv9a8bm996pkc"
],
"is_default": false,
"status": "ACTIVE",
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z",
"created_by": "user_01kx4h2jdafq8bk9amzvy6hbv0",
"updated_by": "user_01kx4h2jdafq8bk9amzvy6hbv0"
}{
"message": "<string>",
"type": "invalid_request_error"
}{
"type": "validation_error",
"message": "unknown device id: pvd_01nope"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Created
A named, reusable list of preview devices.
Unique identifier for the device set.
Human-readable name.
The devices in this set, by PreviewDevice.id.
ISO-8601 timestamp of when the set was created.
ISO-8601 timestamp of when the set was last written.
ISO-8601 timestamp of when the set was archived. Present only on the archive response, which is the one place the state is observable.
⌘I