API Reference

Send Email

Send an email with attachments and advanced options.

Endpoint

POST /v1/mail/send
POST
/v1/mail/send
curl -X POST https://api.case.dev/v1/mail/send \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "client@example.com",
  "subject": "Deposition Summary",
  "body": "Please find attached the deposition summary.",
  "attachments": [
    {
      "name": "summary.pdf",
      "url": "https://your-bucket.s3.amazonaws.com/summary.pdf"
    }
  ]
}'

Example Request

curl -X POST https://api.case.dev/v1/mail/send \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "client@example.com",
    "subject": "Deposition Summary",
    "body": "Please find attached the deposition summary.",
    "attachments": [
      {
        "name": "summary.pdf",
        "url": "https://your-bucket.s3.amazonaws.com/summary.pdf"
      }
    ]
  }'

Example Response

{
  "id": "msg_abc123",
  "status": "sent",
  "to": "client@example.com",
  "subject": "Deposition Summary",
  "timestamp": "2024-01-15T10:30:00Z"
}

Request Parameters

Required:

  • to (string): Recipient email address
  • subject (string): Email subject line
  • body (string): Email body content

Optional:

  • from (string): Sender email address (must be verified domain)
  • cc (array): CC recipients
  • bcc (array): BCC recipients
  • attachments (array): File attachments
    • name (string): Filename
    • url (string): Publicly accessible URL to the file
    • content_type (string): MIME type (auto-detected if not provided)
  • webhook_url (string): URL to receive delivery status updates
  • metadata (object): Custom metadata for tracking

List Messages

Get a list of sent emails with filtering options.

Endpoint

GET /v1/mail/messages

Example Request

curl "https://api.case.dev/v1/mail/messages?status=sent&limit=20" \
  -H "Authorization: Bearer sk_case_your_api_key_here"

Example Response

{
  "messages": [
    {
      "id": "msg_abc123",
      "to": "client@example.com",
      "subject": "Deposition Summary",
      "status": "delivered",
      "timestamp": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 1,
  "limit": 20,
  "offset": 0
}

Get Message Details

Get detailed information about a specific email.

Endpoint

GET /v1/mail/messages/{id}

Example Request

curl "https://api.case.dev/v1/mail/messages/msg_abc123" \
  -H "Authorization: Bearer sk_case_your_api_key_here"

Example Response

{
  "id": "msg_abc123",
  "to": "client@example.com",
  "subject": "Deposition Summary",
  "body": "Please find attached the deposition summary.",
  "status": "delivered",
  "attachments": [
    {
      "name": "summary.pdf",
      "size": 245760,
      "url": "https://your-bucket.s3.amazonaws.com/summary.pdf"
    }
  ],
  "timestamp": "2024-01-15T10:30:00Z",
  "delivered_at": "2024-01-15T10:30:05Z"
}