get
https://www.locally.com/headless/api/1.0/email/template/send
Send an email using a template.
Request Parameters
🏷️ header · unmarked parameters are query params
| Parameter | Type | Required | Description |
|---|---|---|---|
Locally-Api-Token 🏷️ | string | Yes | Locally API token must be passed in the header to authenticate the API consumer. |
email | string | Yes | The email address to send the product details to. |
link | string | Yes | The link to the product details page. |
template | string | Yes | The email template. E.g. 'save_for_later' (Save for Later), 'save_cart' (Save Cart). |
Example Request
curl --get 'https://www.locally.com/headless/api/1.0/email/template/send' \
--header 'Locally-Api-Token: {{API_TOKEN}}' \
--data-urlencode '[email protected]' \
--data-urlencode 'link=https://www.locally.com/product/12345' \
--data-urlencode 'template=save_for_later'const params = new URLSearchParams({
email: '[email protected]',
link: 'https://www.locally.com/product/12345',
template: 'save_for_later'
});
const response = await fetch(`https://www.locally.com/headless/api/1.0/email/template/send?${params}`, {
headers: {
'Locally-Api-Token': '{{API_TOKEN}}'
}
});
const data = await response.json();
console.log(data);import requests
url = "https://www.locally.com/headless/api/1.0/email/template/send"
params = {
"email": "[email protected]",
"link": "https://www.locally.com/product/12345",
"template": "save_for_later"
}
headers = {"Locally-Api-Token": "{{API_TOKEN}}"}
response = requests.get(url, params=params, headers=headers)
print(response.json())template accepts save_for_later or save_cart. The link value must be a locally.com URL — links pointing at other domains are rejected.
Example Response
{
"success": true,
"data": {
"success": 1,
"session": {
"id": "abc999"
}
},
"msg": ""
}Response Explanation
success—truemeans the request was processed and staystrueeven when the email is rejected — checkdata.successfor the send outcome; auth and server errors returnfalsewith anerror_code.data.success—1when the email was queued,0on a validation failure or unrecognizedtemplatevalue; booleans insidedataserialize as1/0.save_for_latersends the same email as Send Save for Later email.data.session.id— Session ID returned on every response. Pass it as theLocally-Api-Session-Idheader on later calls to persist location and cart state; expired or missing IDs are replaced with fresh ones.msg— Human-readable envelope message: an empty string on success, the error text whensuccessisfalse(which also adds anerror_codefield).
200Successful
400Bad Request
401Unauthorized
402Request Failed
403Forbidden
404Not Found
429Too Many Requests
500Server Error

