We’re at capacity right now: new teams join from the waiting list. Join the waiting list →
Kolvantage

Docs › Developers

Server API

The server API lets your website's server talk to Kolvantage directly: report events your server knows best (a confirmed payment, a registration) and tell Kolvantage who your customers are, for Marketing. Server events can't be blocked by ad blockers or faked from a browser.

All endpoints are under https://app.kolvantage.com/api/v1/ and use the website's secret key.

Getting a secret key

Each website has one secret key for the whole server API.

  1. Open the website, then Settings → API.
  2. In the Secret key card, click Create secret key.
  3. Copy the key right away and give it to your developer privately. It is shown only once. Keys start with kv_.

The card then shows "A secret key is set", the key's last four characters, when it was created and when it was last used.

  • Replace key makes a new key. The current key stops working right away, so your server must switch to the new one.
  • Delete key removes it. Your server can't send events or users until you create a new one.

Creating and replacing keys needs the Owner or Admin role. Other roles see "Ask the website's owner or an admin for the secret key."

The Settings → API tab also shows ready-to-copy examples with your website's address.

Authentication

Send the key in the Authorization header of every request:

Authorization: Bearer kv_YOUR_SECRET_KEY

Send request bodies as JSON, with Content-Type: application/json.

The key belongs to one website, so you never send a website id: everything you send goes to the key's website.

The visitor id

Requests say which person they are about with visitor: the visitor's Kolvantage id. It links what your server sends to that person's visits, recordings, A/B tests and Marketing profile.

  • The Kolvantage script keeps the id in the kv_vid cookie on your own domain (and its subdomains). Your server reads it from the customer's request, for example $_COOKIE['kv_vid'] in PHP or req.cookies.kv_vid in Node.
  • In the browser, Kolvantage.visitorId() gives the same id (see JavaScript API).
  • When something happens without the customer's browser (for example a payment provider calling your server), save kv_vid with the customer when they log in or start the payment, and send that.

A visitor id is 8 to 64 letters, numbers or -.

POST /api/v1/events

Reports that an event happened. The event must exist in the website's Events tab and be set to come from Your server (API).

curl -X POST https://app.kolvantage.com/api/v1/events \
  -H "Authorization: Bearer kv_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "event": "ftd", "visitor": "KV_VID_COOKIE", "value": 150.00, "currency": "USD", "order_id": "payment-123", "user_id": "user-45" }'
FieldRequiredWhat it is
eventYesThe event's code name, as shown in the Events tab (e.g. ftd)
visitorNoThe kv_vid cookie. Leave the field out when you don't have it (an empty or malformed one is ignored too, the event is still counted). Without it the event is counted in the Events tab only, not for A/B tests, journeys, segments or the visitor's profile
valueNoThe amount, for events with an amount. A number, e.g. 49.90. It is rounded to 2 decimals. Ignored for events without an amount
currencyNoOverrides the event's currency: USD, EUR, GBP, ILS, CAD, AUD, JPY, CHF, SEK, NOK, DKK, PLN, BRL, MXN, INR or ZAR. Anything else uses the event's own currency
order_idNoYour own id for this firing, as text or a number (e.g. the order or payment id). Sending the same order_id again for the same event counts once, so retries are safe (an event can be set to allow repeats in the Events tab, e.g. for partial refunds; the same order_id on two different events is never a problem). Shown with the event. (id is its old name and still works)
user_idNoYour own id for the person, as text or a number (e.g. their id in your system). Shown with the event and in Affiliates → Transactions. It does not affect counting
urlNoA page address to store with the event

When a visitor is sent, the event is linked to their latest visit, so it shows on their recording, with that visit's device and country.

Responses

201 Created: the event was received and counted.

{ "ok": true, "duplicate": false, "visitorKnown": true, "abConversions": 1 }

200 OK: that id was already received for this event, so it wasn't counted again ("duplicate": true).

  • visitorKnown: false when no visitor was sent, or Kolvantage has no recorded visit from that visitor (yet).
  • abConversions: how many A/B test goals this event completed for the visitor.
  • visitorIgnored and warning: only present when the visitor you sent was empty or not a valid id. The event was counted, without a visitor.

API logs

Open the website's Events tab and look for API logs. It lists every call your server made to Kolvantage, newest first and 50 to a page, whether it worked or not. For each call you see the time, the event, the result, the amount, the user ID, the order ID, the visitor (the first characters) and, when something was wrong, why.

The result is one of:

  • Counted: the event was stored.
  • Repeated order_id: not counted again: the same order_id was sent before, so this call was not counted. The row still shows the amount this call carried, so you can see if a repeat sent a different amount than the first (Kolvantage keeps the first one).
  • Refused: not stored: fix the call and send it again. The reason says what was wrong.
  • Counted, without a usable visitor: the event was stored, but it can't be linked to a recording, an A/B test or an affiliate.

Use the filters above the list to find a call by result, event, order ID or user ID (a part of the ID is enough), and Download CSV to get everything the filters match as a file (times in UTC). Calls are kept, with no time limit. A call with a wrong secret key can't be listed, because it isn't known which website it was for.

POST /api/v1/users

Creates or updates a Marketing user, found by your own id for them (external_id). Send it at registration, and whenever their details change.

curl -X POST https://app.kolvantage.com/api/v1/users \
  -H "Authorization: Bearer kv_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "CUSTOMER-ID",
    "visitor": "KV_VID_COOKIE",
    "email": "dana@example.com",
    "phone": "+14155550100",
    "first_name": "Dana",
    "language": "en",
    "tags": { "plan": "gold", "deposits": 3 },
    "email_subscribed": true,
    "sms_subscribed": true,
    "whatsapp_subscribed": true
  }'
