> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Create Abandoned Cart Email Template

POST https://api.bigcommerce.com/stores/{store_hash}/v3/marketing/abandoned-cart-emails
Content-Type: application/json

Create an Abandoned Cart Email template.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/admin/content/abandoned-cart-emails/create-abandoned-cart-email-template

## Authentication

- `X-Auth-Token` header (required) — ### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| | Information & Settings | read-only | `store_v2_information_read_only`| | Information & Settings | modify | `store_v2_information` | ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

## Request

### Path parameters

- `store_hash` (string, required) — Permanent ID of the BigCommerce store.

### Query parameters

- `channel_id` (integer, optional) — Channel ID to use for channel-level data.

### Headers

- `Accept` (string, required, default: application/json) — The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body.

### Body (application/json)

This endpoint expects an AbandondedCartEmailPayload.

- `is_active` (boolean, optional)
- `coupon_code` (string, optional)
- `notify_at_minutes` (enum, optional) — Describes when this email will be sent, in minutes. Only supports certain intervals described in the enum.
  - Allowed values: `60`, `120`, `180`, `240`, `300`, `360`, `420`, `480`, `540`, `600`, `660`, `720`, `780`, `840`, `900`, `960`, `1020`, `1080`, `1140`, `1200`, `1260`, `1320`, `1380`, `1440`, `2880`, `4320`, `5760`, `7200`, `8640`, `10080`, `11520`, `12960`, `14400`
- `template` (Template, optional)

## Response

### 200

OK

- `data` (AbandondedCartEmail, optional)
- `meta` (metaCollection_open, optional) — Response metadata.

## Errors

### 422 Unprocessable Entity Error

Unprocessable Entity

- `status` (integer, optional)
- `title` (string, optional)
- `type` (string, optional)
- `errors` (list of string, optional)

## Types

### Template

- `subject` (string, required)
- `body` (string, required)
- `translations` (list of TranslationDefinition, required)

### AbandondedCartEmail

- `id` (integer, optional)
- `notify_at_minutes` (enum, optional) — Describes when this email will be sent, in minutes. Only supports certain intervals described in the enum.
  - Allowed values: `60`, `120`, `180`, `240`, `300`, `360`, `420`, `480`, `540`, `600`, `660`, `720`, `780`, `840`, `900`, `960`, `1020`, `1080`, `1140`, `1200`, `1260`, `1320`, `1380`, `1440`, `2880`, `4320`, `5760`, `7200`, `8640`, `10080`, `11520`, `12960`, `14400`
- `coupon_code` (string, optional)
- `template` (Template, optional)
- `is_active` (boolean, optional)
- `sent_num` (integer, optional)

### metaCollection_open

Response metadata.

### TranslationDefinition

- `locale` (string, required) — Locale code for this language, such as 'en', 'en-us', 'fr-ca'.
- `keys` (TranslationDefinitionKeys, required) — Language keys for the template. User-defined. Should match any language keys used in the template.

### TranslationDefinitionKeys

Language keys for the template. User-defined. Should match any language keys used in the template.

## Examples

**Request**

```json
{
  "is_active": true,
  "coupon_code": "FF11-22X4",
  "notify_at_minutes": 60,
  "template": {
    "subject": "Complete your purchase at {{ store.name }}",
    "body": "{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}",
    "translations": [
      {
        "locale": "en",
        "keys": {
          "hello_phrase": "Welcome"
        }
      }
    ]
  }
}
```

**Response**

```json
{
  "data": {
    "id": 1,
    "notify_at_minutes": 60,
    "coupon_code": "FF11-22X4",
    "template": {
      "subject": "'Complete your purchase at {{ store.name }}'",
      "body": "'Complete your purchase <a href=\"{{ notification.checkout_link }}\">{{notification.checkout.link}}'",
      "translations": [
        {
          "locale": "en",
          "keys": {}
        }
      ]
    },
    "is_active": true,
    "sent_num": 1
  },
  "meta": {}
}
```

**SDK Code**

