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);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
base_template_tenant_association = client.tenants.templates.versions.retrieve(
version="version",
tenant_id="tenant_id",
template_id="template_id",
)
print(base_template_tenant_association.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"),
)
baseTemplateTenantAssociation, err := client.Tenants.Templates.Versions.Get(
context.TODO(),
"version",
courier.TenantTemplateVersionGetParams{
TenantID: "tenant_id",
TemplateID: "template_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baseTemplateTenantAssociation.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.tenants.BaseTemplateTenantAssociation;
import com.courier.models.tenants.templates.versions.VersionRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
VersionRetrieveParams params = VersionRetrieveParams.builder()
.tenantId("tenant_id")
.templateId("template_id")
.version("version")
.build();
BaseTemplateTenantAssociation baseTemplateTenantAssociation = client.tenants().templates().versions().retrieve(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
base_template_tenant_association = courier.tenants.templates.versions.retrieve("version", tenant_id: "tenant_id", template_id: "template_id")
puts(base_template_tenant_association)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$baseTemplateTenantAssociation = $client
->tenants
->templates
->versions
->retrieve('version', tenantID: 'tenant_id', templateID: 'template_id');
var_dump($baseTemplateTenantAssociation);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Tenants.Templates.Versions;
CourierClient client = new();
VersionRetrieveParams parameters = new()
{
TenantID = "tenant_id",
TemplateID = "template_id",
Version = "version",
};
var baseTemplateTenantAssociation = await client.Tenants.Templates.Versions.Retrieve(parameters);
Console.WriteLine(baseTemplateTenantAssociation);courier tenants:templates:versions retrieve \
--api-key 'My API Key' \
--tenant-id tenant_id \
--template-id template_id \
--version versioncurl --request GET \
--url https://api.courier.com/tenants/{tenant_id}/templates/{template_id}/versions/{version} \
--header 'Authorization: Bearer <token>'{
"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"
}
]
}
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Courier Create
Get a Specific Template Version
Fetches a specific version of a tenant template.
Supports the following version formats:
latest- The most recent version of the templatepublished- The currently published versionv{version}- A specific version (e.g., “v1”, “v2”, “v1.0.0”)
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);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
base_template_tenant_association = client.tenants.templates.versions.retrieve(
version="version",
tenant_id="tenant_id",
template_id="template_id",
)
print(base_template_tenant_association.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"),
)
baseTemplateTenantAssociation, err := client.Tenants.Templates.Versions.Get(
context.TODO(),
"version",
courier.TenantTemplateVersionGetParams{
TenantID: "tenant_id",
TemplateID: "template_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", baseTemplateTenantAssociation.ID)
}
package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.tenants.BaseTemplateTenantAssociation;
import com.courier.models.tenants.templates.versions.VersionRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
VersionRetrieveParams params = VersionRetrieveParams.builder()
.tenantId("tenant_id")
.templateId("template_id")
.version("version")
.build();
BaseTemplateTenantAssociation baseTemplateTenantAssociation = client.tenants().templates().versions().retrieve(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
base_template_tenant_association = courier.tenants.templates.versions.retrieve("version", tenant_id: "tenant_id", template_id: "template_id")
puts(base_template_tenant_association)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$baseTemplateTenantAssociation = $client
->tenants
->templates
->versions
->retrieve('version', tenantID: 'tenant_id', templateID: 'template_id');
var_dump($baseTemplateTenantAssociation);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Tenants.Templates.Versions;
CourierClient client = new();
VersionRetrieveParams parameters = new()
{
TenantID = "tenant_id",
TemplateID = "template_id",
Version = "version",
};
var baseTemplateTenantAssociation = await client.Tenants.Templates.Versions.Retrieve(parameters);
Console.WriteLine(baseTemplateTenantAssociation);courier tenants:templates:versions retrieve \
--api-key 'My API Key' \
--tenant-id tenant_id \
--template-id template_id \
--version versioncurl --request GET \
--url https://api.courier.com/tenants/{tenant_id}/templates/{template_id}/versions/{version} \
--header 'Authorization: Bearer <token>'{
"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"
}
]
}
}
}{
"message": "Example message text",
"type": "invalid_request_error"
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Id of the tenant for which to retrieve the template.
Id of the template to be retrieved.
Version of the template to retrieve. Accepts "latest", "published", or a specific version string (e.g., "v1", "v2").
Response
The template's id
The timestamp at which the template was created
The timestamp at which the template was last updated
The timestamp at which the template was published
The version of the template
The template's data containing it's routing configs and Elemental content
Show child attributes
Show child attributes
⌘I