Browse the guides

Read leads with an API key

Give your own system, an ERP or a report a read-only key, and it fetches your leads, with their history and tasks, whenever it wants.

For: Super adminsUpdated

An API key lets your own system read your leads from selXP: an ERP, a data warehouse, a Power BI report, or a script your IT team writes. It fetches them when it wants, and each time can ask for only what changed. A key reads; it never changes anything.

It is the other side of the webhook: a webhook sends each lead as it changes, a key lets your system come and get them. Both give the same fields, so one receiver can take either.

Make a key

Only a super admin can make keys. Someone from LucidArc who is in on support access cannot.

  1. Open CRM sync and tap Read leads with a key.
  2. Under Who uses it, write a name you will recognise, such as Our ERP or Power BI.
  3. If you have more than one company, choose whether it reads The whole workspace or one company’s leads.
  4. Tap Make the key.
  5. Tap Copy the key and give it to whoever runs that system.

The key is shown once. selXP keeps only a fingerprint of it, so nobody, LucidArc included, can show it again. If it is lost, cut it off and make a new one.

Keep keys safe

  • Give a key only to the people who run the system that uses it. Anyone with the key can read the leads it covers.
  • Make one key for each system, so you can cut one off without stopping the others.
  • Cut off stops a key at once. Do it when someone who had the key leaves, or the system is retired.
  • A workspace can have 5 keys at a time. The screen shows when each was last used and who made it.
  • Making and cutting off keys are in your audit trail.

What it reads

The same as a webhook call:

  • The lead: its score, temperature, notes, value, event, product interests, owner, company in your group and the answers to your own questions.
  • The person: name, job title, emails and phones.
  • The company: name and website.
  • Its history (notes, calls, messages, visits) and its tasks.

Card photos and files stay in selXP. A lead deleted in selXP is reported once as deleted, with nothing but its id. Someone erased for a privacy request stops appearing.

For whoever builds the reading end

Every call is a GET to https://app.selxp.com/v1/api, with the key as a bearer token:

Authorization: Bearer sxp_0123456789abcdef0123456789abcdef0123456789abcdef
Call What it gives
GET /ping Checks the key: the workspace, the key’s name and its company, if one
GET /leads Leads in the order they last changed, oldest first, a page at a time
GET /leads/{id} One lead

GET /leads takes:

Query What it is
limit Leads per page, 1 to 100. 50 when left out.
cursor Where the last page ended, as the API gave it. Carries on from there.
since Only leads changed after this moment, in ISO 8601 with a time zone. For a first read from a date.

It answers:

{
  "data": [
    {
      "lead": { "id": "6f1c2e0a-…", "title": "Huda Karim · Delta Pumps", "score": 72, "temperature": "HOT" },
      "contact": {
        "id": "…",
        "fullName": "Huda Karim",
        "jobTitle": "Procurement Lead",
        "emails": ["…"],
        "phones": ["…"]
      },
      "company": { "id": "…", "name": "Delta Pumps", "website": null },
      "history": [{ "id": "…", "type": "CALL", "at": "…", "by": "Sara", "text": "Asked for a quote" }],
      "tasks": [
        { "id": "…", "title": "Send quote", "dueOn": "2026-11-10", "state": "OPEN", "ownerEmail": "…" }
      ],
      "changedAt": "2026-11-08T09:12:44.120531Z"
    }
  ],
  "more": false,
  "cursor": "WyIyMDI2LTExLTA4VDA5OjEyOjQ0LjEyMDUzMVoiLCI2ZjFjMmUwYS0uLi4iXQ"
}

The fields of lead, contact, company, history and tasks are those of a webhook’s lead.saved body: see Send leads to a webhook.

  • A lead counts as changed when it, its history or its tasks change.
  • more: true means another page is waiting. Call again with the cursor it gave.
  • Keep the last cursor. Calling with it later gives only what changed since. With nothing new, data is empty and the cursor stays the same.
  • A deleted lead comes as { "lead": { "id": "…" }, "deleted": true, … }.

A first full read, then the changes every few minutes, in Node:

let cursor = loadSavedCursor(); // null the first time
let more = true;
while (more) {
  const url = new URL("https://app.selxp.com/v1/api/leads");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { authorization: `Bearer ${process.env.SELXP_KEY}` } });
  const page = await res.json();
  for (const item of page.data) item.deleted ? removeLead(item.lead.id) : saveLead(item);
  cursor = page.cursor;
  saveCursor(cursor);
  more = page.more;
}

Answers

Status When
200 It worked.
400 A value is wrong: a cursor the API did not give, a limit over 100, a date without a time zone.
401 No key, a wrong one, or one cut off.
403 Your workspace is suspended or closed.
404 No such lead for this key.
429 More than 120 calls in a minute with one key. Wait a minute.

Errors come as { "statusCode": 401, "message": "…" }.

Good to know

  • Keys are for company workspaces. A personal space can export its leads to Excel from Leads instead.
  • Goals, streaks and rankings are never in it.
  • To have leads sent the moment they change, use a webhook as well.

Still stuck?

Ask your company's admin, or write to hello@lucidarc.ae. Say which screen you were on and what you expected to happen.

Book a demo