Tenant Templates
Get a Template version
Returns one version of a tenant template, addressed by version number or by latest, with its content and publish timestamp.
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/v4"
"github.com/trycourier/courier-go/v4/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
Path Parameters
Response
⌘I
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/v4"
"github.com/trycourier/courier-go/v4/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"
}