Skip to main content

API

Integrations​

API

This documentation covers the RESTful API endpoints for customers, forms, workflows, campaign content, campaigns and social analytics. All endpoints are protected by ApiClientMiddleware and require proper authentication.

info

Using an AI assistant such as Claude, ChatGPT, Gemini or Cursor? You don't need an API key: connect it over MCP and sign in with your TrueBeep account instead.

Create a secret key​

To get started, create a secret key to authenticate your API requests.

Use https://api.truebeep.com/v1 as the base URL for all TrueBeep API requests.

POST/customer

Create Customer​

Creates a new customer record.

Example Responses:
{
"success": true,
"data": {
"id": "e8c43l37t1zayx8t66t5xbg9",
"firstName": "John",
"lastName": "Doe",
"phone": "+177566302",
"points": 15
}
}
Parameters:
FieldTypeDescription
firstName(Required)
stringThis field is required
lastName(Required)
stringThis field is required
phone(Conditional)
stringMin 10 digits
email(Conditional)
stringValid email
username(Optional)
stringOptional
info

Conditional fields indicate that at least one of the marked fields is required. For this endpoint, you must provide either phone or email (or both) along with the required fields.

POST/customers

Bulk Create Customers​

Create multiple customer records in a single request.

Example Responses:
[
{
"id": "uuid",
"firstName": "John",
"lastName": "Doe",
"phone": "1234567890",
"email": "john.doe@example.com"
},
{
"id": "uuid2",
"firstName": "Sam",
"lastName": "Smith",
"phone": "9876543210",
"email": "sam.smith@example.com"
}
]
Parameters:
FieldTypeDescription
firstName(Required)
stringThis field is required
lastName(Required)
stringThis field is required
phone(Conditional)
stringMin 10 digits
email(Conditional)
stringValid email
username(Optional)
stringOptional
info

Conditional fields indicate that at least one of the marked fields is required. For this endpoint, you must provide either phone or email (or both) along with the required fields.

PUT/customer/:customerId

Update Customer​

Update customer information.

Example Responses:
{
"id": "uuid",
"firstName": "Walter",
"lastName": "White",
"phone": "+1234567890"
}
GET/customer/:customerId

Get Customer​

Retrieve customer information by ID.

Example Responses:
{
"id": "uuid",
"firstName": "John",
"lastName": "Doe",
"phone": "1234567890",
"email": "john.doe@example.com",
"points": "100"
}
POST/customer/:customerId/qr

Update Customer QR Points​

Update customer points using a QR code scan.

Example Responses:
{
"success": true,
"data": {
"id": "jv3cstlguhr2e91oihi0bfsx",
"firstName": "John",
"lastName": "Doe",
"points": 2
}
}
Parameters:
FieldTypeDescription
code(Required)
stringThis field is required
couponId(Required)
stringThis field is required
POST/customer/:customerId/loyalty

Update Customer Loyalty Points​

Update a customer's loyalty points.

Example Responses:
{
"id": "l7817f8lbdqn18pok75x2mnm",
"firstName": "John",
"lastName": "Doe",
"email": "john@gmail.com",
"points": 10
}
Parameters:
FieldTypeDescription
points(Required)
numberThis field is required
type(Required)
increment or decrementThis field is required

Forms API​

The Forms API lets your own website, app, or backend submit responses into a TrueBeep form. You keep your existing front-end — the markup, styling, and validation stay yours — and TrueBeep becomes the place the submissions are stored, searched, exported, and turned into customer records.

Use it to:

  • Replace a mailto or a bespoke form handler with a real inbox you can filter and export
  • Consolidate many website forms into one TrueBeep form, tagging each submission with the page it came from
  • Capture leads as customers automatically — a submission with an email or phone is matched to an existing customer or creates a new one

All Forms endpoints are protected by ApiClientMiddleware and use the same secret key as the rest of the API. Base URL https://api.truebeep.com/v1, with your key as a bearer token:

Authorization: Bearer <token>

Requests are scoped to the team that owns the key — you can only read and write your own team's forms.

warning

Server-to-server only. Your secret key grants full write access to your team's data, so it must never be embedded in browser JavaScript or a mobile app binary. Post the form to your own backend first, then have your backend call this API.

How it works​

1

Create the form

Build it in the Form Builder, or create it over the API with POST /forms. Either way the form defines the schema that submissions are validated against.

2

Read the field keys

Call the schema endpoint to get each field's key. Keys are what you submit against.

3

Submit responses

POST an array of key / value pairs. The response appears in your dashboard under Forms → View Responses immediately.

See the Forms guide for building and publishing a form.

About field keys​

Every field has a key — a lowercase, underscore-separated identifier derived from its label. First Name becomes first_name, Email Address becomes email_address.

danger

Keys are regenerated from the label every time the form is saved in the builder. Renaming a field label will change its key and silently break an integration that hard-codes the old one. Two further quirks to be aware of when naming fields:

  • A question mark becomes a trailing q — How did you find us? yields how_did_you_find_usq
  • Digits are replaced with letters derived from the field's internal id, so Line 2 yields an unpredictable key

Prefer labels without digits or question marks, and always read keys from the schema endpoint rather than guessing them.

POST/forms

Create a Form​

Creates a form and all its fields in one request. Returns the generated formId and each field's server-generated key.

