Skip to content

cURL

cURL is the lowest-common-denominator way to call 3AVA Mail. Useful for one-off scripts, debugging, and CI checks.

Terminal window
curl -X POST https://mail.3ava.com/api/emails \
-H "Authorization: Bearer am_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Hello",
"html": "<p>Hi.</p>"
}'
Terminal window
curl -X POST https://mail.3ava.com/api/emails \
-H "Authorization: Bearer am_YOUR_KEY" \
-H "Idempotency-Key: order-12345" \
-H "Content-Type: application/json" \
-d @body.json

Where body.json contains the email body.

Encode the file in base64 first:

Terminal window
ATTACHMENT=$(base64 < invoice.pdf)
cat > body.json <<EOF
{
"from": "Acme <[email protected]>",
"to": ["[email protected]"],
"subject": "Your invoice",
"html": "<p>Attached.</p>",
"attachments": [
{
"filename": "invoice.pdf",
"content": "$ATTACHMENT",
"content_type": "application/pdf"
}
]
}
EOF
curl -X POST https://mail.3ava.com/api/emails \
-H "Authorization: Bearer am_YOUR_KEY" \
-H "Content-Type: application/json" \
-d @body.json
Terminal window
curl https://mail.3ava.com/api/emails/a1b2c3d4-... \
-H "Authorization: Bearer am_YOUR_KEY"
Terminal window
curl -s https://mail.3ava.com/api/emails -H "Authorization: Bearer am_YOUR_KEY" \
| jq '.data[] | {id, status, subject}'