Record a page visit
POST
https://referalli.com /t/{orgToken}/visit Beacon sent by aff.js on each landing. Upserts the visitor (anonId) and, when the page was opened with ?via=<code> and no clickId, records a click for that link. Returns the click id to keep in the browser. CORS open to any origin.
Auth: none.
Parameters
orgTokenstring
path
required
Request body
application/json
anonIdstring
required
clickIdstring
codestring
urlstring
substring
The partner's sub-ID from
?sub=, stored on a click this beacon creates.visitTokenAn opaque third-party visit token (the Seolyticize tag's,
v1.…; printable ASCII, at most 512 characters), stored on a click this beacon creates. Ignored when invalid.refererstring
consentobject
The visitor's consent as the tracker read it from the site's CMP (
aff.consentEvidence()). Stored on the click and the visit.Show child parameters
providerstring
required
The adapter that read it (
onetrust, tcf, cookiemunch, …), custom for aff.consent(), none, or no-cmp.statestring
required
atstring
When the tracker read it.
stampstring
The CMP's consent record id, when it has one.
tcStringstring
gppStringstring
purposesstring[]
{
"anonId": "string",
"clickId": "string",
"code": "string",
"url": "string",
"sub": "string",
"visitToken": {},
"referer": "string",
"consent": {
"provider": "string",
"state": "granted",
"at": "2024-01-01T00:00:00Z",
"stamp": "string",
"tcString": "string",
"gppString": "string",
"purposes": [
"string"
]
}
}Code samples
cURL
curl -X POST "https://referalli.com/t/{orgToken}/visit" \
-H "Content-Type: application/json" \
-d '{"anonId":"string","clickId":"string","code":"string","url":"string","sub":"string","visitToken":{},"referer":"string","consent":{"provider":"string","state":"granted","at":"2024-01-01T00:00:00Z","stamp":"string","tcString":"string","gppString":"string","purposes":["string"]}}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
200 OK
Example
{
"ok": true,
"clickId": "string",
"cookieWindowDays": 0
}Schema
okboolean
required
clickIdstring
required
cookieWindowDaysinteger
required
The link's own cookie window in days when the click came from a link that sets one; aff.js keeps the referral context that long.
400 The request is invalid.
error.code is one of:Example
{
"error": {
"code": "validation_error",
"message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
"details": [
{
"code": "invalid_format",
"path": [
"destinationUrl"
],
"message": "Invalid URL"
}
],
"docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
}
}{
"error": {
"code": "mode_mismatch",
"message": "the `referalli-mode` header disagrees with the api key's mode",
"docs_url": "https://referalli.com/docs/errors-and-limits#mode_mismatch"
}
}{
"error": {
"code": "bad_request",
"message": "rejected by the http layer before the handler",
"docs_url": "https://referalli.com/docs/errors-and-limits#bad_request"
}
}{
"error": {
"code": "invalid_handoff_token",
"message": "`handofftoken` on `associate` is malformed, expired (24 hours), signed for another org, or its signature does not verify",
"docs_url": "https://referalli.com/docs/errors-and-limits#invalid_handoff_token"
}
}Schema
errorobject
required
Show child parameters
codestring
required
messagestring
required
detailsrequestIdstring
docs_urlstring
required
The docs entry for this error code: what it means and how to fix it.
Headers
x-request-idstring
This request's id (
req_…), matching the server logs. On every response.404 No such resource.
error.code is one of:Example
{
"error": {
"code": "not_found",
"message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
}
}{
"error": {
"code": "not_enrolled",
"message": "the user is not a partner in the program (and the widget's autoenroll is off, or no verified email was given)",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_enrolled"
}
}Schema
errorobject
required
Show child parameters
codestring
required
messagestring
required
detailsrequestIdstring
docs_urlstring
required
The docs entry for this error code: what it means and how to fix it.
Headers
x-request-idstring
This request's id (
req_…), matching the server logs. On every response.429 Rate limited.
error.code is one of:Example
{
"error": {
"code": "rate_limited",
"message": "an endpoint limit or the per-key quota was exceeded",
"docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
}
}Schema
errorobject
required
Show child parameters
codestring
required
messagestring
required
detailsrequestIdstring
docs_urlstring
required
The docs entry for this error code: what it means and how to fix it.
Headers
x-request-idstring
This request's id (
req_…), matching the server logs. On every response.Retry-Afterinteger
Seconds until a retry can succeed.
RateLimit-Limitinteger
The quota bucket's size (the burst).
RateLimit-Remaininginteger
Requests that can be made right now.
RateLimit-Resetinteger
Seconds until the bucket is full again.
500 Unexpected server error.
error.code is one of:Example
{
"error": {
"code": "internal_error",
"message": "retry with backoff",
"requestId": "req_8f2c1d4e5a6b7c8d",
"docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
}
}Schema
errorobject
required
Show child parameters
codestring
required
messagestring
required
detailsrequestIdstring
docs_urlstring
required
The docs entry for this error code: what it means and how to fix it.
Headers
x-request-idstring
This request's id (
req_…), matching the server logs. On every response.default Any other error, in the same envelope.
Example
{
"error": {
"code": "string",
"message": "string",
"details": {},
"requestId": "string",
"docs_url": "string"
}
}Schema
errorobject
required
Show child parameters
codestring
required
messagestring
required
detailsrequestIdstring
docs_urlstring
required
The docs entry for this error code: what it means and how to fix it.
Updated