Example Responses:
{
"success": true,
"data": {
"id": "q06e8ni8x0oksl2l23xxknjz",
"name": "Contact Us",
"status": "published",
"fields": [
{ "key": "first_name", "label": "First Name", "type": "varchar", "fieldType": "TextInput", "isRequired": true, "options": [] },
{ "key": "email_address", "label": "Email Address", "type": "varchar", "fieldType": "EmailInput", "isRequired": true, "options": [] },
{ "key": "region", "label": "Region", "type": "varchar", "fieldType": "Select", "isRequired": false, "options": ["Guam", "CNMI"] }
]
}
}
Body Parameters:
FieldTypeDescription
name(Required)
stringMust be unique within your team
fields(Required)
arrayAt least one field — see the field object below
description(Optional)
stringShown under the form title
formPurpose(Optional)
stringContext used by AI form filling
status(Optional)
stringdraft or published. Default draft
isPublic(Optional)
booleanDefault true
createCustomerOnSubmit(Optional)
booleanDefault true
webhookUrl(Optional)
stringPOSTed the full response after each submission
webhookSecret(Optional)
stringSent as Authorization: Bearer on the webhook
Field object:
FieldTypeDescription
fieldType(Required)
stringTextInput, Textarea, EmailInput, PhoneInput, NumberInput, DatePicker, Select, Radio, Checkbox
label(Required)
stringAlso the source of the generated key
isRequired(Optional)
booleanDefault false
options(Optional)
string[]Required for Select, Radio, and checkbox groups
isGroup(Optional)
booleanCheckbox only — renders a multi-select group
placeholder(Optional)
string
helperText(Optional)
stringHint shown under the field
defaultValue(Optional)
string
aiInstruction(Optional)
stringGuidance for AI-assisted form filling
warning

You cannot choose the field keys. They are generated from each label using the same rules the Form Builder uses, so that opening the form in the builder and saving it does not rename them. Read the keys from the create response, or from GET /forms/:formId/schema, before you write any code that submits to the form.

info

Field ordering follows the order of the fields array. type (the storage type) is derived from fieldType — you do not send it.

PATCH/forms/:formId

Update a Form​

Updates a form's settings and, optionally, its fields. Every property is optional — send only what you want to change.

Example Responses:
{
"success": true,
"data": {
"id": "q06e8ni8x0oksl2l23xxknjz",
"name": "Contact Us",
"status": "published",
"fields": [
{ "key": "first_name", "label": "First Name", "type": "varchar", "fieldType": "TextInput", "isRequired": true, "options": [] }
],
"removedFields": []
}
}

Accepts every body parameter from Create (except that name is optional), plus:

FieldTypeDescription
fields(Optional)
arrayOmit to leave fields untouched. If sent, this is the complete list the form ends up with
removeMissingFields(Optional)
booleanConfirms deletion of fields absent from fields. Default false

How fields are matched​

Fields are matched to the existing ones by label. A field whose label is unchanged keeps its id and key, so every answer already collected against it is preserved while its type, options, or required flag change freely. A field with a new label is created; renaming a label therefore creates a new field rather than renaming the old one.

danger

Removing a field permanently deletes every answer already collected for it, across all past responses — it cannot be undone.

Because fields is a complete replacement list, simply forgetting to include an existing field would silently destroy data. The API therefore refuses the update, listing the fields at risk.

Re-send the missing fields to keep them, or set removeMissingFields: true to confirm you intend to delete them and their data.

{
"success": false,
"code": "FIELDS_WOULD_BE_REMOVED",
"message": "These fields are missing from the update and removing them deletes every answer already collected for them. Re-send them, or set removeMissingFields to true to confirm.",
"fields": ["how_did_you_find_us"]
}
info

Header, footer, and styling configured in the Form Builder are preserved on update — only the field list is rewritten.

GET/forms

List Forms​

Returns every form belonging to your team, so you can find the formId you need without opening the dashboard.

Example Responses:
{
"success": true,
"data": [
{
"id": "qo0zhyldtdiv7vxgtg6emq5r",
"name": "Contact Us",
"status": "published",
"provider": "internal",
"isPublic": true,
"responseCount": 128,
"createdAt": "2026-08-20T01:37:41.438Z",
"updatedAt": "2026-08-20T01:37:41.438Z"
}
]
}
GET/forms/:formId/schema

Get Form Schema​

Returns the form's fields, in the order they appear in the builder. Call this once when building your integration — and again whenever someone edits the form — to pick up the current keys and select options.

Example Responses:
{
"success": true,
"data": {
"id": "qo0zhyldtdiv7vxgtg6emq5r",
"name": "Contact Us",
"status": "published",
"fields": [
{
"key": "first_name",
"label": "First Name",
"type": "varchar",
"fieldType": "TextInput",
"isRequired": true,
"options": [],
"maxLength": 255
},
{
"key": "who_is_this_directed_to",
"label": "Who is this directed to",
"type": "varchar",
"fieldType": "Select",
"isRequired": false,
"options": ["Customer Service / Tech Support", "Business Sales", "Ad Sales"],
"maxLength": 255
},
{
"key": "comment",
"label": "Comment",
"type": "text",
"fieldType": "Textarea",
"isRequired": false,
"options": [],
"maxLength": null
}
]
}
}
Field object:
FieldTypeDescription
keystringThe identifier you submit against
labelstringHuman-readable label as shown on the form
typestringStorage type — varchar, text, number, boolean, or date
fieldTypestringBuilder component — TextInput, Select, Checkbox, Textarea, ...
isRequiredbooleanSubmissions missing this field are rejected
optionsstring[]Allowed values for Select, Radio, and checkbox groups. Empty otherwise
maxLengthnumber255 for varchar fields, null when unlimited
POST/forms/:formId/responses

Submit a Form Response​

Creates a form response. Returns the new response id and, when a customer could be matched or created, the customer id.

Example Responses:
{
"success": true,
"data": {
"formResponseId": "e8c43l37t1zayx8t66t5xbg9",
"subscriberId": "jv3cstlguhr2e91oihi0bfsx"
}
}
Body Parameters:
FieldTypeDescription
responses(Required)
arrayAt least one { key, value } pair
responses[].key(Required)
stringA key from the schema endpoint
responses[].value(Required)
mixedString, number, boolean, or array of strings — see the table below
customer(Optional)
objectOverrides the customer details derived from the submission
customer.firstName(Optional)
stringOptional
customer.lastName(Optional)
stringOptional
customer.email(Optional)
stringValid email
customer.phone(Optional)
stringOptional

Value formats by field type​

The type returned by the schema endpoint determines what a value may be:

