Getting started
Send your first email
Publish a template, create an API key, and send your first email.
1. Prepare your project
Create a project with a plan that includes sending. Use sandbox mode to test without delivering email. For live delivery, complete Sending setup and enable live sending.
2. Publish a template
Create a template with the key welcome. Add {{ name }} to its text and {{ action_url }} as a button URL, then publish it. The examples below supply both variables. If you use another template, copy its key and required variables from the editor.
3. Create an API key
Create an API key in your project’s API keys page. Save it as SENDERY_API_KEY in your server environment. Keep the key out of browser code and source control.
export SENDERY_API_KEY="your_project_api_key"4. Send an email
Run the cURL example, or install your language’s SDK and use its example. Replace the recipient with your email address to test live delivery. Reuse welcome-123 only when retrying this same email; choose a new key for another send.
curl https://sendery.co/api/v1/emails \
-H "Authorization: Bearer $SENDERY_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Idempotency-Key: welcome-123' \
-d '{
"to": "[email protected]",
"template": "welcome",
"data": {"name": "Alex", "action_url": "https://example.com/start"}
}'require 'vendor/autoload.php';
use Sendery\Client;
$sendery = new Client(getenv('SENDERY_API_KEY'));
$receipt = $sendery->send(
to: '[email protected]',
template: 'welcome',
data: ['name' => 'Alex', 'action_url' => 'https://example.com/start'],
);
echo $receipt['id'];import { Sendery } from '@sendery/sdk';
const apiKey = process.env.SENDERY_API_KEY;
if (!apiKey) throw new Error('Set SENDERY_API_KEY on your server.');
const sendery = new Sendery(apiKey);
const receipt = await sendery.send({
to: '[email protected]',
template: 'welcome',
data: { name: 'Alex', action_url: 'https://example.com/start' },
});
console.log(receipt.id);import os
from sendery import Sendery
sendery = Sendery(os.environ["SENDERY_API_KEY"])
receipt = sendery.send(
to="[email protected]",
template="welcome",
data={"name": "Alex", "action_url": "https://example.com/start"},
)
print(receipt["id"])import co.sendery.Sendery;
import java.util.Map;
public class SendWelcome {
public static void main(String[] args) {
var sendery = new Sendery(System.getenv("SENDERY_API_KEY"));
var receipt = sendery.send("[email protected]", "welcome", Map.of(
"name", "Alex",
"action_url", "https://example.com/start"
));
System.out.println(receipt.id());
}
}import co.sendery.Sendery
fun main() {
val sendery = Sendery(System.getenv("SENDERY_API_KEY"))
val receipt = sendery.send("[email protected]", "welcome", mapOf(
"name" to "Alex",
"action_url" to "https://example.com/start"
))
println(receipt.id())
}5. Check the result
A 202 response confirms acceptance. Save the returned id to check delivery status. In sandbox mode, the status becomes simulated and no email is delivered.
{
"id": "35a6b227-1748-412e-8651-430492201670",
"status": "queued"
}6. Retrieve the email
Replace the example ID below with the ID returned by your send request.
curl https://sendery.co/api/v1/emails/35a6b227-1748-412e-8651-430492201670 \
-H "Authorization: Bearer $SENDERY_API_KEY" \
-H 'Accept: application/json'