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 routingStrategyMutationResponse = 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(routingStrategyMutationResponse.id);
{
  "id": "rs_01abc123"
}

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

Response returned by create and replace operations.

id
string
required

The routing strategy ID (rs_ prefix).