Deliver
The Deliver endpoint queues an email for delivery through Customer.io. JustAI selects the optimal variant and handles delivery on your behalf.
Endpoint
Section titled “Endpoint”POST https://worker.justwords.ai/api/deliver/:org_slugAuthentication
Section titled “Authentication”This endpoint requires authentication via an API key. Include your key in the X-Api-Key header.
See the Quickstart for details on creating and managing API keys.
Request
Section titled “Request”Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
org_slug | string | Yes | Your organization identifier (e.g., your-company-name). |
Request Body
Section titled “Request Body”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
template_id | string | Yes | - | Unique identifier for the template. |
email | string | Yes | - | Recipient email address. |
copy_id | string | No | - | Force a specific variant by ID. |
attrs | object | No | {} | Key-value pairs for targeting/filtering. |
fields | object | No | {} | Key-value pairs for LiquidJS template variable substitution. |
lookback_days | number | No | 14 | Number of days of historical data to use for optimization. |
offset_days | number | No | 3 | Number of days to offset the lookback window. |
use_cache | boolean | No | true | Whether to use cached results. |
epsilon | number | No | - | Exploration rate override for the bandit algorithm. |
Examples
Section titled “Examples”Basic Request
Section titled “Basic Request”curl -X POST https://worker.justwords.ai/api/deliver/your-org \ -H "X-Api-Key: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "template_id": "welcome-email", "email": "alice@example.com" }'const response = await fetch( 'https://worker.justwords.ai/api/deliver/your-org', { method: 'POST', headers: { 'X-Api-Key': 'your_api_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ template_id: 'welcome-email', email: 'alice@example.com', }), });
const data = await response.json();console.log(data);import requests
url = "https://worker.justwords.ai/api/deliver/your-org"headers = { "X-Api-Key": "your_api_key", "Content-Type": "application/json"}payload = { "template_id": "welcome-email", "email": "alice@example.com"}
response = requests.post(url, json=payload, headers=headers)data = response.json()print(data)With Personalization
Section titled “With Personalization”{ "template_id": "welcome-email", "email": "alice@example.com", "fields": { "user_name": "Alice", "account_type": "premium" }, "attrs": { "plan": "premium", "region": "us-east" }}Response
Section titled “Response”Success Response (200 OK)
Section titled “Success Response (200 OK)”{ "status": "ok"}A 200 response means the message has been queued for delivery. It does not mean the email has been sent yet — delivery happens asynchronously.