Reference › Examples

Reference

Examples

Copy-paste HTTP examples for supported public REST flows. Replace placeholders before running them.

Send a transactional email

Route: POST /v1/emails.

curl -X POST "https://api.ctct.dev/v1/emails" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: receipt-1042" \
  -d '{
    "from": "noreply@constantcontact.com",
    "to": ["ada@example.com"],
    "subject": "Your receipt is ready",
    "html": "<p>Your receipt AB-1042 is ready.</p>",
    "message_class": "transactional"
  }'

Check send status

curl "https://api.ctct.dev/v1/sends/<SEND_ID>" \
  -H "Authorization: Bearer <API_KEY>"

Create and verify a domain

Routes: POST /v1/domains and POST /v1/domains/{domain_id}:verify.

curl -X POST "https://api.ctct.dev/v1/domains" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"domain_name":"<DOMAIN>"}'

curl -X POST "https://api.ctct.dev/v1/domains/<DOMAIN_ID>:verify" \
  -H "Authorization: Bearer <API_KEY>"

Create a webhook endpoint

Route: POST /v1/webhook-endpoints.

curl -X POST "https://api.ctct.dev/v1/webhook-endpoints" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhooks/ctct",
    "event_types": ["email.sent", "email.delivered"]
  }'

Redeliver a webhook event

curl -X POST "https://api.ctct.dev/v1/webhook-events/<EVENT_ID>:redeliver" \
  -H "Authorization: Bearer <API_KEY>"