typeAccepted valueNotes
varcharstring, number, or string[]Max 255 characters. For Select / Radio the value must be one of options. Checkbox groups take an array and are stored pipe-joined
textstringNo length limit — use this for long free-text and URLs
numbernumber or a numeric stringMust be finite
booleantrue / false, or "true" / "false"
dateISO 8601 stringe.g. 2026-08-20T00:00:00.000Z
warning

varchar fields are capped at 255 characters and a longer value is rejected with INVALID_FIELD_VALUES. If you need to send something long — a page URL with tracking parameters, a plan summary, a free-text comment — make that field a Textarea in the builder so it is stored as text instead.

Validation rules​

  • Required fields are enforced. Any field with isRequired: true that is missing, null, or blank rejects the whole submission with 400 MISSING_REQUIRED_FIELDS.
  • Unknown keys are ignored, not rejected. A key that does not exist on the form is dropped and echoed back in data.ignoredKeys so typos surface without failing live traffic. Always check this array while building your integration.
  • Blank optional fields are skipped. They are not stored as empty values.
  • Select and Radio values are checked against options, so a value that does not match is rejected rather than silently stored.
{
"success": true,
"data": {
"formResponseId": "e8c43l37t1zayx8t66t5xbg9",
"subscriberId": null,
"ignoredKeys": ["emial_address"]
}
}
GET/forms/:formId/responses

List Form Responses​

Returns a form's responses, newest first, with pagination and filtering.

Example Responses:
{
"success": true,
"data": [
{
"id": "kt36fnwwr0ni3dk6biksw8nf",
"createdAt": "2026-08-20T02:40:06.967Z",
"source": "public",
"isRead": false,
"formId": "qo0zhyldtdiv7vxgtg6emq5r",
"formName": "Contact Us",
"subscriberId": "v863ihow50ztrh8kserqhvjx",
"subscriberFirstName": "John",
"subscriberLastName": "Doe",
"fields": [
{ "key": "first_name", "label": "First Name", "type": "varchar", "fieldType": "TextInput", "value": "John" },
{ "key": "inquiry_source", "label": "Inquiry Source", "type": "varchar", "fieldType": "Select", "value": "fiber" },
{ "key": "comment", "label": "Comment", "type": "text", "fieldType": "Textarea", "value": "Please call me." }
]
}
],
"pagination": { "page": 1, "limit": 20, "total": 137, "totalPages": 7 }
}
Query Parameters:
FieldTypeDescription
page(Optional)
numberDefault 1
limit(Optional)
numberDefault 20, max 100
order(Optional)
stringasc or desc by submission time. Default desc
source(Optional)
stringpublic (form or API) or ai (collected by AI auto-reply)
isRead(Optional)
stringtrue or false
startDate(Optional)
stringISO date; filters createdAt >=
endDate(Optional)
stringISO date; filters createdAt <=
search(Optional)
stringCase-insensitive match across every answer on the response
fieldKey(Optional)
stringFilter on one field, e.g. inquiry_source. Requires fieldValue
fieldValue(Optional)
stringExact value the field must equal. Requires fieldKey
tip

fieldKey + fieldValue is what makes one shared form workable across many pages. If every page sets its own inquiry_source, then ?fieldKey=inquiry_source&fieldValue=fiber gives you just that page's submissions — no separate form needed per page.

info

fields always lists every field currently on the form, in builder order. A field the responder left blank — or one added to the form after the response was collected — comes back with value: null, so the shape is stable across rows and easy to turn into table columns or CSV.

GET/forms/:formId/responses/:responseId

Get a Form Response​

Returns a single response in the same shape as a list entry. Responds 404 RESPONSE_NOT_FOUND if the response does not exist, is not on that form, or belongs to another team.

Customer matching​

When a submission contains an email or phone number, TrueBeep looks for an existing customer on your team with that channel and links the response to them, creating a new customer if there is no match. The returned subscriberId is that customer.

Values are taken from the submission automatically:

  • Email — the first field with fieldType: "EmailInput"
  • Phone — the first field with fieldType: "PhoneInput"
  • Name — the first_name and last_name fields, or a single name field split on the first space

Send a customer object to override any of these. If a submission has neither an email nor a phone, subscriberId is null and the response is still stored.

info

Customer matching never fails a submission. If the customer record cannot be created, the form response is still saved and subscriberId comes back null.

Turning customer creation off​

Customer creation is controlled by the form, not by the request. Open the form in the Form Builder → Settings → Customer and switch Create Customer On Submit off to collect responses without adding anyone to your customer list.

It is on by default, and the setting applies to every route into the form — this API and the public form page alike — so all your pages behave consistently and no integration can opt itself out.

The current value is returned by the schema endpoint:

{
"success": true,
"data": {
"id": "qo0zhyldtdiv7vxgtg6emq5r",
"name": "Contact Us",
"createCustomerOnSubmit": true,
"fields": []
}
}

With it off, submissions still succeed and every answer is still stored — including name, email and phone, which remain visible in the responses table and in exports. You simply get subscriberId: null and nobody is added to your customer list.

warning

Switching it off is not retroactive, and there is no way to back-fill customers from responses collected while it was off. If you are unsure, leave it on — you can always turn it off later, but you cannot recover the gap.

Consolidating several website forms into one​

If the same enquiry form appears on many pages, you do not need a TrueBeep form for each one. Build a single form with the union of the fields, mark the page-specific ones optional, and add a field that records where the submission came from — a Select of page slugs, plus a Textarea for the full URL.

Every page then posts to the same formId, differing only in that source value, and you get one inbox and one export you can still segment by page.

{
"responses": [
{ "key": "first_name", "value": "John" },
{ "key": "email_address", "value": "john.doe@example.com" },
{ "key": "inquiry_source", "value": "fiber" },
{ "key": "source_url", "value": "https://www.example.com/shop/internet/fiber?utm_source=newsletter" }
]
}
tip

Make the source field a Select so its values stay consistent and filterable, and keep the full-URL field a Textarea — URLs with tracking parameters routinely exceed the 255-character varchar limit.

