Server-side identify API
The one POST every backend guide makes, with its fields, responses and a reusable helper.
One POST from your backend, right after it creates the account, records the signup with its source. Every framework and auth-provider guide is this call.
Request
POST https://dashboard.chartsy.app/api/attribution/identify/
Authorization: Bearer <CHARTSY_SECRET_KEY>
Content-Type: application/json
{
"email": "person@example.com",
"attribution_first": { ...parsed chartsy_attrib cookie... },
"attribution_last": { ...parsed chartsy_attrib_last cookie... },
"visitor_id": "<chartsy_visitor_id cookie>"
}| Field | Required | Notes |
|---|---|---|
email | Yes | The new account’s email. Lowercased by Chartsy. |
attribution_first | No | The chartsy_attrib cookie, URL-decoded then JSON-parsed. Send {} if missing. |
attribution_last | No | The chartsy_attrib_last cookie, decoded the same way. Falls back to first touch. |
visitor_id | No | The chartsy_visitor_id cookie as-is. Enables revenue matching by id. |
A missing cookie is not a reason to skip the call: the signup still counts, just with an unknown source.
Responses
| Status | Meaning |
|---|---|
200 {"ok": true} | The signup was recorded. |
204 | Empty response for anything else - wrong key, invalid email or rate limit. Check the key and the email first. |
Chartsy keeps the first signup per email and ignores repeats, so a retry or a second call is harmless.
Reusable helper (Node 18+)
For any Node backend: call it right after the account is created, passing the email and a way to read the request's cookies. Used by the Express and Next.js guides.
// chartsy.js
const readJson = (raw) => {
try { return JSON.parse(decodeURIComponent(raw || '')) || {}; } catch { return {}; }
};
export async function chartsyIdentify(email, cookies) {
// cookies: a function name => value (Express: n => req.cookies[n];
// Next.js: n => cookies().get(n)?.value)
const first = readJson(cookies('chartsy_attrib'));
const last = readJson(cookies('chartsy_attrib_last'));
try {
await fetch('https://dashboard.chartsy.app/api/attribution/identify/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.CHARTSY_SECRET_KEY}`,
},
body: JSON.stringify({
email,
attribution_first: first,
attribution_last: Object.keys(last).length ? last : first,
visitor_id: cookies('chartsy_visitor_id') || '',
}),
});
} catch (err) {
console.error('Chartsy identify failed', err); // never block signup on analytics
}
}

