{"openapi":"3.1.0","info":{"title":"Programmable Contact API","version":"1.0.0","description":"One contact record, one consent record and one unsubscribe across a workspace's apps. Send a key as Authorization: Bearer <key>. Secret keys start pct_ and carry scopes (read, events:write, full); publishable keys start pcf_ and can only submit a form. Errors are { error: { code, message } }. Syncing an account subscribes nobody; only the person's own yes does. No key can send, approve, subscribe anyone, lift a stop or erase anyone: a list of subscribers is only staged, for an owner or admin to approve in the dashboard."},"servers":[{"url":"https://programmable.contact"}],"paths":{"/api/v1/me":{"get":{"operationId":"getMe","summary":"What the key is","description":"The workspace and app the key speaks for, and its scopes. The way to test a key.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"The key.","content":{"application/json":{"schema":{"type":"object","properties":{"workspace":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"}}},"app":{"anyOf":[{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"}}},{"type":"null"}]},"key":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"kind":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}}}}}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/topics":{"get":{"operationId":"listTopics","summary":"List topics","description":"The kinds of email a person can say yes or no to.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Topics.","content":{"application/json":{"schema":{"type":"object","properties":{"topics":{"type":"array","items":{"$ref":"#/components/schemas/Topic"}}},"required":["topics"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/suppressions/check":{"post":{"operationId":"checkSuppressions","summary":"Check whether optional email to addresses is stopped","description":"The check an app calls before it sends its own optional mail. A POST so that no address appears in a URL.","x-scope":"read","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":100}},"required":["emails"]}}}},"responses":{"200":{"description":"One result per address, in order.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"suppressed":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string","description":"bounce, complaint, unsubscribe_all, manual, agent_mail_opt_out or erased (this workspace's own stops), not_mailable (stopped for every workspace; why is not told), or invalid_address"},{"type":"null"}]}}}}},"required":["results"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/contacts/batch":{"put":{"operationId":"upsertContacts","summary":"Send an app's accounts","description":"For 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.","x-scope":"events:write","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"app":{"type":"string","description":"One of the workspace's app keys. Only for a key that isn't bound to an app."},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Account"},"minItems":1,"maxItems":500}},"required":["contacts"]}}}},"responses":{"200":{"description":"A result per row.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"ok":{"type":"boolean"},"contact_id":{"type":"string"},"outcome":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}},"required":["ok"]}},"created":{"type":"integer"},"updated":{"type":"integer"},"failed":{"type":"integer"}},"required":["results"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/contacts/{id}":{"get":{"operationId":"exportContact","summary":"Everything held about one person","description":"A 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.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The copy.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/events":{"post":{"operationId":"sendEvent","summary":"Tell Contact something happened to an account","description":"Account 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.","x-scope":"events:write","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The event's id. Sending it again is acknowledged, not repeated."},"type":{"type":"string","description":"user.created, user.updated, plan.changed, user.deleted, or lifecycle.<name>"},"created_at":{"type":"string","format":"date-time"},"app":{"type":"string","description":"One of the workspace's app keys. Only for a key that isn't bound to an app."},"data":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"once_key":{"type":"string","description":"Lifecycle only: the message goes once per person per key."}}}]}},"required":["id","type","data"]}}}},"responses":{"200":{"description":"Processed, or a duplicate.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["processed","duplicate"]},"contact_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"lifecycle":{"type":"string","description":"sent, already_sent, no_template, template_off, no_sender, refused:<why>, not_sent:<why>"}},"required":["status"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/optouts/batch":{"put":{"operationId":"importOptOuts","summary":"Bring over people who already turned a kind of mail off","description":"Sent 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.","x-scope":"events:write","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"app":{"type":"string","description":"One of the workspace's app keys. Only for a key that isn't bound to an app."},"topic":{"type":"string","description":"One of the app's own topic keys."},"people":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Account"},{"type":"object","properties":{"stopped_at":{"type":"string","format":"date-time"}}}]},"minItems":1,"maxItems":500}},"required":["topic","people"]}}}},"responses":{"200":{"description":"A result per person.","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"ok":{"type":"boolean"},"contact_id":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}},"required":["ok"]}},"stopped":{"type":"integer"},"failed":{"type":"integer"}},"required":["results"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/consents/prompt":{"post":{"operationId":"getConsentPrompt","summary":"Should this app ask this person for marketing consent now?","description":"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.","x-scope":"events:write","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sub":{"type":"string"},"email":{"type":"string"},"email_verified":{"type":"boolean"},"country":{"type":"string"},"app":{"type":"string","description":"One of the workspace's app keys. Only for a key that isn't bound to an app."}}}}}},"responses":{"200":{"description":"Whether to ask, and with what.","content":{"application/json":{"schema":{"type":"object","properties":{"ask":{"type":"boolean"},"reason":{"type":"string","enum":["ask","no_prompt","unidentified","all_off","suppressed","answered","asked_recently"]},"prompt":{"anyOf":[{"$ref":"#/components/schemas/Prompt"},{"type":"null"}]},"ask_again_after":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["ask","reason"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/consents":{"post":{"operationId":"recordConsentAnswer","summary":"Record what a person answered to the consent prompt","description":"granted is the topics they ticked; every other topic offered is recorded as declined. An empty list is a no.","x-scope":"events:write","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sub":{"type":"string"},"email":{"type":"string"},"email_verified":{"type":"boolean"},"account_ref":{"type":"string"},"country":{"type":"string"},"name":{"type":"string"},"app":{"type":"string","description":"One of the workspace's app keys. Only for a key that isn't bound to an app."},"text_id":{"type":"string","description":"From the prompt.","format":"uuid"},"granted":{"type":"array","items":{"type":"string"},"maxItems":12},"dismissed":{"type":"boolean"},"page":{"type":"string","maxLength":500},"ip":{"type":"string","maxLength":64}},"required":["text_id","granted"]}}}},"responses":{"200":{"description":"Recorded.","content":{"application/json":{"schema":{"type":"object","properties":{"contact_id":{"type":"string"},"subscribed":{"type":"array","items":{"type":"string"}},"declined":{"type":"array","items":{"type":"string"}}},"required":["contact_id","subscribed","declined"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"not_asked (this person isn't being asked now), or stale_wording (fetch the prompt again).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"not_offered: a granted key that wasn't in the prompt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/leads":{"post":{"operationId":"submitLead","summary":"A sign-up from a form","description":"Starts 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.","x-scope":"forms:submit","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"form":{"type":"string","description":"The form's key."},"email":{"type":"string"},"name":{"type":"string"},"topics":{"type":"array","items":{"type":"string"},"description":"A subset of the form's topics; all of them when absent. An empty list is refused (no_topics): nothing chosen is never read as everything."},"page":{"type":"string"},"country":{"type":"string","description":"Two letters."},"turnstile_token":{"type":"string"},"website":{"type":"string","description":"Leave empty."},"ip":{"type":"string","description":"Secret keys only: the visitor's address."},"form_version":{"type":"integer","description":"The form's version the page showed (GET /api/v1/forms)."},"fields":{"type":"object","properties":{},"additionalProperties":true,"description":"Answers to the form's own fields, by key: text, a number, a day (YYYY-MM-DD), one of a choice's options, or yes/no (a boolean)."}},"required":["form","email"]}}}},"responses":{"200":{"description":"Taken.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string","enum":["confirmation_pending"]}},"required":["ok","status"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"form_changed: the form has a newer version than form_version.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"no_topics; unknown_field or bad_field_value (error.field names the key).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The bot check isn't set up, so the form isn't taking sign-ups.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/campaigns":{"get":{"operationId":"listCampaigns","summary":"List campaigns","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}}},"required":["campaigns"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"draftCampaign","summary":"Start a campaign draft","description":"The API can draft and read campaigns. It cannot test, approve or send one: those are done by a person in the dashboard.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"topic":{"type":"string","description":"A marketing topic's key."},"subject":{"type":"string"},"preheader":{"type":"string","description":"Preview text beside the subject."},"body":{"type":"string","description":"Merge fields, filled in per person when it is sent: {{first_name}}, {{name}}, {{sender_name}}, {{workspace_name}}, {{topic_name}}, and the workspace's own fields as {{field.<key>}} (GET /api/v1/fields), each with an optional fallback for an empty value: {{first_name|there}}. A value is always plain text. An unknown field is refused (422 bad_merge_field), and none may go in a link's address."},"audience":{"type":"object","properties":{"apps":{"type":"array","items":{"type":"string"}},"plan_statuses":{"type":"array","items":{"type":"string"}},"signed_up_from":{"type":"string","description":"YYYY-MM-DD"},"signed_up_to":{"type":"string","description":"YYYY-MM-DD"},"source":{"type":"string"},"segment":{"type":"string","description":"A saved segment's id: only people in it. A segment narrows; it never stands in for consent.","format":"uuid"}},"description":"Narrows who gets it among people who agreed to the topic. Never adds anyone."}},"required":["name","topic"]}}}},"responses":{"201":{"description":"The draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/campaigns/{id}":{"get":{"operationId":"getCampaign","summary":"One campaign, with its results","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The campaign.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateCampaignDraft","summary":"Change a draft","description":"Any change clears the last test. Refused once the campaign is approved.","x-scope":"full","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"subject":{"type":"string"},"preheader":{"type":"string","description":"Preview text beside the subject."},"body":{"type":"string","description":"Merge fields, filled in per person when it is sent: {{first_name}}, {{name}}, {{sender_name}}, {{workspace_name}}, {{topic_name}}, and the workspace's own fields as {{field.<key>}} (GET /api/v1/fields), each with an optional fallback for an empty value: {{first_name|there}}. A value is always plain text. An unknown field is refused (422 bad_merge_field), and none may go in a link's address."},"audience":{"type":"object","properties":{"apps":{"type":"array","items":{"type":"string"}},"plan_statuses":{"type":"array","items":{"type":"string"}},"signed_up_from":{"type":"string","description":"YYYY-MM-DD"},"signed_up_to":{"type":"string","description":"YYYY-MM-DD"},"source":{"type":"string"},"segment":{"type":"string","description":"A saved segment's id: only people in it. A segment narrows; it never stands in for consent.","format":"uuid"}},"description":"Narrows who gets it among people who agreed to the topic. Never adds anyone."}}}}}},"responses":{"200":{"description":"The draft.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/sequences":{"get":{"operationId":"listSequences","summary":"List sequences","description":"Emails 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.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Live ones first, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"sequences":{"type":"array","items":{"$ref":"#/components/schemas/Sequence"}}},"required":["sequences"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/replies":{"get":{"operationId":"listReplies","summary":"List replies to the workspace's mail","description":"Replies 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.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"view","in":"query","schema":{"type":"string","description":"open (a person's replies nobody has dealt with), stop (seem to ask to stop, not dealt with), auto (automatic answers), handled, or all (the default).","enum":["open","stop","auto","handled","all"]}},{"name":"contact_id","in":"query","schema":{"type":"string","description":"Only this contact's.","format":"uuid"}},{"name":"since","in":"query","schema":{"type":"string","description":"Received at or after.","format":"date-time"}},{"name":"before","in":"query","schema":{"type":"string","description":"Received before (for the next page: the last one's received_at).","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","description":"1 to 500; 100 when left out."}}],"responses":{"200":{"description":"Newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"replies":{"type":"array","items":{"$ref":"#/components/schemas/Reply"}}},"required":["replies"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/sequences/{id}":{"get":{"operationId":"getSequence","summary":"One sequence, with its steps and results","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The sequence.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sequence"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/subscribers/import":{"put":{"operationId":"stageSubscriberImport","summary":"Hand over a list of people who already agreed to a topic elsewhere, for review","description":"Nobody 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.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"topic":{"type":"string","description":"A marketing topic's key."},"basis":{"type":"string","enum":["double_opt_in","imported"]},"attestation":{"type":"string","description":"Who vouches for these people's consent and how they know (20 to 500 characters). Kept with every row."},"wording":{"type":"string","description":"The words the people were shown when they agreed."},"label":{"type":"string","description":"A short name for the list, kept as where they came from."},"people":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"consented_at":{"type":"string","format":"date-time"},"confirmed_at":{"type":"string","format":"date-time"},"ip":{"type":"string"},"page":{"type":"string"},"name":{"type":"string"},"country":{"type":"string"}},"required":["email","consented_at"]},"minItems":1,"maxItems":2000}},"required":["topic","basis","attestation","wording","label","people"]}}}},"responses":{"202":{"description":"Staged for review.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending"]},"rows":{"type":"integer"},"expires_at":{"type":"string","format":"date-time"}},"required":["id","status","rows","expires_at"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"too_many_pending: 20 lists already wait for review.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/subscribers/import/{id}":{"get":{"operationId":"getSubscriberImport","summary":"Where a staged list stands","description":"No addresses: the people are not given back. A list nobody decided on is gone after 30 days (404).","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The list.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","approved","rejected","expired"]},"topic":{"type":"string"},"basis":{"type":"string"},"label":{"type":"string"},"rows":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"decided_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"result":{"anyOf":[{"type":"object","properties":{"added":{"type":"integer"},"already":{"type":"integer"},"failed":{"type":"integer"}}},{"type":"null"}]}},"required":["id","status","topic","basis","label","rows"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/contacts":{"get":{"operationId":"listContacts","summary":"List contacts","description":"Newest first, 50 a page. search matches anywhere in an address or the start of a name.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"app","in":"query","schema":{"type":"string","description":"An app's key: has a current account there."}},{"name":"topic","in":"query","schema":{"type":"string","description":"A topic's key: subscribed to it."}},{"name":"state","in":"query","schema":{"type":"string","enum":["suppressed","all_off","unconfirmed","no_address"]}},{"name":"country","in":"query","schema":{"type":"string","description":"Two letters."}},{"name":"tag","in":"query","schema":{"type":"string","description":"A tag's id: has it."}},{"name":"segment","in":"query","schema":{"type":"string","description":"A saved segment's id: in it."}},{"name":"page","in":"query","schema":{"type":"integer","description":"From 1."}}],"responses":{"200":{"description":"A page of contacts.","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"unconfirmed_email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"apps":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string"}}}},"total":{"type":"integer"},"page":{"type":"integer"}},"required":["contacts","total","page"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A segment that isn't there, or can't run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/tags":{"get":{"operationId":"listTags","summary":"List tags","description":"The workspace's tags, each with how many people have it.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Tags.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"people":{"type":"integer"},"created_at":{"type":"string"}}}}},"required":["tags"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/tags/batch":{"post":{"operationId":"changeTagsInBatch","summary":"Put tags on, or take them off, many people","description":"A 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.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contact_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":1000},"add":{"type":"array","items":{"type":"string"},"maxItems":20},"remove":{"type":"array","items":{"type":"string","description":"A tag's name or id."},"maxItems":20}},"required":["contact_ids"]}}}},"responses":{"200":{"description":"What changed.","content":{"application/json":{"schema":{"type":"object","properties":{"people":{"type":"integer","description":"People found."},"added":{"type":"integer"},"removed":{"type":"integer"}},"required":["people","added","removed"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/contacts/{id}/tags":{"get":{"operationId":"getContactTags","summary":"One person's tags","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Their tags.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["tags"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"changeContactTags","summary":"Put tags on one person, or take them off","description":"A label, not consent. Removing is a POST too: there is no DELETE.","x-scope":"full","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"add":{"type":"array","items":{"type":"string"},"maxItems":20},"remove":{"type":"array","items":{"type":"string","description":"A tag's name or id."},"maxItems":20}}}}}},"responses":{"200":{"description":"Their tags now.","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["tags"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/contacts/{id}/fields":{"get":{"operationId":"getContactFields","summary":"One person's values for the workspace's fields","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Their values.","content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"object","properties":{},"additionalProperties":true,"description":"By key: text, a number, a day (YYYY-MM-DD) or a boolean."}},"required":["fields"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"setContactFields","summary":"Set some of a person's field values","description":"By 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.","x-scope":"full","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"object","properties":{},"additionalProperties":true,"description":"By key: text, a number, a day (YYYY-MM-DD) or a boolean."}},"required":["fields"]}}}},"responses":{"200":{"description":"All their values now.","content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"object","properties":{},"additionalProperties":true,"description":"By key: text, a number, a day (YYYY-MM-DD) or a boolean."}},"required":["fields"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/fields":{"get":{"operationId":"listFields","summary":"List the workspace's own fields","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Fields.","content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","choice","boolean"]},"options":{"type":"array","items":{"type":"string"}},"merge_field":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["key","label","type"]}}},"required":["fields"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createField","summary":"Define a field","description":"Its key (made from the label when not given) and type never change. A choice needs its options.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"key":{"type":"string","description":"Lowercase letters, digits and _, starting with a letter."},"type":{"type":"string","enum":["text","number","date","choice","boolean"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","type"]}}}},"responses":{"201":{"description":"The field.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","date","choice","boolean"]},"options":{"type":"array","items":{"type":"string"}},"merge_field":{"type":"string"},"created_at":{"type":"string","format":"date-time"}},"required":["key","label","type"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/segments":{"get":{"operationId":"listSegments","summary":"List saved segments","description":"Each with how many people it matches now.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Segments.","content":{"application/json":{"schema":{"type":"object","properties":{"segments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"definition":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"tag, custom, app, plan, country, signed_up, added, source, topic, last_message, search or state."},"op":{"type":"string","description":"The field's operator: has, has_not, is, is_not, contains, eq, gt, lt, after, before, within_days, more_than_days, is_true, is_false, set, not_set, unknown, subscribed, unsubscribed, pending, never, matches, suppressed, all_off, unconfirmed, no_address."},"ref":{"type":"string","description":"For tag (its id), custom (a field's key), app (its key) and topic (its key)."},"value":{"type":"string","description":"What it is compared with: a day YYYY-MM-DD, a number of days, a number, a two-letter country, a plan status, or words."}},"required":["field","op"]},"maxItems":20}},"description":"Conditions that must all (or any) hold. Checked against an allow-list; anything else is refused (422 bad_segment)."},"summary":{"type":"string","description":"The conditions in words."},"count":{"anyOf":[{"type":"integer","description":"People it matches now; null when it can't run (a tag or field it names was deleted)."},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","definition","count"]}}},"required":["segments"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createSegment","summary":"Save a segment","description":"A filter over contacts. It never subscribes anyone; a campaign narrowed by it still goes only to people who agreed to its topic.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"definition":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"tag, custom, app, plan, country, signed_up, added, source, topic, last_message, search or state."},"op":{"type":"string","description":"The field's operator: has, has_not, is, is_not, contains, eq, gt, lt, after, before, within_days, more_than_days, is_true, is_false, set, not_set, unknown, subscribed, unsubscribed, pending, never, matches, suppressed, all_off, unconfirmed, no_address."},"ref":{"type":"string","description":"For tag (its id), custom (a field's key), app (its key) and topic (its key)."},"value":{"type":"string","description":"What it is compared with: a day YYYY-MM-DD, a number of days, a number, a two-letter country, a plan status, or words."}},"required":["field","op"]},"maxItems":20}},"description":"Conditions that must all (or any) hold. Checked against an allow-list; anything else is refused (422 bad_segment)."}},"required":["name","definition"]}}}},"responses":{"201":{"description":"The segment.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"definition":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"tag, custom, app, plan, country, signed_up, added, source, topic, last_message, search or state."},"op":{"type":"string","description":"The field's operator: has, has_not, is, is_not, contains, eq, gt, lt, after, before, within_days, more_than_days, is_true, is_false, set, not_set, unknown, subscribed, unsubscribed, pending, never, matches, suppressed, all_off, unconfirmed, no_address."},"ref":{"type":"string","description":"For tag (its id), custom (a field's key), app (its key) and topic (its key)."},"value":{"type":"string","description":"What it is compared with: a day YYYY-MM-DD, a number of days, a number, a two-letter country, a plan status, or words."}},"required":["field","op"]},"maxItems":20}},"description":"Conditions that must all (or any) hold. Checked against an allow-list; anything else is refused (422 bad_segment)."},"summary":{"type":"string","description":"The conditions in words."},"count":{"anyOf":[{"type":"integer","description":"People it matches now; null when it can't run (a tag or field it names was deleted)."},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","definition","count"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/segments/{id}":{"get":{"operationId":"getSegment","summary":"One segment, with its count now","description":"Counts only; list its people with GET /api/v1/contacts?segment=<id>.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The segment.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"definition":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"]},"conditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","description":"tag, custom, app, plan, country, signed_up, added, source, topic, last_message, search or state."},"op":{"type":"string","description":"The field's operator: has, has_not, is, is_not, contains, eq, gt, lt, after, before, within_days, more_than_days, is_true, is_false, set, not_set, unknown, subscribed, unsubscribed, pending, never, matches, suppressed, all_off, unconfirmed, no_address."},"ref":{"type":"string","description":"For tag (its id), custom (a field's key), app (its key) and topic (its key)."},"value":{"type":"string","description":"What it is compared with: a day YYYY-MM-DD, a number of days, a number, a two-letter country, a plan status, or words."}},"required":["field","op"]},"maxItems":20}},"description":"Conditions that must all (or any) hold. Checked against an allow-list; anything else is refused (422 bad_segment)."},"summary":{"type":"string","description":"The conditions in words."},"count":{"anyOf":[{"type":"integer","description":"People it matches now; null when it can't run (a tag or field it names was deleted)."},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","definition","count"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/forms":{"get":{"operationId":"listForms","summary":"List sign-up forms","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Forms.","content":{"application/json":{"schema":{"type":"object","properties":{"forms":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"version":{"type":"integer","description":"Moves on whenever the wording, topics, fields or thank-you change; earlier sign-ups keep the version they saw."},"topics":{"type":"array","items":{"type":"string"}},"wording":{"type":"string"},"fields":{"type":"object","properties":{"name":{"type":"string","enum":["off","optional","required"]},"country":{"type":"string","enum":["off","optional","required"]}}},"custom_fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"Send the answer as fields.<key> on POST /api/v1/leads."},"label":{"type":"string","description":"As the form shows it."},"type":{"type":"string","enum":["text","number","date","choice","boolean"]},"options":{"type":"array","items":{"type":"string"}},"required":{"type":"boolean"}},"required":["key","label","type","required"]},"description":"The workspace's own fields the form asks, in order."},"thank_you":{"type":"object","properties":{"message":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string","description":"An https page on one of the form's sites."},{"type":"null"}]}}},"allowed_origins":{"type":"array","items":{"type":"string"}},"daily_cap":{"type":"integer"},"status":{"type":"string"}}}}},"required":["forms"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/funnel":{"get":{"operationId":"getFunnel","summary":"Sign-ups and new payers per app and week, by source, and per form","description":"From what apps have reported. No revenue.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"weeks","in":"query","schema":{"type":"integer","description":"1 to 52; default 8."}}],"responses":{"200":{"description":"The funnel.","content":{"application/json":{"schema":{"type":"object","properties":{"weeks":{"type":"integer"},"by_week":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":true}},"by_source":{"type":"object","properties":{},"additionalProperties":true},"forms":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":true}}}}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/report":{"get":{"operationId":"getReport","summary":"The audience, sending and health over time","description":"Counts 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.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"unit","in":"query","schema":{"type":"string","description":"week (default) or month.","enum":["week","month"]}},{"name":"range","in":"query","schema":{"type":"string","description":"12w (default), 6m or 12m.","enum":["12w","6m","12m"]}},{"name":"topic","in":"query","schema":{"type":"string","description":"A topic's key. Omitted: subscribed to any topic."}}],"responses":{"200":{"description":"The report.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such topic.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/calendar":{"get":{"operationId":"getCalendar","summary":"What is on the calendar","description":"Days 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.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string","description":"First day, YYYY-MM-DD. Omitted with to: 30 days before to. Both omitted: this month.","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","description":"Last day, YYYY-MM-DD, at most 366 days after from. Omitted: 30 days after from.","format":"date"}}],"responses":{"200":{"description":"The calendar.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Calendar"}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/prospects":{"get":{"operationId":"listProspects","summary":"List prospects","description":"A record of who the workspace is talking to. Nothing is ever sent to a prospect from Contact.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"stage","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"overdue","in":"query","schema":{"type":"string","description":"1: next step overdue."}}],"responses":{"200":{"description":"Prospects.","content":{"application/json":{"schema":{"type":"object","properties":{"prospects":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":true}}},"required":["prospects"]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"addProspect","summary":"Add a prospect","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"person":{"type":"string"},"email":{"type":"string"},"stage":{"type":"string"},"source":{"type":"string"},"next_step":{"type":"string"},"next_step_on":{"type":"string","description":"YYYY-MM-DD"}}}}}},"responses":{"201":{"description":"The prospect.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/prospects/{id}":{"get":{"operationId":"getProspect","summary":"One prospect with its history","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The prospect.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateProspect","summary":"Change a prospect, move its stage, or add a note","description":"Fields not sent stay as they are. do_not_contact also stops optional email to the address.","x-scope":"full","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"person":{"type":"string"},"email":{"type":"string"},"stage":{"type":"string"},"source":{"type":"string"},"next_step":{"type":"string"},"next_step_on":{"type":"string"},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"The prospect.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/campaigns/{id}/preview":{"get":{"operationId":"previewCampaign","summary":"A campaign as a recipient would get it","description":"Merge fields are filled in for a sample person.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"From, subject, text and HTML.","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"subject":{"type":"string"},"text":{"type":"string"},"html":{"type":"string"}},"required":["from","subject","text","html"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"It can't be prepared yet: no sender, or no legal name and address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/campaigns/{id}/audience":{"get":{"operationId":"campaignAudience","summary":"How many a draft would go to now","description":"Numbers only, no addresses.","x-scope":"read","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Counts.","content":{"application/json":{"schema":{"type":"object","properties":{"would_go_to":{"type":"integer"},"left_out":{"type":"object","properties":{},"additionalProperties":{"type":"integer"}}},"required":["would_go_to","left_out"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/links":{"get":{"operationId":"listLinks","summary":"List tracked links with their click counts","description":"Clicks are counted per link per day, never per person; bots and mail scanners are counted apart.","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"Links.","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"destination":{"type":"string"},"label":{"type":"string"},"campaign_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"object","properties":{},"additionalProperties":true},"status":{"type":"string"},"clicks":{"type":"integer"},"bot_clicks":{"type":"integer"}}}}},"required":["links"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createLink","summary":"Make a tracked link","description":"A 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.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"string","description":"https only."},"label":{"type":"string"},"utm_source":{"type":"string"},"utm_medium":{"type":"string"},"utm_campaign":{"type":"string"},"ref":{"type":"string"}},"required":["destination"]}}}},"responses":{"201":{"description":"The link.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":true}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhooks","x-scope":"read","security":[{"key":[]}],"responses":{"200":{"description":"The workspace's webhooks.","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhooks"]}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createWebhook","summary":"Add a webhook","description":"Contact 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.","x-scope":"full","security":[{"key":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"An https address on the public internet."},"events":{"type":"array","items":{"type":"string"},"description":"Event types wanted. Absent or empty: all of them."}},"required":["url"]}}}},"responses":{"201":{"description":"The webhook, with its secret.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"whsec_…: the signing secret, shown once."}},"required":["secret"]}]}}}},"400":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/webhooks/{id}":{"delete":{"operationId":"deleteWebhook","summary":"Remove a webhook","x-scope":"full","security":[{"key":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed."},"401":{"description":"No working key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"An error: { error: { code, message } }","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many requests with this key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string","description":"For an error about one of a form's own fields (field_required, unknown_field, bad_field_value): its key."}},"required":["code","message"]}},"required":["error"]},"Account":{"type":"object","properties":{"sub":{"type":"string","description":"The shared sign-in id, when the app has one for the person."},"email":{"type":"string"},"email_verified":{"type":"boolean","description":"True only when the app's sign-in proved the address. An unverified address never joins or takes over a record."},"account_ref":{"type":"string","description":"The app's own id for the account. Needed when there is no sub."},"name":{"type":"string"},"country":{"type":"string","description":"Two-letter country code."},"signed_up_at":{"type":"string","format":"date-time"},"plan":{"type":"string"},"plan_status":{"type":"string","enum":["free","trialing","active","past_due","canceled"]},"paying_since":{"type":"string","format":"date-time"},"source":{"type":"object","properties":{"ref":{"type":"string"},"utm_source":{"type":"string"},"utm_medium":{"type":"string"},"utm_campaign":{"type":"string"},"utm_content":{"type":"string"},"utm_term":{"type":"string"},"landing":{"type":"string"},"referrer_host":{"type":"string"},"first_seen_at":{"type":"string"}},"description":"Where the sign-up came from (the suite's attribution fields)."}},"description":"One of an app's accounts. Needs sub, or account_ref, or a verified email."},"Topic":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"class":{"type":"string","enum":["marketing","lifecycle"]},"app":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["active","archived"]}},"required":["key","name","class","status"]},"Calendar":{"type":"object","properties":{"time_zone":{"type":"string","description":"The workspace's time zone (IANA). Days are its days."},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"entries":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["campaign_scheduled","campaign_sending","campaign_sent","sequence_started","sequence_approved","planned"]},"id":{"type":"string","description":"The campaign's, sequence's or planned item's id.","format":"uuid"},"date":{"type":"string","description":"The day, in the workspace's time zone.","format":"date"},"at":{"anyOf":[{"type":"string","description":"The moment (UTC). Null for a planned item, which has a day only.","format":"date-time"},{"type":"null"}]},"title":{"type":"string","description":"The campaign's or sequence's name, or the planned item's title."},"channel":{"type":"string","enum":["email","social","other"]},"status":{"type":"string","description":"The campaign's or sequence's state, or planned."},"paused":{"type":"boolean","description":"A campaign that is paused."},"notes":{"type":"string","description":"A planned item's notes."},"campaign_id":{"anyOf":[{"type":"string","description":"The campaign a planned item is about.","format":"uuid"},{"type":"null"}]},"note":{"type":"string","description":"On a planned social item: posting from Contact isn't available yet."}},"required":["kind","id","date","at","title","channel","status"]}}},"required":["time_zone","from","to","entries"],"description":"Ids, days, kinds and titles. No address or person."},"Campaign":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"topic":{"type":"string","description":"The marketing topic it is sent under."},"subject":{"type":"string","description":"Up to 200 characters. May hold merge fields."},"preheader":{"type":"string","description":"The preview text a mail app shows beside the subject, up to 200 characters. May hold merge fields."},"body":{"type":"string","description":"Plain text with a little markup: # heading, ## smaller heading, **bold**, *italic*, - list, 1. numbered list, [words](https://…), [words](https://…){button} on its own line, --- for a line. Merge fields, filled in per person when it is sent: {{first_name}}, {{name}}, {{sender_name}}, {{workspace_name}}, {{topic_name}}, and the workspace's own fields as {{field.<key>}} (GET /api/v1/fields), each with an optional fallback for an empty value: {{first_name|there}}. A value is always plain text. An unknown field is refused (422 bad_merge_field), and none may go in a link's address."},"audience":{"type":"object","properties":{"apps":{"type":"array","items":{"type":"string"}},"plan_statuses":{"type":"array","items":{"type":"string"}},"signed_up_from":{"type":"string","description":"YYYY-MM-DD"},"signed_up_to":{"type":"string","description":"YYYY-MM-DD"},"source":{"type":"string"},"segment":{"type":"string","description":"A saved segment's id: only people in it. A segment narrows; it never stands in for consent.","format":"uuid"}},"description":"Narrows who gets it among people who agreed to the topic. Never adds anyone."},"status":{"type":"string","enum":["draft","approved","sending","sent","cancelled"]},"tested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"starts_at":{"anyOf":[{"type":"string","description":"Not before this moment, chosen by the person who approved it. Null: at once.","format":"date-time"},{"type":"null"}]},"scheduled":{"type":"boolean","description":"Approved with a start time still to come; nothing sent yet. Only a person can schedule or unschedule, in the dashboard."},"recipient_count":{"anyOf":[{"type":"integer","description":"How many it was approved for."},{"type":"null"}]},"left_out":{"anyOf":[{"type":"object","properties":{},"additionalProperties":{"type":"integer"},"description":"At approval: how many were left out, by reason."},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"results":{"type":"object","properties":{},"additionalProperties":{"type":"integer"},"description":"Messages by outcome: sent, delivered, bounced, complained, refused, failed."}},"required":["id","name","topic","status"]},"Sequence":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"topic":{"type":"string","description":"The marketing topic people join it by subscribing to."},"status":{"type":"string","enum":["draft","active","paused","stopped"]},"needs_approval":{"type":"boolean","description":"A draft, or changed since its approval: nothing is sent until a person approves it in the dashboard."},"include_imports":{"type":"boolean","description":"People brought in by an approved import join too."},"allow_reenrol":{"type":"boolean","description":"Someone who left and subscribes again starts again."},"stop_on_reply":{"type":"boolean","description":"A person's reply to any of the workspace's email ends their place in it (on by default; turning it off needs the sequence approved again)."},"segment_id":{"anyOf":[{"type":"string","description":"A saved segment that narrows it: only people in it join, and each step goes only to people still in it when it falls due (someone no longer in it leaves). It never stands in for the topic's yes. Changing it needs the sequence approved again.","format":"uuid"},{"type":"null"}]},"approved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"first_approved_at":{"anyOf":[{"type":"string","description":"People join from here on.","format":"date-time"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time"},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"integer","description":"1 for the first."},"delay_minutes":{"type":"integer","description":"The wait after the step before (after joining, for the first). 0 is at once."},"subject":{"type":"string"},"preheader":{"type":"string"},"body":{"type":"string","description":"Merge fields, filled in per person when it is sent: {{first_name}}, {{name}}, {{sender_name}}, {{workspace_name}}, {{topic_name}}, and the workspace's own fields as {{field.<key>}} (GET /api/v1/fields), each with an optional fallback for an empty value: {{first_name|there}}. A value is always plain text. An unknown field is refused (422 bad_merge_field), and none may go in a link's address."},"tested_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"results":{"type":"object","properties":{"sent":{"type":"integer"},"delivered":{"type":"integer"},"bounced":{"type":"integer"},"clicks":{"type":"integer","description":"Summed over the step's tracked links; never per person."},"unsubscribes":{"type":"integer"},"waiting_for_it":{"type":"integer"}}}},"required":["id","position","delay_minutes","subject","body"]}},"people":{"type":"object","properties":{"in_it":{"type":"integer"},"completed":{"type":"integer"},"left":{"type":"integer"},"stopped":{"type":"integer"}},"description":"Counts only."}},"required":["id","name","topic","status","steps"]},"Reply":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","description":"Who it is from: the person the message was sent to.","format":"uuid"},"message_id":{"type":"string","description":"The message it answers.","format":"uuid"},"message_kind":{"type":"string","enum":["campaign","lifecycle","sequence"]},"campaign_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"sequence_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"sequence_step_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"from_recipient":{"type":"boolean","description":"It came from the address the message was sent to. False for a forward answered by someone else: shown, and it ends no sequence."},"subject":{"type":"string"},"text":{"type":"string","description":"Their words as plain text, with what they quoted. Up to 20,000 characters."},"auto_reply":{"type":"boolean","description":"An automatic answer (an out-of-office, an auto-responder, a delivery report)."},"auto_reply_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"unsubscribe_intent":{"type":"boolean","description":"It seems to ask to stop. Flagged for a person; nothing was stopped."},"sequences_ended":{"type":"integer","description":"How many of their places in sequences it ended (stop-on-reply)."},"received_at":{"type":"string","format":"date-time"},"handled_at":{"anyOf":[{"type":"string","description":"When someone in the workspace marked it dealt with.","format":"date-time"},{"type":"null"}]}},"required":["id","contact_id","message_id","message_kind","subject","text","auto_reply","unsubscribe_intent","received_at"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","off"]},"created_at":{"type":"string","format":"date-time"}},"required":["id","url","events","status"]},"Prompt":{"type":"object","properties":{"text_id":{"type":"string","format":"uuid"},"body":{"type":"string","description":"The wording to show."},"topics":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}},"required":["key","name"]}}},"required":["text_id","body","topics"]},"Report":{"type":"object","properties":{"unit":{"type":"string","enum":["week","month"]},"range":{"type":"string","enum":["12w","6m","12m"]},"topic":{"anyOf":[{"type":"string","description":"The topic's key, or null for any topic."},{"type":"null"}]},"periods":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","description":"The period's first day, YYYY-MM-DD (UTC)."},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"}},"required":["key","start","end"]}},"audience":{"type":"object","properties":{"opening":{"type":"integer","description":"Subscribers when the range began."},"periods":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string","description":"YYYY-MM-DD"},"joined":{"type":"object","properties":{"form":{"type":"integer"},"import":{"type":"integer"},"app":{"type":"integer","description":"From an app's consent prompt."},"other":{"type":"integer"}}},"left":{"type":"object","properties":{"unsubscribed":{"type":"integer"},"stopped":{"type":"integer","description":"Turned off all optional email."},"erased":{"type":"integer"}}},"bounced":{"type":"integer","description":"Subscribers whose address a hard bounce stopped. Still counted in the total."},"complained":{"type":"integer","description":"Subscribers whose address a complaint stopped. Still counted in the total."},"turnedOff":{"type":"integer","description":"People who turned the topic (or all email) off, subscribers or not."},"net":{"type":"integer","description":"Joined minus left."},"total":{"type":"integer","description":"Subscribers at the period's end (now, for the running period)."}},"required":["period","joined","left","net","total"]}}},"required":["opening","periods"]},"sending":{"type":"object","properties":{"monthlyLimit":{"anyOf":[{"type":"integer","description":"The workspace's monthly ceiling, or null for none."},{"type":"null"}]},"periods":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string"},"sent":{"type":"object","properties":{"campaign":{"type":"integer"},"lifecycle":{"type":"integer"},"confirmation":{"type":"integer"},"test":{"type":"integer"}}},"total":{"type":"integer"},"delivered":{"type":"integer"},"bounced":{"type":"integer"},"complained":{"type":"integer"},"logged":{"type":"integer","description":"Logged and not sent (a test setup). Not in total."}},"required":["period","sent","total"]}}},"required":["monthlyLimit","periods"]},"health":{"type":"object","properties":{"days":{"type":"integer"},"sent":{"type":"integer"},"bounce":{"type":"object","properties":{"count":{"type":"integer"},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"tone":{"type":"string","enum":["success","waiting","danger","neutral"]},"advice":{"type":"string"}}},"complaint":{"type":"object","properties":{"count":{"type":"integer"},"rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"tone":{"type":"string","enum":["success","waiting","danger","neutral"]},"advice":{"type":"string"}}}},"required":["days","sent","bounce","complaint"]}},"required":["unit","range","topic","periods","audience","sending","health"],"description":"Counts only. No address, name or person."}},"securitySchemes":{"key":{"type":"http","scheme":"bearer","description":"An API key from the dashboard's API keys page."}}}}