Webhooks​

If the form has a webhook URL configured in its settings, TrueBeep POSTs the complete response — including every field's key, label, type, and value — to that URL after a successful submission. When a webhook secret is set it is sent as Authorization: Bearer <secret>.

The webhook target always comes from the form's own settings and can never be supplied in the request body. Delivery is fire-and-forget with a 10-second timeout: a failing webhook is logged but does not fail the submission.

Errors​

codeStatusMeaning
FORM_NOT_FOUND404No form with that id on your team
RESPONSE_NOT_FOUND404No such response on that form
FORM_NAME_TAKEN409Another form on your team already uses that name
FIELDS_WOULD_BE_REMOVED409An update omitted existing fields; confirm with removeMissingFields
NO_FORM_OWNER422The team has no existing form to inherit an owner from — create one in the dashboard first
FORM_HAS_NO_FIELDS422The form exists but has no fields yet — finish it in the builder
MISSING_REQUIRED_FIELDS400One or more required fields were absent. The offending keys are in fields
INVALID_FIELD_VALUES400A value did not match its field's type, options, or length. Per-field messages are in fields
AUTH_HEADER_MISSING401No Authorization header
INVALID_CLIENT401The key does not resolve to a team
API_KEY_EXPIRED401Generate a new key in team settings
{
"success": false,
"code": "MISSING_REQUIRED_FIELDS",
"message": "Missing required field(s): first_name, email_address",
"fields": ["first_name", "email_address"]
}

Workflows API​

The Workflows API lets you build and run workflows from your own code: create one from a graph or a plain-language description, rename it, change its steps, publish it, pause and resume it, and read its runs. It applies the same rules as the workflow editor, so a workflow you create over the API opens in the editor exactly as you sent it, and one that wouldn't publish in the editor won't publish here either.

Same base URL and secret key as the rest of the API:

Authorization: Bearer <token>

Requests are scoped to the team that owns the key. Another team's workflow behaves exactly like one that doesn't exist (404).

How it works​

1

Look up your ids

GET /workflows/resources returns the email and message templates, forms, tags, segments, custom fields and sending domains a workflow can use.

2

Create a draft

POST /workflows with a graph of triggers and steps, or POST /workflows/generate with a description and let AI build it. Either way the result is a draft: nothing runs yet.

3

Publish

POST /workflows/:workflowId/publish. If a step is incomplete you get every problem back at once, so you can fix them in one pass.

4

Watch the runs

GET /workflows/:workflowId/executions lists each run and whether it completed or failed.

Workflow lifecycle​

StatusMeaningGet here with
draftSaved, not runningPOST /workflows, POST /:id/unpublish
activePublished: its trigger starts runsPOST /:id/publish, POST /:id/resume
pausedPublished, but no new runs startPOST /:id/pause
archivedGone from the list; no longer returned by the APIPOST /:id/archive

Every save creates a new version. Publishing makes the latest version live. Editing a live workflow saves a new draft version and the live one keeps running until you publish again. hasUnpublishedChanges tells you when that's the case. Pause and resume keep the version that's live; unpublish takes it down entirely. Runs already in progress always finish on the version they started with.

The graph​

A workflow is a graph of nodes (one trigger, then steps) joined by edges.

{
"nodes": [
{ "id": "start", "kind": "trigger.event", "config": { "eventName": "subscriber.opted_in" } },
{ "id": "welcome", "kind": "action.email", "label": "Welcome email",
"config": { "to": "{{trigger.email}}", "contentId": "<emailTemplateId>" } },
{ "id": "wait", "kind": "flow.delay", "config": { "durationMs": 172800000 } },
{ "id": "tips", "kind": "action.sms", "config": { "contentId": "<messagingTemplateId>" } }
],
"edges": [
{ "source": "start", "target": "welcome" },
{ "source": "welcome", "target": "wait" },
{ "source": "wait", "target": "tips" }
]
}
  • id: any string unique in the graph. On create the ids are replaced with generated ones (read them back from the response). On update they're kept, so you can refer to the same step across edits.
  • position ({ x, y }) is optional. Steps without one are laid out automatically; on update, existing steps keep their place in the editor.
  • edges: source → target. After a flow.condition step, set branch to "true" or "false"; everywhere else leave it out.
  • label (optional): the name shown on the step in the editor.
Triggers (exactly one per workflow):
kindconfig
trigger.eventeventName: subscriber.created, subscriber.opted_in, form.submitted, interaction.created, campaign.completed, campaign.failed. Optional formId (with form.submitted) and interactionType (with interaction.created: message, booking, purchase, order, …)
trigger.webhookLeave config empty. An endpoint is created for you; its url and signing secret are in the response's webhooks
trigger.croncronExpr (e.g. 0 9 * * 1), timezone (default UTC)
trigger.datefield (joined_at or custom:<key> of a date custom field), offsetDays (−365 to 365), recurrence (yearly/once), time (HH:MM), timezone
Steps:
kindconfig
action.emailcontentId (email template), to (e.g. {{trigger.email}}), fromEmail (an address on a verified sending domain; if you leave it out, noreply@ your first verified domain is used)
action.smscontentId (message template). to is optional: blank sends to the run's customer
action.whatsappcontentId. to is optional, as for SMS
action.messengerplatform (facebook/instagram), contentId. psid is optional: blank uses the customer's own id
action.tagop (add/remove), tagIds
action.update_fieldfield (custom field key), op (set/increment/today/clear), value
action.webhookurl, method, headers, body (an API call to your own system)
flow.delaydurationMs, up to 90 days
flow.conditionexpr: { "all": [ { "field": "trigger.email", "op": "exists" } ] }. Ops: eq, neq, in, nin, gt, gte, lt, lte, contains, not_contains, exists, in_segment, not_in_segment

Values such as to and message bodies can use personal values like {{trigger.email}}. The webhook and schedule triggers have no customer, so SMS, WhatsApp and Messenger steps after them need an explicit to/psid.

