Skip to content

Send device signals

POST
/v1/collect
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.

Media typeapplication/json

Built by the tag. The signal objects are not part of the contract.

object
event
required

What happened on the page, for example pageview or submit.

string
<= 32 characters
tag_version
string
device_token

The device token the tag stored on an earlier visit.

string | null
stored_in
object
key
additional properties
boolean
signals
object
automation
object
behavior
object

Example generated

{
"event": "example",
"tag_version": "example",
"device_token": "example",
"stored_in": {
"additionalProperty": true
},
"signals": {},
"automation": {},
"behavior": {}
}

The collection was stored.

Media typeapplication/json
object
request_id
required

Pass this to your server and on to POST /v1/decision.

string
device_token

A signed token the tag stores to recognize the device next time.

string
agent_notice

How the tag talks to agents on your forms, from your agent policy setting.

string
Allowed values: hidden visible off

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.

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Branch on this

string
message
required

What went wrong.

string
fix

What to change.

string

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).

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Branch on this

string
message
required

What went wrong.

string
fix

What to change.

string

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).

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Branch on this

string
message
required

What went wrong.

string
fix

What to change.

string

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.

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Branch on this

string
message
required

What went wrong.

string
fix

What to change.

string

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"
}
}
Retry-After
integer
>= 1

Seconds to wait before retrying.

The collection could not be stored. Retry; your page carries on.

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Branch on this

string
message
required

What went wrong.

string
fix

What to change.

string

Example generated

{
"error": {
"code": "example",
"message": "example",
"fix": "example"
}
}