---
title: "How do I send an email with a Sendkit template via the API?"
description: "Choose the template and customize the content for each recipient using headers"
url: https://help.sarbacane.com/en/articles/438-how-do-i-send-an-email-with-a-sendkit-template-via-the-api
collection: "Transactional emails"
updated: 2026-10-15
language: en
alternates: [fr, es]
---

# How do I send an email with a Sendkit template via the API?

Choose the template and customize the content for each recipient using headers

The Sendkit API lets you send emails using a Sendkit template and personalize their content for each recipient.

To use a template and pass personalization data, the following two headers are required:

-   **X-SKT-TEMPLATE** : selects the Sendkit template to use.
    
-   **X-SKT-SUB** : passes personalization data for each recipient.
    

The template you use must be created in Sendkit under “My campaigns.” It is not possible to call a Studio template directly via the API. However, you can create a Sendkit template using a Studio template as a base.

## **Request example**

In the following example:

-   the template used is called name1;
    
-   the personalization fields are FirstName and LastName.
    

curl --request POST \\

  --url [https://api.sarbacane.com/sendkit/email/send](https://api.sarbacane.com/sendkit/email/send) \\

  --header 'content-type: application/json' \\

  --header 'x-apikey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \\

  --data '{

    "to": \[

      {

        "address": "[recipient@example.com](mailto:recipient@example.com)"

      }

    \],

    "msg": {

      "from": {

        "address": "[sender@example.com](mailto:sender@example.com)",

        "personalName": "Frank Sender"

      },

      "replyTo": {

        "personalName": "Frank Sender",

        "address": "[reply@example.com](mailto:reply@example.com)"

      },

      "subject": ".",

      "html": "."

    },

    "headers": {

      "X-SKT-TEMPLATE": "name1",

      "X-SKT-SUB": \[

        {

          "email": "[recipient@example.com](mailto:recipient@example.com)",

          "values": {

            "FirstName": "John",

            "LastName": "Doe"

          },

          "meta": {

            "orderId": 1234567890,

            "shipmentId": 123456789

          }

        }

      \],

      "X-SKT-TEXTVERSION": 1,

      "X-SKT-TAGS": \[

        "Test",

        "Sendkit",

        "Shipping",

        "Hello"

      \]

    }

  }'

**Important** **:** the html field is required

In the example above, the content is simply ".", because it will be automatically replaced with the content of the template specified in X-SKT-TEMPLATE.

The X-SKT-SUB header allows you to transmit data specific to each recipient.

It can notably be used to:

-   replace dynamic variables;
    
-   personalize email content for each recipient;
    
-   add business data;
    
-   personalize the subject;
    
-   manage conditional content;
    
-   transmit data that is not displayed in the email.
    

There are many possibilities. For example, you can use data from your information system to:

-   display complementary products;
    
-   modify certain content or CSS elements;
    
-   generate a different subject for each recipient;
    
-   display information related to an order or delivery.
    

## **Variables**

You can add variables to the content of your template.

For example:

Hello {{FirstName}} {{LastName}},

Then pass the corresponding values in X-SKT-SUB:

"values": {

  "FirstName": "John",

  "LastName": "Doe"

}

  
  

## **Meta**:

The X-SKT-META header allows you to add custom key-value elements. The elements contained in the meta header are not present in the destination email. Only webhooks allow you to retrieve this information and process it in your system.

For example, it can contain:

-   a user ID;
    
-   an order number;
    
-   a delivery ID;
    
-   any other data that can be used to link to your information system.
    

Example:

"meta": {

  "unique\_id": "987654321",

  "order\_id": "132456798",

  "shipment\_id": "1237498798"

}

Note: if a key exists in both X-SKT-META and X-SKT-SUB, the SUB value takes priority. 

## **Text version**

The X-SKT-TEXTVERSION header automatically generates a text version from the HTML content of the email.

Example:

"X-SKT-TEXTVERSION": 1

## **Add tags**

The X-SKT-TAGS header lets you associate tags with the email to filter and analyze statistics in Sendkit. This allows you to distinguish between emails such as "password reset" or "welcome" emails, or according to their sources. Tags are of course not visible to your recipients.

### **Conditions**

-   Maximum of 5 tags per email;
    
-   only the first 5 tags are retained;
    
