Skip to main content

Server-to-Server (S2S) API

Send events directly from your backend using standard HTTP requests. No SDK installation required — works with any programming language.


Base URL

https://sdk-api.gamerebellion.com/api/v1

Authentication

All requests require the X-API-Key header:

X-API-Key: <YOUR_API_KEY>

Endpoints

Single Event

POST /api/v1/event

Send a single event:

{
"event_type": "transaction",
"identifiers": {
"player_id": "player-12345",
"device_id": "device-uuid"
},
"utm": {
"source": "facebook",
"medium": "cpc",
"campaign": "summer_2026"
},
"payload": {
"amount": 4.99,
"currency": "USD",
"type": "iap",
"description": "Premium Sword",
"status": "success",
"usd_value": 4.99
}
}

Batch Events

POST /api/v1/events

Send up to 100 events in a single request:

{
"events": [
{ "event_type": "impression", "payload": { ... } },
{ "event_type": "click", "payload": { ... } },
{ "event_type": "conversion", "payload": { ... } }
]
}

Session Management

POST /api/v1/sessions/start
POST /api/v1/sessions/stop
POST /api/v1/sessions/end

Response Codes

CodeMeaning
200Event(s) accepted
400Invalid request body or missing required fields
401Invalid or missing API key
403API key revoked or insufficient permissions
429Rate limit exceeded
500Server error — retry with exponential backoff

Rate Limits

TierLimit
Free100 requests/minute
Pro1,000 requests/minute
EnterpriseCustom

Rate limit headers are included in every response:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 997
X-RateLimit-Reset: 1679616000

Python Example

A complete Python client for the S2S API:

import os
import requests
import time

class GameRebellionS2SClient:
def __init__(self, api_key: str, base_url: str = "https://sdk-api.gamerebellion.com"):
self.base_url = base_url
self.session = requests.Session()
self.session.headers.update({
"X-API-Key": api_key,
"Content-Type": "application/json"
})

def track_event(self, event_type: str, payload: dict, identifiers: dict = None, utm: dict = None):
body = {"event_type": event_type, "payload": payload}
if identifiers:
body["identifiers"] = identifiers
if utm:
body["utm"] = utm
return self.session.post(f"{self.base_url}/api/v1/event", json=body)

def track_batch(self, events: list):
return self.session.post(f"{self.base_url}/api/v1/events", json={"events": events})

def track_impression(self, campaign_id: str, **kwargs):
return self.track_event("impression", {"campaign_id": campaign_id, **kwargs})

def track_click(self, campaign_id: str, **kwargs):
return self.track_event("click", {"campaign_id": campaign_id, **kwargs})

def track_conversion(self, campaign_id: str, conversion_type: str, **kwargs):
return self.track_event("conversion", {
"campaign_id": campaign_id,
"conversion_type": conversion_type,
**kwargs
})

# Usage — load credentials from environment, never hardcode
client = GameRebellionS2SClient(os.environ["GR_API_KEY"])

# Track a single event
client.track_event("transaction", {
"amount": 4.99,
"currency": "USD",
"type": "iap",
"status": "success"
}, identifiers={"player_id": "player-12345"})

# Track marketing attribution chain
client.track_impression("summer_2026", platform="facebook", creative_id="video_v3")
client.track_click("summer_2026", creative_id="video_v3")
client.track_conversion("summer_2026", "install")

cURL Example

curl -X POST https://sdk-api.gamerebellion.com/api/v1/event \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"event_type": "feature_use",
"identifiers": {"player_id": "player-12345"},
"payload": {
"type": "test",
"name": "first_event",
"category": "setup"
}
}'