GramClaw API

v1

스크립트, AI 에이전트 또는 텔레그램 MCP 서버에서 메시지 검색, CRM 파이프라인 관리, 사용자 지정 열 설정, 메시지·브로드캐스트·캠페인 전송을 할 수 있습니다. 키 생성 위치: 설정 → API 키.

Start with an outcome

View all

인증

모든 요청에는 Bearer 토큰으로 사용할 워크스페이스 API 키가 필요합니다. 설정 → API 키에서 생성하세요 — 전체 키( gc_live_…)는 한 번만 표시됩니다.

기본 URL
https://gramclaw.com
모든 요청
Authorization: Bearer gc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
빠른 시작
BASE="https://gramclaw.com"
KEY="gc_live_…"
curl -s "$BASE/api/v1/me" -H "Authorization: Bearer $KEY"

참고: API 호출은 확인 단계 없이 곧바로 실행됩니다(앱 내 AI와 달리). 키가 곧 인증 수단이므로 비밀번호처럼 관리하세요. 속도 제한: 분당 120건의 요청 (키당). 모든 응답에 X-RateLimit-* 헤더가 포함됩니다. 오류는 { "error": "…" } 를 4xx/5xx 상태 코드와 함께 반환합니다.

스코프: 키에는 read (채팅, 메시지, 검색, 분석), write (파이프라인, 열, 웹훅), 및/또는 send (메시지, 브로드캐스트, 캠페인), or campaign for separately authorized internal campaign reads (and, behind a separate mutation gate and allowlists, campaign creation and cancellation). — 키를 생성할 때 선택합니다. 전송 유형 POST 요청은 Idempotency-Key 헤더를 허용하므로 재시도 시 중복 전송되지 않습니다.

엔드포인트

GET/api/v1/me— Verify key & list Telegram accounts스코프: read

Returns only currently eligible, workspace-scoped internal Telegram accounts plus explicit capabilities.

GET/api/v1/chats— List existing Telegram chats스코프: read

Reads an exact eligible account through scoped Telegram v2. No conversation is created and no message is marked read.

필드유형비고
account_id*string
cursorstring
limitnumberdefault 50, max 100
GET/api/v1/chats/{id}— Get chat and participants스코프: read

Returns provider-neutral metadata and participants for the exact account/chat scope.

필드유형비고
account_id*string
participant_cursorstring
participant_limitnumber
GET/api/v1/chats/{id}/messages— Read message history스코프: read

Reads scoped Telegram history without changing read state.

필드유형비고
account_id*string
beforestring
limitnumber
POST/api/v1/chats/start— Open a chat by Telegram username스코프: send

Resolves a Telegram username and opens its private chat under one exact eligible account. Requires a send-scoped key, the Start Chat feature gate, and a caller-supplied Idempotency-Key. It never sends a message.

필드유형비고
account_id*string
identifier*stringusername, @username, or t.me username link
Idempotency-Key header*string
GET/api/v1/contacts— List observed Telegram contacts스코프: read

Reads account-scoped contacts already observed by GramClaw. Requires both REST API and CRM read access; it never performs a Telegram lookup.

필드유형비고
account_idstring
qstring
cursorstring
limitnumberdefault 100, max 200
GET/api/v1/pipeline— Read scoped Telegram pipeline스코프: read

Returns workspace stages and account-qualified Telegram chat placements. Requires both REST API and Pipeline read access.

POST/api/v1/pipeline/move— Move a scoped Telegram chat스코프: write

Assigns an existing chat to a visible workspace stage. Requires an explicit write-scoped key plus the REST API and Pipeline gates.

필드유형비고
account_id*string
chat_id*string
stage_key*stringvisible key from GET /api/v1/pipeline
GET/api/v1/columns— Read custom columns and scoped values스코프: read

Returns workspace column definitions plus values keyed by both Telegram account and chat. Requires both REST API and CRM read access.

필드유형비고
account_idstringoptional exact account filter for values
POST/api/v1/columns/set— Set a scoped Telegram column value스코프: write

Sets or clears a configured value for one exact account/chat. Requires an explicit write-scoped key plus the REST API and CRM gates.

필드유형비고
account_id*string
chat_id*string
column_id*string
value*string[]empty array clears the value
GET/api/v1/analytics— Read truthful Telegram analytics스코프: read

Reports persisted message activity and durable campaign-send ledger counts. Delivery, read, and engagement are null rather than inferred. Requires both REST API and Analytics read access.

필드유형비고
period"7d" | "30d" | "all"default 7d
GET/api/v1/campaigns— List internal Telegram campaigns스코프: campaign

Lists only workspace-owned internal Telegram campaigns with truthful durable reporting. Requires an explicitly issued campaign scope plus the independent Campaigns gate and user allowlist.