```python Add active abandoned cart email template
import requests

url = "https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails"

payload = {
    "is_active": True,
    "coupon_code": "FF11-22X4",
    "notify_at_minutes": 60,
    "template": {
        "subject": "Complete your purchase at {{ store.name }}",
        "body": "{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}",
        "translations": [
            {
                "locale": "en",
                "keys": { "hello_phrase": "Welcome" }
            }
        ]
    }
}
headers = {
    "Accept": "application/json",
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add active abandoned cart email template
const url = 'https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails';
const options = {
  method: 'POST',
  headers: {
    Accept: 'application/json',
    'X-Auth-Token': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"is_active":true,"coupon_code":"FF11-22X4","notify_at_minutes":60,"template":{"subject":"Complete your purchase at {{ store.name }}","body":"{{lang \'hello_phrase\' }}<br>Complete your purchase <a href=\'{{ notification.checkout_link }}\'>{{notification.checkout.link}}","translations":[{"locale":"en","keys":{"hello_phrase":"Welcome"}}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add active abandoned cart email template
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails"

	payload := strings.NewReader("{\n  \"is_active\": true,\n  \"coupon_code\": \"FF11-22X4\",\n  \"notify_at_minutes\": 60,\n  \"template\": {\n    \"subject\": \"Complete your purchase at {{ store.name }}\",\n    \"body\": \"{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}\",\n    \"translations\": [\n      {\n        \"locale\": \"en\",\n        \"keys\": {\n          \"hello_phrase\": \"Welcome\"\n        }\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Accept", "application/json")
	req.Header.Add("X-Auth-Token", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add active abandoned cart email template
require 'uri'
require 'net/http'

url = URI("https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"is_active\": true,\n  \"coupon_code\": \"FF11-22X4\",\n  \"notify_at_minutes\": 60,\n  \"template\": {\n    \"subject\": \"Complete your purchase at {{ store.name }}\",\n    \"body\": \"{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}\",\n    \"translations\": [\n      {\n        \"locale\": \"en\",\n        \"keys\": {\n          \"hello_phrase\": \"Welcome\"\n        }\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Add active abandoned cart email template
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails")
  .header("Accept", "application/json")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"is_active\": true,\n  \"coupon_code\": \"FF11-22X4\",\n  \"notify_at_minutes\": 60,\n  \"template\": {\n    \"subject\": \"Complete your purchase at {{ store.name }}\",\n    \"body\": \"{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}\",\n    \"translations\": [\n      {\n        \"locale\": \"en\",\n        \"keys\": {\n          \"hello_phrase\": \"Welcome\"\n        }\n      }\n    ]\n  }\n}")
  .asString();
```

```php Add active abandoned cart email template
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails', [
  'body' => '{
  "is_active": true,
  "coupon_code": "FF11-22X4",
  "notify_at_minutes": 60,
  "template": {
    "subject": "Complete your purchase at {{ store.name }}",
    "body": "{{lang \'hello_phrase\' }}<br>Complete your purchase <a href=\'{{ notification.checkout_link }}\'>{{notification.checkout.link}}",
    "translations": [
      {
        "locale": "en",
        "keys": {
          "hello_phrase": "Welcome"
        }
      }
    ]
  }
}',
  'headers' => [
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Add active abandoned cart email template
using RestSharp;

var client = new RestClient("https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"is_active\": true,\n  \"coupon_code\": \"FF11-22X4\",\n  \"notify_at_minutes\": 60,\n  \"template\": {\n    \"subject\": \"Complete your purchase at {{ store.name }}\",\n    \"body\": \"{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}\",\n    \"translations\": [\n      {\n        \"locale\": \"en\",\n        \"keys\": {\n          \"hello_phrase\": \"Welcome\"\n        }\n      }\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add active abandoned cart email template
import Foundation

let headers = [
  "Accept": "application/json",
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "is_active": true,
  "coupon_code": "FF11-22X4",
  "notify_at_minutes": 60,
  "template": [
    "subject": "Complete your purchase at {{ store.name }}",
    "body": "{{lang 'hello_phrase' }}<br>Complete your purchase <a href='{{ notification.checkout_link }}'>{{notification.checkout.link}}",
    "translations": [
      [
        "locale": "en",
        "keys": ["hello_phrase": "Welcome"]
      ]
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bigcommerce.com/stores/store_hash/v3/marketing/abandoned-cart-emails")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```