Developer Documentation · REST v1

Send transactional emails & trigger sequences from your own domain.

Use Briefs as your application's high-speed email delivery engine. Authenticate with a secret key, send from your SPF + DKIM verified custom domain, and enroll users into automated drip sequences with a single HTTPS request.

Send your first email in 30 seconds

Base URL: https://withbriefs.com/api/v1. Pass your secret key in the Authorization: Bearer sk_... header and include an Idempotency-Key on every write request so retries are always safe.

curl -X POST "https://withbriefs.com/api/v1/emails" \
  -H "Authorization: Bearer sk_live_your_secret_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: welcome-user-42" \
  -d '{
    "from": "noreply@yourdomain.com",
    "from_name": "Briefs App",
    "to": "ada@example.com",
    "reply_to": "support@yourdomain.com",
    "subject": "Your login code is 849201",
    "html": "<p>Hi Ada, your one-time code is <strong>849201</strong>.</p>",
    "text": "Hi Ada, your one-time code is 849201.",
    "tags": ["auth", "otp"]
  }'
const res = await fetch("https://withbriefs.com/api/v1/emails", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.BRIEFS_SECRET_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": `otp-${userId}-${codeId}`,
  },
  body: JSON.stringify({
    from: "noreply@yourdomain.com",
    from_name: "Acme App",
    to: "ada@example.com",
    subject: "Your login code is 849201",
    html: "<p>Hi Ada, your one-time code is <strong>849201</strong>.</p>",
    text: "Hi Ada, your one-time code is 849201.",
    tags: ["auth", "otp"],
  }),
});

const data = await res.json();
console.log(res.status, data.data.id); // 202 "em_..."
import os, requests

resp = requests.post(
    "https://withbriefs.com/api/v1/emails",
    headers={
        "Authorization": f"Bearer {os.environ['BRIEFS_SECRET_KEY']}",
        "Idempotency-Key": "welcome-user-42",
    },
    json={
        "from": "noreply@yourdomain.com",
        "from_name": "Acme App",
        "to": "ada@example.com",
        "subject": "Welcome aboard",
        "html": "<p>Thanks for signing up!</p>",
        "text": "Thanks for signing up!",
        "tags": ["onboarding"],
    },
    timeout=10,
)
print(resp.status_code, resp.json())
use Illuminate\Support\Facades\Http;

$response = Http::withToken(config('services.briefs.secret_key'))
    ->withHeaders(['Idempotency-Key' => 'invoice-' . $invoice->id])
    ->timeout(10)
    ->post('https://withbriefs.com/api/v1/emails', [
        'from'      => 'noreply@yourdomain.com',
        'from_name' => 'Acme Billing',
        'to'        => $user->email,
        'subject'   => 'Receipt for Invoice #' . $invoice->number,
        'html'      => '<p>Payment received. Thank you!</p>',
        'tags'      => ['billing', 'receipt'],
    ]);
payload := []byte(`{
  "from": "noreply@yourdomain.com",
  "to": "ada@example.com",
  "subject": "Password reset",
  "text": "Reset your password using the link in your dashboard."
}`)

