Skip to main content
GET
/
tenants
/
{tenant_id}
/
templates
/
{template_id}
/
versions
/
{version}
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 baseTemplateTenantAssociation = await client.tenants.templates.versions.retrieve('version', {
  tenant_id: 'tenant_id',
  template_id: 'template_id',
});

console.log(baseTemplateTenantAssociation.id);
{
  "id": "tenant_abc",
  "created_at": "2024-01-15T10:30:00.000Z",
  "updated_at": "2024-01-15T10:30:00.000Z",
  "published_at": "2024-01-15T10:30:00.000Z",
  "version": "string",
  "data": {
    "routing": {
      "method": "all",
      "channels": [
        "string"
      ]
    },
    "content": {
      "version": "string",
      "elements": [
        {
          "type": "text",
          "channels": [
            "string"
          ],
          "ref": "string",
          "if": "string",
          "loop": "string",
          "content": "string",
          "align": "left",
          "text_style": "text",
          "color": "string",
          "bold": "string",
          "italic": "string",
          "strikethrough": "string",
          "underline": "string",
          "locales": {
            "locales_key": {
              "content": "string"
            }
          },
          "format": "markdown"
        }
      ]
    }
  }
}

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

Id of the tenant for which to retrieve the template.

template_id
string
required

Id of the template to be retrieved.

version
string
required

Version of the template to retrieve. Accepts "latest", "published", or a specific version string (e.g., "v1", "v2").

Response

id
string
required

The template's id

created_at
string
required

The timestamp at which the template was created

updated_at
string
required

The timestamp at which the template was last updated

published_at
string
required

The timestamp at which the template was published

version
string
required

The version of the template

data
TenantTemplateData · object
required

The template's data containing it's routing configs and Elemental content