info

Ids must belong to your team. A contentId, formId, tagIds or segment that belongs to another team is rejected on update (INVALID_REFERENCE). On create it's removed instead, and removedReferences counts how many were removed, so check it. Get valid ids from GET /workflows/resources.

GET/workflows/resources

Get Workflow Resources​

Everything a graph can reference: emailTemplates, messagingTemplates, forms, tags, segments, customFields, dateFields and sendingDomains.

POST/workflows

Create a Workflow​

Creates a draft. Send a graph to add its steps now, or leave it out and add them later with PATCH.

Example Responses:
{
"success": true,
"data": {
"id": "d2kq8v0yq3n1x7f5m4t6p9wa",
"name": "Welcome series",
"description": "Welcome email, then a tips SMS two days later",
"status": "draft",
"publishedVersionId": null,
"latestVersion": { "id": "k1y7z0c3v8b2n5m4x6q9w1er", "number": 1 },
"hasUnpublishedChanges": false,
"graph": { "version": 1, "nodes": ["…"], "edges": ["…"] },
"webhooks": [],
"removedReferences": 0,
"createdAt": "2026-10-19T08:00:00.000Z",
"updatedAt": "2026-10-19T08:00:00.000Z"
}
}
Body Parameters:
FieldTypeDescription
name(Required)
string1–255 characters
description(Optional)
stringUp to 2000 characters
graph(Optional)
object{ nodes, edges }; see The graph
POST/workflows/generate

Generate a Workflow with AI​

Describe the automation in plain language and get back a draft, built with your team's templates, forms and tags. Review it (or open it in the editor) before you publish. Generation can take up to a minute.

FieldTypeDescription
prompt(Required)
string5–2000 characters
GET/workflows

List Workflows​

Query: status (draft, active, paused), search (matches the name), page (default 1), size (default 20, max 100). Each item has id, name, description, status, publishedVersionId, executionCount, createdAt and updatedAt, plus pagination: { page, size, total }.

GET/workflows/:workflowId

Get a Workflow​

Returns the workflow with its latest graph and its webhooks. Each webhook has its url and secret. A POST to the URL starts a run with the JSON body as trigger data, and must carry the header x-workflow-signature: sha256=<hex>, where <hex> is the HMAC-SHA256 of the raw request body keyed with the secret. Unsigned or wrongly signed calls get 401.

PATCH/workflows/:workflowId

Update a Workflow​

Renames it, changes the description, and/or saves a new version of its steps. Send only what you want to change.

FieldTypeDescription
name(Optional)
string1–255 characters
description(Optional)
string
graph(Optional)
objectThe complete graph. Saved as a new draft version; publish to make it live
warning

graph replaces the whole graph: any step you leave out is removed in the new version. GET the workflow first, change what you need, and send the full graph back. Keep the webhook trigger's webhookId if it has one, otherwise you get a new endpoint URL.

POST/workflows/:workflowId/publish

Publish a Workflow​

Makes the latest version live. Its trigger starts runs immediately.

If a step is incomplete, nothing is published and you get every problem at once:

{
"success": false,
"code": "NOT_READY_TO_PUBLISH",
"message": "Fix these before publishing",
"problems": [
"Node #2 (Welcome email) · content id: Pick an email template.",
"Node #2 (Welcome email) · from email: Pick a verified sending domain."
]
}
POST/workflows/:workflowId/pause

Pause, Resume and Unpublish​

  • POST /workflows/:workflowId/pause: stops new runs. Only a published (active) workflow can be paused.
  • POST /workflows/:workflowId/resume: turns a paused workflow back on, with the version that was live. Saved edits that were never published stay unpublished; use publish for those.
  • POST /workflows/:workflowId/unpublish: back to draft. Its steps are kept, and you can publish again any time.

All three return the updated workflow, or 409 when the workflow isn't in a state the action applies to.

POST/workflows/:workflowId/archive

Archive a Workflow​

Stops its trigger and removes it from your workflow list. Runs already in progress finish, and its run history is kept. There's no API call to restore an archived workflow.

GET/workflows/:workflowId/executions

List Workflow Runs​

The most recent runs first, with status (pending, running, completed, failed, cancelled; a run waiting on a delay step is running), startedAt, finishedAt, error and the versionId the run used. Query: page, size.

Workflow errors​

StatuscodeWhen
404WORKFLOW_NOT_FOUNDNo such workflow on your team, or it's archived
409NOT_LIVE, NOT_PAUSED, ALREADY_DRAFTPause, resume or unpublish doesn't apply to the current status
422INVALID_NAME, NOTHING_TO_UPDATE, INVALID_PROMPTA body field is missing or out of range
422INVALID_GRAPHThe graph doesn't match the format; issues lists each problem with its path
422INVALID_REFERENCEThe graph uses an id your team doesn't own
422NOT_READY_TO_PUBLISH, NO_STEPSPublishing needs every step complete; problems lists them
422GENERATION_FAILEDAI couldn't build a valid workflow; try rephrasing

Content API​

The Content API creates the content a campaign sends: social posts, messages (SMS, WhatsApp, Messenger, Instagram direct messages) and emails. Every item is saved as a draft in your Content, Messaging or Email library, built by the same content builder as the dashboard, so it opens in the editor exactly as you sent it.

Same base URL and secret key as the rest of the API. Requests are scoped to the team that owns the key; another team's content behaves exactly like content that doesn't exist (404).

How it works​

1

Write the content

POST /contents with the text, optional per-channel text, and optional images or a video. Emails take a plain-text/Markdown body or a full HTML template.

2

Check the response

warnings lists channel problems (text too long, a platform not connected, a file a platform rejects). needsMedia lists channels that still need an image or video. editUrl opens the item in TrueBeep.

3

Use it in a campaign

Pass the content id to POST /campaigns. See the Campaigns API below.

Content types and channels​

