Ensure you have enabled and configured API access in your Mautic settings and have the necessary permissions for
twigtemplates
.Get List of Twig Templates
Retrieves a collection of all configured Twig Templates. Successful Response (Example)Get a Specific Twig Template
Fetches the details of a single Twig Template using its unique ID. Path Parameters{templateId}
(integer, required): The ID of the Twig Template you want to retrieve.
Create a Twig Template
Allows you to add a new Twig Template to your Mautic instance. Request Body Parametersname
(string, required): The name for the new template.template
(string, required): The Twig code for the template.description
(string, optional): A brief description of the template’s purpose.
GET /api/twigTemplates/{templateId}
.
Edit a Twig Template
Updates an existing Twig Template identified by its ID. You only need to send the fields you want to change. Path Parameters{templateId}
(integer, required): The ID of the Twig Template to edit.
name
(string, optional): The updated name for the template.template
(string, optional): The updated Twig code.description
(string, optional): The updated description.
The documentation states that if the template doesn’t exist, it might create a new one. Please verify this behavior in your Mautic version.
Delete a Twig Template
Permanently removes a Twig Template from Mautic based on its ID. Path Parameters{templateId}
(integer, required): The ID of the Twig Template to delete.