Skip to main content
PUT
/
lists
/
{list_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
});

await client.lists.update('list_id', { name: 'name' });
import os
from courier import Courier

client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.lists.update(
list_id="list_id",
name="name",
)
package main

import (
"context"

"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)

func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Lists.Update(
context.TODO(),
"list_id",
courier.ListUpdateParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.lists.ListUpdateParams;

public final class Main {
private Main() {}

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

ListUpdateParams params = ListUpdateParams.builder()
.listId("list_id")
.name("name")
.build();
client.lists().update(params);
}
}
require "courier"

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

result = courier.lists.update("list_id", name: "name")

puts(result)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Courier\Client;
use Courier\PreferenceStatus;
use Courier\ChannelClassification;
use Courier\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');

try {
$result = $client->lists->update(
'list_id',
name: 'name',
preferences: [
'categories' => [
'foo' => [
'status' => PreferenceStatus::OPTED_IN,
'channelPreferences' => [
['channel' => ChannelClassification::DIRECT_MESSAGE]
],
'rules' => [['until' => 'until', 'start' => 'start']],
],
],
'notifications' => [
'foo' => [
'status' => PreferenceStatus::OPTED_IN,
'channelPreferences' => [
['channel' => ChannelClassification::DIRECT_MESSAGE]
],
'rules' => [['until' => 'until', 'start' => 'start']],
],
],
],
);

var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}
using TryCourier;
using TryCourier.Models.Lists;

CourierClient client = new();

ListUpdateParams parameters = new()
{
ListID = "list_id",
Name = "name",
};

await client.Lists.Update(parameters);
courier lists update \
--api-key 'My API Key' \
--list-id list_id \
--name name
curl --request PUT \
--url https://api.courier.com/lists/{list_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"preferences": {
"categories": {},
"notifications": {}
}
}
'

Authorizations

Authorization
string
header
required

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

Path Parameters

list_id
string
required

A unique identifier representing the list you wish to retrieve.

Body

application/json
name
string
required
preferences
RecipientPreferences · object | null

Response

204 - undefined