typeChannelsNotes
content (social)facebook, facebookStories, facebookReels, instagram, instagramStories, instagramReels, twitter, linkedin, tikTok, youtubeShortsOne shared text, optional per-channel text. Stories, Reels, TikTok and Shorts need media
messagingsms, whatsapp, messenger, instagramMessageSMS is text only. One image can be sent as the WhatsApp header
email—email.body (plain text or Markdown) or email.html (a full HTML template)

A channel is created turned off when it can't be used as sent: its platform isn't connected, it needs media you didn't send, or a file breaks that platform's rules. The reason is in warnings, and the item still saves.

Media​

Send images or one video in media. Every file is downloaded into your team's Media Cloud, checked, and attached the same way a dashboard upload is.

ImagesVideo
FormatsJPG, PNG, WebPMP4
By URL ({ "url": "https://…" })Up to 8 MBUp to 1 GB
As base64 ({ "base64": "…" })Up to 5 MBNot accepted
Per itemUp to 10 imagesOne video, not mixed with images
  • The file type is read from the file itself, not its name or extension.
  • URLs must be public https addresses. Links to private or internal addresses are refused.
  • Files count toward your Media Cloud storage. If an upload would go over your plan's limit, nothing is uploaded and you get 422 STORAGE_LIMIT_REACHED.
  • Each platform's own rules (for example video length for Reels or TikTok) are checked. A file that breaks one platform's rules is still saved and used on the channels it fits; the channel it doesn't fit is turned off with the reason in warnings.
  • On PATCH, media replaces the item's media. Leave it out to keep the current media.

HTML email templates​

Send a complete HTML email in email.html (up to 500 KB) instead of email.body. It's saved like Emails → Upload HTML in the dashboard and opens in the HTML code editor.

For safety the HTML is cleaned before it's saved: scripts, embedded frames, event handlers (such as onclick) and javascript: links are removed. Inline styles, <style> blocks, tables and images linked by https URL are kept.

POST/contents

Create Content​

Example Responses:
{
"success": true,
"data": {
"id": "ba6wmleti05wjybgh3e7clav",
"name": "Weekend sale",
"type": "content",
"status": "draft",
"editUrl": "https://app.truebeep.com/content-builder/ba6wmleti05wjybgh3e7clav",
"text": "Weekend sale: 20% off everything, Saturday and Sunday only.",
"channels": [
{ "id": "facebook", "title": "Facebook", "enabled": true, "text": "Weekend sale: 20% off…", "errors": [] },
{ "id": "twitter", "title": "X (Twitter)", "enabled": true, "text": "Weekend sale: 20% off, Sat–Sun only.", "errors": [] }
],
"media": [
{ "fileId": "q1w2e3r4t5y6u7i8o9p0a1s2", "url": "https://…", "type": "image", "mimeType": "image/jpeg", "sizeBytes": 182044, "width": 1080, "height": 1350 }
],
"needsMedia": ["facebookReels", "instagramReels", "youtubeShorts"],
"warnings": [],
"mediaHint": "Add or change media with `media`, or in TrueBeep at https://app.truebeep.com/content-builder/ba6wmleti05wjybgh3e7clav."
}
}
Body Parameters:
FieldTypeDescription
type(Required)
stringcontent, messaging or email
name(Required)
stringLibrary name, 1–255 characters
text(Optional)
stringShared text for every channel (social and messaging)
channels(Optional)
objectPer channel: { "<channelId>": { "text": "…", "enabled": true } }
media(Optional)
array[{ "url": "…" }] or [{ "base64": "…", "fileName": "…" }]; see Media
email(Optional)
objectbody or html, plus optional suggestedSubject, suggestedPreviewText. Required for email
More examples:

A text message:

An email from text or Markdown (paragraphs, **bold**, *italic*, links and lists):

An email from your own HTML template:

suggestedSubject and suggestedPreviewText become the default subject and preview text of an email campaign that uses this content.

GET/contents

List Content​

Query: type (content, messaging, email), search (matches the name), page (default 1), size (default 20, max 100). Each item has id, name, type, status, updatedAt, the enabled channels and editUrl, plus pagination: { page, size, total }.

GET/contents/:contentId

Get Content​

Returns the same shape as create. For emails, email.mode is html (an HTML template) or builder (designed in the email editor), with the html (first 100,000 characters), htmlLength and htmlTruncated.

PATCH/contents/:contentId

Update Content​

Changes the name, the shared text, one channel's text or on/off, the media, or the email. Send only what you want to change.

  • Changing text keeps media someone already added in TrueBeep.
  • An email designed in the email editor can't be replaced with email.body or email.html here (409); change it in the editor.
POST/contents/:contentId/duplicate

Duplicate Content​

DELETE/contents/:contentId

Delete Content​

Refused with 409 CONTENT_IN_USE while a scheduled or running campaign uses it.

Content errors​

StatuscodeWhen
400INVALID_MEDIAA file isn't a supported type, is corrupt, is a base64 video, mixes images and video, or the URL isn't public https. item and reason say which one and why
400UNSUPPORTED_TYPEads content isn't available through the API
404CONTENT_NOT_FOUNDNo such content on your team
409EMAIL_MODE_MISMATCH, EDITED_IN_EDITORThe email was designed in the email editor; change it there
409CONTENT_IN_USEA scheduled or running campaign uses this content
413MEDIA_TOO_LARGE, HTML_TOO_LARGEA file or the HTML is over its size limit
422INVALID_CONTENT, NOTHING_TO_UPDATE, UNKNOWN_CHANNELA body field is missing, unknown or out of range
422MEDIA_FETCH_FAILEDA media URL couldn't be downloaded (not found, timed out)
422STORAGE_LIMIT_REACHEDThe upload would go over your Media Cloud storage limit; usedBytes, limitBytes, incomingBytes
502MEDIA_UPLOAD_FAILEDThe file couldn't be saved; try again

Campaigns API​

The Campaigns API creates draft campaigns from your content, previews them, and schedules them. It checks everything the dashboard's Start button checks (audience, sender, balance), so a campaign that wouldn't start in the dashboard won't schedule here either. There's no "send now": a scheduled campaign goes to review and is sent by TrueBeep.

