API keys, the REST API, and the Telegram MCP server

Create API keys, call the public REST API, and connect the Telegram MCP server to Claude, Cursor, or your own agent.

GramClaw exposes the same Telegram engine two ways: a REST API for custom automation, and a remote MCP (Model Context Protocol) server for AI agents. Both authenticate with an API key you create in Settings, both respect the same per-account pacing that keeps your Telegram accounts healthy, and both require an active subscription or trial.

In practice: the REST API is for code — sync contacts from your product, trigger a campaign when a user signs up, pipe conversations into your data warehouse. The MCP server is for agents — Claude Desktop, Claude Code, Cursor, or your own agent gets tools to list chats, read messages, send replies, run broadcasts, and manage the pipeline, with no code written.

Create an API key

  1. 1

    Open Settings → API Keys

    Generate a key and choose its scopes — read for listing and reading data, send for anything that writes or messages. Scope keys to the minimum they need.

  2. 2

    Copy it once

    The full key (gc_live_…) is shown only at creation — store it in a secrets manager. If it leaks, delete it in Settings and it stops working immediately.

  3. 3

    Authenticate

    REST: send it as an Authorization: Bearer header. MCP: put it in the server URL as the key parameter.

The REST API in one minute

The API covers the platform surface: accounts, chats, messages, contacts, campaigns, broadcasts, pipeline columns, and analytics. Requests are plain JSON over HTTPS. Full endpoint documentation — every route, its scopes, and request/response examples — lives on the API docs page, and a machine-readable OpenAPI spec is available at /openapi.json for codegen or for handing to an LLM.

Connect the MCP server

  1. 1

    Copy the server URL

    https://gramclaw.com/api/mcp?key=gc_live_… — the key both identifies and authorizes you, scoped to the accounts it may act on.

  2. 2

    Add it to your MCP client

    Claude Desktop, Claude Code, Cursor, or any MCP-compatible client accepts a remote server URL. No local install, no proxy.

  3. 3

    Ask for real work

    Once connected, your agent can search chats, draft and send replies, launch campaigns, check campaign status, and move deals through the pipeline — every send subject to the same account pacing as the rest of GramClaw.

Good practices

  • One key per integration, named accordingly, so revoking one thing never breaks another.
  • Prefer read-only scopes for dashboards and analytics jobs.
  • Rotate keys when teammates leave and delete keys you no longer use — revocation is instant.
  • Remember that API and MCP sends are real Telegram messages from your real accounts: the same consent and volume judgment applies as in the app.

Frequently asked questions

Where is the full endpoint reference?
The API documentation page lists every endpoint, its scopes, and request/response examples, and the OpenAPI spec at /openapi.json is available for tooling.
How do I revoke a key?
Delete it from Settings → API Keys; it stops working immediately.
Does the MCP server work with clients other than Claude?
Yes — any MCP-compatible client can connect to the remote server URL. Claude Desktop, Claude Code, and Cursor are the most common.
Do API sends bypass account pacing?
No. Everything that sends — app, campaigns, REST, MCP — goes through the same per-account throttling that protects your Telegram accounts.
Chat on Telegram