GramClaw API

v1

Steuern Sie Ihren Telegram-Outreach über Skripte, KI-Agenten oder den Telegram-MCP-Server: Nachrichten suchen, die CRM-Pipeline verwalten, benutzerdefinierte Spalten festlegen sowie Nachrichten, Broadcasts und Kampagnen senden. Erstellen Sie einen Schlüssel unter Einstellungen → API-Schlüssel.

Authentifizierung

Jede Anfrage benötigt einen Workspace-API-Schlüssel als Bearer-Token. Erstellen Sie einen unter Einstellungen → API-Schlüssel – der vollständige Schlüssel ( gc_live_…) wird nur einmal angezeigt.

Basis-URL
https://gramclaw.com
Jede Anfrage
Authorization: Bearer gc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Schnellstart
BASE="https://gramclaw.com"
KEY="gc_live_…"
curl -s "$BASE/api/v1/me" -H "Authorization: Bearer $KEY"

Hinweis: API-Aufrufe werden direkt ausgeführt – es gibt keinen Bestätigungsschritt (anders als bei der In-App-KI). Der Schlüssel ist die Autorisierung; schützen Sie ihn wie ein Passwort. Ratenlimit: 120 Anfragen / Minute pro Schlüssel, mit X-RateLimit-* -Headern bei jeder Antwort. Fehler geben { "error": "…" } mit einem 4xx/5xx-Status zurück.

Scopes: Schlüssel tragen read (Chats, Nachrichten, Suche, Analysen), write (Pipeline, Spalten, Webhooks), und/oder send (Nachrichten, Broadcasts, Kampagnen) – wählen Sie sie bei der Erstellung des Schlüssels. Send-POSTs akzeptieren einen Idempotency-Key -Header, damit Wiederholungen nie doppelt senden.

Endpunkte

GET/api/v1/meVerify key & list accountsScope: read

Confirms a key works and returns the workspace plus the connected accounts it can act on (with account ids for broadcasting).

Antwort
{
  "workspace_id": "cbf805da-…",
  "key": { "name": "Claude MCP", "prefix": "gc_live_ab12cd34", "scopes": ["read","send"] },
  "accounts": [
    { "id": "acc_…", "provider": "Telegram", "type": "MESSAGING", "name": "…" }
  ]
}
GET/api/v1/chatsList conversationsScope: read

The workspace's conversations newest-first, served from GramClaw's own store (fast — no provider calls). Cursor-paginated; filter by account, pipeline stage, or column value.

FeldTypHinweise
cursorstringfrom previous next_cursor
limitnumberdefault 50, max 100
account_idstring
stage_keystringonly chats in this stage
column_idstringwith column_value: only matching chats
column_valuestring
Anfrage
curl -s "$BASE/api/v1/chats?stage_key=qualified&limit=20" \
  -H "Authorization: Bearer $KEY"
Antwort
{
  "chats": [{ "id": "…", "name": "Sarah K", "provider": "TELEGRAM",
              "last_message_text": "…", "last_message_at": "…", "unread_count": 2 }],
  "next_cursor": "bzoyMA", "has_more": true
}
GET/api/v1/chats/{id}Get one chatScope: read

One chat enriched with its pipeline stage and custom-column values.

Antwort
{
  "chat": { "id": "…", "name": "Sarah K", "stage_key": "qualified",
            "columns": [{ "column_id": "…", "value": ["High"] }] }
}
GET/api/v1/chats/{id}/messagesRead message historyScope: read

A chat's messages, oldest-first within the page. Pass `before` (ISO timestamp) to page older messages; the response's next_before feeds the next call.

FeldTypHinweise
limitnumberdefault 30, max 100
beforestringISO timestamp — messages older than this
Anfrage
curl -s "$BASE/api/v1/chats/CHAT_ID/messages?limit=50" \
  -H "Authorization: Bearer $KEY"
Antwort
{
  "messages": [{ "id": "…", "text": "Hey!", "is_sender": false,
                 "timestamp": "2026-07-06T10:00:00Z", "attachments": [] }],
  "source": "db", "next_before": "2026-07-01T08:00:00Z"
}
POST/api/v1/chats/startStart a new conversationScope: send

Start (or find) a DM with someone by phone, @username, or provider id — including people never messaged before. Optionally sends a first message. Supports Idempotency-Key.

FeldTypHinweise
account_id*stringaccount to send from (see /me)
identifier*stringphone, @username, or provider id
providerstringhint: TELEGRAM, WHATSAPP, …
textstringoptional first message
Anfrage
curl -s "$BASE/api/v1/chats/start" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"account_id":"acc_…","identifier":"@newlead","text":"Hi!"}'
Antwort
{ "chat": { "id": "…" } }
GET/api/v1/contactsList contactsScope: read

The workspace's contact cache (name + provider id per account). Cursor-paginated, searchable by name.

FeldTypHinweise
cursorstring
limitnumberdefault 100, max 200
account_idstring
qstringname search
Antwort
{
  "contacts": [{ "account_id": "…", "provider_id": "…", "name": "Sarah K" }],
  "next_cursor": null, "has_more": false
}
GET/api/v1/pipelineGet pipeline

The workspace's pipeline stages and which chats sit in each stage. Chats not in placements are in the default 'new' stage.

Antwort
{
  "stages": [{ "key": "new", "label": "New", "terminal": false }, …],
  "placements": [{ "chat_id": "…", "stage_key": "qualified" }]
}
POST/api/v1/pipeline/moveMove a chat to a stage

Move a chat into a pipeline stage.

