Docs

GraphQL API

One typed endpoint that unifies your dashboard reads.

Why GraphQL

The gateway folds reads that used to take several REST calls — your profile, performance overview, campaigns, sites and conversion goals — into a single request. It proxies the existing REST services, so data and permissions are identical.

Endpoint & auth

POST your query to https://api.mpwa.to/graphql with a Bearer access token — the same token the REST API uses.

curl
curl -fsS https://api.mpwa.to/graphql \
  -H "Authorization: Bearer eyJ…" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ me { role } campaigns { id name status } }"}'

Example query

Ask for exactly the fields you need; unused branches cost nothing.

query.graphql
query Dashboard {
  me { id email role }
  overview(from: "2026-05-25T00:00:00Z", to: "2026-06-01T00:00:00Z") {
    impressions
    clicks
    ctr
    revenueMicros
  }
  campaigns { id name status }
  conversionsByGoal(windowDays: 30) { name conversions }
}

Schema

The current read schema. campaigns needs the advertiser role; sites needs the publisher role.

schema.graphql
type Query {
  me: Me!
  overview(from: String, to: String): Overview
  conversionsByGoal(windowDays: Int): [ConversionGoal!]!
  campaigns: [Campaign!]!   # advertiser role
  sites: [Site!]!           # publisher role
}

Try it in GraphiQL

Open the in-browser IDE, add an Authorization header, and run queries live.

Open GraphiQL

Prefer REST? See the REST API reference →