Send email

Send an email using a template.

Request Parameters

🏷️ header · unmarked parameters are query params

ParameterTypeRequiredDescription
Locally-Api-Token 🏷️stringYesLocally API token must be passed in the header to authenticate the API consumer.
emailstringYesThe email address to send the product details to.
linkstringYesThe link to the product details page.
templatestringYesThe 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

  • successtrue means the request was processed and stays true even when the email is rejected — check data.success for the send outcome; auth and server errors return false with an error_code.
  • data.success1 when the email was queued, 0 on a validation failure or unrecognized template value; booleans inside data serialize as 1/0. save_for_later sends the same email as Send Save for Later email.
  • data.session.id — Session ID returned on every response. Pass it as the Locally-Api-Session-Id header 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 when success is false (which also adds an error_code field).
Query Params
string
required

The email address to send the product details to.

string
required
string
required

The email template. E.g. 'save_for_later' (Save for Later), 'save_cart' (Save Cart)

Headers
string
required

Locally API token must be passed in the header to authenticate the API consumer

Responses
200

Successful

400

Bad Request

401

Unauthorized

402

Request Failed

403

Forbidden

404

Not Found

429

Too Many Requests

500

Server Error

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here!