Send device signals
const url = 'https://collect.localhost/v1/collect';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"event":"example","tag_version":"example","device_token":"example","stored_in":{"additionalProperty":true},"signals":{},"automation":{},"behavior":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://collect.localhost/v1/collect \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "event": "example", "tag_version": "example", "device_token": "example", "stored_in": { "additionalProperty": true }, "signals": {}, "automation": {}, "behavior": {} }'The tag calls this for you. It is listed so you know what crosses the wire: the tag posts
device, browser, and interaction signals with your publishable site key, from an origin in
the key’s allowed domains, and gets back a request_id to pass to your server. The signal
objects are built by the tag and are not part of the contract; they change as the tag
improves.
The tag fails open: if this call fails or times out, your form still submits.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Built by the tag. The signal objects are not part of the contract.
object
What happened on the page, for example pageview or submit.
The device token the tag stored on an earlier visit.
object
object
object
object
Example generated
{ "event": "example", "tag_version": "example", "device_token": "example", "stored_in": { "additionalProperty": true }, "signals": {}, "automation": {}, "behavior": {}}Responses
Section titled “Responses”The collection was stored.
object
Pass this to your server and on to POST /v1/decision.
A signed token the tag stores to recognize the device next time.
How the tag talks to agents on your forms, from your agent policy setting.
Example
{ "agent_notice": "hidden"}The request is not valid. code says why: invalid_body, invalid_event_type,
missing_account_id, unknown_element_type, element_not_accepted,
card_number_refused, ssn_refused, invalid_amount, invalid_currency, or
invalid_value_type.
object
object
Stable error code. Branch on this
What went wrong.
What to change.
Example
{ "error": { "code": "invalid_event_type", "message": "event_type is missing or malformed", "fix": "use a built-in integration point such as signup, login, or checkout, or one of your own (2 to 40 lowercase letters, digits, and underscores)" }}The site key is missing, unknown, revoked, or expired (invalid_site_key).
object
object
Stable error code. Branch on this
What went wrong.
What to change.
Example generated
{ "error": { "code": "example", "message": "example", "fix": "example" }}The page’s origin is not in the site key’s allowed domains (origin_not_allowed).
object
object
Stable error code. Branch on this
What went wrong.
What to change.
Example generated
{ "error": { "code": "example", "message": "example", "fix": "example" }}The key is calling faster than its limit (rate_limited). Each key has its own limit; see
Errors in the developer docs. Wait the seconds in Retry-After, then retry.
object
object
Stable error code. Branch on this
What went wrong.
What to change.
Example
{ "error": { "code": "rate_limited", "message": "this key is sending decisions faster than its limit", "fix": "wait for the Retry-After header, then retry; ask us if you need a higher limit" }}Headers
Section titled “Headers”Seconds to wait before retrying.
The collection could not be stored. Retry; your page carries on.
object
object
Stable error code. Branch on this
What went wrong.
What to change.
Example generated
{ "error": { "code": "example", "message": "example", "fix": "example" }}