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

const tenant = await client.tenants.update('tenant_id', { name: 'name' });

console.log(tenant.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
)
tenant = client.tenants.update(
tenant_id="tenant_id",
name="name",
)
print(tenant.id)
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"),
)
tenant, err := client.Tenants.Update(
context.TODO(),
"tenant_id",
courier.TenantUpdateParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tenant.ID)
}
package com.courier.example;

import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.tenants.Tenant;
import com.courier.models.tenants.TenantUpdateParams;

public final class Main {
private Main() {}

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

TenantUpdateParams params = TenantUpdateParams.builder()
.tenantId("tenant_id")
.name("name")
.build();
Tenant tenant = client.tenants().update(params);
}
}
require "courier"

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

tenant = courier.tenants.update("tenant_id", name: "name")

puts(tenant)
<?php

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

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

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

try {
$tenant = $client->tenants->update(
'tenant_id',
name: 'name',
brandID: 'brand_id',
defaultPreferences: [
'items' => [
[
'status' => 'OPTED_OUT',
'customRouting' => [ChannelClassification::DIRECT_MESSAGE],
'hasCustomRouting' => true,
'id' => 'id',
],
],
],
parentTenantID: 'parent_tenant_id',
properties: ['foo' => 'bar'],
userProfile: ['foo' => 'bar'],
);

var_dump($tenant);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using TryCourier;
using TryCourier.Models.Tenants;

CourierClient client = new();

TenantUpdateParams parameters = new()
{
TenantID = "tenant_id",
Name = "name",
};

var tenant = await client.Tenants.Update(parameters);

Console.WriteLine(tenant);
courier tenants update \
--api-key 'My API Key' \
--tenant-id tenant_id \
--name name
curl --request PUT \
--url https://api.courier.com/tenants/{tenant_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"parent_tenant_id": "<string>",
"default_preferences": {
"items": [
{
"id": "<string>",
"has_custom_routing": true,
"custom_routing": []
}
]
},
"properties": {},
"user_profile": {},
"brand_id": "<string>"
}
'
{
  "id": "tenant_abc",
  "name": "Example Name",
  "parent_tenant_id": "tenant_abc",
  "default_preferences": {
    "items": [
      {
        "status": "OPTED_OUT",
        "has_custom_routing": true,
        "custom_routing": [
          "direct_message"
        ],
        "id": "pt_01kx4h2jdafq8bk99mj9q2gsa2"
      }
    ]
  },
  "properties": {},
  "user_profile": {},
  "brand_id": "bnd_01kx4mrd0pfzw8wt7pn7p2fzag"
}
{
"message": "Example message text",
"type": "invalid_request_error"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

tenant_id
string
required

A unique identifier representing the tenant to be returned.

Body

application/json
name
string
required

Name of the tenant.

parent_tenant_id
string | null

Tenant's parent id (if any).

default_preferences
DefaultPreferences · object | null

Defines the preferences used for the tenant when the user hasn't specified their own.

properties
object | null

Arbitrary properties accessible to a template.

user_profile
object | null

A user profile object merged with user profile on send.

brand_id
string | null

Brand to be used for the account when one is not specified by the send call.

Response

id
string
required

Id of the tenant.

name
string
required

Name of the tenant.

parent_tenant_id
string | null

Tenant's parent id (if any).

default_preferences
DefaultPreferences · object | null

Defines the preferences used for the account when the user hasn't specified their own.

properties
object | null

Arbitrary properties accessible to a template.

user_profile
object | null

A user profile object merged with user profile on send.

brand_id
string | null

Brand to be used for the account when one is not specified by the send call.