Send an in-app event or an install
const url = 'https://restapi.affattr.com/v1/external_data/add_event';const options = { method: 'POST', headers: {'API-KEY': '<API-KEY>', 'Content-Type': 'application/json'}, body: '{"adid":"example","advertiser_tracking_enabled":true,"affise_device_id":"0b5b4d0e-7d4c-4a3c-9f62-2f7a1d1c0c11","affise_sdk_version":"example","api_level_os":"example","app_id":123,"app_version":"example","application_tracking_enabled":true,"click_id":"example","country":"DE","device_name":"example","event":{"affise_event_category":"example","affise_event_data":{"additionalProperty":"example"},"affise_event_first_for_user":true,"affise_event_id":"4f8a7c1e-2b9d-4c55-9a51-0d6f3e2a7b10","affise_event_name":"Purchase","affise_event_timestamp":1793527620,"affise_event_user_data":"example","affise_parameters":{"additionalProperty":"example"}},"first_open_time":1793527500,"gaid_adid":"example","gen_from_click":true,"idfa":"example","idfv":"example","ip":"example","ips":["example"],"language":"example","os_name":"example","os_version":"example","partner_id":1,"partner_name":"example","partner_upsert":true,"platform":"example","pub_click_id":"example","random_user_id":"9a4f0f5e-31d2-4c5b-8a0b-7e7d0f1c2b3a","referrer":"example","sandbox":true,"sdk_platform":"example","timezone_dev":"example","ua":"example","user_agent":"example"}'};
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://restapi.affattr.com/v1/external_data/add_event \ --header 'API-KEY: <API-KEY>' \ --header 'Content-Type: application/json' \ --data '{ "adid": "example", "advertiser_tracking_enabled": true, "affise_device_id": "0b5b4d0e-7d4c-4a3c-9f62-2f7a1d1c0c11", "affise_sdk_version": "example", "api_level_os": "example", "app_id": 123, "app_version": "example", "application_tracking_enabled": true, "click_id": "example", "country": "DE", "device_name": "example", "event": { "affise_event_category": "example", "affise_event_data": { "additionalProperty": "example" }, "affise_event_first_for_user": true, "affise_event_id": "4f8a7c1e-2b9d-4c55-9a51-0d6f3e2a7b10", "affise_event_name": "Purchase", "affise_event_timestamp": 1793527620, "affise_event_user_data": "example", "affise_parameters": { "additionalProperty": "example" } }, "first_open_time": 1793527500, "gaid_adid": "example", "gen_from_click": true, "idfa": "example", "idfv": "example", "ip": "example", "ips": [ "example" ], "language": "example", "os_name": "example", "os_version": "example", "partner_id": 1, "partner_name": "example", "partner_upsert": true, "platform": "example", "pub_click_id": "example", "random_user_id": "9a4f0f5e-31d2-4c5b-8a0b-7e7d0f1c2b3a", "referrer": "example", "sandbox": true, "sdk_platform": "example", "timezone_dev": "example", "ua": "example", "user_agent": "example" }'Server-to-server event of a device: creates the install when no install is found (app_id and first_open_time required for that) and publishes the in-app event of event. The parameters are taken from the JSON body and from the query (dotted names, event.affise_event_name). Client API key only. See the Events tag for the time fields and the differences from the SDK.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Event
object
IDFA, a UUID.
ATT status (iOS); absent keeps the stored value.
Device id, a UUID.
Example
0b5b4d0e-7d4c-4a3c-9f62-2f7a1d1c0c11Application. With first_open_time a new install is created when no install is found.
Example
123LAT status; absent keeps the stored value.
Click of the tracking link to attribute the install to.
ISO 3166-1 alpha-2; overrides the geo of the ip.
Example
DEThe in-app event. Without it the request only creates (or updates) the install.
object
Ignored: the category is always “external”.
Not used.
object
Id of the event, a UUID; generated when absent or not a UUID.
Example
4f8a7c1e-2b9d-4c55-9a51-0d6f3e2a7b10Event name, letters and digits; a client event name is accepted too.
Example
PurchaseTime of the event, unix seconds, milliseconds or microseconds (detected by magnitude). 0 or absent: the time of the request. More than 5 minutes in the future: 400.
Example
1793527620Event parameters, a flat object: affise_p_revenue, affise_p_currency and others.
object
First launch after the install, unix seconds or milliseconds. See the Time section.
Example
1793527500GAID, a UUID.
Build the install from the click found by ip (probabilistic).
Alias of adid.
IDFV, a UUID.
IP of the device.
More ips of the device for probabilistic attribution, tried after ip.
Partner of the install when nothing else attributes it.
Create the partner named partner_name when nothing else attributes the install.
Click id of the partner to attribute the install to.
Install id, a UUID; a new one for a known affise_device_id is a reinstall.
Example
9a4f0f5e-31d2-4c5b-8a0b-7e7d0f1c2b3aInstall referrer.
The event comes from a test device: environment sandbox.
User agent of the device.
Alias of ua.
Responses
Section titled “ Responses ”Accepted
object
Set when the request was rejected.
object
Example
{ "error": { "text": "event from future" }, "request_id": "6ebb1a30-76ef-42fe-8ba8-c423791de78e"}Rejected: error.text tells why
object
Set when the request was rejected.
object
Example
{ "error": { "text": "event from future" }, "request_id": "6ebb1a30-76ef-42fe-8ba8-c423791de78e"}No credentials (answered with 403 until default-deny is enabled)
object
What went wrong. 403 always says “Access denied”.
Id of the request, to quote to support.
Example
{ "error": "Access denied", "request_id": "6ebb1a30-76ef-42fe-8ba8-c423791de78e"}Invalid credentials or application of another client
object
What went wrong. 403 always says “Access denied”.
Id of the request, to quote to support.
Example
{ "error": "Access denied", "request_id": "6ebb1a30-76ef-42fe-8ba8-c423791de78e"}Internal server error
object
What went wrong. 403 always says “Access denied”.
Id of the request, to quote to support.
Example
{ "error": "Access denied", "request_id": "6ebb1a30-76ef-42fe-8ba8-c423791de78e"}