Pull the same metrics you see in the advertiser dashboard — campaigns, spend, impressions, clicks, conversions, billing — from scripts, cron jobs, or custom integrations. All endpoints are read-only.
Base URL
https://platform.trygravity.ai
Authentication
Every request must include your Gravity advertiser API key in the X-API-Key header. Grab the key from your dashboard under Settings → API Key.
curl https://platform.trygravity.ai/advertiser-dashboard/info \
-H "X-API-Key: YOUR_API_KEY"
This is the same API key shown on your advertiser settings page. You can regenerate it at any time.
Endpoints
GET /advertiser-dashboard/info
Advertiser profile.
curl https://platform.trygravity.ai/advertiser-dashboard/info \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"advertiser_id": "abc-123",
"name": "Acme Corp",
"email": "ads@acme.com"
}
GET /advertiser-dashboard/campaigns
List all campaigns with lifetime stats (impressions, clicks, spend, conversions).
Filter by campaign status (e.g. active, paused, draft).
curl "https://platform.trygravity.ai/advertiser-dashboard/campaigns" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"campaigns": [
{
"campaign_id": "camp-456",
"name": "Summer Sale",
"status": "active",
"is_active": true,
"daily_budget": 100.0,
"landing_page": "https://acme.com/summer",
"campaign_objective": "conversions",
"created_at": "2025-05-01T00:00:00",
"start_time": "2025-05-01T00:00:00",
"end_time": null,
"impressions": 350000,
"clicks": 1800,
"spend": 875.50,
"conversions": 42,
"conversion_value": 4200.00
}
]
}
GET /advertiser-dashboard/campaigns/
Single campaign detail with full stats and targeting config.
curl "https://platform.trygravity.ai/advertiser-dashboard/campaigns/camp-456" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"campaign_id": "camp-456",
"name": "Summer Sale",
"status": "active",
"is_active": true,
"daily_budget": 100.0,
"landing_page": "https://acme.com/summer",
"campaign_objective": "conversions",
"created_at": "2025-05-01T00:00:00",
"start_time": "2025-05-01T00:00:00",
"end_time": null,
"allowed_countries": ["US", "CA"],
"allowed_devices": ["desktop", "mobile"],
"utm_params": { "utm_source": "gravity", "utm_medium": "ai" },
"deployment_status": "deployed",
"impressions": 350000,
"clicks": 1800,
"spend": 875.50,
"conversions": 42,
"conversion_value": 4200.00
}
GET /advertiser-dashboard/metrics
Daily time-series performance metrics.
Number of days to look back (1–365).
Start date (YYYY-MM-DD). Overrides days when paired with end_date.
Filter to a single campaign. Omit for aggregate metrics across all campaigns.
curl "https://platform.trygravity.ai/advertiser-dashboard/metrics?days=7" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"data": [
{
"date": "2025-05-20",
"impressions": 50000,
"clicks": 260,
"spend": 125.00,
"conversions": 6,
"revenue": 600.00,
"ctr": 0.52,
"cpc": 0.48,
"cpm": 2.50,
"conversion_rate": 2.31,
"cpa": 20.83,
"roas": 4.80
}
],
"total_impressions": 350000,
"total_clicks": 1800,
"total_spend": 875.50,
"total_conversions": 42,
"total_revenue": 4200.00
}
| Metric | Description |
|---|
ctr | Click-through rate (clicks / impressions × 100). |
cpc | Cost per click (spend / clicks). |
cpm | Cost per mille (spend / impressions × 1000). |
conversion_rate | Conversions / clicks × 100. |
cpa | Cost per acquisition (spend / conversions). |
roas | Return on ad spend (revenue / spend). |
GET /advertiser-dashboard/conversions
Recent conversions with pagination. Returns attributed and unattributed conversions.
Opaque pagination cursor (pass next_cursor from a previous response).
Filter to a single campaign.
Filter by conversion event type (e.g. purchase, lead).
curl "https://platform.trygravity.ai/advertiser-dashboard/conversions?limit=10" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"conversions": [
{
"conversion_id": "conv-789",
"event_type": "purchase",
"value_cents": 9999,
"currency": "USD",
"conversion_timestamp": "2025-05-20T14:30:00",
"campaign_id": "camp-456",
"order_id": "order-abc",
"page_url": "https://acme.com/checkout/success",
"source": "capi",
"is_attributed": true
}
],
"total_conversions": 42,
"has_more": true,
"next_cursor": "conv-788"
}
GET /advertiser-dashboard/billing
Billing summary — total spend, billed, unbilled, credits.
curl "https://platform.trygravity.ai/advertiser-dashboard/billing" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"total_spend_dollars": 875.50,
"total_billed_dollars": 800.00,
"unbilled_dollars": 75.50,
"credits_dollars": 0.00,
"billing_enabled": true,
"last_spend_sync_at": "2025-05-20T15:00:00",
"last_billed_at": "2025-05-19T00:00:00"
}
GET /advertiser-dashboard/events/analytics
Pixel event analytics — domain breakdowns, time-series, and event type counts from your tracking pixel.
Number of days to look back (1–365).
Start date (YYYY-MM-DD). Overrides days when paired with end_date.
Filter by domain (partial match).
Filter by event type (e.g. page_view, form_submit, click).
curl "https://platform.trygravity.ai/advertiser-dashboard/events/analytics?days=30" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"domains": [
{ "domain": "acme.com", "events": 12500 },
{ "domain": "blog.acme.com", "events": 3200 }
],
"time_series": [
{ "date": "2025-05-20T00:00:00", "events": 850 },
{ "date": "2025-05-20T01:00:00", "events": 720 }
],
"event_types": [
{ "event_type": "page_view", "total": 10000, "last_received": "2025-05-20T15:00:00" },
{ "event_type": "form_submit", "total": 500, "last_received": "2025-05-20T14:30:00" }
],
"has_historical_data": true
}
GET /advertiser-dashboard/events/conversion-stats
Conversion time-series from conversion_stats_hourly — daily totals and per-event-type breakdowns.
Number of days to look back (1–365).
Start date (YYYY-MM-DD). Overrides days when paired with end_date.
Filter by conversion event type (e.g. purchase, lead).
curl "https://platform.trygravity.ai/advertiser-dashboard/events/conversion-stats?days=30" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"time_series": [
{ "date": "2025-05-20T00:00:00", "conversions": 8 },
{ "date": "2025-05-21T00:00:00", "conversions": 12 }
],
"total": 42,
"by_event_type": [
{ "event_type": "purchase", "total": 30 },
{ "event_type": "lead", "total": 12 }
]
}
GET /advertiser-dashboard/integrations
Connected integrations — Shopify stores and Calendly accounts.
curl "https://platform.trygravity.ai/advertiser-dashboard/integrations" \
-H "X-API-Key: YOUR_API_KEY"
Response
{
"shopify": [
{
"id": "conn-123",
"shop_domain": "acme-store.myshopify.com",
"is_active": true,
"connected_at": "2025-04-01T12:00:00",
"verification_status": "verified"
}
],
"calendly": [
{
"id": "conn-456",
"is_active": true,
"connected_at": "2025-03-15T09:00:00"
}
]
}
Code examples
import requests
API_KEY = "your-api-key"
BASE = "https://platform.trygravity.ai/advertiser-dashboard"
# Get last 30 days of metrics
metrics = requests.get(
f"{BASE}/metrics",
headers={"X-API-Key": API_KEY},
params={"days": 30},
).json()
print(f"Impressions: {metrics['total_impressions']:,}")
print(f"Spend: ${metrics['total_spend']:.2f}")
print(f"Conversions: {metrics['total_conversions']}")
print(f"ROAS: {metrics['total_revenue'] / metrics['total_spend']:.2f}x" if metrics['total_spend'] > 0 else "")
Errors
| Status | Description |
|---|
401 | Invalid or missing X-API-Key. |
400 | Invalid parameter (e.g. out-of-range days). |
404 | Campaign not found or doesn’t belong to your account. |
422 | Missing required parameter. |
Questions
Email support@trygravity.ai for anything API-related. We read it.