Skip to main content
The draft workflow is the core safety mechanism in ActionLayer. Your AI never sends email directly — it submits a draft, and a human approves it before delivery.

The Workflow

AI submits draft → Human notified → Human approves → Email sent

                            Human rejects → Draft archived

Draft States

StateDescription
pendingSubmitted, awaiting human review
staleA newer inbound message arrived after this draft was written
approvedHuman approved — ready to send
rejectedHuman rejected
sentSuccessfully delivered via Postmark

Submitting a Draft

curl -X POST https://api.actionlayer.dev/v1/drafts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "thread_id": "THREAD_ID",
    "identity_id": "IDENTITY_ID",
    "based_on_message_id": "MESSAGE_ID",
    "subject": "Re: Your inquiry",
    "body": "Thank you for reaching out...",
    "rationale": "Customer asked about pricing. Responding with Pro plan details."
  }'
The based_on_message_id field is required — it tells ActionLayer which message the AI read when writing this draft. This enables stale detection.

Stale Detection

If a new inbound message arrives after a draft was submitted, the draft becomes stale. This prevents the AI’s reply from being out of context.
  • On submission: Returns a stale_warning if a newer message already exists
  • On send: Blocks delivery if the draft is stale — returns HTTP 409

Approval Modes

ModeBehavior
manual (default)Human must approve every draft before sending
autoDraft is automatically approved and sent on submission
Set approval_mode when creating an identity. Auto-send is always opt-in.

Approving and Sending

# Step 1 — Approve
curl -X POST https://api.actionlayer.dev/v1/drafts/{draft_id}/approve \
  -H "Authorization: Bearer YOUR_API_KEY"

# Step 2 — Send
curl -X POST https://api.actionlayer.dev/v1/drafts/{draft_id}/send \
  -H "Authorization: Bearer YOUR_API_KEY"