Skip to content
ProgrammableContact

API and MCP

Everything here is also described as OpenAPI 3.1 at /openapi.json, and the webhook events at /docs/api/events.json.

Keys

Make a key on the dashboard's API keys page and send it as Authorization: Bearer <key>. A secret key starts pct_ and has scopes: read, events:write (an app sending its accounts and events), and full, which can do both and change things. A publishable key starts pcf_, is safe in a web page, and can only submit a sign-up form from the sites the form lists. A key can be bound to one app. Errors are { error: { code, message } }.

curl https://programmable.contact/api/v1/me \
  -H "Authorization: Bearer pct_…"

What an app usually does

  1. Send its accounts once: PUT /api/v1/contacts/batch. This makes contacts and subscribes nobody.
  2. Send account events from then on: POST /api/v1/events with user.created, user.updated, plan.changed or user.deleted.
  3. Ask its users for consent with programmable-ui's consent-prompt item, which calls /api/v1/consents/prompt and /api/v1/consents.
  4. Say when a lifecycle message is due: POST /api/v1/events with lifecycle.<name>.
  5. Before sending its own optional email, check: POST /api/v1/suppressions/check.

Calls

CallWhat it doesKey
GET /api/v1/meWhat the key isThe workspace and app the key speaks for, and its scopes. The way to test a key.Key: read
GET /api/v1/topicsList topicsThe kinds of email a person can say yes or no to.Key: read
POST /api/v1/suppressions/checkCheck whether optional email to addresses is stoppedThe check an app calls before it sends its own optional mail. A POST so that no address appears in a URL.Key: read
PUT /api/v1/contacts/batchSend an app's accountsFor the first load or a re-sync. Makes contacts and app memberships. Subscribes nobody. Each row stands alone; sending the same batch again is safe.Key: events:write
GET /api/v1/contacts/{id}Everything held about one personA copy for the person: their details, apps, email preferences, messages sent and consent history. There is no API call to erase a person: an owner or admin does that on the person's page in the dashboard.Key: read
POST /api/v1/eventsTell Contact something happened to an accountAccount events (user.created, user.updated, plan.changed, user.deleted) keep the contact record current and subscribe nobody. A lifecycle event (lifecycle.<name>) says now is the moment for that app's message of that name; the answer's lifecycle field says what happened, and nothing is queued. Each id is acted on once.Key: events:write
PUT /api/v1/optouts/batchBring over people who already turned a kind of mail offSent once when an app's lifecycle mail moves to Contact, so nobody who stopped it starts getting it again. An app stops only its own topics. This call can only stop mail.Key: events:write
POST /api/v1/consents/promptShould this app ask this person for marketing consent now?Apps normally use programmable-ui's consent-prompt item instead of calling this. Give it a short timeout and show nothing on any failure: it must never hold up a sign-in. A POST although it only reads, so that no address appears in a URL.Key: events:write
POST /api/v1/consentsRecord what a person answered to the consent promptgranted is the topics they ticked; every other topic offered is recorded as declined. An empty list is a no.Key: events:write
POST /api/v1/leadsA sign-up from a formStarts double opt-in: nobody is subscribed until they confirm from the message sent to the address. The answer is the same whatever the address's state. A web page sends a publishable key (pcf_) from one of the form's listed sites, with a Turnstile token; a server relaying its own form sends a secret key with events:write and the visitor's ip. A form that requires a name or a country refuses a sign-up without it (name_required, country_required). Answers to the form's own fields (custom_fields in GET /api/v1/forms) go in fields, by key, and are checked against the form's current version: a key it doesn't ask is refused (422 unknown_field), a value its kind can't hold too (422 bad_field_value), and a required one left out or empty is 400 field_required; error.field names the key. An answer is kept on the sign-up's own record and only fills a value that record doesn't have: a sign-up never changes or clears a value already there. Send form_version, the version whose wording your page showed, and a sign-up on a form that has changed since is refused (form_changed) rather than recorded against wording the person didn't see.Key: publishable key
GET /api/v1/campaignsList campaignsKey: read
POST /api/v1/campaignsStart a campaign draftThe API can draft and read campaigns. It cannot test, approve or send one: those are done by a person in the dashboard.Key: full
GET /api/v1/campaigns/{id}One campaign, with its resultsKey: read
PATCH /api/v1/campaigns/{id}Change a draftAny change clears the last test. Refused once the campaign is approved.Key: full
GET /api/v1/sequencesList sequencesEmails sent in order to each person who joins a topic. The API only reads them: drafting is the dashboard's and the MCP's, and approving, resuming or putting anyone in one is a person's, in the dashboard.Key: read
GET /api/v1/repliesList replies to the workspace's mailReplies people sent to campaign, sequence and lifecycle email, for a workspace with replies on (Settings, Sending). Read only: nothing in the API answers one, sends, or acts on one. A reply that seems to ask to stop is flagged for a person; it stops nothing. Ids, words and flags: never an address or a name.Key: read
GET /api/v1/sequences/{id}One sequence, with its steps and resultsKey: read
PUT /api/v1/subscribers/importHand over a list of people who already agreed to a topic elsewhere, for reviewNobody is added: the list waits, with its evidence, until an owner or admin approves it in the dashboard (which brings it in as that person) or rejects it. A list nobody decides on is deleted after 30 days. The list is checked as an import would be: double_opt_in needs confirmed_at for every row; an imported yes permits nothing under the strict consent policy; an older yes never undoes a newer stop. Nothing is sent. Up to 20 lists may wait at once.Key: full
GET /api/v1/subscribers/import/{id}Where a staged list standsNo addresses: the people are not given back. A list nobody decided on is gone after 30 days (404).Key: read
GET /api/v1/contactsList contactsNewest first, 50 a page. search matches anywhere in an address or the start of a name.Key: read
GET /api/v1/tagsList tagsThe workspace's tags, each with how many people have it.Key: read
POST /api/v1/tags/batchPut tags on, or take them off, many peopleA tag is a label, not consent: this subscribes nobody and stops nothing. A new name makes a new tag. People erased or not in this workspace are skipped.Key: full
GET /api/v1/contacts/{id}/tagsOne person's tagsKey: read
POST /api/v1/contacts/{id}/tagsPut tags on one person, or take them offA label, not consent. Removing is a POST too: there is no DELETE.Key: full
GET /api/v1/contacts/{id}/fieldsOne person's values for the workspace's fieldsKey: read
PATCH /api/v1/contacts/{id}/fieldsSet some of a person's field valuesBy key; null or an empty string clears one. Every value is checked first: an unknown key or a bad value changes nothing. A fact about the person, not consent.Key: full
GET /api/v1/fieldsList the workspace's own fieldsKey: read
POST /api/v1/fieldsDefine a fieldIts key (made from the label when not given) and type never change. A choice needs its options.Key: full
GET /api/v1/segmentsList saved segmentsEach with how many people it matches now.Key: read
POST /api/v1/segmentsSave a segmentA filter over contacts. It never subscribes anyone; a campaign narrowed by it still goes only to people who agreed to its topic.Key: full
GET /api/v1/segments/{id}One segment, with its count nowCounts only; list its people with GET /api/v1/contacts?segment=<id>.Key: read
GET /api/v1/formsList sign-up formsKey: read
GET /api/v1/funnelSign-ups and new payers per app and week, by source, and per formFrom what apps have reported. No revenue.Key: read
GET /api/v1/reportThe audience, sending and health over timeCounts per week or month (UTC), worked out from the consent ledger and the message log: subscribers joined (by form, import, app prompt, other), left (unsubscribed, stopped all email, erased), net, the total at each period's end, bounces and complaints that stopped a subscriber's address, and people who turned the topic off. Emails sent by kind against the monthly limit, and the last 30 days' bounce and complaint rates. Aggregates only: no address, name or person.Key: read
GET /api/v1/calendarWhat is on the calendarDays in the workspace's own time zone: campaigns scheduled (approved with a start time to come), sending and sent, by the time they go; sequences on the day they started and on each later approval; and planned items (a title, a channel and notes on a day; a plan sends and posts nothing, and posting to social networks from Contact isn't available). Ids, days, kinds and titles: no address or person. Read only: a campaign is scheduled by the person who approves it, in the dashboard.Key: read
GET /api/v1/prospectsList prospectsA record of who the workspace is talking to. Nothing is ever sent to a prospect from Contact.Key: read
POST /api/v1/prospectsAdd a prospectKey: full
GET /api/v1/prospects/{id}One prospect with its historyKey: read
PATCH /api/v1/prospects/{id}Change a prospect, move its stage, or add a noteFields not sent stay as they are. do_not_contact also stops optional email to the address.Key: full
GET /api/v1/campaigns/{id}/previewA campaign as a recipient would get itMerge fields are filled in for a sample person.Key: read
GET /api/v1/campaigns/{id}/audienceHow many a draft would go to nowNumbers only, no addresses.Key: read
GET /api/v1/linksList tracked links with their click countsClicks are counted per link per day, never per person; bots and mail scanners are counted apart.Key: read
POST /api/v1/linksMake a tracked linkA short address on the link host that sends people to the destination, with these tags added. The destination can't be changed by whoever follows it.Key: full
GET /api/v1/webhooksList webhooksKey: read
POST /api/v1/webhooksAdd a webhookContact will POST events to the address, signed with X-Programmable-Signature. The events are listed at /docs/api/events.json. The secret is in this answer and never shown again.Key: full
DELETE /api/v1/webhooks/{id}Remove a webhookKey: full

Nothing in the API tests, approves or sends a campaign, or turns a lifecycle message on: a person does that in the dashboard.

What a key can't do

No key can send, approve, subscribe anyone, lift a stop or erase anyone. An agent prepares; a person decides.

MCP, for AI agents

https://programmable.contact/api/mcp, streamable HTTP, with the same keys. A read key gets the read tools; full adds drafting campaigns and sequences, keeping prospects and planning on the calendar. An agent can read, draft and propose. No tool sends, approves, schedules a send, subscribes anyone, lifts a stop or erases anyone.

{
  "mcpServers": {
    "programmable-contact": {
      "type": "http",
      "url": "https://programmable.contact/api/mcp",
      "headers": { "Authorization": "Bearer pct_…" }
    }
  }
}

Webhooks

Add an address on the dashboard's Webhooks page or with POST /api/v1/webhooks. Each delivery is { id, type, created_at, data }, signed in X-Programmable-Signature as t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">, keyed by the whole whsec_… secret. Refuse a t more than five minutes off, and act on each id once. No event carries an email address or a name.

Programmable Contact