Skip to content

API, CLI and MCP

Everything you can do in the app, your code and your agents can do too: submit links, uploads or whole accounts, wait for the tags, and read the results. One contract with three ways in. Jobs are async, writes are idempotent, and you see the cost before and after.

New to Garfunkel? See how a post is analyzed.

Quickstart

Create an API key in the app under Settings → Developers, set it as GARFUNKEL_API_KEY, then pick your way in. MCP clients can also sign in with OAuth instead of a key.

export GARFUNKEL_API_KEY=gma_live_…
garfunkel submit urls.txt --category sports --dry-run
garfunkel submit urls.txt --category sports --wait
garfunkel results export job_… --format jsonl

Authentication

Send Authorization: Bearer gma_live_… — an org-scoped API key from API keys. The CLI and MCP read GARFUNKEL_API_KEY. Every POST accepts an Idempotency-Key; replays return the original response and never double-charge.

Submit a job

Submitting returns a job id immediately (202). priority is standard (cheaper, minutes to hours) or fast. Set dry_run: true for a free estimate with per-item validation.

curl -X POST https://garfunkel.gar-ai.com/api/v1/jobs \
  -H "Authorization: Bearer $GARFUNKEL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "items": [{ "url": "https://www.tiktok.com/@user/video/7412345678901234567" }],
    "options": { "translate_to": "en" },
    "dry_run": true
  }'

Item statuses: queued → fetching → processing → succeeded | failed | canceled.

Account jobs

“Every post from @handle since 2025-01-01.” Counting costs 2¢ per 20 posts new to your team, charged separately from analysis. The job then waits in awaiting_confirmation with per-account posts_found, oldest_post_at, reached_since and notices (e.g. when a platform only returns posts back to a later date). Confirm with POST /jobs/{id}/confirm: pick the latest posts with "selection": { "latest": 50 } or the top posts by a metric with "selection": { "top": { "metric": "views", "n": 50 } }. Or set options.max_credits to auto-confirm.

{
  "items": [
    { "account": "@nike", "platform": "tiktok", "since": "2025-01-01", "max_posts": 1000 },
    { "account": "https://x.com/nasa", "since": "2025-01-01" }
  ],
  "options": { "max_credits": 50000 }
}

Uploads

Bytes go directly to storage, never through the API. Uploads not attached to a job within 24 hours are deleted.

POST /api/v1/uploads
{ "filename": "clip.mp4", "content_type": "video/mp4", "size_bytes": 1234567 }
→ { "id": "upl_…", "upload_url": "<presigned PUT>", "method": "PUT", "headers": {…}, "expires_at": "…" }

# PUT the bytes straight to storage, then submit { "upload_id": "upl_…" } as a job item.

Results

One analyzed post. Embedding vectors are returned only with ?include=embedding. pacing comes from shot detection (beta).

{
  "item_id": "itm_01J…",
  "job_id": "job_01J…",
  "source": { "platform": "tiktok", "url": "…", "author": "…", "posted_at": "…",
              "metrics": { "views": 0, "likes": 0, "comments": 0, "shares": 0 } },
  "caption": "…",
  "language": "es",
  "transcript": { "text": "…", "segments": [{ "start": 0.0, "end": 2.1, "text": "…" }] },
  "translation": { "language": "en", "caption": "…", "transcript": "…", "on_screen_text": "…" },
  "summary": "…",
  "tags": { "format": "…", "theme": "…", "tone": ["…"], "topics": ["…"], "keywords": ["…"] },
  "hook": { "type": "…", "timing_s": 1.2, "confidence": 0.8 },
  "pacing": { "beta": true, "shot_count": 14, "avg_shot_s": 2.1, "cuts_per_s": 0.47, "first_cut_s": 0.9 },
  "embedding": { "dims": 1024 },
  "credits_charged": 50,
  "processed_at": "…"
}

Endpoints

EndpointWhat it does
POST /api/v1/jobsSubmit URLs, uploads or accounts (dry_run for a free estimate).
GET /api/v1/jobs/{id}Status, per-status counts, amounts (cents) reserved / charged / released, accounts + notices.
GET /api/v1/jobs/{id}/itemsPaginated items; filter with ?status=failed.
POST /api/v1/jobs/{id}/confirmPick the posts of an account job awaiting confirmation: all of them, the latest N or the top N by a metric.
POST /api/v1/jobs/{id}/cancelCancel an order awaiting confirmation or a top-up. Orders can’t be canceled once they start; failed posts are never charged.
POST /api/v1/jobs/{id}/retryRetry failed items (re-estimated, re-reserved).
POST /api/v1/uploadsPresigned PUT for your own media.
GET /api/v1/resultsFilter by job_id, platform, tag, q.
POST /api/v1/results/searchSemantic search over embeddings.
GET /api/v1/results/exportStreaming CSV or JSONL.
GET /api/v1/creditsBalance (cents + balance_usd), reserved, packs, spending rewards.
DELETE /api/v1/dataDelete everything for your org.

Errors

Every non-2xx uses one envelope. Codes: unauthorized, forbidden, not_found, invalid_request, insufficient_credits, rate_limited, idempotency_conflict, counting_in_progress, internal_error.

{ "error": { "code": "insufficient_credits",
             "message": "Job needs $1.80; your balance is 42¢.",
             "details": { "required": 180, "balance": 42 },
             "retryable": false } }

Item failure codes are stable and never charged:

post_not_foundThe post doesn’t exist (anymore).
post_privateThe post isn’t public.
unsupported_urlNot a TikTok, Instagram or X post URL.
media_unavailableThe platform didn’t return the media.
media_too_largeOver the size limit.
upload_invalidThe uploaded file couldn’t be read.
provider_errorUpstream failure — retryable.
internal_errorOur failure — retryable.