req, _ := http.NewRequest("POST", "https://withbriefs.com/api/v1/emails", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("BRIEFS_SECRET_KEY"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", "reset-user-42")

resp, err := (&http.Client{Timeout: 10 * time.Second}).Do(req)

API Endpoint Reference

All responses are JSON with a consistent error boolean, human-readable message, and typed data payload.

POST /api/v1/emails Secret Key Only Verified Domain Required

Queues a transactional email for immediate asynchronous delivery and returns 202 Accepted. If from is omitted, your profile's verified custom sending domain is used automatically.

Field / Header Type Description
Idempotency-KeyheaderOptional (max 128 chars). Replays return 200 with idempotent_replay: true and never double-send.
tostring · requiredRecipient email address (RFC validated). Checked against global & account suppression lists.
subjectstring · requiredEmail subject (max 255 chars). CR/LF header breaks are stripped automatically.
html / textstring · one req.HTML body (max 250 KB) and/or plain-text body (max 100 KB).
fromstring · optionalVerified sender address (e.g. noreply@yourdomain.com). Must match a verified domain.
from_namestring · optionalDisplay sender name (max 120 chars).
reply_tostring · optionalReply-To email address.
tagsstring[] · optionalUp to 10 tags (max 64 chars each) for filtering and observability.
202 Accepted
{
  "error": false,
  "message": "Email queued for delivery.",
  "data": {
    "id": "em_k8n2p9v4q1x7m3r6w0z5y2b8",
    "status": "queued",
    "from": "Acme App <noreply@yourdomain.com>",
    "to": "ada@example.com",
    "reply_to": "support@yourdomain.com",
    "subject": "Your login code is 849201",
    "tags": ["auth", "otp"],
    "error": null,
    "sent_at": null,
    "created_at": "2026-11-24T18:40:00+00:00"
  }
}
GET /api/v1/emails/{id} Secret Key Only

Retrieves the latest delivery status (queued, sent, delivered, bounced, complained, or failed) for an email sent by your account.

POST /api/v1/sequences/{sequence_id}/enroll Secret Key Only

Upserts a contact (including optional custom_fields for personalization tags) and enrolls them into an active automated email sequence. Safe to call repeatedly — existing enrollments are returned idempotently.

Field Type Description
emailstring · requiredContact's email address.
firstname / lastnamestring · optionalContact name fields used for personalization.
categorystring · optionalSegment/category label (defaults to General).
custom_fieldsobject · optionalUp to 30 key/value pairs (e.g. {"plan": "Pro", "company": "Acme"}).
Example Request
curl -X POST "https://withbriefs.com/api/v1/sequences/12/enroll" \
  -H "Authorization: Bearer sk_live_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ada@example.com",
    "firstname": "Ada",
    "custom_fields": {
      "plan": "Pro",
      "workspace": "Acme Labs"
    }
  }'
POST /api/v1/contacts Secret or Publishable Key

Syncs contacts from your backend (Authorization: Bearer sk_..., supports confirmed: true and custom_fields) or directly from browser signup forms (X-Api-Key: pk_... with origin allowlist & optional Turnstile).

Security hardening & deliverability guarantees

Built so your app stays fast and your sender domain stays out of spam folders.

Verified Domain Enforcement

Every transactional email must come from a domain you own and have verified with SPF + DKIM. Unverified or spoofed from domains are rejected with 422.

Strict Key Isolation

Secret keys (sk_...) are hashed at rest and reject browser requests carrying an Origin header. Publishable keys (pk_...) can never send emails.

Idempotent Retries

Send an Idempotency-Key header to make network retries 100% safe. Duplicate keys return the original email payload with zero extra charge.

Async Queue + Auto-Retry

API requests validate, log, and dispatch to the mail worker immediately (202 Accepted), with 3 automatic exponential-backoff retries on transient SMTP failures.

Suppression & Circuit Breaker

Suppressed recipients are blocked before dispatch, and a 60s cached reputation circuit breaker auto-pauses API sends if 24h bounce rate exceeds 5%.

Predictable Rate Limits

/api/v1/emails allows 120 req/min and 5,000 req/hr per account; /api/v1/sequences/*/enroll allows 120 req/min.

HTTP Status Error Code Meaning
202—Email validated, metered, and queued for delivery.
200—Email fetched, or idempotent replay of an earlier Idempotency-Key.
401—Missing or invalid API key.
402quota_exceededEmail credits exhausted. Top up or upgrade your plan.
403secret_key_required / sending_pausedPublishable key used on a secret-only route, or account sending is paused.
422unverified_sending_domain / recipient_suppressedValidation error, unverified from domain, or suppressed recipient.
429reputation_circuit_openRate limit exceeded or automatic reputation circuit breaker triggered.