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>"
}
FieldRequiredNotes
emailYesThe new account’s email. Lowercased by Chartsy.
attribution_firstNoThe chartsy_attrib cookie, URL-decoded then JSON-parsed. Send {} if missing.
attribution_lastNoThe chartsy_attrib_last cookie, decoded the same way. Falls back to first touch.
visitor_idNoThe 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

StatusMeaning
200 {"ok": true}The signup was recorded.
204Empty 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
  }
}

Related articles

Chartsy Team

Written by

Chartsy Team

Analytics team at Chartsy

The Chartsy Team writes guides, product updates, and resources to help SaaS and eCommerce founders make sense of their metrics, without SQL or spreadsheets.

Chartsy
Ministry of Economy and Innovation
Startup Albania

The Chartsy program is realized with the financial support of the Albanian Government through the Ministry of Economy and Innovation, under the Grant 2026 scheme, and is implemented by the Innovation4Albania Agency.