Resources

    Templates API

    List, create, update and delete HTML email templates.

    How templates work

    A template is a reusable email design stored as full HTML. Templates created through the API appear under Templates in the app, can be edited in the HTML editor, and can be used as the starting point for campaigns and automation emails. Merge tags such as {{firstName}} and {{coupon_code}}, and product blocks using template syntax like {% for item in line_items %}, are rendered per recipient at send time. Dynamic product feeds use the same syntax with feed.<slug> as the collection, for example {% for item in feed.recently_viewed limit:4 %} wrapped in {% if feed.recently_viewed %}. Built-in slugs are recently_viewed, cart, recommended, best_sellers and new_arrivals; custom feeds are defined under Integrations, Product feeds in the app. Items expose name, url, image, price, compare_at_price, currency, vendor, category and product_id (plus quantity and line_total for cart). For multilingual catalogs each item is rendered in the recipient's language (subscriber language field, then the language they browsed in, then the store default); add a lang modifier to fix it, for example {% for item in feed.best_sellers limit:4 lang:en %}.

    Use the optional category field to organize designs, for example welcome, newsletter or custom (the default).

    Use cases

    • Push designs from your own design pipeline or repository into the platform.
    • Keep one master template in sync across several accounts or environments.
    • Fetch a template’s HTML to render previews in your own tools.
    • Create seasonal variants of a base template programmatically.

    Endpoints

    GET

    List templates

    /templates-api

    Returns your email templates. HTML templates created through this API are editable in the HTML editor.

    curl -X GET "https://api.mailingplatform.net/templates-api?category=welcome&limit=50" \
      -H "Authorization: Bearer mp_live_..."
    GET

    Get single template

    /templates-api/{id}

    Retrieve one template by id, including its full HTML content.

    NameTypeDescription
    idrequiredstringTemplate id (path).
    curl -X GET "https://api.mailingplatform.net/templates-api/{id}" \
      -H "Authorization: Bearer mp_live_..."
    POST

    Create template

    /templates-api

    Create an HTML template. Required fields: name, html.

    NameTypeDescription
    namerequiredstringTemplate name.
    htmlrequiredstringHTML content. Merge tags such as {{firstName}} are supported.
    categorystringOptional category, for example welcome.
    descriptionstringOptional description.
    curl -X POST "https://api.mailingplatform.net/templates-api" \
      -H "Authorization: Bearer mp_live_..." \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Welcome email",
      "category": "welcome",
      "description": "Optional",
      "html": "<!DOCTYPE html><html><body>Hello {{firstName}}</body></html>"
    }'
    PUT

    Update template

    /templates-api/{id}

    Update an existing template. Send only the fields you want to change. At least one of name, description, category, or html is required. Updating html replaces the template content and keeps it editable in the HTML editor.

    curl -X PUT "https://api.mailingplatform.net/templates-api/{id}" \
      -H "Authorization: Bearer mp_live_..." \
      -H "Content-Type: application/json" \
      -d '{
      "name": "Welcome email",
      "category": "welcome",
      "description": "Updated description",
      "html": "<!DOCTYPE html><html><body>Hello {{firstName}}</body></html>"
    }'
    DELETE

    Delete template

    /templates-api/{id}

    Permanently delete a template you own. Returns 404 if the template does not exist. The delete is rejected if an automation email still references the template.

    curl -X DELETE "https://api.mailingplatform.net/templates-api/{id}" \
      -H "Authorization: Bearer mp_live_..."