cURL
cURL is the lowest-common-denominator way to call 3AVA Mail. Useful for one-off scripts, debugging, and CI checks.
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>" }'With idempotency
Section titled “With idempotency”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.jsonWhere body.json contains the email body.
With attachment
Section titled “With attachment”Encode the file in base64 first:
ATTACHMENT=$(base64 < invoice.pdf)cat > body.json <<EOF{ "subject": "Your invoice", "html": "<p>Attached.</p>", "attachments": [ { "filename": "invoice.pdf", "content": "$ATTACHMENT", "content_type": "application/pdf" } ]}EOFcurl -X POST https://mail.3ava.com/api/emails \ -H "Authorization: Bearer am_YOUR_KEY" \ -H "Content-Type: application/json" \ -d @body.jsonGet email status
Section titled “Get email status”curl https://mail.3ava.com/api/emails/a1b2c3d4-... \ -H "Authorization: Bearer am_YOUR_KEY"Tip: use jq to parse
Section titled “Tip: use jq to parse”curl -s https://mail.3ava.com/api/emails -H "Authorization: Bearer am_YOUR_KEY" \ | jq '.data[] | {id, status, subject}'