Integrations
See which integrations are connected, how they're doing and which tools depend on them, and disconnect one. Requires `integrations:read` to read and `integrations:write` to disconnect. Connecting an integration means signing in to the other service, so it happens in the dashboard.
The Integration object
Returned by the integrations endpoints.
okexpiring{ "provider": "shopify", "displayName": "Shopify", "connected": true, "usingToolCount": 4, "connectedAccount": "northwind-outfitters.myshopify.com", "connectedAt": "12 days ago", "health": "ok", "tokenExpires": "in 23 days", "lastUsed": "2 days ago", "scopes": [ "read_orders", "read_customers" ], "subProducts": [], "affected": {} }
List integrations and their status
Requires `integrations:read`. Returns every integration in the catalog, each marked `connected` or not, with its operations and, when connected, the account, sign-in health and how many of your tools use it. Times such as `connectedAt`, `tokenExpires` and `lastUsed` are phrases for people ("12 days ago"), not timestamps. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/connected \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list()
{ "code": "SUCCESS", "message": "ok", "data": { "integrations": [ { "key": "shopify", "displayName": "Shopify", "description": "Look up orders and customers in your store.", "icon": "shopping-bag", "category": "commerce", "authType": "oauth2", "connected": true, "tools": [ { "name": "shopify_get_order", "displayName": "Get Order", "description": "Finds an order by number.", "parameters": [ { "name": "orderNumber", "type": "string", "description": "The order number.", "required": true } ], "effect": "read" } ], "connectedAccount": "northwind-outfitters.myshopify.com", "connectedAt": "12 days ago", "tokenExpires": "in 23 days", "health": "ok", "usingToolCount": 4, "lastUsed": "2 days ago", "scopes": [ "read_orders", "read_customers" ] } ] } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
List connection records
Requires `integrations:read`. Returns your workspace's connection records, one per connected account. WhatsApp can have several. Credentials are never returned. For most uses, `GET /integrations/connected` is the better choice. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/list \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list()
{ "code": "SUCCESS", "message": "ok", "data": { "connections": [ { "_id": "6702a1c4e4b0f1a2b3c4d611", "createdAt": "2026-09-24T10:11:00Z", "updatedAt": "2026-10-01T09:00:00Z", "userId": "66f1c2a9e4b0f1a2b3c4d5e9", "businessId": "66f1c2a9e4b0f1a2b3c4d5e1", "provider": "shopify", "metadata": { "shop": "northwind-outfitters.myshopify.com" }, "accountName": "northwind-outfitters.myshopify.com", "scopes": [ "read_orders", "read_customers" ] } ] } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "db error", "error": "<database error>" }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
Get integration totals
Requires `integrations:read`. Returns how many integrations you've connected, how many exist, how many of your tools use them, and how many sign-ins lapse within 7 days. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/stats \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list()
{ "code": "SUCCESS", "message": "ok", "data": { "connected": 3, "total": 9, "toolsInUse": 7, "expiringTokens": 0, "categories": 5 } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
Get daily call counts per integration
Requires `integrations:read`. Returns, for each integration your tools have called, the number of calls per day split into success, empty and failure, plus the most recent call. Days follow the time zone in `tz`. Only integrations with at least one recorded call appear, and calls are kept for 30 days. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/activity \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list()
{ "code": "SUCCESS", "message": "ok", "data": { "days": 2, "integrations": { "shopify": { "daily": [ { "date": "2026-10-05", "success": 22, "empty": 3, "failure": 1 }, { "date": "2026-10-06", "success": 4, "empty": 0, "failure": 0 } ], "total": 30, "failures": 1, "lastRunAt": "2026-10-06T07:58:12Z", "lastClass": "success" } } } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "failed", "error": "<database error>" }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
List recent calls through integrations
Requires `integrations:read`. Returns the most recent calls your tools made through the integrations you name, newest first, with the outcome, timing and any error. Pass several keys to cover a group, such as `google_calendar,gmail`. Calls are kept for 30 days. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/runs?keys=value \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list({ keys: 'value' })
{ "code": "SUCCESS", "message": "ok", "data": { "runs": [ { "id": "6712f0a1c4a1f09d8e7b6b10", "toolId": "66f1c2a9e4b0f1a2b3c4d5f3", "toolName": "Look up order", "businessId": "66f1c2a9e4b0f1a2b3c4d5e1", "integrationKey": "shopify", "at": "2026-10-06T07:58:12Z", "outcome": "found", "class": "success", "latencyMs": 412 } ] } }
{ "code": "ERROR", "message": "missing keys", "error": "keys is required" }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "failed", "error": "<database error>" }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
Get one integration's status
Requires `integrations:read`. Returns whether you've connected this integration and, when you have, the account, sign-in health, permissions, sub-products and how many tools, automations and agents depend on it. Times are phrases for people, not timestamps. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/value/detail \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.retrieve('value')
{ "code": "SUCCESS", "message": "ok", "data": { "provider": "shopify", "displayName": "Shopify", "connected": true, "usingToolCount": 4, "connectedAccount": "northwind-outfitters.myshopify.com", "connectedAt": "12 days ago", "health": "ok", "tokenExpires": "in 23 days", "lastUsed": "2 days ago", "scopes": [ "read_orders", "read_customers" ], "affected": { "tools": 4, "workflows": 1, "assistants": 2 } } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "integration not found", "error": "mongo: no documents in result" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
List what depends on an integration
Requires `integrations:read`. Returns your tools built on this integration, and the automations and agents that use those tools. Check it before disconnecting, since they stop working without the connection. Each list is `null` when empty, and an unknown key returns three `null` lists rather than an error. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/value/affected \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.retrieve('value')
{ "code": "SUCCESS", "message": "ok", "data": { "tools": [ { "name": "Look up order", "id": "66f1c2a9e4b0f1a2b3c4d5f3" } ], "workflows": [ { "name": "Order status follow-up", "id": "66f1c2a9e4b0f1a2b3c4d5f8" } ], "assistants": [ { "name": "Northwind Support", "id": "66f1c2a9e4b0f1a2b3c4d5e6" } ] } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
List linked WhatsApp numbers
Requires `integrations:read`. Returns each WhatsApp number linked to your workspace, with Meta's IDs and the number and business name customers see. Access tokens are never included. For numbers linked before these details were saved, the first call looks them up at Meta and stores them, so it can be slower. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl https://api.trycareflow.com/integrations/whatsapp/connections \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.list()
{ "code": "SUCCESS", "message": "ok", "data": { "connections": [ { "id": "6702a1c4e4b0f1a2b3c4d620", "phoneNumberId": "109876543210987", "wabaId": "102345678901234", "accountName": "102345678901234", "displayPhoneNumber": "+44 20 7123 4567", "verifiedName": "Harbourview Hotel", "connectedAt": "2026-09-24T10:11:00Z" } ] } }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }
Disconnect an integration
Requires `integrations:write`. Removes your workspace's connection to a provider, named in the `provider` query parameter (there's no body). Tools, automations and agents that use it stop working until someone reconnects in the dashboard; see `GET /integrations/{provider}/affected` first. For most providers every connection record is removed. For `whatsapp` only one record is removed per call, and you can't choose which number, so this isn't a safe way to unlink a specific WhatsApp number. For `shopify` Careflow also tries to uninstall the app from the store; if that fails the connection is still removed and `warning` says so. A provider you never connected still returns success. Connecting an integration (signing in to the other service) and linking WhatsApp numbers happen in the dashboard only; the API reads connections and can disconnect them.
curl -X DELETE https://api.trycareflow.com/integrations/disconnect?provider=value \ -H "Authorization: Bearer sk_live_••••"
const Integration = await careflow.integrations.del({ provider: 'value' })
{ "code": "SUCCESS", "message": "Integration disconnected", "data": { "status": "disconnected", "provider": "shopify", "warning": "" } }
{ "code": "ERROR", "message": "invalid request", "error": "Business ID or Provider missing" }
{ "code": "ERROR", "message": "unauthorized", "error": "invalid or revoked API key" }
{ "code": "ERROR", "message": "insufficient_scope", "error": "this API key needs the knowledge:write scope" }
{ "code": "ERROR", "message": "too_many_requests", "error": "You have exceeded the rate limit for api. Please try again in 12s." }
{ "code": "ERROR", "message": "db error", "error": "Could not disconnect integration" }
{ "code": "ERROR", "message": "service_unavailable", "error": "key lookup failed" }