Documentation
Sign inGet started

Get an SMS template

GET
/v1/sms/templates/{template_ref}
const tpl = await bird.smsTemplates.get("bird_otp_verification");
console.log(tpl.body, tpl.variables);
Returns a single SMS template: its body preview, category, the variables it expects (each with its accepted format), and the languages it is available in. Fetch a template before sending with it to see which parameters keys are required; an unknown reference returns a 404. To browse the whole catalogue, use List SMS templates instead.
Parametri
template_ref
string
The template's slug (for example bird_otp_verification) or its smt_-prefixed id. A reference starting with smt_ resolves by id; anything else resolves by slug.
Payload di risposta
id
string
obbligatorio
Unique identifier for the template.
slug
string
obbligatorio
The template's permanent handle. Pass it (or the id) as the template reference when sending. Handles beginning with bird_ are reserved for Bird's built-in templates.
name
string
obbligatorio
The template's display name, shown wherever the template is listed. Nothing resolves through it, so it is safe to show wherever a human reads the template.
description
nullable string
obbligatorio
What the template is for. Null when unset.
scope
string
obbligatorio
Whether the template is one of our built-in templates (system) or one your workspace created (workspace).
Possible values: system, workspace
status
string
obbligatorio
Where the template stands as a whole. The same five states on every channel.
  • draft: nothing has ever gone live.
  • pending: nothing is live and at least one language is in review.
  • active: at least one language is live, so something can be sent.
  • rejected: it was reviewed and every language was refused.
  • inactive: nothing is live and nothing is in review, so content was withdrawn or was blocked before anything went live.
This is a summary. It answers whether the template is usable at all, not whether every language is: a template with one language live is active even while another is still drafted or refused. Read languages for per-language state, which is what says which language is where and why.
Which of the five a template can reach follows its channel's review model. A channel whose content a third party reviews reaches all five; one whose content goes live on publish moves between draft, active and inactive.
Open enum: treat a value you do not recognize as a new one rather than as an error.
Possible values (may grow over time): draft, pending, active, rejected, inactive
category
string
obbligatorio
Content classification applied to messages sent from this template.
body
string
obbligatorio
The template body in its default language, shown for preview. Variable placeholders appear inline (for example {{ code }}). Name a language on the send to have another one served.
variables
array of object
obbligatorio
The typed slots this template fills in from the values you supply in parameters when sending. Every language of a template declares the same slots, so this list holds for whichever one a send resolves to.
Mostra attributi secondari
variables.key
string
obbligatorio
The key this slot is filled by. On email and SMS it is the key you set in the send's parameters object. On WhatsApp it is the name you repeat on the matching parameter inside components, or, for a template whose placeholders are positional, the position itself as 1, 2 and so on.
variables.type
string
obbligatorio
The value type this slot accepts. SMS templates use the typed slots (code, amount and the rest), each of which rejects a value that does not match its constraint. Email and WhatsApp templates use text, which accepts any value. Open enum: treat an unrecognized value as a future type rather than an error.
Possible values (may grow over time): code, ttl, count, ref, date, date_time, amount, currency, text
variables.required
boolean
obbligatorio
Whether the slot must be supplied when sending. On SMS and WhatsApp a missing required value is rejected with a 422. On email it is advisory: a missing value renders as empty rather than rejecting the send.
variables.constraint
string
obbligatorio
A plain-language description of what values this variable accepts.
variables.sensitive
boolean
Whether this slot's value is kept out of durable storage. A sensitive slot's rendered value never appears in message content read back through the API: a stand-in placeholder is stored instead.
default_language
string
obbligatorio
The language a send uses when it names none, and the last resort when on_missing_language is fallback and the language asked for is not available.
available_languages
array of string
obbligatorio
The languages a send can resolve right now, as BCP-47 tags. The set may shrink for reasons other than editing, so read it rather than assuming it matches what you last saw.
languages
object
obbligatorio
Where each of the template's languages stands, keyed by BCP-47 language tag. Content is not here: body previews the default language, and a send resolves the one it needs.
on_missing_language
string
obbligatorio
What a send does when it asks for a language this template does not carry. Defaults to fallback on SMS.
language_source_required
boolean
obbligatorio
Whether a send has to name a language. When true, a send that names none is rejected instead of being served the default language.
draft_version_id
nullable string
obbligatorio
The current editable draft version, or null for a built-in system template, which has no draft.
live_version_id
nullable string
obbligatorio
The version a send resolves to, or null for a built-in system template, which Bird ships ready to send rather than versioning.
published_version_id
nullable string
obbligatorio
Deprecated: use live_version_id instead, which carries the same value.
revision
nullable integer
obbligatorio
The draft's revision counter. Null for a built-in system template, which is unversioned.
last_submitted_at
nullable string
obbligatorio
When this template was last submitted. Null for a built-in system template: Bird ships it ready to send, so there is nothing submitted to date.
created_at
nullable string
obbligatorio
When the template was created. Null for a built-in system template, which Bird ships rather than stores.
updated_at
nullable string
obbligatorio
When the template was last modified. Null for a built-in system template, which Bird ships rather than stores.