Skip to content

Call a tool

After this page you can run any tool over HTTP. Every tool is one POST /api/public/v1/call with a body that names it; the same tool over MCP takes the same arguments and returns the same result.

{ "name": "<tool>", "arguments": { } }

arguments may be left out for a tool that takes none. The answer is the tool’s result as JSON. A key sees only the tools its scopes allow; GET /tools.json lists them with their schemas, and every tool has a page under Reference.

Start with whoami: it needs no scope and tells you what the key may do and what is missing.

curl https://countviews.com/api/public/v1/call \
-H "Authorization: Bearer $COUNTVIEWS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"whoami","arguments":{}}'

dryRun: true runs the real code in a transaction that is rolled back: you get the answer the real call would give and nothing is kept. No idempotency key is needed. The header Prefer: dry-run does the same; if you send both, they must agree.

curl https://countviews.com/api/public/v1/call \
-H "Authorization: Bearer $COUNTVIEWS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"campaign_draft_save","arguments":{"externalRef":"spring-2026","title":"Spring launch","kind":"clips","platforms":["youtube_shorts"],"topics":["gaming"],"budget":{"amount":50000,"currency":"EUR"},"rate":{"amount":100,"currency":"EUR"},"maxPayoutPerVideo":{"amount":20000,"currency":"EUR"},"dryRun":true}}'

Money is { "amount", "currency" } with amount in cents.

Every write needs an idempotencyKey argument or an Idempotency-Key header: any string of letters, digits and . _ : -, up to 128 characters. Send the same key and body again and you get the first answer with replayed: true and the header Idempotent-Replayed: true. A different body under a used key is 409 idempotency_conflict; a key whose first attempt is still running is 409 idempotency_in_flight.

curl https://countviews.com/api/public/v1/call \
-H "Authorization: Bearer $COUNTVIEWS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"campaign_draft_save","arguments":{
"externalRef":"spring-2026","title":"Spring launch","kind":"clips",
"platforms":["youtube_shorts"],"topics":["gaming"],
"budget":{"amount":50000,"currency":"EUR"},
"rate":{"amount":100,"currency":"EUR"},
"maxPayoutPerVideo":{"amount":20000,"currency":"EUR"},
"idempotencyKey":"save-spring-2026-1"}}'

The answer lists what is still missing before the draft can be published and complete: true once nothing is.

campaign_activate spends money, so it may answer with HTTP 202 and status: "approval_required". Nothing was spent. A person was emailed and approves in the workspace.

curl https://countviews.com/api/public/v1/call \
-H "Authorization: Bearer $COUNTVIEWS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"campaign_activate","arguments":{"quoteId":"<quoteId from campaign_quote_issue>","idempotencyKey":"launch-spring-2026-1"}}'
{
"status": "approval_required",
"slug": "spring-2026",
"approvalId": "…",
"reason": "first_activation",
"approveAt": "https://countviews.com/…",
"expiresAt": "2026-10-21T10:00:00Z"
}

The answer also carries reserve and fee (the amount that would be held and the commission inside it). Values above are illustrative.

Do not call campaign_activate again. Poll approval_status with the approvalId (or watch events_list for campaign.activated and approval.rejected) and tell the person where to approve. The request lapses after 24 hours. Why a person is asked: Money and approvals.

Status Meaning
200 Done.
202 approval_required: nothing spent, a person decides.
401 Key wrong, revoked, or its maker is gone.
403 scope_missing or permission_missing.
402, 409, 422 Refused; the code says why and, for money, that nothing was spent.
429 Over a limit: wait Retry-After seconds, then repeat the same call.
503 api_unavailable or sandbox_busy: wait and repeat with the same key.