Get ban alerts via webhooks with OpenAI Codex
Get TikTok/Instagram ban alerts from OpenAI Codex: create_webhook_endpoint for account.banned, ban_appeal.submitted, ban_resolution.decided; list_accoun…
From OpenAI Codex, ban visibility is one create_webhook_endpoint call subscribing to account.ban_appeal.submitted (the earliest signal — the manager filed a platform appeal and the account is unavailable), account.banned (confirmed) and account.ban_resolution.decided (TokPortal's commercial outcome: refund, remake or no_remake with a reason_code), plus list_account_bans as the pollable source of truth. Deliveries are signed (TokPortal-Signature, HMAC SHA-256) and retryable with retry_webhook_delivery. No official API tells you a third-party account was banned; here it is a first-class event.
Connect TokPortal to OpenAI Codex
OpenAI Codex is a terminal agent: OpenAI's coding agent (Codex CLI and IDE extension); MCP servers live in ~/.codex/config.toml.
Add the remote server to ~/.codex/config.toml:
[mcp_servers.tokportal]
url = "https://app.tokportal.com/api/ext/mcp"
# either OAuth (run `codex mcp login tokportal` once) …
# … or a static key from your environment:
# bearer_token_env_var = "TOKPORTAL_API_KEY"
Then codex mcp login tokportal for the OAuth flow. Recent Codex builds also accept the one-liner codex mcp add tokportal --url https://app.tokportal.com/api/ext/mcp; the stdio form always works:
codex mcp add tokportal --env TOKPORTAL_API_KEY=sk_... -- npx -y tokportal-mcp
Snippet status: verified against OpenAI Codex's documentation (source).
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
The lifecycle is explicit. When a manager can no longer use an account and files an appeal with the platform, TokPortal emits account.ban_appeal.submitted — that is the moment to pause scheduling for that account in your systems. If the appeal succeeds, account.ban_appeal.resolved reports it and the account continues; if it fails or there is no appeal path, account.banned fires and the account's banned flag flips in list_accounts. Staff then decide the commercial outcome and account.ban_resolution.decided carries resolution (refund, remake, no_remake), a reason_code (e.g. tos_ban) and refund_credits; credits.restored fires if TokPortal Coverage restores credits. Bundles tied to a banned account are cancelled (bundle.cancelled).
From OpenAI Codex the setup is: list_webhook_events to see the catalogue, create_webhook_endpoint with your url and the four events, test_webhook_endpoint to receive a webhook.test, and get_webhook_endpoint to copy the signing secret into your receiver. Verify TokPortal-Signature (t=<timestamp>,v1=<hex>) with the raw body — the Node SDK ships verifyWebhookSignature. If your endpoint was down, list_webhook_deliveries shows failed attempts and retry_webhook_delivery replays one.
For reporting and reconciliation, list_account_bans is the only source of truth: filter status (appeal_pending, appeal_accepted, appeal_refused, no_appeal_banned), resolution (refund, remake, no_remake, pending), since as a polling watermark, and include_screenshots=true for a signed 7-day evidence URL. Agents must report these values verbatim and never infer a ban from missing analytics or a not_found profile.
Run it from OpenAI Codex
Start a OpenAI Codex 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_list_webhook_events— Catalogue of event names and payload contract.tokportal_create_webhook_endpoint—url,events: ["account.ban_appeal.submitted","account.banned","account.ban_resolution.decided","credits.restored"].tokportal_test_webhook_endpoint— Sendswebhook.testto validate your receiver and signature check.tokportal_get_webhook_endpoint— Endpoint details incl. signing secret.tokportal_list_webhook_deliveries— Delivery log per endpoint (status, attempts).tokportal_retry_webhook_delivery— Replay a failed delivery bydelivery_id.tokportal_list_account_bans— Source of truth:status,resolution,since,include_screenshots.tokportal_list_accounts—banned=true|falsefilter and theban_appealblock per account.
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. Create a webhook endpoint at https://hooks.example.com/tokportal for
account.ban_appeal.submitted, account.banned, account.ban_resolution.decided and credits.restored,
simulate a test delivery (no webhook is sent), then show me list_account_bans since 2026-08-01 grouped by status and resolution.
Run codex in your project, paste the prompt; Codex lists the tokportal_* calls it wants to make and asks for approval unless you run with full-auto.
REST equivalent (write requests below are simulations; GET requests read existing real data)
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://hooks.example.com/tokportal","description":"Ban alerts",
"events":["account.ban_appeal.submitted","account.banned","account.ban_resolution.decided","credits.restored"]}'
curl -X POST -H "X-TokPortal-Dry-Run: true" https://app.tokportal.com/api/ext/webhooks/ENDPOINT_ID/test -H "X-API-Key: sk_..."
# Poll as a backstop
curl "https://app.tokportal.com/api/ext/account-bans?since=2026-08-01T00:00:00Z&include_screenshots=true" -H "X-API-Key: sk_..."
Receiver (Node): verify TokPortal-Signature with the raw body before parsing — see Webhooks → Signature verification.
Key parameters
| Parameter | Values | Notes |
|---|---|---|
events | account.ban_appeal.submitted · account.banned · account.ban_appeal.resolved · account.ban_resolution.decided · credits.restored · bundle.cancelled | Up to 50 events per endpoint. |
url | https URI ≤2000 chars | Must answer 2xx quickly; retries otherwise. |
TokPortal-Signature (header) | t= | HMAC SHA-256 over the raw body; verify with the endpoint secret. |
status (list_account_bans) | appeal_pending · appeal_accepted · appeal_refused · no_appeal_banned | Report verbatim. |
resolution | refund · remake · no_remake · pending | Staff commercial outcome with reason_code and refund_credits. |
since | ISO timestamp | updated_at watermark for polling. |
Full schemas: OpenAPI reference · openapi.json.
Example configurations
Ban-only endpoint
{"url":"https://hooks.example.com/tokportal/bans","events":["account.ban_appeal.submitted","account.banned","account.ban_resolution.decided"],"description":"Ban alerts → Slack"}
Full lifecycle endpoint
{"url":"https://hooks.example.com/tokportal/all","events":["account.finalized","video.finalized","account.ban_appeal.submitted","account.banned","account.ban_resolution.decided","credits.restored","bundle.cancelled"]}
Example account.ban_resolution.decided payload (shape)
{"type":"account.ban_resolution.decided","data":{"account_id":"ACCOUNT_UUID","status":"appeal_refused","resolution":"remake","reason_code":"platform_policy","refund_credits":0}}
Credits
Webhooks are free. TokPortal Coverage (25 credits / 30 days per eligible saved account after the included first period) is what funds refund / remake outcomes and credits.restored; read the exact terms on Credits & Pricing and Bans & Appeals.
Why not the official API
Official APIs surface a ban only indirectly — calls start failing with token or permission errors on an account you own — and never for accounts operated by someone else. TokPortal's managers see the ban first, file the appeal, and the API turns each step into a signed event and a queryable record, dated 2026-08-16 in the changelog.
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
Which event should pause my scheduling?
account.ban_appeal.submitted — the account is already unavailable even though not yet confirmed banned. Resume on account.ban_appeal.resolved (accepted) or reassign content on account.banned.
How do I verify a delivery is genuine?
Compute HMAC SHA-256 of the raw request body with the endpoint secret and compare with v1 in TokPortal-Signature; reject stale t values. The Node SDK's verifyWebhookSignature does this.
What if my endpoint was down for an hour?
TokPortal retries; check list_webhook_deliveries and call retry_webhook_delivery for anything still failed. Reconcile with list_account_bans?since=….
Can the agent tell me if I get a refund?
Yes — account.ban_resolution.decided carries resolution and refund_credits; list_account_bans?resolution=refund lists them; credits.restored fires when Coverage restores credits.
Related
Also works with
- Get ban alerts via webhooks with OpenClaw
- Get ban alerts via webhooks with Hermes Agent
- Get ban alerts via webhooks with Gemini CLI
- Get ban alerts via webhooks with Goose
- Get ban alerts via webhooks with Perplexity
- Get ban alerts via webhooks with Microsoft Copilot Studio
All 25 agents for "Get ban alerts via webhooks"
Other jobs with OpenAI Codex
- Create TikTok accounts with OpenAI Codex
- Post 100 TikTok videos a day with OpenAI Codex
- Run US TikTok accounts from abroad with OpenAI Codex
- Warm TikTok & Instagram accounts with OpenAI Codex
- Run a faceless TikTok channel with OpenAI Codex
- Seed UGC across many accounts with OpenAI Codex
- Seed a music sound on TikTok with OpenAI Codex
- Launch an app with persona accounts with OpenAI Codex
- Run multi-client agency operations with OpenAI Codex
- Pull analytics across all accounts with OpenAI Codex
- Create Instagram accounts with OpenAI Codex