API
Integration API
Prepare forms, register approved domains, and verify submissions with a scoped integration key.
Authentication and business selection
Base URL: https://api.inflow.build/api/agent-integration. Use HTTPS and Authorization: Bearer ik_…. Every endpoint except business discovery requires X-Business-Id. JSON writes also require Content-Type: application/json. The body limit is 1 MiB. Credentials and API responses must not be cached. Start with Website integration to create a key.
| Grant | Access |
|---|---|
| none | No form access; use independently granted CRM or domain capabilities. |
| created | Create unpublished forms; read and edit only forms created by this exact key. A replacement key does not inherit those forms. |
| selected | Read and edit the specified existing forms. Cannot create forms. |
| all | Create drafts and read or edit all forms in the selected business. |
| crm | Separate leads, clients, projects, and pipeline view/edit grants; see CRM integration API. |
| domains | Register only hosts explicitly approved at issuance, with current settings edit permission. |
| readLeads: false | Read one exact submission with its continuation token and current leads view permission. |
| readLeads: true | Read exact submissions and paginated leads within permitted forms, with current leads view permission. |
Changes that wait for the person
Deleting one record or one form and sending a message always wait for the person who made the key. So do pipeline changes and any change after 25 in an hour, unless the person turned those off for the key. Form changes are mostly free: creating a form, publishing it, and editing labels, help text, placeholders, field order, styling, the confirmation message, new fields and choice options all run straight away and appear in the key's activity with undo. A form edit waits when it removes a field, or changes a field's type or id, and that field already has submissions (the same change on a field with no submissions runs at once), or when it changes where answers go (a field's mapping or the leadRecordType). One edit that mixes safe and risky changes waits as a whole, and the approval says which part was risky, for example: Removes the Phone field, which has 14 answers. DELETE /api/agent-integration/forms/:id deletes one form and always waits for the person: send X-Agent-Reason, expect 202 waiting_for_approval, and on approval the form goes to Trash, where the person can restore it (or undo it from key activity). Deleting many forms at once is never possible. The form document has no settings for notification recipients, webhooks, spreadsheet links or spam protection, so a key can't change those. Read GET /forms/:id/status for submission counts before you remove or retype a field. Send your reason in the X-Agent-Reason header (or a reason field in the body); the person sees it next to the request. A missing reason gets 400 reason_required. The server answers 202 with an approval ID. Tell the person what you asked for, then check the approval until its status is approved, denied, expired or failed. On approved, result.entityId names what changed. Don't retry the change another way. Asking again with the same request returns the same approval.
{
"success": true,
"status": "waiting_for_approval",
"approvalId": "6718f0c2a1b2c3d4e5f6a7b8",
"check": "GET /api/agent-integration/approvals/6718f0c2a1b2c3d4e5f6a7b8",
"expiresAt": "2026-10-24T10:40:00.000Z"
}Never possible with a key, whatever it grants: deleting many records or forms at once, deleting a business, billing, team and key management. These return 403 blocked_for_keys. A key also stops after 200 changes in an hour (429 write_limit). Every request is logged for the person, who can undo any change from the dashboard.
GET /approvals/:id
No business header is needed. Returns {success, approval: {id, op, status, summary, result, expiresAt, decidedAt}}. Requests expire after 24 hours.
GET /businesses
Discover the businesses explicitly granted to this key and still accessible to its issuer. No business header is needed. Map each website to the correct returned business before making changes.
source .inflow.env
curl -sS "$INFLOW_API_BASE/api/agent-integration/businesses" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY"{
"success": true,
"businesses": [{
"businessId": "67a1b2c3d4e5f6a7b8c9d0e1",
"name": "Coding portfolio",
"slug": "coding-portfolio",
"publicKey": "pk_example",
"forms": "created",
"formIds": [],
"approvedDomains": ["portfolio.example.com", "localhost:3000"],
"readLeads": false
}],
"expiresAt": null,
"renewableUntil": null,
"idleDays": 90,
"rotate": false,
"instructions": "Choose the correct business and send X-Business-Id on every subsequent request. …"
}By default a key has no fixed expiry (expiresAt: null) and stops after idleDays without use. The person can also pick 30 or 90 days, turn on rotation, or keep the older 24-hour renewing key.
POST /keys/renew
Only for keys with rotate: true or a renewableUntil date; other keys get 403 and simply keep working. Swap the current key for a new one before expiresAt. No business header is needed. The new key has the same grants and window, and never outlives renewableUntil when one is set. Success is 201 with {success, key, secret}. Save the new secret before doing anything else: the old one stops working at once, and sending it again revokes every key in its chain. After renewableUntil, create a new key in the dashboard. Two renewals of the same key cannot both succeed; the second gets 409.
curl -sS -X POST "$INFLOW_API_BASE/api/agent-integration/keys/renew" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY"GET /catalog
Fetch the canonical portable-form JSON Schema before constructing a definition. The response includes schema, business, scope, endpoints, and rules: valid field variants, composite field types, stable ID rules, renderer limitations, and an example. Validate against the live catalog; do not guess supported fields from another form provider.
export INFLOW_BUSINESS_ID="67a1b2c3d4e5f6a7b8c9d0e1"
curl -sS "$INFLOW_API_BASE/api/agent-integration/catalog" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY" \
-H "X-Business-Id: $INFLOW_BUSINESS_ID"POST /validate-definition
Send a portable document: {"format":"inflow-form","version":1,"definition":{…}}. This endpoint writes nothing. A 200 response means validation ran; inspect valid and issues before saving. When valid, document contains the normalized portable document. Preserve unique step, option, nested field, and hidden-field IDs when editing.
curl -sS -X POST "$INFLOW_API_BASE/api/agent-integration/validate-definition" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY" \
-H "X-Business-Id: $INFLOW_BUSINESS_ID" \
-H "Content-Type: application/json" \
--data-binary @form.jsonGET /forms and GET /forms/:id
List returns {success, forms, nextCursor} restricted to the grant, ordered by descending form ID. Use limit from 1 to 50 (default 20), then pass a non-null nextCursor as before to fetch the next page. Entries include formId, name, description, revision, published, updatedAt, and editorUrl. Reading one form returns its effective draft definition and revision, even if an older version is already published.
POST /forms
Send the same validated portable document from form.json. Only created and all-form grants may create. Success is 201 and the new form is unpublished. Open editorUrl for human review. Do not automatically retry a timed-out creation: the server may already have saved it. Check the permitted form list first.
curl -sS -X POST "$INFLOW_API_BASE/api/agent-integration/forms" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY" \
-H "X-Business-Id: $INFLOW_BUSINESS_ID" \
-H "Content-Type: application/json" \
--data-binary @form.json{
"success": true,
"formId": "67a1b2c3d4e5f6a7b8c9d0e2",
"revision": 0,
"published": false,
"definition": { "name": "Contact", "steps": [] },
"editorUrl": "https://inflow.build/b/coding-portfolio/forms/67a1b2c3d4e5f6a7b8c9d0e2/edit",
"publicKey": "pk_example",
"statusUrl": "https://api.inflow.build/api/agent-integration/forms/67a1b2c3d4e5f6a7b8c9d0e2/status"
}PUT /forms/:id
GET the latest definition and revision, then send the portable document plus top-level expectedRevision. This replaces the draft definition; it is not a partial patch. Success uses the same response envelope as creation. On 409, read the form again and reapply your changes to the latest definition rather than overwriting another editor's work.
{
"format": "inflow-form",
"version": 1,
"expectedRevision": 3,
"definition": { "name": "Contact", "steps": [] }
}{
"success": false,
"message": "Form changed since this revision",
"currentRevision": 4
}POST /environments
Send name (1–100 characters) and domains (1–30 hosts). Every normalized host must have been approved at key issuance, and the issuer must still have settings edit permission. New environments return 201 with {success, environment}; a fully registered request returns 200 with alreadyRegistered: true. Partial overlap returns 409: register remaining domains separately. Existing environments are not modified.
{
"name": "Portfolio website",
"domains": ["portfolio.example.com", "localhost:3000"]
}GET /forms/:id/status
Pass ?origin=https%3A%2F%2Fportfolio.example.com to check the real website origin. The response includes published, hasUnpublishedChanges, revision, origins with registered and legacy hosts plus the requested check, submissions with total/last24h/lastAt, and editorUrl. The publication diagnostic checks whether the effective definition passes publishing validation and reports actionable issues; publishing still requires dashboard review. The separate renderer.widgetReady and renderer.issues describe Toolkit compatibility: top-level file uploads, address/ranking composites, and calendar fields inside composites need a native form or custom renderer. Top-level calendars use effective business availability or documented defaults, exposed in renderer.booking. Check /catalog → rules.rendererCapabilities before choosing an embed. A successful status request is not proof that a lead's fields are mapped correctly.
GET /forms/:id/submissions/:leadId
First submit from the published website using its pk_ key and submissionVersion: 2; see Submissions API. Retain leadId and continuationToken locally. Send the latter as X-Inflow-Continuation-Token alongside the integration key and business header. Proof expires after 24 hours; key expiry and current permissions also apply. The token is unnecessary only when this grant explicitly permits reading other leads.
curl -sS "$INFLOW_API_BASE/api/agent-integration/forms/$INFLOW_FORM_ID/submissions/$INFLOW_LEAD_ID" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY" \
-H "X-Business-Id: $INFLOW_BUSINESS_ID" \
-H "X-Inflow-Continuation-Token: $INFLOW_CONTINUATION_TOKEN"Response: {success: true, lead: {…}}. The lead projection includes _id, formId, contact, responses, fields, notes, hiddenFields, selectedPhotos, source, captureStatus, and createdAt where present. It excludes continuation credentials. Compare saved values against your synthetic input; a changed submission count is insufficient.
GET /forms/:id/submissions
Requires explicit readLeads: true and current leads view permission. Use limit from 1 to 50 (default 20). Results sort by descending lead ID. Response: {success, leads, nextCursor}. When nextCursor is non-null, pass it as before on the next request with the same business, form, and limit. A null cursor means no more results at that time.
curl -sS "$INFLOW_API_BASE/api/agent-integration/forms/$INFLOW_FORM_ID/submissions?limit=20" \
-H "Authorization: Bearer $INFLOW_INTEGRATION_KEY" \
-H "X-Business-Id: $INFLOW_BUSINESS_ID"Rate limits and retries
| Budget | Limit |
|---|---|
| Integration requests per IP | 60 / minute |
| Authenticated requests per integration key | 120 / minute |
| Authenticated requests across an issuer's keys | 240 / minute |
| Dashboard key management per issuer | 60 / minute |
| Key creation per issuer | 10 / hour |
All applicable budgets are enforced; an earlier IP limit can be reached before the key budget. Production counters are shared across server instances and use fixed windows, which can permit a burst at a window boundary. Other global or public-endpoint limits may also apply. On 429, honor Retry-After in seconds and use bounded retries with jitter. On 503, back off. Automatically retry reads; reconcile potentially completed writes before retrying.
Errors and recovery
| Status | Meaning | Recovery |
|---|---|---|
| 400 | Malformed body, ID, business selection, or cursor | Check the message and validation issues; correct the request. |
| 401 | Invalid, revoked, or expired credential | Create a replacement key in the dashboard and update local configuration. |
| 403 | Insufficient grant, current permission, billing, or HTTPS requirement | Use HTTPS and review scope, membership, billing, and approved domains. |
| 404 | Form or submission unavailable within scope; proof may be wrong or expired | Check business/form/lead mapping and the exact submission token. |
| 409 | Stale revision or overlapping domain registration | Re-read the draft or register remaining domains separately. |
| 413 | Body exceeds the 1 MiB limit | Reduce payload size; do not embed image bytes in definitions. |
| 429 | Request budget exhausted | Wait for Retry-After before retrying. |
| 503 | Shared limiter unavailable | Back off; requests fail closed until rate limiting recovers. |
Most errors use {success: false, message}; validation failures may include issues, and limiter errors include code. Check HTTP status and the response shape. Validation can return HTTP 200 with valid: false. Never include credentials or customer data in a debugging report.