MailClanker · Docs · MCP server

REST API reference

Base URL https://mailclanker.com/api/v1. Send Authorization: Bearer pk_live_… with a key from API keys. Keys have scopes: read, write and send.

JSON in and out. Errors are {"error": {"code", "message"}}. Lists take ?limit=…&cursor=… and return {data, next_cursor}. Each key may make 60 requests a minute (429 with Retry-After).

Machine-readable: OpenAPI 3.1 (openapi.json).

curl https://mailclanker.com/api/v1/newsletters \
  -H "Authorization: Bearer pk_live_…"

Newsletters

get/api/v1/newslettersscope: read

List newsletters

Newest first, with the number of active subscribers.

Parameters

FieldTypeNotes
limitinteger (1–100) Default: 50.
cursorstring (max 300 chars)

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/newsletters/{id}scope: read

Get a newsletter

Includes subscriber counts by status.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After

Subscribers

get/api/v1/newsletters/{id}/subscribersscope: read

List subscribers

Newest first. Filters: status, tag, email (exact).

Parameters

FieldTypeNotes
id (path) *string (uuid)
status"pending" | "active" | "unsubscribed" | "bounced" | "complained"
tagstring
emailstring (max 254 chars)
limitinteger (1–100) Default: 50.
cursorstring (max 300 chars)

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/newsletters/{id}/subscribersscope: write

Add a subscriber

Idempotent: 200 with the existing subscriber, 201 when created. Double opt-in follows the newsletter unless double_opt_in is given; skipping it needs the send scope and consent: {source, timestamp} (400 consent_required). Suppressed addresses are 409 suppressed.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
email *string
first_namestring | null
last_namestring | null
tagsstring[]
custom_fieldsobject
double_opt_inboolean
consentobject

Responses

  • 200
    Subscriber Already subscribed (unchanged)
  • 201
    Subscriber Created
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/subscribers/{id}scope: read

Get a subscriber

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
patch/api/v1/subscribers/{id}scope: write

Update a subscriber

tags replaces the tags; custom_fields is merged (a null value removes a key).

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
first_namestring | null
last_namestring | null
tagsstring[]
custom_fieldsobject

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
delete/api/v1/subscribers/{id}scope: write

Delete a subscriber (GDPR)

Hard delete. A hashed suppression is kept so the address isn't re-added by accident.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/subscribers/{id}/unsubscribescope: write

Unsubscribe a subscriber

Idempotent. Adds a newsletter-level suppression.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After

Segments

get/api/v1/newsletters/{id}/segmentsscope: read

List segments

Newest first.

Parameters

FieldTypeNotes
id (path) *string (uuid)
limitinteger (1–100) Default: 50.
cursorstring (max 300 chars)

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/newsletters/{id}/segmentsscope: write

Create a segment

rules is {all: [...]} or {any: [...]} with 1–50 conditions {field, op, value}: tag has/not_has; created_at, confirmed_at, last_opened_at, last_clicked_at before/after (ISO date) or within_days/not_within_days (1–3650) or exists/not_exists; email, first_name, last_name text operators; status, source eq/neq; custom.<field>.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
name *string (max 100 chars)
rules *object

Responses

  • 201
    Segment Created
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/segments/{id}scope: read

Get a segment

Includes subscriber_count: active, non-suppressed subscribers it matches now.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
patch/api/v1/segments/{id}scope: write

Update a segment

Rename it or replace its rules. Changing the rules while a scheduled send (or one waiting for approval) uses it is 409 segment_in_use.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
namestring (max 100 chars)
rulesobject

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
delete/api/v1/segments/{id}scope: write

Delete a segment

Drafts and past sends that used it go back to all active subscribers. Refused with 409 segment_in_use while a scheduled send (or one waiting for approval) uses it.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After

Posts

get/api/v1/newsletters/{id}/postsscope: read

List posts

Newest first, without content. Filter by status.

Parameters

FieldTypeNotes
id (path) *string (uuid)
status"draft" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed"
limitinteger (1–100) Default: 50.
cursorstring (max 300 chars)

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/newsletters/{id}/postsscope: write

Create a draft