CLI

export GARFUNKEL_API_KEY=gma_live_…

garfunkel submit urls.txt --category sports --dry-run   # free estimate
garfunkel submit urls.txt --category sports --wait      # run it
garfunkel results export job_… --format jsonl -o results.jsonl

# Whole accounts: 2¢ per 20 new posts counted, charged separately from analysis; pick its latest 50
garfunkel submit --accounts accounts.txt --since 2025-01-01
garfunkel jobs confirm job_… --latest 50

Exit codes: 0 ok, 2 usage, 3 auth, 4 not enough balance, 5 finished with failed items, 6 timeout.

MCP

Connect Claude, ChatGPT, Cursor or any MCP client to the posts your team has analyzed. The server is remote MCP over Streamable HTTP at this address:

https://garfunkel.gar-ai.com/api/mcp

Two ways to sign in

  • OAuth for Claude, ChatGPT and Claude Code: add the address, sign in to Garfunkel, pick your team and approve. Turn off Allow spending on the approval screen for read-only access. See or disconnect connected apps in Settings → AI assistants.
  • API key for Cursor, scripts and headless agents: send Authorization: Bearer gma_live_…. A key can do everything your team can, including spending from the balance, until you revoke it in Settings → Developers.

Claude (web and desktop)

  1. In Claude, open Customize → Connectors, choose + Add, then Add custom connector.
  2. Name it Garfunkel, paste the server address and choose Continue.
  3. Keep authentication on Sign in now, set the OAuth client to Register automatically and choose Add.
  4. Sign in to Garfunkel, pick your team and approve.
  5. In a chat, open + → Connectors and check that Garfunkel is on.

Custom connectors work on every Claude plan; Free allows one. On Team and Enterprise, an owner adds the connector under Organization settings → Connectors first, then each member chooses Connect.

Claude Code

claude mcp add --transport http garfunkel https://garfunkel.gar-ai.com/api/mcp

Then run /mcp in Claude Code, pick garfunkel and choose Authenticate. Your browser opens once to sign in and approve.

Without a browser (CI, a remote machine), send your API key instead:

claude mcp add --transport http garfunkel https://garfunkel.gar-ai.com/api/mcp \
  --header "Authorization: Bearer $GARFUNKEL_API_KEY"

Add --scope user to use it in every project. --scope project writes the server to .mcp.json for everyone in the repo, so share it there with OAuth, never with a key.

ChatGPT

  1. In ChatGPT, open Plugins, choose +, then Add custom MCP server.
  2. Name it Garfunkel. Under Connection, choose a public endpoint and paste the server address.
  3. Choose OAuth for authentication and leave the client fields empty: ChatGPT registers itself. Accept the warning and choose Create as a plugin.
  4. Sign in to Garfunkel, pick your team and approve.
  5. In a new chat, type @ and pick Garfunkel.

Custom MCP servers depend on your plan and workspace policies. If the option is missing, ask your workspace admin. ChatGPT asks you before any tool spends from your balance. Top up in Garfunkel: ChatGPT has no checkout.

Cursor

Cursor connects with an API key, because Garfunkel’s OAuth can’t return to Cursor’s sign-in callback. Create a key in Settings → Developers and add this to ~/.cursor/mcp.json for every project, or .cursor/mcp.json for one:

{
  "mcpServers": {
    "garfunkel": {
      "url": "https://garfunkel.gar-ai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer gma_live_…"
      }
    }
  }
}

Keep .cursor/mcp.json out of git while it holds a key.

Other clients

Any client with remote MCP over Streamable HTTP works. With OAuth, the client finds the sign-in from the address on its own (dynamic client registration with PKCE), so leave any client ID and secret empty. Without OAuth, send the API key header. Clients that read an mcpServers file take this:

{
  "mcpServers": {
    "garfunkel": {
      "type": "http",
      "url": "https://garfunkel.gar-ai.com/api/mcp",
      "headers": {
        "Authorization": "Bearer gma_live_…"
      }
    }
  }
}

To test a connection, run npx @modelcontextprotocol/inspector, choose Streamable HTTP, paste the address and use Quick OAuth Flow or add the header.

Try it

Ask in plain words. Before anything costs money, the assistant shows the price and waits for your yes.

  • “Estimate tagging these 3 TikToks, then tell me which hook types they use.”
  • “Which hooks work best for @nba in the posts we’ve analyzed?”
  • “Why did this post work?” with a link or item id.

Claude also offers ready-made prompts as slash commands: audit_account, why_post_worked, comment_insights, compare_accounts, what_to_make_next. The resource garfunkel://guide explains every result field.

Tools: estimate_job, submit_job, create_upload, confirm_job, list_job_posts, get_job, get_team, wait_for_job, list_results, get_result, list_accounts, get_account, analyze_comments, refresh_metrics, get_comments, search_results, export_results, chat_with_data, get_credit_balance, show_post, create_checkout.

If it doesn’t connect

  • No option to add a server: your plan or workspace doesn’t allow custom connectors yet. Ask your workspace admin.
  • 401 or “needs authentication”: sign in again (in Claude Code, /mcp → Authenticate). With a key, check that it starts with gma_live_ and hasn’t been revoked.
  • A tool asks for more access: spending was turned off when you approved. Disconnect the app and connect again with Allow spending on.
  • New tools are missing: refresh the connection (in ChatGPT, Refresh on the plugin) or reconnect. Clients cache the tool list.