Customers API
A customer is a person of your back office, known by your identifier (customerExternalId): a customer number, an account id. SLNK keeps one customer per identifier and project, with its origin click, its leads, its sales, its revenue and its lifetime value. Customers are created by /api/v1/track/lead and /track/sale when the call carries customerExternalId, or declared here.
What SLNK stores
| Data | Stored as | Never stored |
|---|---|---|
| Your identifier | HMAC-SHA256 hash keyed by the project secret, and a mask: four dots then the last four characters (....0123; the last character only for an identifier of four characters or less) | The identifier in clear |
SHA-256 of the trimmed lower-case address, and a mask (k****i@g****.com) | The address in clear |
Consequences:
- The search by identifier is an exact match, case and inner spaces included (leading and trailing spaces are trimmed). A partial search is impossible.
- The hash is the one of the web SDK
identify(userId): when your site callsslnka.identify("CLI-000123"), the sessions and touchpoints of that visitor appear in the customer's timeline. - Rotating the project's token secret makes existing customers unreachable by identifier, like identified visitors. Their totals and timelines stay readable from the list.
Operations
| Method | Path | Access |
|---|---|---|
| GET | /api/v1/customers | analytics:read key, or member with Attribution view |
| GET | /api/v1/customers/{id} | idem |
| GET | /api/v1/customers/{id}/timeline | idem |
| POST | /api/v1/customers | conversions:write key, or member with Attribution edit |
| PATCH | /api/v1/customers/{id} | idem |
| DELETE | /api/v1/customers/{id} | Console only (member with Attribution edit); API keys get 403 |
The operations require the multi-touch attribution feature of your plan. A member session sends the project in the X-Project-Id header; a key is bound to its project.
List customers
curl "https://api.slnk.ma/api/v1/customers?sort=revenue&page=0&size=20" \
-H "Authorization: Bearer $SLNK_SERVER_KEY"
| Parameter | Default | Description |
|---|---|---|
externalId | Your identifier, exact match: 0 or 1 customer | |
sort | lastActivity | lastActivity (latest confirmed conversion; customers without one last), revenue or createdAt, always descending |
page | 0 | Page index |
size | 20 | 1 to 100 |
The response is a page (content, totalElements, totalPages, number, size) of:
{
"id": "CUSTOMER_ID",
"externalIdMasked": "....0123",
"firstLinkId": "LINK_ID",
"firstShortCode": "Ab3dE9x",
"firstTouchAt": "2026-11-06T09:12:00Z",
"leadsCount": 1,
"salesCount": 2,
"revenue": 1250.00,
"currency": "MAD",
"lastActivityAt": "2026-11-20T15:03:00Z",
"createdAt": "2026-11-06T09:15:00Z"
}
leadsCountandsalesCountcount confirmed conversions; a cancelled sale is excluded.revenueis the sum of the confirmed sales in the project currency. A sale in another currency is counted insalesCountbut not inrevenue.
Get a customer
GET /api/v1/customers/{id} returns the list fields and:
| Field | Description |
|---|---|
emailMasked | Masked e-mail, null when unknown |
origin | First click: clickId, linkId, shortCode, channel and campaignId of its touchpoint, firstTouchAt. null when the customer was declared without click |
ltv | Lifetime value: cumulative revenue to date (equals revenue) |
averageOrderValue | revenue divided by the confirmed sales in the project currency, 0 without sale |
otherCurrencySales | Confirmed sales in another currency, excluded from revenue |
firstLeadAt, firstSaleAt | First confirmed lead and sale |
sessionsCount, lastSeenAt | Sessions and last visit of the visitors linked by identify; null without linked visitor |
The response never contains the identifier nor the e-mail in clear.
Timeline
GET /api/v1/customers/{id}/timeline?limit=20 returns the events of the customer, most recent first:
{
"items": [
{ "type": "sale", "occurredAt": "2026-11-20T15:03:00Z", "id": "CONVERSION_ID", "shortCode": "Ab3dE9x", "eventName": "purchase", "amount": 900.00, "currency": "MAD", "status": "CONFIRMED" },
{ "type": "lead", "occurredAt": "2026-11-06T09:15:00Z", "id": "CONVERSION_ID", "eventName": "account_opened", "status": "CONFIRMED" },
{ "type": "touchpoint", "occurredAt": "2026-11-06T09:12:00Z", "id": "TOUCHPOINT_ID", "linkId": "LINK_ID", "shortCode": "Ab3dE9x", "channel": "sms" },
{ "type": "click", "occurredAt": "2026-11-06T09:12:00Z", "id": "CLICK_ID", "linkId": "LINK_ID", "shortCode": "Ab3dE9x", "deviceType": "mobile", "city": "Casablanca" }
],
"nextCursor": "MjAyNi0xMS0wNlQwOToxMjowMFp8Y2xpY2t8Q0xJQ0tfSUQ"
}
| Type | Source |
|---|---|
click | First click of the customer |
touchpoint | Touchpoints of the customer's clicks, and of the visitors linked by identify |
lead, sale | Confirmed conversions |
cancelled | Cancelled sale |
Pass nextCursor as cursor to read the next page; it is null on the last page. limit goes from 1 to 100 (default 20).
Declare a customer
curl -X POST https://api.slnk.ma/api/v1/customers \
-H "Authorization: Bearer $SLNK_SERVER_KEY" \
-H "Content-Type: application/json" \
-d '{"externalId":"CLI-000123","email":"karim@example.ma"}'
Idempotent per identifier: 201 when the customer is created, 200 with the existing customer otherwise (its e-mail replaced when one is sent). Most integrations do not need this call: /track/lead and /track/sale create the customer.
Replace the e-mail
PATCH /api/v1/customers/{id} with {"email":"new@example.ma"}. The e-mail is the only editable field; {"email":null} forgets it.
Erase a customer
DELETE /api/v1/customers/{id}, from the console (customer page, Erase data), answers 204:
- its conversions are kept without customer (anonymized): amounts, click and attribution are unchanged, so your revenue reports stay exact;
- the visitors linked to its identifier by
identifyenter the CNDP erasure queue, which deletes their clicks, touchpoints, sessions and profiles; - the customer is deleted.
The action is irreversible and recorded in the audit log (customer.erased). A visitor erasure requested by the SDK or the Privacy Requests page erases the customers linked to that visitor the same way.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid sort, page, size, limit or e-mail |
| 400 | CUSTOMER_EXTERNAL_ID_INVALID | Identifier blank once trimmed, or longer than 255 characters |
| 400 | CURSOR_INVALID | Unreadable timeline cursor: start again from the first page |
| 403 | PERMISSION_DENIED | Missing scope or role, or erasure with an API key |
| 403 | FEATURE_NOT_AVAILABLE | Multi-touch attribution is not in your plan |
| 404 | CUSTOMER_NOT_FOUND | Unknown customer in this project |