Content as content_markdown (with ::button[Label](url) and ::embed[Title](url "thumbnail") blocks) or content_json (TipTap JSON), not both.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
title *string
slugstring
subject *string
preview_textstring
content_markdownstring
content_jsonany
segment_idstring (uuid) | null
publish_to_webboolean

Responses

  • 201
    Post Created
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/posts/{id}scope: read

Get a post

Includes content (JSON and Markdown), the latest pre-send check and stats totals.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
    Post OK
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
patch/api/v1/posts/{id}scope: write

Update a draft

Drafts only (409 not_draft). Optional revision refuses the update if the post changed since (409 revision_conflict). Any edit cancels an open send approval request.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
titlestring
slugstring
subjectstring
preview_textstring
content_markdownstring
content_jsonany
segment_idstring (uuid) | null
publish_to_webboolean
revisioninteger

Responses

  • 200
    Post OK
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/precheckscope: write

Run the pre-send check

Rules plus, when AI is configured, an AI check (20 credits). Unchanged content returns the stored result without charging again.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 402
    Not enough credits (insufficient_credits)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
  • 503
    A dependency isn't configured or available
post/api/v1/posts/{id}/testscope: write

Send a test email

Workspace members' addresses only. Max 5 per request, 50 per workspace per day.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body

FieldTypeNotes
emails *string[]

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
  • 502
    The email provider failed (provider_error)
post/api/v1/posts/{id}/schedulescope: send

Schedule or send now

Omit send_at (or the body) to send now. Reserves one credit per recipient. Posts written via MCP need a human approval first (403 approval_required).

Parameters

FieldTypeNotes
id (path) *string (uuid)

Request body (optional)

FieldTypeNotes
send_atstring (date-time) | null

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 402
    Not enough credits (insufficient_credits)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/pausescope: send

Pause a send

Scheduled or sending → paused.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/resumescope: send

Resume a send

Paused → scheduled/sending. Safety pauses can only be resumed by the owner in the dashboard.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/cancelscope: send

Cancel a send

Scheduled, sending or paused → cancelled; unsent messages are skipped and unused credits refunded.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 409
    Conflict with the current state (see error.code)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/posts/{id}/statsscope: read

Get post stats

Totals, rates and clicks per link. Opens are approximate.

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/publishscope: write

Publish to the web archive

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
post/api/v1/posts/{id}/unpublishscope: write

Remove from the web archive

Parameters

FieldTypeNotes
id (path) *string (uuid)

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 404
    Not found in this workspace (not_found)
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After

Account

get/api/v1/accountscope: read

Get the account

Workspace status, daily send limit and what's left of it today, credit balance.

Responses

  • 200
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After
get/api/v1/credits/ledgerscope: read

List credit ledger entries

Newest first. amount is signed.

Parameters

FieldTypeNotes
limitinteger (1–100) Default: 50.
cursorstring (max 200 chars)

Responses

  • 200
  • 400
    Invalid input (validation_error, invalid_json, …)
  • 401
    Missing, invalid or revoked API key (unauthorized)
  • 403
    Missing scope (insufficient_scope), account status or approval required
  • 429
    Rate limited (60 requests/minute per key, or a daily quota); see Retry-After

Objects

Error

FieldTypeNotes
error *object

Account

FieldTypeNotes
id *string (uuid)
name *string
slug *string
status *"trial" | "active" | "review" | "suspended"
daily_send_limit *integer
daily_sends_remaining *integer
credit_balance *integer
currency *string

LedgerEntry

FieldTypeNotes
id *string (uuid)
amount *integer
reason *"purchase" | "free_grant" | "reserve" | "refund" | "ai_usage" | "admin_adjust" | "transactional"
ref_type *string | null
ref_id *string | null
note *string | null
created_at *string (date-time)

Newsletter

FieldTypeNotes
id *string (uuid)
name *string
slug *string
description *string | null
from_name *string
from_local_part *string
sender_domain_id *string (uuid) | null
reply_to *string | null
postal_address *string
double_opt_in *boolean
track_opens *boolean
track_clicks *boolean
public_archive *boolean
active_subscribers *integer
created_at *string (date-time)
updated_at *string (date-time)