FeldTypHinweise
chat_id*string
stage_key*stringfrom GET /api/v1/pipeline
Anfrage
curl -s "$BASE/api/v1/pipeline/move" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"…","stage_key":"qualified"}'
Antwort
{ "ok": true, "message": "Moved to **Qualified**." }
GET/api/v1/columnsList custom columns

The workspace's custom columns (tags) with ids, types, and allowed option values.

Antwort
{
  "columns": [
    { "id": "…", "name": "Priority", "type": "select",
      "options": [{ "value": "High", "color": "#f87171" }] }
  ]
}
POST/api/v1/columns/setSet a column value

Set (or clear) a custom-column value on a chat. An empty value array clears it.

FeldTypHinweise
column_id*stringfrom GET /api/v1/columns
chat_id*string
value*string[]empty clears
Anfrage
curl -s "$BASE/api/v1/columns/set" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"column_id":"…","chat_id":"…","value":["High"]}'
Antwort
{ "ok": true, "message": "Set **Priority** = High." }
POST/api/v1/messagesSend a message

Send a single message to an existing chat.

FeldTypHinweise
chat_id*string
text*string
Anfrage
curl -s "$BASE/api/v1/messages" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"…","text":"Hi there!"}'
Antwort
{ "ok": true, "message": "Message sent." }
POST/api/v1/broadcastBroadcast to an audience

Send one message to everyone in a pipeline stage or with a custom-column value. Supports {{name}} personalization. Capped at 30 recipients per call.

FeldTypHinweise
account_id*stringaccount to send from (see /me)
audience_type*"stage" | "column"
audience_ref*stringstage_key, or column_id for column
column_valuestringrequired for column audiences
message_text*stringmay include {{name}}
Anfrage
curl -s "$BASE/api/v1/broadcast" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"account_id":"acc_…","audience_type":"stage",
       "audience_ref":"qualified","message_text":"Hi {{name}}!"}'
Antwort
{ "ok": true, "message": "Broadcast sent to **12** recipients.",
  "recipients": 12, "audience_total": 12, "capped": false }
POST/api/v1/campaignsCreate a campaign (large sends)Scope: send

The API path for sends larger than broadcast's 30-recipient cap (max 5,000 contacts). GramClaw's background worker delivers every message — initial + optional follow-up steps — respecting per-account daily quotas. Supports Idempotency-Key. Also: GET /api/v1/campaigns lists campaigns; GET /api/v1/campaigns/{id} returns status + per-contact detail.

FeldTypHinweise
namestring
account_idstringor account_pool: string[] to rotate accounts
message_text*stringmay include {{name}}
contacts*array[{ name?, identifier, chat_id? }]
stepsarrayfollow-ups: [{ branch, wait_hours, variants[] }]
daily_quota_per_accountnumberdefault 30
Anfrage
curl -s "$BASE/api/v1/campaigns" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: launch-jul-06" \
  -d '{"account_id":"acc_…","message_text":"Hi {{name}}!",
       "contacts":[{"name":"Sarah","identifier":"@sarahk"}]}'
Antwort
{ "campaign": { "id": "…", "status": "queued" }, "queued": true }
GET/api/v1/analyticsCampaign analyticsScope: read

Workspace campaign totals (sent, failed, replies, reply rate) plus the 50 most recent campaigns.

Antwort
{
  "totals": { "campaigns": 12, "sent": 452, "replies": 87, "reply_rate": 0.1925 },
  "campaigns": [ … ]
}
POST/api/v1/webhooksRegister a webhookScope: write

Get pushed events instead of polling: message.received, message.edited, message.deleted, pipeline.moved, campaign.replied. Deliveries are signed (X-GramClaw-Signature: sha256=HMAC_SHA256(secret, body)); the secret is returned once at creation. GET lists endpoints; PATCH /api/v1/webhooks/{id} updates url/events/active; DELETE removes. Max 10 per workspace; 20 consecutive failures auto-disable an endpoint.

FeldTypHinweise
url*stringyour HTTPS endpoint
eventsstring[]omit or ["*"] for all events
Anfrage
curl -s "$BASE/api/v1/webhooks" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/hooks/gramclaw",
       "events":["message.received","pipeline.moved"]}'
Antwort
{ "webhook": { "id": "…", "events": ["message.received","pipeline.moved"] },
  "secret": "whsec_…  ← shown once, signs every delivery" }

Verbinden von Claude / Cursor (Telegram-MCP)

Am einfachsten – Remote-Connector (eine URL). Fügen Sie in Ihrem MCP-Client einen benutzerdefinierten Connector hinzu und fügen Sie Ihre persönliche URL ein. Erstellen Sie einen Schlüssel unter Einstellungen → API-Schlüssel, um die vollständige URL mit Ihrem Schlüssel zu erhalten. Siehe die Telegram-MCP-Übersicht für die Werkzeugliste.

Remote-MCP-URL
https://gramclaw.com/api/mcp?key=gc_live_…

Alternative – lokaler Server (Cursor oder Claude-Desktop-Konfigurationsdatei):

claude_desktop_config.json
{
  "mcpServers": {
    "gramclaw": {
      "command": "npx",
      "args": ["-y", "gramclaw-mcp"],
      "env": {
        "GRAMCLAW_API_KEY": "gc_live_…",
        "GRAMCLAW_BASE_URL": "https://gramclaw.com"
      }
    }
  }
}
Brauchen Sie Hilfe bei der Einrichtung? Besuchen Sie den API- und MCP-Hilfeleitfaden.
Chat on Telegram