Run multi-client agency operations with Claude Code
Run an agency's TikTok/Instagram operations from Claude Code: per-client external_ref, bulk account fleets, videos_only reposting, ban webhooks and per-…
An agency using Claude Code with TokPortal runs every client through the same four primitives — bundles, accounts, videos, webhooks — and keeps them separate with external_ref and account filters. create_bundles_bulk opens a client's fleet in their market, list_bundles/list_accounts filter by client reference, videos_only bundles carry each month's content onto delivered accounts, create_webhook_endpoint pushes account.banned and video.finalized into the agency's tooling, and export_analytics_videos / create_analytics_report produce the client deliverable. One API key, no per-client OAuth, no app audit, human-operated accounts the agency never has to log into.
Connect TokPortal to Claude Code
Claude Code is a terminal agent: Anthropic's terminal coding agent; MCP servers are added with claude mcp add and used in any session.
Remote (OAuth, recommended):
claude mcp add --transport http tokportal https://app.tokportal.com/api/ext/mcp
Then run /mcp inside Claude Code and authenticate in the browser. Local stdio alternative with an API key:
claude mcp add tokportal -e TOKPORTAL_API_KEY=sk_... -- npx -y tokportal-mcp
Prefer a packaged install? The TokPortal plugin ships the MCP server plus slash commands:
claude plugin marketplace add tokportal/claude-plugin
claude plugin install tokportal@tokportal
Snippet status: verified against Claude Code's documentation (source).
Dedicated guide: Claude Code + TokPortal.
Once connected, sanity-check the setup with a read-only call: "What is my TokPortal credit balance?" should trigger tokportal_get_credit_balance. GET requests and dry-run writes do not spend credits.
Try the workflow without spending
For this trial, use the remote MCP endpoint https://app.tokportal.com/api/ext/mcp, local tokportal-mcp 1.15.1 or later, or the REST API. Upgrade and restart an older local server first. Version 1.15.0 does not forward the dry-run header; do not use its write tools for a simulation. If you cannot verify the installed local version, use the remote endpoint or REST.
Use the sandbox for the first attempt. MCP write tools accept dry_run: true as a top-level argument, beside body; REST writes accept the X-TokPortal-Dry-Run: true header. Keep your usual authentication and scopes. Each simulated write validates the request and returns credits_would_charge with credits_charged: 0. Nothing is created or published.
Simulated IDs start with 00000000-0000-4000-8000-. Use them only in later dry-run writes. GET requests read real data, so skip publish-readiness checks and polling for synthetic IDs. Simulations have no cross-call memory and upload URLs are placeholders: do not upload files to them.
To run for real, review the returned price and confirm before the first live write. Bundle creation charges credits immediately; publishing hands the order to a manager. Repeat creation without dry-run mode and use the new real IDs for configuration and publishing. A synthetic ID cannot be reused in a live request.
How it works
Structure comes from external_ref: put the client slug in it (acme-us, bloom-fr) on every bundle — create_bundle and create_bundles_bulk both accept it, and list_bundles?external_ref=acme-us returns that client's work. Video slots have their own external_ref for creative ids. Accounts inherit their bundle; list_account_bundles on an account gives its history. If clients need real isolation, use one API key per client (keys are per workspace, shown once, revocable individually) — the agent can hold several and pick by client.
Monthly operations from Claude Code then look like this. Onboarding: create_bundles_bulk (accounts_count, videos_per_account, country, warming terms) plus per-account configure_bundle_account from the client's brand sheet. Content: upload_video for each asset, batch_configure_bundle_videos for the month at ≤3/day, publish_bundle. Reposting existing accounts next month: create_bundle with bundle_type: videos_only and account_id, videos_quantity, then the same batch fill. Corrections: request_bundle_video_corrections when the client rejects a post during the 72-hour review (in_review), or finalize_bundle_video to approve immediately; set auto_finalize_videos: false on bundles where the client insists on approving.
Risk and reporting: one webhook endpoint per client system with account.banned, account.ban_appeal.submitted, account.ban_resolution.decided, video.finalized; list_account_bans as the single source of truth for ban state and refund/remake outcomes; create_analytics_report (or export_analytics_report_html) for a branded monthly report and export_analytics_videos for the raw CSV. Credits are shared per workspace — list_credit_transactions gives the per-bundle ledger to re-invoice each client.
Run it from Claude Code
Start a Claude Code session in the project folder and paste the prompt below. Every tokportal_* call is shown before it runs; approve read-only tools freely and review write tools (create_*, configure_*, publish_*) before accepting.
Tool sequence
tokportal_get_credit_costs— Per-client quotes; contract allowances show here.tokportal_create_bundles_bulk— Client fleet withexternal_ref: <client>.tokportal_list_bundles—external_ref,status,platformfilters per client.tokportal_create_bundle—videos_only+account_idfor next month's content on delivered accounts.tokportal_batch_configure_bundle_videos— Month of slots per bundle.tokportal_request_bundle_video_corrections— Client rejects a post in review → manager redoes it.tokportal_create_webhook_endpoint— Per-client endpoint:account.banned,account.ban_appeal.submitted,account.ban_resolution.decided,video.finalized.tokportal_list_account_bans— Ban lifecycle + refund/remake resolution for client comms.tokportal_create_analytics_report— Monthly report per client (orexport_analytics_report_html).tokportal_list_credit_transactions— Ledger to re-invoice credits per client.
Prompt to paste
Evaluate this workflow in the TokPortal sandbox only.
Use the remote MCP endpoint https://app.tokportal.com/api/ext/mcp or local tokportal-mcp 1.15.1 or later for write tools.
Verify the installed local version before using its write tools. Version 1.15.0 is unsafe for simulations.
If the local version is older or unknown, use the remote endpoint or authenticated REST
requests with X-TokPortal-Dry-Run: true instead.
For every non-GET MCP tool call, set dry_run: true as a top-level boolean beside body.
For every REST write in a workflow, send the X-TokPortal-Dry-Run: true header.
Use normal read tools for existing real objects. Do not GET or poll synthetic IDs,
and do not upload files to simulated upload URLs. Simulated objects have no cross-call memory.
Show credits_would_charge and verify credits_charged is 0 for each simulated write.
Do not execute any live write. Ask for my explicit GO before the first real write,
including bundle creation, which charges immediately. After GO, repeat creation
without dry_run and use the new real IDs; never reuse synthetic IDs in live requests.
Use the TokPortal MCP tools. Client "acme-us": list_bundles with external_ref acme-us and status published,
list_account_bans since 2026-08-01 for their accounts, then create_analytics_report for 2026-08-01 → 2026-08-31
filtered on those accounts. Summarize: posts finalized, views, bans + resolutions, credits spent (list_credit_transactions).
Paste the prompt in a Claude Code session; Claude Code shows each tokportal_* call and asks for approval on write tools. /mcp shows connection state.
REST equivalent (write requests below are simulations; GET requests read existing real data)
# Client fleet
curl -X POST -H "X-TokPortal-Dry-Run: true" https://app.tokportal.com/api/ext/bundles/bulk \
-H "X-API-Key: sk_..." -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"platforms":["tiktok"],"country":"US","accounts_count":8,"videos_per_account":30,"external_ref":"acme-us"}'
# This client's bundles
curl "https://app.tokportal.com/api/ext/bundles?external_ref=acme-us&status=published" -H "X-API-Key: sk_..."
# Next month on a delivered account
curl -X POST -H "X-TokPortal-Dry-Run: true" https://app.tokportal.com/api/ext/bundles \
-H "X-API-Key: sk_..." -H "Content-Type: application/json" -H "Idempotency-Key: $(uuidgen)" \
-d '{"bundle_type":"videos_only","account_id":"ACCOUNT_UUID","videos_quantity":30,"external_ref":"acme-us","title":"Acme – Oct"}'
# Client-specific ban + delivery webhook
curl -X POST -H "X-TokPortal-Dry-Run: true" https://app.tokportal.com/api/ext/webhooks \
-H "X-API-Key: sk_..." -H "Content-Type: application/json" \
-d '{"url":"https://agency.example/hooks/acme","events":["account.banned","account.ban_appeal.submitted","account.ban_resolution.decided","video.finalized"],"description":"Acme"}'
Key parameters
| Parameter | Values | Notes |
|---|---|---|
external_ref | ≤200 chars | Client slug on bundles; filter list_bundles by it. |
bundle_type | account_and_videos · videos_only | videos_only + account_id for recurring content. |
auto_finalize_videos | boolean | false when the client must approve each post (72 h window). |
status (list_bundles) | draft · published · completed … | Combine with external_ref for client dashboards. |
events (webhooks) | account.banned · account.ban_appeal.submitted · account.ban_resolution.decided · video.finalized … | One endpoint per client system. |
since (list_account_bans) | ISO timestamp | Polling watermark on updated_at. |
Full schemas: OpenAPI reference · openapi.json.
Example configurations
Client onboarding fleet
{"platforms":["tiktok","instagram"],"country":"FR","accounts_count":6,"videos_per_account":20,
"wants_advanced_warming":true,"advanced_warming_terms_count":6,"external_ref":"bloom-fr"}
Approval-required content bundle
{"bundle_type":"videos_only","account_id":"ACCOUNT_UUID","videos_quantity":12,"auto_finalize_videos":false,"external_ref":"bloom-fr"}
Monthly report request
{"title":"Bloom – September","brandName":"Bloom","from":"2026-09-01","to":"2026-09-30","countries":["FR"],"platforms":["tiktok","instagram"]}
Credits
Credits are shared per workspace; use list_credit_transactions (per-bundle lines) to re-invoice each client. Standard rates: 32 per account, 2 per slot, 5 per warming target, 25 per 30 days TokPortal Coverage per eligible account after the included first period. See Credits & Pricing.
Why not the official API
Official APIs make an agency the OAuth broker for every client account — each grant expires, each app must be audited, each token is limited to 6 requests/minute with per-user daily caps, and none of it creates or warms accounts. TokPortal gives the agency one key, human-operated accounts per client market, and a ban lifecycle it can actually report on.
As of August 2026 the first-party routes look like this. TikTok's Content Posting API (Direct Post) requires each account owner to authorize your app with the video.publish scope, limits every user access token to 6 requests per minute, keeps all posts from unaudited apps in private viewing mode until TikTok audits the app, and enforces an unpublished daily post cap per user (spam_risk_too_many_posts) that integrators commonly report at roughly 15–25 posts per account per day. Meta's Instagram Content Publishing API allows 100 API-published posts per professional account in a 24-hour moving window and only for accounts you own and connect via OAuth. Neither creates accounts, warms them, or reports third-party bans. TokPortal is human-operated infrastructure: accounts created and run by managers in the target country, one X-API-Key for all of them, dated slots (max 3 per day per bundle) instead of per-account tokens.
Sources: TikTok Content Posting API – Direct Post, TikTok Content Posting API – Get started, Instagram Platform – Content Publishing.
FAQ
How do I isolate clients?
Lightweight: external_ref per bundle and per-client webhook endpoints. Strict: one API key per client (revocable individually) and let the agent pick the key by client.
Can clients approve posts before they count as done?
Yes — set auto_finalize_videos: false; each post waits in in_review for finalize_bundle_video or request_bundle_video_corrections (72-hour window, then auto-finalize).
What do I tell a client when an account is banned?
Read list_account_bans for the exact status (appeal_pending, appeal_refused, no_appeal_banned…) and the staff resolution (refund, remake, no_remake + reason_code, refund_credits). Never infer bans from other signals.
How do I produce the monthly deliverable?
create_analytics_report (JSON) or export_analytics_report_html (branded HTML) with from/to and country/platform filters, plus export_analytics_videos for the CSV appendix.
Related
Also works with
- Run multi-client agency operations with ChatGPT
- Run multi-client agency operations with OpenAI Codex
- Run multi-client agency operations with Cursor
- Run multi-client agency operations with Windsurf
- Run multi-client agency operations with Cline
- Run multi-client agency operations with OpenClaw
All 25 agents for "Run multi-client agency operations"
Other jobs with Claude Code
- Create TikTok accounts with Claude Code
- Post 100 TikTok videos a day with Claude Code
- Run US TikTok accounts from abroad with Claude Code
- Warm TikTok & Instagram accounts with Claude Code
- Run a faceless TikTok channel with Claude Code
- Seed UGC across many accounts with Claude Code
- Seed a music sound on TikTok with Claude Code
- Launch an app with persona accounts with Claude Code
- Get ban alerts via webhooks with Claude Code
- Pull analytics across all accounts with Claude Code
- Create Instagram accounts with Claude Code