Skip to main content
PUT
/
routing-strategies
/
{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 routingStrategyGetResponse = await client.routingStrategies.replace('id', {
  name: 'Email via SendGrid v2',
  routing: { method: 'single', channels: ['email'] },
  channels: { email: { providers: ['ses', 'sendgrid'] } },
  description: 'Updated routing with SES primary',
  providers: { ses: { override: {} } },
  tags: ['production', 'email', 'v2'],
});

console.log(routingStrategyGetResponse.id);
{
  "id": "abc-123",
  "name": "Example Name",
  "description": "An example description.",
  "tags": [
    "string"
  ],
  "routing": {
    "method": "all",
    "channels": [
      "string"
    ]
  },
  "channels": {
    "channels_key": {
      "brand_id": "VWNG5GW9DE80VKKVQNFN1ENXEYG3",
      "providers": [
        "string"
      ],
      "routing_method": "all",
      "if": "string",
      "timeouts": {
        "provider": 1,
        "channel": 1
      },
      "override": {},
      "metadata": {
        "utm": {
          "source": "string",
          "medium": "string",
          "campaign": "string",
          "term": "string",
          "content": "string"
        }
      }
    }
  },
  "providers": {
    "providers_key": {
      "override": {},
      "if": "string",
      "timeouts": 1,
      "metadata": {
        "utm": {
          "source": "string",
          "medium": "string",
          "campaign": "string",
          "term": "string",
          "content": "string"
        }
      }
    }
  },
  "created": 1,
  "creator": "user_123",
  "updated": 1,
  "updater": "user_123"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

Routing strategy ID (rs_ prefix).

Body

application/json

Request body for replacing a routing strategy. Full document replacement; missing optional fields are cleared.

name
string
required

Human-readable name for the routing strategy.

routing
MessageRouting · object
required

Routing tree defining channel selection method and order.

description
string | null

Optional description. Omit or null to clear.

tags
string[] | null

Optional tags. Omit or null to clear.

channels
MessageChannels · object

Per-channel delivery configuration. Omit to clear.

providers
MessageProviders · object

Per-provider delivery configuration. Omit to clear.

Response

Full routing strategy entity returned by GET.

id
string
required

The routing strategy ID (rs_ prefix).

name
string
required

Human-readable name.

routing
MessageRouting · object
required

Routing tree defining channel selection method and order.

channels
MessageChannels · object
required

Per-channel delivery configuration. May be empty.

providers
MessageProviders · object
required

Per-provider delivery configuration. May be empty.

created
integer<int64>
required

Epoch milliseconds when the strategy was created.

creator
string
required

User ID of the creator.

description
string | null

Description of the routing strategy.

tags
string[] | null

Tags for categorization.

updated
integer<int64> | null

Epoch milliseconds of last update.

updater
string | null

User ID of the last updater.