Skip to main content

Server-to-server events

Send events directly from your server to Adtrace using the S2S Event API. S2S events appear the same as SDK events in the panel.

The SDK handles queuing, retries, and client-side delivery, so send routine in-app events through the SDK when possible. Use S2S for sensitive or server-validated events — not for every event in your app.

Install is required

Before any S2S event is accepted, the device must have a recorded install. Integrate the Adtrace SDK on Android, iOS, or Web first, then send selected events from your server.

Important

Verify the device has an install in the Testing Console in the panel before you send S2S events.

Sending past or aggregated revenue

You can send S2S events at any time after an install exists for a device.

TopicBehavior
InstallMust already exist for that device.
Event timeBy default, the timestamp is when Adtrace receives the request.
sent_atOptional ISO 8601 value if you need a specific event time.
Historical backfillYou can send aggregated past revenue in one call, but it does not recreate individual past event rows unless you send separate requests with appropriate sent_at values.

Endpoint

URLhttps://s2s.adtrace.io/s2s/event
MethodPOST
Content-Typeapplication/json
AuthorizationToken <S2S API KEY>

Get your S2S API key from the Adtrace panel (Dashboard → Settings).

Common request body fields

FieldRequiredDescription
app_tokenYesYour app token from the panel. Example: abc123xyz456
event_tokenYesYour event token from the panel. Example: xyz123
os_nameYes*"android" or "ios" for mobile. See Web for web identifiers.
revenueNoRevenue amount as a string. Example: "5000000"
currencyNoCurrency label. Required when revenue is set. Example: "IRR"
sent_atNoEvent timestamp in ISO 8601. Example: 2024-01-01T01:01:01.001Z+0000
event_value_paramsNoEvent parameters as a JSON string. Example: "{\"key1\":\"value1\"}"

* Web events may use web_uuid without os_name — see the Web section below.

Every request must include one platform device identifier. Do not omit all identifiers.

Android

Set os_name to "android" (lowercase).

FieldRequiredDescription
gps_adidOne required*Google Play Services advertising ID.
adtrace_adidOne required*Adtrace device ID (adid). Use when gps_adid is unavailable.

Read identifiers from the Android SDK or the Testing Console.

Example (Android)

curl --location --request POST 'https://s2s.adtrace.io/s2s/event' \
--header 'Authorization: Token YOUR_S2S_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_token": "YOUR_APP_TOKEN",
"os_name": "android",
"gps_adid": "DEVICE_GPS_ADID",
"event_token": "YOUR_EVENT_TOKEN",
"revenue": "5000000",
"currency": "IRR"
}'

Example with adtrace_adid (Android)

curl --location --request POST 'https://s2s.adtrace.io/s2s/event' \
--header 'Authorization: Token YOUR_S2S_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_token": "YOUR_APP_TOKEN",
"os_name": "android",
"adtrace_adid": "DEVICE_ADTRACE_ADID",
"event_token": "YOUR_EVENT_TOKEN"
}'

iOS

Set os_name to "ios" (lowercase).

FieldRequiredDescription
idfaOne required*Apple Identifier for Advertisers. Available only when the user authorizes tracking.
adtrace_adidOne required*Adtrace device ID (adid). Use when idfa is unavailable.

Read identifiers from the iOS SDK or the Testing Console.

Example (iOS)

curl --location --request POST 'https://s2s.adtrace.io/s2s/event' \
--header 'Authorization: Token YOUR_S2S_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_token": "YOUR_APP_TOKEN",
"os_name": "ios",
"idfa": "DEVICE_IDFA",
"event_token": "YOUR_EVENT_TOKEN",
"revenue": "9.99",
"currency": "USD"
}'

Example with adtrace_adid (iOS)

curl --location --request POST 'https://s2s.adtrace.io/s2s/event' \
--header 'Authorization: Token YOUR_S2S_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_token": "YOUR_APP_TOKEN",
"os_name": "ios",
"adtrace_adid": "DEVICE_ADTRACE_ADID",
"event_token": "YOUR_EVENT_TOKEN"
}'

Web

For web integrations, send web_uuid or adid as the device identifier. Retrieve web_uuid with Adtrace.getWebUUID() and pass it to your backend.

FieldRequiredDescription
web_uuidOne required*Web device identifier from the Web SDK.
adidOne required*Adtrace device ID from attribution. Use when web_uuid is unavailable.

Example (Web)

curl --location --request POST 'https://s2s.adtrace.io/s2s/event' \
--header 'Authorization: Token YOUR_S2S_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_token": "YOUR_APP_TOKEN",
"web_uuid": "DEVICE_WEB_UUID",
"event_token": "YOUR_EVENT_TOKEN"
}'

See Web FAQ — S2S events for web-specific guidance.

Troubleshooting

StatusErrorWhat to do
404Install for device not foundNo install record exists. Open the app or site so the SDK sends an install, then verify in the Testing Console.
404Device ids not foundInclude a platform device identifier (gps_adid, idfa, web_uuid, or adtrace_adid).
403IP address is not validAdd your server IP to the IP allowlist in the panel. Run curl ident.me on the server to confirm the outbound IP.
400Os name must be android or iosSet os_name to "android" or "ios" exactly (lowercase) for mobile requests.