-   Maximum of 50 alphanumeric characters per tag;
    
-   special characters are not allowed (@, -, ,, etc.).
    

Example:

"X-SKT-TAGS": \[

  "Test",

  "Sendkit",

  "Shipping",

  "Hello"

\]  

## **Force the domain**

By default, the sending domain is inferred from the sender's address.

The X-SKT-DOMAIN header lets you force the domain used for sending.

Example:

"X-SKT-DOMAIN": "[sendkit.example.com](https://sendkit.example.com)"

**Important** **:** if the specified domain is not fully configured and validated in Sendkit, a shared domain may be used for sending.

## **Configure tracking** 

The X-SKT-TRACKING header allows you to enable or disable tracking of interactions with the email.

It allows you in particular to manage:

-   open tracking;
    
-   click tracking.
    

Example:

"X-SKT-TRACKING": {

  "html": {

    "open": 1

    "click": 1

  },

  "text": {

    "click": 1

  }

}

## **Enable Google Analytics** 

The X-SKT-GOOGLEANALYTICS header lets you enable and customize Google Analytics tracking on links contained in the email.

Example :

"X-SKT-GOOGLEANALYTICS": {

  "enable": "1",

  "utm\_source": "Sendkit\_Support",

  "utm\_medium": "email",

  "utm\_content": "Test\_Sending",

  "utm\_campaign": "Have\_a\_look"

}

UTM parameters allow you to identify the source and context of clicks in your analytics tools.  

## **Header summary**

<table data-id="707e5bff-a922-49e6-a15b-1e6bb6b9d503" style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="2e18adfd-3332-446c-9bcd-07f05c30d1d4" style="text-align: center;"><span style="color: #000000;"><strong>Header</strong></span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="9d89549d-48f6-48c8-b908-2aed728ea226" style="text-align: center;"><span style="color: #000000;"><strong>Usage</strong></span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="876bef0b-f4a1-4422-978a-4edf6fe10747"><span style="color: #188038;">X-SKT-TEMPLATE</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="65c83d61-cf3e-4774-808e-044a11c99892"><span style="color: #000000;">Select the Sendkit template to use</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="f70c17fa-83b6-4c14-9b9e-7d35602cf838"><span style="color: #188038;">X-SKT-SUB</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="4254f35f-997b-4ec8-a370-e77ff7289aba"><span style="color: #000000;">Customize the email for each recipient</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="84864a2c-9b07-4e2a-865b-992c4e14d2d6"><span style="color: #188038;">X-SKT-META</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="fadebeb2-d2f6-4f56-9dcf-336e0982dfa0"><span style="color: #000000;">Add global data accessible via webhooks</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="881b3b83-7771-4982-9ce8-927fdf59af5e"><span style="color: #188038;">X-SKT-TEXTVERSION</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="2671463a-81f0-4eaa-ac6c-f563e4ea6b6b"><span style="color: #000000;">Generate a text version from the HTML</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="6d71de00-cbab-46c7-8959-162d84b0ff51"><span style="color: #188038;">X-SKT-TAGS</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="f93d7f4c-92f7-4858-8e9f-9d16d1e3e852"><span style="color: #000000;">Add tags to filter and analyze statistics</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="c884a33a-8fe7-4211-b46c-059c9e009b26"><span style="color: #188038;">X-SKT-DOMAIN</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="1f89298c-cd46-4c00-9dd5-f023200f15c6"><span style="color: #000000;">Force the sending domain</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="2ceae6d0-58a2-45c4-a0ac-298eb33d2cf6"><span style="color: #188038;">X-SKT-TRACKING</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="3058281e-419c-460f-8984-1ed4b750c1b5"><span style="color: #000000;">Configure open and click tracking</span></p></td></tr><tr><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="6eb1a851-c1bb-4919-a773-eecc5c963308"><span style="color: #188038;">X-SKT-GOOGLEANALYTICS</span></p></td><td colspan="1" rowspan="1" style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word;"><p data-id="25a43e41-4993-4073-95fb-3f7868703486"><span style="color: #000000;">Configure Google Analytics tracking</span></p></td></tr></tbody></table>

With X-SKT-TEMPLATE and X-SKT-SUB, you can use a Sendkit template while dynamically personalizing its content for each recipient.