FieldRequiredWhat it is
external_idYesThe customer's id in your system, up to 128 characters. Sent again, the same user is updated (no duplicates)
visitorNoThe kv_vid cookie. Links this browser (its visits, events, web push subscription) to the customer. If the browser was an anonymous user before (for example a web push subscriber), that user is merged into this one
emailNoA valid email address
phoneNoA full number with the country code, e.g. +14155550100. Spaces, dashes, dots and brackets are removed, and a leading 00 counts as +
first_name, last_nameNoUp to 80 characters each. Usable in messages, e.g. {{ first_name }}
languageNoA two-letter language code, e.g. en
countryNoA two-letter country code, e.g. US
timezoneNoe.g. Europe/London, up to 60 characters
tagsNoAn object of values to filter or personalize by: text (up to 500 characters), numbers or true/false. A tag set to null or "" is removed. Names: letters, numbers and _ . : -, up to 64 characters. Up to 100 tags
email_subscribedNotrue or false: whether the customer agreed to marketing emails
sms_subscribedNotrue or false: marketing SMS, to their phone
whatsapp_subscribedNotrue or false: marketing WhatsApp messages, to their phone. WhatsApp needs its own agreement

About subscriptions:

  • An email or phone you send is added to the user as an email or SMS subscription. A new one is added as not subscribed, unless you also send email_subscribed: true (or sms_subscribed: true). An address the user already had keeps its status (subscribed, unsubscribed, bounced or complained).
  • email_subscribed, sms_subscribed and whatsapp_subscribed set the status for the user's email or phone: true subscribes, false unsubscribes. Left out, nothing changes. They need an email (or phone) on the user.
  • WhatsApp is never added on its own: send whatsapp_subscribed: true only when the customer agreed to it.

Fields you leave out are not changed. An empty email or phone is ignored (it doesn't remove the current one).

Responses: 201 Created for a new user, 200 OK when an existing user was updated. Both return the user:

{
  "external_id": "CUSTOMER-ID",
  "email": "dana@example.com",
  "phone": "+14155550100",
  "first_name": "Dana",
  "last_name": null,
  "language": "en",
  "country": null,
  "timezone": null,
  "tags": { "plan": "gold", "deposits": 3 },
  "visitors": ["3f0c1a2e-8b4d-4c61-9e7a-1d2b3c4d5e6f"],
  "subscriptions": [
    { "id": "…", "type": "email", "address": "dana@example.com", "status": "subscribed", "created_at": 1767225600000 },
    { "id": "…", "type": "sms", "address": "+14155550100", "status": "subscribed", "created_at": 1767225600000 }
  ],
  "created_at": 1767225600000
}
  • visitors: the visitor ids (browsers) linked to this user.
  • subscriptions: one per channel address. type is push, email, sms or whatsapp. status is subscribed, unsubscribed, bounced, complained or invalid. Web push subscriptions don't include an address.
  • Times are in milliseconds since 1970 (UTC).

GET /api/v1/users/{external_id}

Reads a user. Returns the user as above, or 404 if there's no user with that external_id.

curl https://app.kolvantage.com/api/v1/users/CUSTOMER-ID \
  -H "Authorization: Bearer kv_YOUR_SECRET_KEY"

URL-encode the id if it contains special characters.

PATCH /api/v1/users/{external_id}

Changes some fields of an existing user. The body takes the same fields as POST /api/v1/users, except external_id (it is in the address). Returns the updated user, or 404 if there's no such user.

curl -X PATCH https://app.kolvantage.com/api/v1/users/CUSTOMER-ID \
  -H "Authorization: Bearer kv_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tags": { "plan": "platinum", "trial": null }, "sms_subscribed": false }'

DELETE /api/v1/users/{external_id}

Removes the user. Answers 204 No Content, or 404 if there's no such user.

curl -X DELETE https://app.kolvantage.com/api/v1/users/CUSTOMER-ID \
  -H "Authorization: Bearer kv_YOUR_SECRET_KEY"

Errors

Errors answer with a status code and a JSON message that says what's wrong:

{ "error": "No event \"ftd\" is defined for this website (Events tab)" }
StatusWhen
400The body isn't JSON, or a field is wrong (for example "event" must be the event's code name, "phone" must be a full number with the country code, "external_id" is required). Also for an event that is set to come from the website's code (browser): change it to Your server (API) in the Events tab
401The Authorization header is missing, or the key is wrong, replaced or deleted
403The account is disabled
404The event isn't defined for this website, or there's no user with that external_id

Webhook addresses

Settings → Marketing also shows addresses under /api/v1/marketing/… for Amazon SES (bounces and complaints), Twilio (SMS delivery reports) and WhatsApp (Meta's webhook). You paste those into the provider's settings; your own server doesn't call them. See Marketing channels.

Limits

  • Request bodies: up to 16 KB for events, 64 KB for users.
  • Event id: up to 100 characters. Event url: up to 2,048 characters.
  • external_id: up to 128 characters.
  • User tags: up to 100, names up to 64 characters, text values up to 500 characters.
  • One secret key per website.

Who can use it

Anyone with the secret key can call the API, so keep it on your server. In the dashboard, creating, replacing and deleting the key needs the Owner or Admin role. The Users (Marketing) card in Settings → API needs the Marketing tool.