필드유형비고
cursorstring
limitnumberdefault 50, max 100
GET/api/v1/campaigns/{id}— Read internal Telegram campaign detail스코프: campaign

Returns durable recipients, sequence steps, operation state, and reporting. capabilities reflect the key scope, allowlists, gates, and current status. Legacy campaigns remain outside the public execution plane.

POST/api/v1/campaigns— Create a campaign for existing private chats스코프: campaign

Disabled by default behind a separate mutation gate plus exact user and workspace allowlists. Requires a campaign-scoped key and Idempotency-Key. Recipients must be existing private chats of READY internal Telegram accounts (max 20). No @usernames, attachments, or client-supplied names; suppressed recipients reject the request. Campaign, steps and recipients are stored atomically and queued for the worker — this call never sends a message.

필드유형비고
message_text*string1-4096 chars; [[name]]/[[username]] come from Telegram
recipients*{ account_id, chat_id }[]1-20 existing private chats
namestringup to 200 chars
steps{ branch, wait_hours, variants }[]follow-ups; branch no_reply, or seen/unseen when branching is enabled
branching_enabledbooleanrequires the U4 branching gate
daily_quota_per_accountnumber1-50 campaign ceiling, default 50; account tier may enforce a lower limit
max_followupsnumber0-5, default 2
scheduled_at / schedule_timezonestringISO time (≤ 1 year ahead) / IANA zone
Idempotency-Key header*string
응답
{ "campaign": { "id": "…", "status": "queued" }, "recipients": 2, "dispatch": "worker" }
POST/api/v1/campaigns/{id}/pause— Pause an internal sequence campaign스코프: campaign

Requires campaign scope, the REST/campaign mutation gates and Idempotency-Key. Pausing changes queue state only; the durable worker remains the only dispatcher. Sequence campaigns only.

필드유형비고
Idempotency-Key header*string
응답
{ "campaign": { "id": "…", "status": "paused" }, "changed": true, "dispatch": "worker" }
POST/api/v1/campaigns/{id}/resume— Resume an internal sequence campaign스코프: campaign

Requires campaign scope, the REST/campaign mutation gates and Idempotency-Key. Resuming changes queue state only; the durable worker remains the only dispatcher. Sequence campaigns only.

필드유형비고
Idempotency-Key header*string
응답
{ "campaign": { "id": "…", "status": "sending" }, "changed": true, "dispatch": "worker" }
POST/api/v1/campaigns/{id}/cancel— Permanently cancel a campaign스코프: campaign

Same gates as creation plus Idempotency-Key. Atomically cancels a scheduled, queued, sending or paused campaign and stops queued recipients; idempotent and irreversible. A send already handed to Telegram may still complete.

필드유형비고
Idempotency-Key header*string
응답
{ "campaign": { "id": "…", "status": "cancelled", "cancelled_at": "…" }, "changed": true }
POST/api/v1/messages— Send text and optionally one attachment스코프: send

Requires an explicit send-scoped key and caller-supplied Idempotency-Key. Sends only to an existing eligible account/chat. JSON supports plain text; multipart/form-data supports exactly one file up to 25 MiB with optional text. No multi-file support. Ambiguous outcomes are never retried.

필드유형비고
account_id*string
chat_id*string
textstringrequired for JSON; optional with an attachment
attachmentsone filemultipart only; maximum 25 MiB; multiple files rejected
Idempotency-Key header*string
요청
curl -s "$BASE/api/v1/messages" \
  -H "Authorization: Bearer $KEY" -H "Idempotency-Key: unique-operation-123" \
  -F "account_id=ACCOUNT_ID" -F "chat_id=telegram:chat:123" \
  -F "text=See attached" -F "attachments=@./file.pdf"
응답
{ "ok": true, "operation_id": "…", "message": { "id": "telegram:message:…" } }

Claude / Cursor에서 연결 (텔레그램 MCP)

가장 쉬움 — 원격 커넥터(URL). MCP 클라이언트에서 사용자 지정 커넥터를 추가하고 개인 URL을 붙여넣으세요. 설정 → API 키에서 키를 생성하면 키가 포함된 전체 URL을 받을 수 있습니다. 텔레그램 MCP 개요 에서 도구 목록을 확인하세요.

원격 MCP URL
https://gramclaw.com/api/mcp?key=gc_live_…

대안 — 로컬 서버 (Cursor 또는 Claude Desktop 구성 파일):

claude_desktop_config.json
{
  "mcpServers": {
    "gramclaw": {
      "command": "npx",
      "args": ["-y", "gramclaw-mcp"],
      "env": {
        "GRAMCLAW_API_KEY": "gc_live_…",
        "GRAMCLAW_BASE_URL": "https://gramclaw.com"
      }
    }
  }
}
설정에 도움이 필요하신가요? API 및 MCP 도움말 가이드.
Chat on Telegram