Same base URL and secret key as the rest of the API. Another team's campaign behaves exactly like one that doesn't exist (404).

How it works​

1

Create the content

POST /contents (see the Content API above) and keep its id.

2

Create a draft campaign

POST /campaigns with the content id and an audience: a segment from GET /campaigns/segments, or tags.

3

Preview

POST /campaigns/:campaignId/preview shows the audience size, channels, send time, estimated cost and anything still missing.

4

Schedule

POST /campaigns/:campaignId/schedule with confirm: true. Without confirm you get the preview back and nothing changes.

Campaign types​

typeContentChannels
content (social)A content item, in contentIdPosts to the channels enabled in the content
messagingA messaging item, in contentIdchannels: sms, whatsapp, messenger, instagram-messenger
emailAn email item, in emailContentIdEmail. Needs emailConfig with senderName, a senderEmail on one of your verified sending domains, and a subject
GET/campaigns/segments

List Segments​

Returns { "segments": [{ "id", "name" }] }: the segments a campaign can target.

POST/campaigns

Create a Campaign​

Creates a draft. Nothing is sent.

Example Responses:
{
"success": true,
"data": {
"id": "fk0dnmrj6oue8b3vdfpjglbg",
"name": "VIP early access",
"type": "messaging",
"status": "draft",
"isReady": false,
"sendAt": "2026-11-07T04:00:00.000Z",
"contentId": "o604qskfmpk7m2pc3t3a2o97",
"emailContentId": null,
"segmentId": "s3gm3nt1d0000000000000001",
"channels": ["sms"],
"audience": { "total": 412, "channels": { "sms": 398 } },
"ready": true,
"missing": [],
"overviewUrl": "https://app.truebeep.com/dashboard/campaigns/fk0dnmrj6oue8b3vdfpjglbg"
}
}
Body Parameters:
FieldTypeDescription
name(Required)
string3–40 characters
type(Required)
stringcontent, messaging or email
contentId(Optional)
stringSocial or messaging content (required for those types)
emailContentId(Optional)
stringEmail content (required for email)
segmentId(Optional)
stringFrom GET /campaigns/segments
tags(Optional)
string[]Target customers with these tags
channels(Optional)
string[]Messaging campaigns only
sendAt(Optional)
stringPlanned send time, ISO 8601 with a UTC offset (e.g. 2026-11-07T10:00:00+06:00)
emailConfig(Optional)
objectsenderName, senderEmail, subject, previewText (email campaigns)
GET/campaigns

List Campaigns​

Query: status (draft, under-review, processing, stopped, completed, cancelled, archived), type, search, page, size (max 100).

GET/campaigns/:campaignId

Get a Campaign​

The campaign with its audience (total and per channel), ready, and missing: everything still needed before it can be scheduled.

PATCH/campaigns/:campaignId

Update a Campaign​

Changes a draft: name, content, audience, channels, send time or email settings. Send only what you want to change. Campaigns that are scheduled or running can't be changed (409 NOT_DRAFT).

POST/campaigns/:campaignId/preview

Preview a Campaign​

What scheduling would do, without changing anything: audienceSize, channels, sendAt, estimatedCost (with costBreakdown; social campaigns have no cost), ready and missing.

POST/campaigns/:campaignId/schedule

Schedule a Campaign​

With confirm: true the campaign is scheduled for sendAt (or the time already set on it) and moves to review. Without it you get { "scheduled": false, "preview": { … } } and nothing changes, which is useful for showing someone what will happen first.

Scheduling is refused when:

  • the campaign isn't a draft (409 NOT_DRAFT)
  • something is missing, such as an empty audience, a send time in the past, or an email sender or subject (422 CAMPAIGN_NOT_READY, with missing)
  • the estimated cost isn't covered by your balance (402 INSUFFICIENT_BALANCE)
POST/campaigns/:campaignId/cancel

Cancel a Campaign​

Takes a scheduled campaign back to draft, or stops one that is sending. A social campaign can only be cancelled while it's in review.

GET/campaigns/:campaignId/results

Get Campaign Results​

Delivery counts by channel and status (analytics), and post insights for social campaigns (insights), as the campaign's Analytics tab shows them.

Campaign errors​

StatuscodeWhen
400UNSUPPORTED_TYPEAds and push campaigns aren't available through the API
402INSUFFICIENT_BALANCEThe estimated cost isn't covered by your balance
404CAMPAIGN_NOT_FOUNDNo such campaign on your team
409NOT_DRAFTOnly a draft can be changed or scheduled
409NOT_SCHEDULED, CANNOT_CANCELThe campaign isn't in a state that can be cancelled
422INVALID_CAMPAIGN, NOTHING_TO_UPDATE, UNKNOWN_CHANNELA body field is missing, unknown or out of range; issues lists them
422CONTENT_NOT_FOUND, CONTENT_TYPE_MISMATCH, SEGMENT_NOT_FOUND, TAG_NOT_FOUNDA referenced id isn't on your team, or the content type doesn't match the campaign
422SENDER_NOT_VERIFIEDsenderEmail isn't on one of your verified sending domains
422CAMPAIGN_NOT_READYScheduling needs everything in missing fixed first
503COST_UNAVAILABLE, DOMAINS_UNAVAILABLEA check couldn't run; try again

Analytics API​

The Analytics API exposes the social analytics behind your TrueBeep dashboard — post-level metrics and page/profile-level insights — for every connected platform: Facebook, Instagram, X (Twitter), LinkedIn, TikTok, and YouTube.

All endpoints are protected by ApiClientMiddleware and require the same secret key as the rest of the API. Use https://api.truebeep.com/v1 as the base URL, and pass your key as a bearer token:

Authorization: Bearer <token>

Requests are automatically scoped to the team that owns the API key — you only ever see your own team's analytics.

Response shape: normalized + raw​

