Enrich your dashboard with an API lookup
For developers. Your internal dashboard shows a client record — this recipe adds a live "what have they connected?" panel by calling the ClientInvite API with the ID you already have.
The pattern
- When you send a client their connect link, append your own ID:
?ref=crm-record-8841. See how customRef works. - From then on,
GET /clients/{id}accepts that ref directly — no need to store ClientInvite's internal ID.
The call
curl
curl https://app.clientinvite.com/api/v1/clients/crm-record-8841 \
-H "Authorization: Bearer ci_live_xxxxxxxxxxxx"Response
{
"error": false,
"data": {
"id": "cl_7d81mq",
"name": "Acme Co",
"email": "hello@acme.com",
"customRef": "crm-record-8841",
"status": "CONNECTED",
"connectedAt": "2026-07-13T09:41:25Z",
"assets": [
{
"platform": "facebook",
"type": "ad_account",
"name": "Acme Co",
"externalId": "act_1086344871362999",
"permission": "manage",
"status": "GRANTED"
},
{
"platform": "google",
"type": "ads_account",
"name": "acme.com",
"externalId": "734-201-8841",
"permission": "manage",
"status": "GRANTED"
}
]
}
}Node.js
// lookup.js — run with: CLIENTINVITE_API_KEY=ci_live_xxxxxxxxxxxx node lookup.js
const CRM_RECORD_ID = 'crm-record-8841';
async function getClientAccess(customRef) {
const res = await fetch(
`https://app.clientinvite.com/api/v1/clients/${encodeURIComponent(customRef)}`,
{ headers: { Authorization: `Bearer ${process.env.CLIENTINVITE_API_KEY}` } }
);
if (res.status === 404) return null; // not connected yet
if (!res.ok) throw new Error(`ClientInvite API: ${res.status}`);
const { data } = await res.json();
return data;
}
const client = await getClientAccess(CRM_RECORD_ID);
if (client) {
console.log(`${client.name}: ${client.assets.length} assets connected`);
} else {
console.log('Client has not completed the connect flow yet.');
}Server-side only
Call the API from your backend, never from browser code — your key would be visible to anyone who opens dev tools. See authentication.
Notes
- A
404just means the client hasn't completed a connect flow with that ref yet — treat it as "not connected", not an error. - The API is read-only in v1 and rate-limited to 60 requests/minute — cache responses if you render them on every page load.
- If you want the data pushed to you the moment it changes instead, use webhooks — most teams use both: webhook to ingest, API to re-fetch on demand.