NewsletterDetail

FieldTypeNotes
id *string (uuid)
name *string
slug *string
description *string | null
from_name *string
from_local_part *string
sender_domain_id *string (uuid) | null
reply_to *string | null
postal_address *string
double_opt_in *boolean
track_opens *boolean
track_clicks *boolean
public_archive *boolean
active_subscribers *integer
created_at *string (date-time)
updated_at *string (date-time)
subscriber_counts *SubscriberCounts

SubscriberCounts

FieldTypeNotes
pending *integer
active *integer
unsubscribed *integer
bounced *integer
complained *integer

Subscriber

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
email *string
first_name *string | null
last_name *string | null
status *"pending" | "active" | "unsubscribed" | "bounced" | "complained"
source *string
tags *string[]
custom_fields *object
flags *string[]
consent_at *string (date-time) | null
confirmed_at *string (date-time) | null
unsubscribed_at *string (date-time) | null
created_at *string (date-time)
updated_at *string (date-time)

Segment

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
name *string
rules *object
created_at *string (date-time)
updated_at *string (date-time)

SegmentDetail

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
name *string
rules *object
created_at *string (date-time)
updated_at *string (date-time)
subscriber_count *integerActive, non-suppressed subscribers the segment matches now

StatsTotals

FieldTypeNotes
sent *integer
delivered *integer
bounced *integer
complained *integer
unsubscribed *integer
unique_opens *integer
unique_clicks *integer

Precheck

FieldTypeNotes
status *"pass" | "warn" | "blocked"
score *number
issues *object[]
ai_used *boolean
credits_charged *integer
checked_at *string (date-time)

PostSummary

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
title *string
slug *string
subject *string
preview_text *string
status *"draft" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed"
segment_id *string (uuid) | null
publish_to_web *boolean
created_via *"dashboard" | "api" | "mcp"
approval_status *"not_required" | "pending" | "approved" | "rejected"
pause_reason *string | null
screening_status *"pending" | "passed" | "held" | "released" | "rejected" | null
revision *integer
scheduled_at *string (date-time) | null
sent_at *string (date-time) | null
published_at *string (date-time) | null
created_at *string (date-time)
updated_at *string (date-time)

Post

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
title *string
slug *string
subject *string
preview_text *string
status *"draft" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed"
segment_id *string (uuid) | null
publish_to_web *boolean
created_via *"dashboard" | "api" | "mcp"
approval_status *"not_required" | "pending" | "approved" | "rejected"
pause_reason *string | null
screening_status *"pending" | "passed" | "held" | "released" | "rejected" | null
revision *integer
scheduled_at *string (date-time) | null
sent_at *string (date-time) | null
published_at *string (date-time) | null
created_at *string (date-time)
updated_at *string (date-time)
content_json *objectTipTap JSON document (see docs/API.md for the supported nodes)
content_markdown *string
precheck *Precheck | null
stats *StatsTotals | null

PostStats

FieldTypeNotes
post_id *string (uuid)
totals *StatsTotals
rates *object
opens_approximate *boolean
links *object[]
updated_at *string (date-time) | null

ScheduleResult

FieldTypeNotes
id *string (uuid)
newsletter_id *string (uuid)
title *string
slug *string
subject *string
preview_text *string
status *"draft" | "scheduled" | "sending" | "paused" | "sent" | "cancelled" | "failed"
segment_id *string (uuid) | null
publish_to_web *boolean
created_via *"dashboard" | "api" | "mcp"
approval_status *"not_required" | "pending" | "approved" | "rejected"
pause_reason *string | null
screening_status *"pending" | "passed" | "held" | "released" | "rejected" | null
revision *integer
scheduled_at *string (date-time) | null
sent_at *string (date-time) | null
published_at *string (date-time) | null
created_at *string (date-time)
updated_at *string (date-time)
estimated_recipients *integer
credits_reserved *integer

TestSendResult

FieldTypeNotes
sent *integer
recipients *string[]
failed *object[]

Deleted

FieldTypeNotes
id *string (uuid)
deleted *boolean

List responses are {data: [Object], next_cursor: string | null}.