Skip to main content

MCP/API

MCP/API is the single programming interface to Qubix. External clients — an AI assistant, a BI script, an automation tool — connect to one endpoint over MCP (Model Context Protocol) and call the methods listed on this page. Every call runs strictly within your permissions: an administrator gets access to the whole account, everyone else — to the data their permission template opens to them.

There is no separate REST API to learn: the methods you see here are exactly what the endpoint serves, so the catalog never drifts from the real interface.

The same methods power the built-in assistant​

These methods are not only for external clients. The built-in Qubix AI assistant — the panel available on every screen of Qubix once a model is connected, with no other setup — calls the very same catalog. So whether you ask the built-in assistant or connect your own AI agent over MCP, both read your data and take actions through the same methods, always within your permissions.

Where to find it​

The page is in your personal settings: open My settings and in the Integrations group choose MCP/API. On the desktop, My settings opens from its icon in the dock.

The endpoint​

Everything goes to one address:

POST https://<your-domain>/api/mcp

The transport is Streamable HTTP (JSON-RPC 2.0): a single endpoint that off-the-shelf MCP clients understand natively and that you can also call directly from any language (see Code examples below).

Your API token​

Programmatic access uses a personal token (PAT) — it is created and managed right on this page, in the Personal token block. Until a token is issued, the block says No token and under it: Create a token to connect an external client.

  1. Click Create token (or Issue new… if you already have one — the page asks you to confirm first).
  2. Copy the token immediately — it is shown only once. The page reminds you: Save the token now: once closed it is not shown again. It is already filled into the examples below. The copy button then reads Copied

The token looks like qbx_…. Qubix stores only its hash and can never show it again. The block shows the token masked, with its last four characters and the day it was created; a token issued before Qubix began recording them shows neither. The line under the token reads Created … · valid until sessions are reset, and for a token without the date, Valid until sessions are reset

  • One token per user. It inherits your role and permissions, so over the API you see exactly the same data and actions as in the interface.
  • Issue new… — after a confirmation, issues a new token; the old one stops working immediately. The question reads Issue a new token?, it explains: The current one stops working at once: clients that use it will no longer connect. and the confirming button is Issue new
  • Revoke… — after a confirmation, deletes the token and cuts off all access that used it. The question reads Revoke the token?, it explains: Clients that use it will no longer connect. and the confirming button is Revoke
Treat the token like a password

A personal token is equivalent to signing in under your account. Do not publish it or share it. If it leaks, click Issue new… here, and the old token stops working immediately.

Connect a client​

Most MCP clients need a small config: the endpoint plus the Authorization header. While the token is shown right after generation, this page already fills the real value into the example below — copy it as is.

JSON
{
"mcpServers": {
"qubix": {
"url": "https://<your-domain>/api/mcp",
"headers": { "Authorization": "Bearer qbx_YOUR_TOKEN" }
}
}
}

For step-by-step setup of a specific assistant (Claude Code, Claude Desktop, Cursor), see Connecting an external AI.

Code examples​

To call the endpoint from your own code, open a session first: initialize returns the session id in the Mcp-Session-Id response header, and every next request carries that header — a request sent before initialize is refused. Every request also carries the authorization and Streamable-HTTP headers. The page offers ready-made examples for cURL, JavaScript and Python — switch the tab and copy. For example, listing the available methods:

Bash
SESSION=$(curl -s -o /dev/null -D - -X POST 'https://<your-domain>/api/mcp' \
-H 'Authorization: Bearer qbx_YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"example","version":"1"}}}' \
| awk -F': ' 'tolower($1) == "mcp-session-id" { print $2 }' | tr -d '\r')

curl -X POST 'https://<your-domain>/api/mcp' \
-H 'Authorization: Bearer qbx_YOUR_TOKEN' \
-H "Mcp-Session-Id: $SESSION" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
Python
import requests

url = "https://<your-domain>/api/mcp"
headers = {
"Authorization": "Bearer qbx_YOUR_TOKEN",
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream",
}
init = requests.post(url, headers=headers, json={
"jsonrpc": "2.0", "id": 1, "method": "initialize",
"params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "example", "version": "1"}},
})
headers["Mcp-Session-Id"] = init.headers["Mcp-Session-Id"]
res = requests.post(url, headers=headers, json={"jsonrpc": "2.0", "id": 2, "method": "tools/list"})
print(res.text)
For custom integrations

These raw calls show the protocol from any language. Off-the-shelf clients (Claude, Cursor) do not need them — they use the config above.

Spend intake by key​

Below the code examples is the Spend intake by key block. It contains the address to which an external program sends Qubix the spend of an ad platform that has no import of its own, the Issue a key button and Request body — a sample request with spend. The block is visible to administrators and to those whose permission template includes Manage traffic sources. An administrator can also issue a key for another person — in the Whose key list next to the button (by default it is set to For myself).

The intake key is not a personal token: it is good only for writing spend and is passed in the request body, not in the Authorization header. How to issue a key, what fields the request has and what the refusals mean — Spend intake by key.

What the API exposes​

The page lists the full method catalog, and each method is tagged read or write. Within your permissions, they cover:

  • Analytics — the dashboard, geo, offers, networks, traffic sources, the Facebook screens and the visitor funnel, plus a drill-down for a single ad, campaign, offer, creative, PWA, geo or traffic source.
  • Creatives — search by meaning and the top-performing creative themes.
  • Britva — viewing auto-pause rules, paused ads and the trigger history; creating, editing and removing rules.
  • Actions — pausing and resuming ads and campaigns; managing offers, networks, traffic sources, tracker campaigns, pixels, websites, domains, PWAs and push campaigns; submitting the spend of ad platforms that have no import of their own — the cost_intake_submit method (more details — Spend intake by key).
  • Free-form queries — a read-only query method for questions the ready-made methods do not cover.

Click a method to open its parameters; the mark beside it says whether it changes data.

The page shows the descriptions of methods and parameters in Russian if your panel is in Russian, and in English if it is in English. With the panel in another language, it takes whichever of these two languages comes first in your browser's language list, and if neither is there — English. A description that has no translation yet is shown in English. An external MCP client receives the descriptions in English.

The search field finds a method by its name, by the displayed description and by the English text of the description.

Write methods are real

Pausing an ad, deleting a rule or an offer through the API changes your live campaigns. In chat clients such actions run only after your confirmation — review what is proposed before approving.

What's next​