Skip to main content
Pull the same metrics you see in the dashboard (revenue, impressions, placements, devices, geography) from scripts, cron jobs, or custom integrations. Reporting endpoints are read-only; POST /publisher-dashboard/placements lets you create placements programmatically.

Base URL

Authentication

Every request must include your Gravity API key in the X-API-Key header. Grab the key from your dashboard under Settings → Platform Settings.
This is the same API key used to serve ads. No extra credentials required.

Endpoints

GET /publisher-dashboard/info

Publisher profile and lifetime totals.
string
required
Your Gravity API key.
Response

GET /publisher-dashboard/stats

Daily performance time series — impressions, clicks, revenue, CPM, CPC, CTR.
integer
default:"30"
Number of days to look back (1–3650).
string
Start date (YYYY-MM-DD). Overrides days when paired with end_date.
string
End date (YYYY-MM-DD).
string
default:"UTC"
IANA timezone for date bucketing (e.g. America/New_York).
Response

GET /publisher-dashboard/activity

Ad request funnel — requests, wins, impressions, fill rate, show rate.
integer
default:"7"
Number of days (1–30).
string
Start date (YYYY-MM-DD).
string
End date (YYYY-MM-DD).
string
default:"UTC"
IANA timezone.
Response

GET /publisher-dashboard/placements

Per-placement performance breakdown with daily time series.
integer
default:"7"
Number of days (1–365).
string
Start date (YYYY-MM-DD).
string
End date (YYYY-MM-DD).
Response

POST /publisher-dashboard/placements

Create a new placement (ad slot) without using the dashboard. The returned slug is the placement_id to send on ad requests. The placement is created active. A new placement can take up to 15 minutes to become servable while the placement cache refreshes; ad requests sent before then get no ad for that slot.
string
required
Display name (max 100 characters). The slug is derived from it ("Sidebar Slot"Sidebar-Slot) and must be unique per publisher.
string
default:"below_response"
One of above_response, below_response, inline_response, left_response, right_response, search_result, center_page, top_page, bottom_page, left_page, right_page.
string
default:"all"
One of all, desktop, mobile, tablet.
string
default:"any"
One of any, react, nextjs, vite, react-native, swift, vanilla, other.
string
URL of the page or screen where the slot lives.
string
Free-form notes.
object
Optional { "max_ad_text_chars": integer }: caps ad body length for this slot. Minimum 120.
Response (201 Created)

GET /publisher-dashboard/devices

Performance breakdown by device type (desktop, mobile, tablet).
integer
default:"30"
Number of days (1–365).
string
Start date (YYYY-MM-DD).
string
End date (YYYY-MM-DD).
Response

GET /publisher-dashboard/geography

Per-country performance breakdown.
integer
default:"30"
Number of days (1–365).
string
Start date (YYYY-MM-DD).
string
End date (YYYY-MM-DD).
Response

GET /publisher-dashboard/countries

Top countries by user count.
integer
default:"20"
Number of countries to return (1–100).
Response

MCP server

The reporting endpoints above are also exposed as an MCP server, so AI agents and MCP-capable clients can query your account directly.
  • Endpoint: POST https://platform.trygravity.ai/mcp (JSON-RPC 2.0 over HTTP)
  • Auth: X-API-Key header (or Authorization: Bearer <key>)
A publisher API key unlocks read-only tools mirroring this API: publisher_get_info, publisher_get_stats, publisher_get_activity, publisher_get_placements, publisher_get_devices, publisher_get_geography, and publisher_get_countries.

Code examples

Errors

Questions

Email support@trygravity.ai for anything API-related. We read it.