Help center › AI and API

Claude, ChatGPT and the API

Ask about your data right in Claude, ChatGPT, Gemini, Copilot or Cursor, or read it from scripts and BI tools — one workspace at a time. Apps read data; the one thing they can change, if an admin allows it, is campaigns — after you confirm each change.

MCP: Claude, ChatGPT and other apps

The AI and API page shows the MCP server address of your workspace — it ends with /mcp.

  • claude.ai or Claude Desktop: Settings → Connectors → Add custom connector, paste the address, then sign in to Megametrics and allow access.
  • ChatGPT: add a custom connector (MCP) with the address in the settings, then sign in and allow access.
  • Claude Code: run the command shown on the page:
claude mcp add --transport http megametrics https://<your address>/mcp
  • Gemini CLI: add the server to mcpServers in ~/.gemini/settings.json, with an API key:
"megametrics": {"httpUrl": "https://<your address>/mcp", "headers": {"Authorization": "Bearer <key>"}}
  • Gemini Enterprise: add a custom MCP connector with the same address and key.
  • Copilot, Cursor and others: the same address, with an API key in the header Authorization: Bearer <key>.

When an app connects, you see what it asks for and choose the workspace it may read. It can see the projects, their sources and loaded data, read reports and run read-only queries. It can't change data, settings, the team or billing; campaigns only as described below. Connected apps on the AI and API page lists them, and Revoke cuts access at once.

What the apps can do over MCP: list projects, describe the data, read the overview, query a slice like Explorer does, run a read-only SQL query, list signals and show a person's journey to a conversion — touches with their shares, without the email or phone. Every answer comes with the SQL that produced its rows. They can also change campaigns (below) and run three marketing checks that need no data.

Change campaigns from the chat

Ask the assistant which campaigns waste budget, then tell it what to change: pause or resume a campaign in Google Ads, Yandex Direct, Meta, TikTok, Microsoft Advertising, LinkedIn or Snapchat, or set its daily budget. It works in two steps:

  1. Preview. The assistant reads the campaign on the platform now and shows what is there and what will be. Nothing changes yet. The preview checks the same things as the board: a campaign stopped by review or out of funds is left to the platform, a budget shared by several campaigns is changed in Google Ads, and a budget can't grow more than five times in one go.
  2. Apply. Only after you agree. The campaign is read once more right before the change; if someone changed its budget on the platform since the preview, nothing is overwritten. One preview applies once and lasts 10 minutes.

Every change goes into the campaign history on the board with your name and the mark through an AI assistant, failed attempts too.

Marketing utilities

Three checks work without any connected data:

  • UTM link. Give the landing page and the platform, and the assistant returns the link with the labels from Labels in ad links: the platform's macro puts the campaign ID into utm_campaign. It also says which field of the platform to paste them into.
  • Ad copy limits. Headlines, descriptions and texts against each field's limit: hard limits of Google Ads, Microsoft Advertising, Yandex Direct, TikTok and X, and recommended lengths of Meta and LinkedIn.
  • Page speed. Google PageSpeed Insights for a public page: the performance score, lab metrics, real visitors' metrics when Google has them, and what would save the most time.

Ask for them in plain words, for example “build a UTM link for this page for Meta” or “do these headlines fit Google Ads?”.

It's off by default. An owner or admin turns on AI assistants can change campaigns in the MCP block of the AI and API page. Then the assistant changes campaigns only for a person who is an admin or owner right now. An app connected with sign-in needs nothing else; an API key also needs Can also change campaigns through MCP. The demo doesn't change campaigns.

API keys

API keys on the AI and API page are for scripts, BI tools and MCP clients without sign-in. A key reads one workspace on behalf of the person who created it and can't change anything. Name it, click Create key and copy it right away — it is shown once and stored only as a hash. Revoke stops it at once. When someone leaves the workspace, their keys stop working.

Only owners and admins manage keys.

Query API

The same data as Explorer, over HTTPS with a key:

  • GET /api/projects — the projects of the workspace;
  • POST /api/projects/<project>/explore — any slice as JSON, with the SQL that produced it;
  • POST /api/projects/<project>/explore/download — the same slice as a CSV or Excel file.
curl -H "Authorization: Bearer $MEGAMETRICS_KEY" https://<your address>/api/projects

The query format is the one Explorer puts in the page address and in saved queries. A query of the attribution dataset also holds the model, the window and the date, see Attribution and customer journeys. A query returns the first 1,000 rows; add "full": true for up to 100,000. In the data catalog every metric says whether it can be summed across rows (additive) — useful for BI tools, which must not add up ratios.

Set up many exports at once

An agency often needs the same report for every client. Create a key with Can also create and change exports — such a key also creates and changes saved queries and exports, and still can't touch accounts, the team or billing. It never does more than the person who created it can do now: if they lose their role, the key loses the right too.

  • POST /api/bulk/exports — up to 100 exports in one call. Each item names the project, the query (name and spec), the destination with its settings and, if needed, a schedule. Every item stands on its own: the answer says which ones were created and why the others weren't.
  • PATCH /api/bulk/exports — pause, resume, reschedule or delete up to 200 exports at once. All of them are checked first: if any is out of reach, nothing changes.
curl -X POST -H "Authorization: Bearer $MEGAMETRICS_KEY" -H "Content-Type: application/json" \
  -d '{"items": [{"project": "rawai-shore", "name": "Weekly spend", "destination": "email",
       "spec": {"dataset": "ads", "metrics": ["cost"], "dimensions": ["campaign"], "range": {"preset": "last_7_days"}},
       "config": {"recipients": ["client@example.com"]},
       "schedule": {"frequency": "weekly", "weekday": 1, "minute_of_day": 540, "timezone": "Europe/Berlin"}}]}' \
  https://<your address>/api/bulk/exports

Send events from your server

A key with Can also send events sends sign-ups and payments from your server, CRM or checkout to a project. It can't change anything else, and like the exports right, it never does more than the person who created it can do now. Like any key, it reads all the workspace's data: give it to a forms service or a CRM only if you trust them.

  • POST /api/projects/<project>/events — one event. event_name is required; mm_token, email, phone or external_id say whose it is; order_id or idempotency_key keep a repeat from counting twice. The answer is {"id": "…", "duplicate": false}.
curl -X POST -H "Authorization: Bearer $MEGAMETRICS_KEY" -H "Content-Type: application/json" \
  -d '{"event_name": "Lead", "email": "anna@example.com", "idempotency_key": "form-8812"}' \
  https://<your address>/api/projects/<project>/events

An email or phone sent as is is hashed on receipt and never stored. All the fields, the visitor token from the website and webhooks from Stripe and Shopify are in Website code and events.

Next: Team and security

Didn't find the answer?

Write to us — a person replies within one working day.