Templates API
In addition to managing templates through Positus Studio, you can manage them directly through the API. The template endpoints are scoped by workspace and allow you to list, retrieve, validate the name of, create, and delete templates.Authentication and Scope
All routes require user Bearer Token authentication and are accessed under the desired workspace:Creating and deleting templates require the authenticated user to be an owner of the workspace. Otherwise, the API responds with
403. The other routes only require the user to have active access to the workspace.List Templates
Returns the workspace templates.- There is no pagination or other filters (name, category, or language).
- Templates with
DELETEDstatus are not returned in the list. - The
PAUSEDstatus has two ids (10and11); to filter it, query one id at a time.
Show Template
Returns a specific template from the workspace.{ "data": { ...template object } }, in the same format as each item in the list. If the template does not belong to the workspace, the API responds with 404.
Unlike the list, the show route also returns templates with
DELETED status.Validate Name
Before creating a template, check whether the name is already in use in the workspace. Trying to create a template with an existing name results in an error.204 No Content: there is no template with that name.422 Unprocessable Entity: the name already exists.
The name is normalized the same way as at creation (see Create Template) and compared only with the templates registered in Positus for the workspace, including those already deleted. The check does not query Meta.
Create Template
Creates a template in the workspace. The template is sent to Meta and, if successful, registered in Positus.The
name is normalized before being saved: it becomes lowercase, and spaces and symbols become _. For example, Meu primeiro template is saved as meu_primeiro_template. The name returned in the response is the normalized one.Components
Thecomponents property is passed to Meta unchanged: Positus does not define or validate component types, parameters, or buttons, and Meta is the one that accepts or rejects the content. See all the possibilities in Meta’s documentation on components.
The only cases in which Positus inspects the content of components are header files:
Simple Template
200 OK
status, category, and wa_id come from Meta’s response. For this reason, the category may differ from the one sent (Meta may recategorize the template) and the status is usually PENDING. Creation responds with 200, not 201.Template with a File in the Header
The file must be sent in the same FormData fieldcomponents[1][example][header_handle][0] (index of the HEADER component within components). The example below shows the logical body, where (binary) represents the file.
200 OK (excerpt). The uploaded file becomes available in header_file, and header_handle[0] now contains the identifier generated by Meta.
Carousel Template
Each card with an image or video header requires the corresponding file incomponents[i][cards][j][components][k][example][header_handle][0] (FormData). The example below shows the logical body.
200 OK. The card files are returned in carousel_files, in the order of the cards:
Authentication Template
200 OK (excerpt):
The authentication component options (such as the body and the
OTP button) are validated by Meta. To see the default text of authentication templates, use the previews route.Limits and Errors
When a template is created through the API, the
message_template_created event is sent to the workspace webhook.Delete Template
Deletes a template from the workspace. Requires the workspace owner user.204 No Content: the template was deleted in Meta and marked asDELETEDin Positus.400: Meta did not delete the template. The response contains{ "message": "..." }with the message returned by Meta.403: the user is not the workspace owner.
Previews
Returns the authentication template previews provided by Meta for the workspace WABA.
The response is the JSON returned by Meta, without transformation, and is cached for 1 hour for the same combination of workspace, category, languages, and options. If the workspace has no WABA, the API responds with
400.
Restrictions
Returns the template restrictions of the workspace.This route is informational only: the create endpoint only validates whether
display_format and sub_category belong to the accepted values, and does not block submission when order_details is false.List Templates of a Number
Returns the templates of the workspace to which a number belongs.
Response —
{ "data": [ ...template objects ] }, with all non-deleted templates of the number’s workspace, with no status filter.