Every metrics payload carries two views so you never have to relearn each platform's vocabulary, yet never lose detail:

  • metrics / kpis — a normalized common set (impressions, reach, engagement, likes, comments, shares, clicks, videoViews, engagementRate). A metric that a platform does not report is null (distinct from a measured 0).
  • rawMetrics / rawKpis — the platform's original keys, untouched (e.g. Facebook's post_video_views_15s, LinkedIn's uniqueImpressionsCount).
info

null means "this platform does not provide this metric" or "not yet ingested" — it is not the same as 0. Data is only as fresh as the last analytics refresh; page/profile responses include lastRefreshedAt so you can surface staleness.

GET/analytics/social/{platform}/posts

List Post Analytics​

Returns paginated post-level analytics for a single platform. Post sub-types (feed post, reel, story) are mixed together by default and can be narrowed with postType.

Example Responses:
{
"success": true,
"data": [
{
"id": "e8c43l37t1zayx8t66t5xbg9",
"postId": "1224...901",
"platform": "facebook",
"postType": "post",
"campaignId": null,
"content": "Summer sale is live!",
"permalinkUrl": "https://facebook.com/...",
"publishedAt": "2026-06-10T12:00:00.000Z",
"metrics": {
"impressions": 1200,
"reach": 900,
"engagement": 84,
"likes": 40,
"comments": 8,
"shares": 6,
"clicks": 30,
"videoViews": 210,
"engagementRate": 0.07
},
"rawMetrics": {
"post_impressions": 1200,
"post_impressions_unique": 900,
"post_video_views_15s": 150
}
}
],
"pagination": { "page": 1, "limit": 20, "total": 137 }
}
Path Parameters:
FieldTypeDescription
platform(Required)
stringfacebook, instagram, twitter, linkedin, tiktok, or youtube
Query Parameters:
FieldTypeDescription
postType(Optional)
stringpost, reel, or story. Omit for all. A no-op on platforms without sub-types (e.g. Twitter)
startDate(Optional)
stringISO date; filters publishedAt >=
endDate(Optional)
stringISO date; filters publishedAt <=
campaignId(Optional)
stringFilter to a single campaign
search(Optional)
stringCase-insensitive match on post content
page(Optional)
numberDefault 1
limit(Optional)
numberDefault 20, max 100
order(Optional)
stringasc or desc by publishedAt. Default desc
info

startDate / endDate accept full ISO timestamps (2026-06-30T23:59:59Z) or plain dates (2026-06-30).

GET/analytics/social/{platform}/posts/:id

Get a Single Post​

Returns the analytics for one post. Responds 404 if the post is not in your team or does not belong to {platform}. The data object has the same shape as a list element above.

{
"success": true,
"data": {
"id": "e8c43l37t1zayx8t66t5xbg9",
"postId": "1224...901",
"platform": "facebook",
"postType": "post",
"metrics": { "impressions": 1200, "engagement": 84, "engagementRate": 0.07 },
"rawMetrics": { "post_impressions": 1200 }
}
}
GET/analytics/social/{platform}/profile

Profile / Page Analytics​

Returns page/profile-level insights for a platform — headline KPIs, a time-series for the selected window, and period-over-period percentage change.

Example Responses:
{
"success": true,
"data": {
"platform": "instagram",
"status": "ready",
"connected": true,
"lastRefreshedAt": "2026-07-13T04:00:00.000Z",
"window": "30d",
"kpis": {
"followers": 5400,
"impressions": 88000,
"reach": 61000,
"engagement": 4300
},
"rawKpis": { "Followers": 5400, "Reach": 61000 },
"timeSeries": { "impressions": [], "reach": [] },
"percentageChange": { "impressions": 0.12, "reach": -0.03 }
}
}
Query Parameters:
FieldTypeDescription
window(Optional)
string7d, 30d, 90d, or 12m. Default 30d
info

Profile metrics are stored as pre-aggregated windows (7d / 30d / 90d / 12m), so — unlike posts — they do not accept arbitrary date ranges. Pick the closest window.

GET/analytics/social/summary

Cross-Platform Summary​

Returns one entry per platform (including ones you have not connected), ideal for a dashboard landing view in a single call.

Example Responses:
{
"success": true,
"data": {
"window": "30d",
"platforms": [
{
"platform": "facebook",
"status": "ready",
"connected": true,
"lastRefreshedAt": "2026-07-13T04:00:00.000Z",
"kpis": { "followers": 12000, "impressions": 240000, "reach": 180000, "engagement": 9100 },
"postCount": 42
},
{
"platform": "tiktok",
"status": "not_connected",
"connected": false,
"lastRefreshedAt": null,
"kpis": null,
"postCount": 0
}
]
}
}
Query Parameters:
FieldTypeDescription
window(Optional)
string7d, 30d, 90d, or 12m. Default 30d
platforms(Optional)
stringComma-separated filter, e.g. facebook,instagram. Omit for all

Connection status​

Because "not connected" is a normal state, profile and summary responses carry an explicit status instead of erroring:

statusconnectedMeaning
not_connectedfalseThe platform is supported but your team hasn't connected it
pendingtrueConnected, but analytics haven't been ingested yet
unavailabletrueConnected, but analytics aren't available (e.g. a LinkedIn personal profile)
readytrueConnected and data is present
info

An unsupported platform in the path (e.g. /analytics/social/myspace/posts) returns 404 PLATFORM_NOT_SUPPORTED. A supported-but-not-connected platform returns 200 with status: "not_connected".

Metric availability by platform​

Not every platform reports every metric — unavailable ones are null in metrics. Notable differences:

PlatformNotes
FacebookFull post + page metrics; reach is unique impressions
Instagramreach, total_interactions (→ engagement), saves in raw
Twitter/XUses public_metrics; reach/clicks not reported
LinkedInMetrics nested per post; engagementRate is a stored ratio; personal profiles have none
TikTokview_count drives impressions/reach/videoViews; no clicks
YouTubeViews drive impressions; channel KPIs come from account metadata