- Templates
- Expert
- Developers
Template Namespace
Also called: Message template namespace · message_template_namespace · HSM namespace
A legacy ID for a WABA's template library that On-Premises API sends had to quote; the Cloud API finds templates by name and language instead.
Reviewed
What is a template namespace?
A template namespace is an opaque string, usually shaped like a UUID with underscores, that Meta assigned to every WhatsApp Business Account (WABA) to label its library of message templates. On the self-hosted On-Premises API a template send had to quote it: the original hsm message type carried namespace plus element_name, and its successor, the template type, carried namespace, name and language. The namespace told the WhatsApp Business API client whose library to look the template up in.
The field has no role on the Cloud API. There you send from a phone_number_id, that number belongs to exactly one WABA, and the template is resolved by its name and language.code inside that WABA's library. The On-Premises client moved the same way over time: from client v2.27.8 a namespace that did not belong to the WABA owning the sending number made the send fail, and from v2.41 the field became optional.
Meta sunset the On-Premises API on 23 October 2025, and the client can no longer send messages. A template namespace is therefore history: you meet it in old integration code, old provider payloads and the message_template_namespace field that can still be read from the WABA node. Treat it as something to remove during a migration, not a setting to configure.
Key takeaways
- A template namespace was a per-WABA ID that On-Premises API template sends had to quote next to the template name.
- The Cloud API ignores it: a template is found by its name and language inside the WABA that owns the sending number.
- Meta sunset the On-Premises API on 23 October 2025, so no live send uses a namespace any more.
- When a Cloud API template send fails, check the template name, language code and owning WABA, not the namespace.
Interactive stop
Follow the namespace from required to retired
Oct 2026NowEvent 7 of 7
Legacy field
The namespace survives only in old code and as a readable WABA field. Remove it when you migrate.
Event 7 of 7: Oct 2026 — Legacy field (now). The namespace survives only in old code and as a readable WABA field. Remove it when you migrate.
How does InfiQ help with a template namespace?
InfiQ runs on Meta's Cloud API, which finds templates by name and language, so namespaces never appear in InfiQ's dashboard or API.
InfiQ API referenceA template namespace: key facts and limits
- Scope
- One per WhatsApp Business Account
- Used by
- On-Premises API template and hsm sends
- Cloud API
- Not used; templates resolved by name + language
- Mismatch rule
- Send failed from On-Premises client v2.27.8
- Optional from
- On-Premises client v2.41
- On-Premises sunset
- 23 October 2025
How does a template namespace work?
Meta assigned one per WABA
When a WABA was created it received a single namespace, shared by every template in it whatever the name or language. You never chose it, and it did not change as templates were added or deleted.
On-Premises sends quoted it
A send to the client's
/v1/messagesendpoint includedtemplate.namespace(orhsm.namespacein the older format) next to the template name and a language policy, so the client could find the right library.Mismatches failed the send
From client v2.27.8, a namespace belonging to a different WABA from the one that owned the sending number made the send fail — a common breakage after numbers moved between accounts or providers.
The Cloud API resolves templates without it
The URL names the
phone_number_id, the number's WABA owns the library, andtemplate.nameplustemplate.language.codeidentify the template. No namespace is involved.Strip it during migration
When porting On-Premises code, delete namespace handling, rebuild
hsmor/v1/messagespayloads forPOST /{PHONE_NUMBER_ID}/messages, and confirm every template name and translation exists in the target WABA.
A template namespace in code
POST https://{ONPREM_CLIENT_HOST}/v1/messagesAuthorization: Bearer {CLIENT_AUTH_TOKEN}Content-Type: application/json{"to": "919812345678","type": "template","template": {"namespace": "c3f1a2b4_5d6e_7f80_9a1b_2c3d4e5f6a7b","name": "emi_due_reminder","language": { "policy": "deterministic", "code": "en" },"components": [{"type": "body","parameters": [{ "type": "text", "text": "Ravi" },{ "type": "text", "text": "5 November" }]}]}}
How a template send looked on the self-hosted client. This API was sunset on 23 October 2025 and no longer sends.
Common mistakes with a template namespace
Debugging the namespace on a Cloud API failure
On the Cloud API a template that cannot be found is about the name, the language code or the WABA that owns the sending number. Check that the exact name and translation exist and are approved in that WABA; the namespace plays no part.
Porting hsm payloads key by key
The
hsmformat usedelement_name,localizable_paramsand a languagepolicy. Rebuild the payload in the Cloud API shape —template.name,template.language.code,components— instead of mapping old keys one to one.Assuming templates moved with the number
Templates live in a WABA. If a migration also moved the number into a different WABA, every template it sends must exist and be approved there; the old library is not reachable.
Following guides that predate the Cloud API
Any guide that asks you to find and paste a namespace was written for the On-Premises API. Check the date and API of a guide before copying its payloads.
Example: Porting a Coimbatore lender's reminder service
A non-banking lender in Coimbatore still ran a 2021-era service that read a namespace from an environment variable and sent EMI reminders through an On-Premises client. After the sunset its sends stopped. The developer rewrote the sender for the Cloud API: the URL now carries the phone_number_id, the body names emi_due_reminder with language.code en, and the namespace variable was deleted. The first Tamil test failed with error 132001 (template does not exist) — not because of a namespace, but because the ta translation had never been created in the new WABA. Adding and approving it fixed the send.
Why does a template namespace matter?
Teams still trip over the namespace in two ways. Code ported from the On-Premises API keeps building payloads around a hard-coded namespace, and developers lose hours "fixing" a field that is not the problem when a template send fails. Older guides, including many provider help pages, still tell people to look the value up and paste it. Knowing it is legacy lets you delete it with confidence and debug the fields that actually decide whether a template send works: the phone number, the template name, the language code and the parameters.
Template Namespace FAQs
Do I need a template namespace to send templates on the Cloud API?+
Where can I still see my namespace?+
Is the namespace the same as a template ID?+
Can I still use the On-Premises API?+
Best practices for a template namespace
- Search old repositories for
namespace,element_nameand/v1/messagesto find On-Premises code paths still waiting for migration. - Log the template name, language code and
phone_number_idon every failed template send; those three explain almost every template-not-found error. - If you run several WABAs, keep template names identical across them so code needs no per-account mapping.
Talk to InfiQ
From definition to your first message
InfiQ is an official Meta Business Partner. Start a 7-day free trial — no card needed — and see this running on your own number.