socialcrawl-mcp 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /** The skill's SKILL.md body and errors reference. Generated by scripts/generate-data.ts (T28) - do not hand-edit. */
2
2
  export declare const GUIDE = "# SocialCrawl API\n\nOne API key and one response envelope for social, commerce, and research data. Lists are `{ items, next_cursor?, total? }`; add `?format=raw` to skip the transform pipeline. Every file below lives in `references/`; open only the one the task needs.\n\n## API Key\n\nResolve the API key only when a live API call is needed. Documentation, capability, pricing, and code-generation questions do not need a key.\n\nCheck these sources in order without displaying their contents:\n\n1. **Environment variable:** use `SOCIALCRAWL_API_KEY` when it starts with `sc_` and is not an example placeholder.\n2. **Config file:** if the environment variable is absent, load `~/.config/socialcrawl/api_key` into `SOCIALCRAWL_API_KEY` in the current process. On POSIX shells, use `SOCIALCRAWL_API_KEY=\"$(<\"$HOME/.config/socialcrawl/api_key\")\"; export SOCIALCRAWL_API_KEY`. On PowerShell, use `$env:SOCIALCRAWL_API_KEY = (Get-Content -LiteralPath \"$HOME/.config/socialcrawl/api_key\" -Raw).Trim()`.\n3. **Missing key:** tell the user to create or rotate a key at https://socialcrawl.dev/dashboard and configure it as `SOCIALCRAWL_API_KEY` or in `~/.config/socialcrawl/api_key`. Do not ask them to paste a secret into chat. Stop before the live call until they say it is configured.\n\nNever print, paste, log, or return the key. Never place a literal key in generated code, a command, a URL, an error message, or a saved transcript. Keep `$SOCIALCRAWL_API_KEY` (POSIX) or `$env:SOCIALCRAWL_API_KEY` (PowerShell) as a variable reference in examples. If the key appeared in chat or output, advise the user to revoke it in the dashboard and create a replacement.\n\n## First Live Call\n\nBefore the first live call in a session:\n\n1. Resolve the API key using the steps above. If it is missing or a placeholder, stop before making the call.\n2. Verify it with the free balance endpoint (0 credits):\n ```bash\n curl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \"https://www.socialcrawl.dev/v1/credits/balance\"\n ```\n3. If successful, show the user `data.balance` (it equals `credits_remaining`) and continue with the user's request. Do not print the whole response: it also carries account links (`top_up_url`, `checkout_url`) that belong to the account owner and should stay out of transcripts and logs. Share `checkout_url` only with the account owner when `runway.days_left` is under 3; it opens checkout only after they sign in to the dashboard.\n4. If it fails, report the error without including request headers or the key, then follow [references/errors.md](references/errors.md).\n\n## Freshness Check (do this once per session)\n\nThis file is a snapshot of the registry with this fingerprint:\n\n<!-- BEGIN:GENERATED:FRESHNESS (auto-generated by generate-skills.ts - SK-08) -->\n```text\nregistry_fingerprint: d43ece429e2fc9a07a5e2bc8e5dd73d15818f2455d2c1f9d3e45491f000f4c2b\ngenerated_at: 2026-12-03\n```\n<!-- END:GENERATED:FRESHNESS -->\n\nBeside the balance check, make one free call:\n\n```bash\ncurl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \"https://www.socialcrawl.dev/v1/utility/endpoints?fingerprint=1\" | head -c 400\n```\n\n- **`data.fingerprint` equals `registry_fingerprint` above** - use the bundled files and move on.\n- **It differs** - this copy and the live API are out of sync (the skill or the server may be newer): a price, parameter or endpoint changed. Treat the live registry as the source of truth. For the section a task needs, read the current copy of this skill, published with every deploy and readable with no API key: https://www.socialcrawl.dev/skills/socialcrawl/references/<platform>.md (same file names and headings as here; https://www.socialcrawl.dev/skills/socialcrawl/SKILL.md for this file), and resolve exact prices and params through `/v1/utility/*` (all free except `utility/ai-detection`, 1 credit). Tell the user **once**, briefly: \"this SocialCrawl skill does not match the live API; run `npx skills update socialcrawl --yes` to refresh it.\" When it was installed as a Claude Code plugin, the command is `claude plugin update socialcrawl@socialcrawl` instead. If you can run shell commands, offer once to run that update for them and run it only on a yes, then re-read this file. A copy uploaded to claude.ai is refreshed by uploading the latest package, https://github.com/socialcrawl/skills/raw/main/socialcrawl.skill. Then answer their actual question. Do not repeat it.\n- **No `data.fingerprint`** (a 404, or an older server that answers with the plain list) - fall back to counts: compare `data.stats.platforms` and `data.stats.endpoints` from `/v1/utility/endpoints` with the totals at the top of [references/index.md](references/index.md). Live numbers HIGHER means behind, as above.\n- **The call fails** (no key yet, offline, non-200) - skip it silently. This check must never block the request.\n\n## Workflow\n\n1. **Find the call first (free, 0 credits, runs nothing).** `GET /v1/utility/find?task=<the job in plain words>` ranks the endpoints for the job, each with `method`, `path`, `params_filled` (taken from your words), `missing`, `estimated_credits` (the most that call can cost with the params shown) and `credits_ceiling` (the most it can cost once the params in `ceiling_params` are added too, such as `coverage=full` or a higher `limit`). Call `results[0]` directly when `uncertain` is false: its method, path and params are the ready call (add any `missing` param, then apply the Cost rule). Before you add a param the row did not fill, gate on `credits_ceiling`, not `estimated_credits`. Check `params_filled` against the task: a search value should be the product or topic name only, and `country`/`language` filled from Hangul (KR, ko) are marked in `inferred_params`. When `uncertain` is true, show the options. For a job that needs several calls (a profile, then posts, then comments; a brand watch), `GET /v1/utility/plan?query=<the job>` returns the calls in order with params, price, and which step feeds which. Write or billing requests return no results. `find` and `plan` share a limit of 30 calls a minute and 1,000 a day per key; past it they still answer 200 but with `uncertain: true` keyword guesses, so in a loop over many tasks route from the bundled files.\n2. **Fall back to the bundled files** when offline, when `find` or `plan` answers 404 (an older server: fall back to the existing flow), or when `uncertain` is true. Route with [Common jobs](#common-jobs) below, or grep [references/index.md](references/index.md): its Job to recipe table, then one line per endpoint (`grep -i transcript references/index.md`). For a recipe, read only its section: `grep -n '^## ' references/recipes.md` gives the line numbers; do not open the whole file. For an endpoint, read the platform file's TOC (from the top until the first `## `), then only its section: `grep -nE '^## (GET|POST|PUT|PATCH|DELETE) /v1/<platform>/<resource> - ' references/<platform>.md`, and read from that line to the next `## `. The section carries the exact cost, cache TTL, pagination, every parameter, the response fields, and the constraints checked before billing.\n3. **Estimate.** Build the exact request and apply the cost gate below (one line for a small flat call, the full preflight in [references/cost-gate.md](references/cost-gate.md) for anything metered or large). A heading's number can be a per-row or per-page unit, not the request total. **When an endpoint's heading price is a range** (`1-178 credits`), its price depends on its params: read `GET /v1/utility/endpoint?id=<platform/resource>` (free) for the live price rule before calling, then quote the exact request with `utility/estimate`, even when this copy of the skill matches the live fingerprint.\n4. **Call.** Resolve the key, then run the request exactly as the section shows it, keeping its HTTP method and body shape. If the user already asked to run this exact paid request, the cost disclosure is enough, except the Ask level: always ask (see the gate in the Cost rule); otherwise ask only before a paid call or wider scope they did not authorise.\n5. **Report.** Return the data, then `credits_used` and `credits_remaining`. For an async job report the hold at submission and the settled charge on completion.\n\n## Common jobs\n\nThe first call for the asks agents meet most, generated from the registry recipes (`{x}` is yours to fill). `find` gives the same answer with your values filled in.\n\n<!-- BEGIN:GENERATED:COMMON_JOBS (auto-generated by generate-skills.ts from registry recipes) -->\n| Job | First call | Then |\n|-----|------------|------|\n| Comments on a post to CSV | `GET /v1/tiktok/post/comments?url={url}&sort=recent&scan_pages=3` | `paginate.py` piped to `to_csv.py --archetype Comment`; any platform's `<platform>/post/comments`; [recipe](references/recipes.md#export-the-latest-n-comments-on-a-tiktok-video) |\n| Creators or influencers by niche, size or country | `GET /v1/prism/creators?keywords={niche}&country={country}&min_followers={min_followers}` | a `202` continues in the background (follow `data.next.status_url`); a product to promote goes in `campaign`, creators you already have in `handles` with `purpose`; [guide](https://www.socialcrawl.dev/docs/prism/creators) |\n| A product's reviews across retailers | `GET /v1/prism/product-reviews?query={product}` | covers Amazon, Google Shopping and Trustpilot reviews; Walmart, Target, Home Depot: `<retailer>/reviews`; [recipe](references/recipes.md#one-report-on-a-products-reviews-across-marketplaces) |\n| Stock price and news | `GET /v1/finance/ticker-search?keyword={company}` | then `finance/quote` (`quote.price.current`) and `finance/news`; [recipe](references/recipes.md#a-stocks-current-price-and-latest-headlines) |\n| YouTube transcript | `GET /v1/youtube/video/transcript?url={url}` | [recipe](references/recipes.md#transcribe-a-video) |\n| Alert on new posts or changes | `POST /v1/monitors` (body `recipe: instagram/profile/posts`) | only when `GET /v1/utility/estimate?id=monitors` returns 200, send `?dry_run=1` first to validate and price without creating; otherwise describe the request and create nothing until the user agrees; for a recurring digest of what is new about a topic, keyword or brand, every 1h or slower, call `POST /v1/search/everywhere` with `schedule` (every `1h` or slower, `dry_run` first), at 20 credits a search per fire and only rows that watch has not delivered, read through `GET /v1/events`, a webhook endpoint or the watch's own `last_fire`; a page: `web/monitors`; [recipe](references/recipes.md#track-a-creators-new-posts-every-day) |\n| Stats for a list of post URLs | `POST /v1/prism/post-stats` (JSON body `urls`) | a file of URLs: `batch.py --urls`; [recipe](references/recipes.md#engagement-stats-for-a-list-of-post-urls) |\n| Korean / Naver search | `GET /v1/naver/brief?query={keyword}&corpora=news,blog,cafearticle,kin` | one corpus: `naver/blog/search`, `naver/news/search`; [recipe](references/recipes.md#what-korean-consumers-say-about-a-product-and-search-interest) |\n| Profile lookup | `GET /v1/tiktok/profile?handle={handle}` | any `<platform>/profile`; many handles: `prism/profiles`; [recipe](references/recipes.md#a-creators-profile-recent-posts-and-the-comments-on-them) |\n| Scrape a web page | `GET /v1/web/scrape?url={url}` | structured fields: `web/extract`; a whole site: `web/crawl` |\n| One topic on several platforms | `GET /v1/search/multi?query={topic}&platforms=tiktok,instagram,youtube&relevance=filter` | [recipe](references/recipes.md#search-a-topic-on-several-platforms-at-once) |\n<!-- END:GENERATED:COMMON_JOBS -->\n\n## Helpers\n\nBundled scripts in `scripts/` (Python 3). They read the key from `SOCIALCRAWL_API_KEY` or `~/.config/socialcrawl/api_key` and never print it; `--help` on each gives the rest. On Windows Git Bash an argument that starts with `/` is rewritten into a path like `C:/Program Files/Git/v1/...`: `sc.py` recovers a `/v1/...` id, but for curl or your own code drop the leading slash or `export MSYS_NO_PATHCONV=1`.\n\n```bash\npython3 scripts/sc.py tiktok/profile handle=nike # one call; JSON to stdout, credits_used to stderr\npython3 scripts/paginate.py tiktok/post/comments --items 500 --max-credits 20 url=<post_url> > rows.jsonl # page to N rows within a budget\npython3 scripts/to_csv.py --archetype Comment --in rows.jsonl --out comments.csv # rows to CSV with stable columns\npython3 scripts/batch.py --urls links.txt > stats.jsonl # stats for a file of post URLs (prism/post-stats, or one prism/jobs job past 500)\npython3 scripts/estimate.py tiktok/post/comments --items 500 --offline url=<post_url> # quote offline from assets/endpoints.json\n```\n\n**Code requests:** read the section and cost-gate, write a snippet that reads `SOCIALCRAWL_API_KEY` from the environment with a comment stating the billing unit, and present it without running it.\n\n**Capability and pricing questions:** answer from the index and [references/pricing.md](references/pricing.md) (cost, tiers, packs, refunds, the free-endpoint list). Auth, envelope, pagination, labels, caching, idempotency: [references/api-overview.md](references/api-overview.md). The free `/v1/utility/*` calls answer from the live registry: `endpoints` (filter `?platform=`, `?search=`), `endpoint?id=tiktok/profile` (one endpoint, with measured field fill rates and production latency), `explain-error` (paste a failed response, get the fix), `plan?query=`, `resolve?input=<url or @handle>` (platform and every endpoint that takes it), `capabilities` (cross-cutting params and where each works), `docs-search?query=`, `recipes`, `quickstart`. `utility/ai-detection` is the one paid utility (1 credit a text).\n\n**Ambiguous platform:** if the user says \"get @nike's profile\" with no platform, ask which one.\n\n## Where to look\n\n| Need | Open |\n|------|------|\n| Any single platform (social, commerce, reviews and places, app stores, search/news/finance, research and dev, link-in-bio) | [index.md](references/index.md) lists every platform file with its endpoint count; open `references/<platform>.md` |\n| One call over many platforms: Prism composites, `search/multi`, `search/everywhere` | [prism.md](references/prism.md), [search.md](references/search.md) |\n| A watch on a known account or post, with webhook delivery (Monitors); a keyword or topic digest is a discover schedule | [monitors.md](references/monitors.md); [discover schedules](references/api-overview.md#discover-schedules-v1prismdiscoverschedules) |\n| Follow, resume, extend or schedule a `prism/discover` run (all free) | [api-overview.md](references/api-overview.md#discover-runs-v1prismdiscoverruns), [schedules](references/api-overview.md#discover-schedules-v1prismdiscoverschedules) |\n| Be told when a discover run or schedule produces something: event feed or signed push | [api-overview.md](references/api-overview.md#account-event-feed-v1events), [webhook endpoints](references/api-overview.md#webhook-endpoints-v1webhook-endpoints) |\n| \"Which of MY list of accounts posted about X\" (Cohorts, not listening) | [cohorts.md](references/cohorts.md) |\n| Cost of a request or a whole paged walk; spend per API key | [cost-gate.md](references/cost-gate.md), [pricing.md](references/pricing.md), [credits usage](references/api-overview.md#credit-balance) |\n| A failed call | [errors.md](references/errors.md) |\n\n> **Never answer \"not supported\" from this table alone.** It is only as new as this file, and a missing row is far more often a stale copy than a real gap. Before telling a user a platform, endpoint or capability does not exist, check the live registry - it is free:\n>\n> ```bash\n> curl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \\\n> \"https://www.socialcrawl.dev/v1/utility/endpoints?search=douyin\"\n> ```\n>\n> Each row carries `path`, `method`, `credits_label`, `required_params`, `one_of`, `optional_params`, `paginated` and `cache_ttl_seconds`: enough to make the call without this file. Only say it is unsupported when the search returns `total: 0`.\n\n**Comparing products across retailers:** Amazon, Walmart, Target, eBay and Home Depot share the canonical Product / Review / Seller schemas, so rows line up. Resolve each retailer's product id (ASIN, item id, TCIN, ...) with its own search, then fetch detail and reviews per retailer. `/v1/prism/product-reviews` is one composite over Amazon, Google Shopping and Trustpilot reviews only; for Walmart, Target or Home Depot call `<retailer>/reviews`.\n\n**Several platforms at once:** To search one platform, call that platform's own search. To search several platforms over a date window with every row judged and de-duplicated, call `/v1/prism/discover`. For a quick fused sweep at a flat 20 credits, call `/v1/search/everywhere`, which drops rows outside `from_date`, `to_date`, `since` or `until` but reads one page per source, so a past window can come back thin. `/v1/prism/discover` answers in the call, or answers `202` with a run you poll at `data.next.poll_url`, a light status read (never resubmit a running request; read it with `wait_s=25` for a free long-poll rather than sleeping between reads, and send `x-client-tag: <name>` to split spend per agent at `GET /v1/credits/usage?group_by=tag`, which the run's searches, comment pages and judging keep); put 2 to 6 topic words in `keywords` and the user's question in `context` ([guide](https://www.socialcrawl.dev/docs/prism/discover)). `/v1/search/multi` runs one query over several platforms' own search, one page per platform, with an optional `since`/`until` window and no background run (each platform's page price, charged only for those that returned rows). Many profiles or post URLs go to `POST /v1/prism/profiles` / `POST /v1/prism/post-stats`, or the background job `POST /v1/prism/jobs`. The comments of up to 25 post URLs across platforms go to `POST /v1/prism/post-comments` in one call. From a person's or company's name to ranked candidate accounts with a match level, call `GET /v1/prism/find-accounts` rather than looping each platform's user search.\n\n**One fused search:** For one fused, ranked search across the platforms it covers at a flat 20 credits a search, call `/v1/search/everywhere`; for a collection of more than 100 rows or more than one page per platform, call `/v1/prism/discover`; for creators, `/v1/prism/creators`; to be told what is new, send `since_watermark` with the `data.next.watermark` of your last answer, or turn the search into a watch with its `data.next.watch`. ([guide](https://www.socialcrawl.dev/docs/search/everywhere)).\n\n**Creators or influencers:** To find creators or influencers (by topic, market, size, or a product to promote), lookalikes of creators, or to measure and rank a list of creators you already have, call `/v1/prism/creators`. For shops, businesses and sellers, call `/v1/prism/discover` with `view=accounts`. It answers in the call or answers `202` with a run you follow at `data.next.status_url`; put 2 to 6 topic words in `keywords` and what the creators post about in `context`, a product to promote in `campaign`, or creators you already have in `handles` with `purpose` ([guide](https://www.socialcrawl.dev/docs/prism/creators)).\n\n\n**Alerts and recurring watches:** To be told when something new appears, match the ask to its job: for a recurring digest of what is new about a topic, keyword or brand, every 1h or slower, call `POST /v1/search/everywhere` with `schedule` (every `1h` or slower, `dry_run` first), at 20 credits a search per fire and only rows that watch has not delivered, read through `GET /v1/events`, a webhook endpoint or the watch's own `last_fire`; for the new posts or comments of an account or post you already know, call `POST /v1/monitors` with `webhook_rows: \"new\"`; for a one-off check of what is new since your last check, on an endpoint that takes `since` or `since_id`, call the endpoint's own `since` or `since_id` (for example `GET /v1/twitter/tweet/replies` with `since_id`, which returns an empty list and costs nothing when nothing is new); for metric snapshots of accounts you name (followers, views, likes), taken on a schedule, call `POST /v1/monitors` with a `track` metric; for reading what your watches produced, from a feed you poll or an endpoint that receives a signed push, call `GET /v1/events` with a named `consumer` for reading, and `/v1/webhook-endpoints` for push; a keyword or topic alert is never a Monitor.\n\n## Making calls\n\nBase URL `https://www.socialcrawl.dev`. Most endpoints are GET with query parameters (URL-encode values):\n\n```\ncurl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \\\n \"https://www.socialcrawl.dev/v1/{platform}/{resource}?{param}={value}\"\n```\n\n**Never assume the method.** Each endpoint section is headed by its real verb with a runnable curl. Batch reads, Prism jobs, web jobs, monitors, and cohorts use POST, PATCH, PUT, or DELETE with `content-type: application/json` (`web/parse` is multipart); the list, plus streaming (`Accept: text/event-stream`) and two-step endpoints that need an id from an earlier call, is in [api-overview.md](references/api-overview.md#non-get-routes-streaming-and-two-step-endpoints). Rate limits: 600 requests per minute and 50 concurrent per key; both return 429 with `Retry-After` and are never billed. Many endpoints take 10-45 s (task-polled sources, social profiles on a slow day): use a 60 s client timeout, or the endpoint's `recommended_timeout_s` from `GET /v1/utility/endpoint?id=` (free). Never time out early and resend a different request: an aborted JSON call still runs, is charged and is cached, so resend the **identical** request and it comes back from cache at 0 credits. A streamed call (`Accept: text/event-stream`) that you abort is refunded and is not cached, so its resend is billed as a new call. A 429 body repeats the wait as `error.details.retry_after_s`; a 504 with `error.details.reason: \"task_queued\"` is picked up by the identical request within the hour, or send it with `Prefer: respond-async` for a job to poll at `data.next.status_url`. `POST` to `web/agent`, `web/sessions`, `web/monitors`, `web/parse`, `monitors` and `trustpilot/reviews/history` ignores `Idempotency-Key`: never auto-retry those, or you create (and pay for) a second one.\n\n## Reading a response\n\nDetails are in [api-overview.md](references/api-overview.md). Seven rules before the first call:\n\n- **Placement.** `pagination` (`next_cursor`, `has_more`, `page_size`) and the optional `meta.hint` sit at the envelope root. `dropped`, `_warnings` and every page report (`labels`, `relevance`, `label_share`, `hydration`, `walk`, ...) sit inside `data`. Read `data._warnings`: a parameter applied under the endpoint's own name (`sort was applied as sort_by, this endpoint's name for it.`), an ignored one (`limit was ignored: this endpoint's page size is fixed. ...`) or a handle that resolved to a different account (`resolved_to_different_handle`) is reported there, not as an error.\n- **Paging.** Send `pagination.next_cursor` back as `cursor` and stop on `has_more: false`, not on a short page or on `total`. A page with no rows and `has_more: true` is not the end, so call again with `next_cursor`. A page the source returned empty costs nothing; a page your `since` or `until` emptied costs what a page costs. A zero-match list is `200` with `items: []` at 0 credits.\n- **Get more in one call; do not loop.** Most list endpoints take `max_items=N` (walk pages until N rows), `max_credits=N` (never spend past it) and `max_pages` (1-50); check the endpoint's parameters first, because self-walking endpoints, the `-full` lanes, job reads and `prism/discover` do not. Each page is billed as one call, `data.walk.stopped` says why it ended (`end`, `max_items`, `max_credits`, `time_budget`, ...) and `pagination.next_cursor` resumes ([details](references/api-overview.md#get-more-in-one-call-max_items-max_credits-max_pages)).\n- **Empty lists say why.** Every `items: []` carries `data.empty_reason` and a one-sentence `data.empty_reason_note`: `no_matches`, `end_of_list`, `nothing_new_since` (your `since` / `stop_at_id` poll found nothing new), `window_filtered`, `relevance_filtered`, `row_filtered`, `already_seen`, or `source_empty_unverified`, the only one worth a retry. Tell the user which it is instead of reporting \"no data\" ([codes](references/api-overview.md#empty-lists-empty_reason)).\n- **Default judgments are free.** Comment, post, review and keyword-search rows carry labels (`computed.labels`) and search rows a relevance score (`computed.relevance`) at no extra cost; `judgments=off` returns the raw page. Opt-in presets (`label=spam|toxic|low_quality|quality|ai_style|ai_written|injection|mention|reports|incentivized`, `relevant_to=`) add **1 credit per started 25 freshly judged rows**, held as `ceil(row cap / 25)` and refunded to the rows actually judged. `relevance=filter` against the query itself is free.\n- **Date windows.** `since` / `until` (`YYYY-MM-DD` or a timestamp) work on about 155 dated lists and on `search/everywhere`. On 25 newest-first lists (the creator feeds and some comment, review and search lists) sending `since` sets their recency sort and the page that reaches the date ends the walk (`pagination.stopped_at`); every other list filters each page, keeps its cursor and bills every page walked, so an empty page that still has `next_cursor` is normal: keep paging. `published_after`, `start_date`, `from_date`, `publish_time=this-week` and `max_age_days` are read as `since`; `published_before`, `end_date` and `to_date` as `until` ([date window](references/api-overview.md#date-window-since-until)). A date on a list whose rows carry none is a free 400 (`unsupported_date_filter`).\n- **Spend controls.** Creator post lists also take `stop_at_id`, so a poll pays only for new pages. Keyword searches take `min_views`, `country` / `exclude_country`, `sort_rows=views`, `seen=<id>` (repeats refunded) on top of the walk (**each page billed**).\n- **`meta.hint`** names one other call that does the job in fewer steps. Its message states the price when that call costs more; follow it only within what the user authorised.\n\n`include=` hydration joins rows to a sibling endpoint and is charged **per row on top of the page**, so never quote the plain heading cost for a hydrated call; the ceilings are in [cost-gate.md](references/cost-gate.md#row-hydration-include) and the traps in [api-overview.md](references/api-overview.md#row-hydration-include).\n\n## Cost rule\n\nCache hits, idempotent replays, every `/v1/utility/*` endpoint except `utility/ai-detection` (1 credit), and `/v1/credits/*` cost 0 credits. Failed calls are refunded, and a request rejected for bad params, a page past the last page, or a rate limit never deducts. Metered endpoints hold an upfront ceiling and refund down to the work done, so the response `credits_used` is the real charge. A band that starts at 0 can settle at 0 (its legs bill only when they return rows), and the top of a wide band is a cap, not the expected charge: `prism/discover` never spends past its `max_credits`. Quote the total for the exact request, not the endpoint's base or unit cost. Scale the gate to the call:\n\n| Call | Gate |\n| --- | --- |\n| Flat price \u2264 5 credits, user asked for it | One line: `\u2248 N credits` |\n| Metered, multi-page, batch, monitor/cohort, or > 25 credits | Full preflight via `estimate.py` / `utility/estimate` |\n| Upfront hold (worst case) > 500 credits or over budget (the user's stated budget) | Ask before calling |\n\nAnything in between, or unsure of the price or params: quote first with the free `GET /v1/utility/estimate?id=<platform/resource>&<params>`. Any reply except a 404 means a current server (a 5xx or network failure is no reply: retry the estimate): use its quote and gate on `hold`, which is the most the request can bill (every page of a `max_pages` or `max_items` walk, and the legs a composite bills itself); `upfront_hold` is only what is deducted when the call starts, and `quote_basis` names the params that were priced, so check it matches the request you will send. `dry_run=1` is then free on any endpoint (validates, fetches nothing). A 404 or `ENDPOINT_NOT_FOUND` means an older server: do **not** send `dry_run=1` (it bills a normal call there, except the labelled dry run an endpoint documents); quote with `scripts/estimate.py` (offline, `assets/endpoints.json`) or the section's **Pricing** line. At every level, report `credits_used` after.\n\n**If the task needs a whole list, price the whole walk before the first page.** Paging to completion multiplies the page cost by the page count, and a heading only shows one page. `instagram/followers` and `instagram/following` are the common case: about 50 accounts a page. A plain walk (5 credits a page) usually ends within a few rows of the profile's count (large verified accounts stop at about 50 rows on every route); `coverage=full` (10 credits a page) is only for a walk that fell short of `data.total`, and at that rate a 2,600-account list is roughly 520 credits, half that on a plain walk. Quote the total and get agreement before starting ([Multi-page walks](references/cost-gate.md#multi-page-walks-coveragefull)).\n\nErrors: classify before retrying with [references/errors.md](references/errors.md), or paste the status and body into the free `GET /v1/utility/explain-error` for the fix. Never retry a 402 unchanged. Credits and balance: `GET /v1/credits/balance` (0 credits); the ledger is `GET /v1/credits/transactions?limit=50`; spend per API key per UTC day (up to 92 days) is `GET /v1/credits/usage?from=&to=&group_by=api_key,day` (both 0 credits). When several agents share one key, have each send `x-client-tag: <name>` (1 to 64 letters, digits, `.`, `_`, `:` or `-`); `GET /v1/credits/usage?group_by=tag` then splits the spend per agent and `GET /v1/credits/transactions?tag=<name>` lists one agent's rows.";
3
- export declare const ERRORS_GUIDE = "# Errors\n\nRead this when a call fails. The full code table (status, retryable, what to do) is generated in [api-overview.md](api-overview.md#error-codes); the `error.details` reasons are in [api-overview.md](api-overview.md#error-details-errordetails).\n\n**Fastest fix:** paste the failed status and body into the free `GET /v1/utility/explain-error?status=<code>&body=<error JSON>` (add `request=<the path and query you sent>` to get a corrected request back). It returns the fault in plain words, the steps that fix it, and whether retrying the same request can succeed. Nothing is fetched and it costs 0 credits.\n\n## Classify before retrying\n\nBranch on `error.retryable` first, then on `error.details`, never on the status alone.\n\n- **Fix before retrying (`retryable: false`):** `MISSING_API_KEY`, `INVALID_API_KEY`, `INSUFFICIENT_CREDITS`, `KEY_BUDGET_EXCEEDED`, `INVALID_REQUEST`, `METHOD_NOT_ALLOWED` (the `Allow` header names the right verb), `ENDPOINT_NOT_FOUND`, `PAYLOAD_TOO_LARGE`, `IDEMPOTENCY_KEY_CONFLICT`, `IDEMPOTENCY_KEY_PAYLOAD_MISMATCH` (use a fresh key for the changed payload), `IDEMPOTENCY_REPLAY_UNAVAILABLE`, and every `COHORT_*` code. Explain the corrective action and do not repeat the same request.\n- **Wait, then retry the same request:** `RATE_LIMITED`, `CONCURRENCY_LIMIT` (`Retry-After: 1`), `SERVICE_UNAVAILABLE`, and `409 IDEMPOTENCY_IN_PROGRESS` (`Retry-After` 1-30 s; resend with the **same** `Idempotency-Key`). Honour `Retry-After`, then back off exponentially with jitter. A `Retry-After` longer than a minute (for example `3600` for a source that is down in one market) means stop and report, not wait in a loop.\n- **Transient upstream failure:** `UPSTREAM_ERROR` (502, or 504 on a timeout) and `INTERNAL_ERROR`, refunded. If `error.details.retry_with` is present, `retryable` is `false` and there is no `Retry-After`: the same request fails the same way, so resend once with exactly the params it names (for example `proxy=auto` on `web/scrape`). If `error.incident` is present, stop calling that platform and poll `GET /v1/status/{platform}` every few minutes. Otherwise retry at most once, then report the outage with the endpoint and `request_id`, never the credential.\n- **Out of time on our side:** a request still unanswered at 54 s gets the standard error envelope with a request id and `Retry-After`, not the hosting platform's bare 504. A request with under 500 ms of its time left answers a refunded 503 with `Retry-After: 5` instead of starting a source call it cannot finish, and a busy database answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 5` within about 3 to 11 s. Wait the `Retry-After`, then resend the identical request once.\n- **Facebook page public but not readable on this attempt:** `facebook/profile` answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 15` when the page is public but could not be read, and `facebook/profile/posts` does the same when a first page (no `cursor`) comes back empty from every source. It is never cached and costs 0 credits: wait the `Retry-After` and resend the same request. A `since`/`until` window that matches no posts is still a normal `200` with an empty page.\n- **Not found:** `RESOURCE_NOT_FOUND` is a valid empty outcome, not a retry loop.\n- **Discover runs and the events feed:** `RUN_NOT_FOUND` / `SCHEDULE_NOT_FOUND` (wrong id, or another account's): list your runs or schedules, or start again. `RUN_STATE_CONFLICT` (409): read the run and do what `data.run.next_step` says (a completed run takes `more`, not `resume`). `RUN_EXPIRED` (410): retention passed, start a new run. `NEEDS_ASYNC` (422): drop `async=false` and follow the 202's `data.next.status_url`. `CURSOR_EXPIRED` (410): restart the feed from `details.oldest_cursor` (or `cursor=oldest`) and tell the user the events in `missed_from`..`missed_until` are gone (30-day retention).\n\n## Act on `error.details`\n\nEvery error carries `error.retryable`, and many carry `error.details.reason`; act on it rather than on the status alone:\n\n- **402** (`balance_too_low`, `key_budget_reached`) always says `retry_will_succeed: false`: **never retry a 402 unchanged**. The same request fails until the balance or that key's limit changes. Point the user at `top_up_url` or `key_settings_url`; `key_name`, `key_prefix` and `account_email_masked`, when present, say which key and account ran out. A key budget is a lifetime cap on that key's net spend (refunds give it back; it never resets on its own), so on `key_budget_reached` the `credits_remaining` is the healthy account balance: the user raises the limit or resets the key's usage in Dashboard \u2192 API Keys, or uses another key. On a metered call `pricing: \"ceiling\"` means the quoted credits are the maximum hold (unused credits are refunded) and `credits_typical` is what a call like it is usually charged; `pricing: \"exact\"` means it is charged what it holds. `lower_cost_options` lists each param that lowers the hold, with the `value` to send (`null`: leave it out) and the `credits_required` it gives, and `credits_required_cheapest` is the hold with all of them. When one of those fits `credits_remaining`, offer the user that smaller request, or a top-up for the full one.\n- **400 `page_limit`** (`max_page`, `narrow_with`): the source has no further pages for this query; stop paging and narrow the query instead. It is the end of the walk, not a failure.\n- **400 with `did_you_mean`**: a parameter or value was misnamed. `error.details.received_unknown` lists the names the endpoint did not recognise, `missing` the required one it did not get, and `did_you_mean` the name it takes (`You sent term; this endpoint takes query`). Resend under that name; it is free.\n- **400 `INVALID_REQUEST` naming a param on a single-source lane** (for example `weibo/profile`, `goodreads/quotes`, `airbnb/search`, `airbnb/listing/availability`): the value you sent is wrong for that source (an id or URL it cannot read, a date it refuses). It is free and final; fix the param named in `error.details.param` and resend. These lanes used to answer a refunded, retryable 502 for the same input, so do not retry one unchanged.\n- **400 `unsupported_date_filter`**: `since` / `until` (or a copied spelling such as `published_after`) on a list whose rows carry no date. Drop the date.\n- **404 `account_gone` / `account_private` / `handle_unresolved`**: follow `error.details.suggestion` once (for a YouTube handle, retry with the stored `channelId` to tell a rename from a removal), then report. On Facebook (`facebook/profile`, `facebook/profile/posts`) an `account_private` 404 also carries `details.account_status`: `age_restricted` (Facebook shows the page only to signed-in viewers who meet its age restriction, so retrying will not help) or `private`. `details.reason` stays `account_private` and the call costs 0 credits. `site_not_supported` on `web/scrape` is final; its `suggestion` names the SocialCrawl endpoint for a social link.\n- **404 `ENDPOINT_NOT_FOUND`** may carry `details.did_you_mean` (paths), `did_you_mean_platform` and `retry_with` (the whole corrected URL, for example for a bare `/search`); check the live registry (`GET /v1/utility/endpoints?search=`, free) before saying something is unsupported. On `/v1/web/jobs|monitors|sessions/{id}` it means the id is unknown for this key.\n- **404 `url_unreachable`** on `web/scrape` and `web/extract`: the address is dead or does not resolve. Free and final; check the URL with the user. `site_not_supported` answers the same way on `web/extract` as on `web/scrape`.\n- **503 `breaker_open`**: that source is paused. The request was refused without being sent and was not billed. Until the time the message states, the same request fails the same way; the same request **without the option the message names** works now. With no stated time, wait for `Retry-After`.\n- **503 \"retry the same cursor\"** on a later search page (`facebook/search/posts`, and `not_found_unconfirmed` on `tiktok/search`): refunded. Resend the **same** cursor once later. When that cursor answers empty again on a later request (`facebook/search/posts`: at least 10 minutes after its first empty answer), the answer is a free `200` with `items: []` and `has_more: false`: the walk has ended.\n- **502 `profile_lookup_timeout`** on `tiktok/user/live`: TikTok did not return the account in time. Refunded; retry later.\n- **5xx** carry `error.status_url` and, during an open incident, `error.incident` (`id`, `title`, `status`, `impact`, `url`). A refunded **504** carries `Retry-After: 30`: wait that long before the one automatic retry.\n- **429** bodies carry `error.details` as well as the headers (`reason`, for example `concurrency`, `limit`, `current`, `remaining`, `retry_after_s`), for clients that drop headers.\n\n## Not errors: `data._warnings` and `meta.hint`\n\nA `200` can still carry advice. `data._warnings` reports a parameter that was ignored or cleaned (a `Query:` label stripped from a search term, a `fields=` path that does not exist, with the path it probably meant) and a handle that resolved to a different account. `meta.hint`, at the envelope root, names one other call that does the job in fewer steps; when that call costs more, its `message` says both prices, so follow it only within what the user authorised. It reaches a key at most once a day per pattern, never on an error; send `X-SocialCrawl-Hints: off` to stop it.\n\n## Retrying paid calls\n\nFor a retryable paid non-streaming request, send an `Idempotency-Key` before the first attempt and reuse it only for the identical payload (same params, same `fields`). A GET with `Accept: text/event-stream` cannot carry an `Idempotency-Key` (free 400); do not automatically retry streaming requests. Never exceed one automatic retry unless the user explicitly asks for continued retries.\n\n**Some POSTs ignore `Idempotency-Key`, so never auto-retry them:** `POST /v1/web/agent`, `/v1/web/sessions`, `/v1/web/monitors`, `/v1/web/parse`, `/v1/monitors` and `/v1/trustpilot/reviews/history`. A resend creates (and, where it bills, bills) a second run, session, monitor or job. Read the list route (`GET /v1/web/jobs`, `GET /v1/web/sessions`, `GET /v1/monitors`) to see whether the first one landed. On `POST /v1/web/crawl` and `/v1/web/batch-scrape` a repeated key returns the existing job (200, 0 credits) without comparing the body.\n\n**A client timeout does not cancel the call.** The server finishes it, charges it and writes it to the cache. Resend the identical request (same or new key) and, within the endpoint's cache TTL, it comes back free from cache (`X-Cache: HIT`). Size your timeout from `recommended_timeout_s` in `GET /v1/utility/endpoint?id=` (60 s is safe almost everywhere).\n\nFailed calls are refunded (upstream errors, circuit-breaker rejections, timeouts, not-found, empty results). `credits_used` on an error envelope is the committed net charge: 0 in almost every case, the kept legs on a partially failed composite. A request rejected for bad params, a page past the source's last page, or a rate limit never deducts at all.";
3
+ export declare const ERRORS_GUIDE = "# Errors\n\nRead this when a call fails. The full code table (status, retryable, what to do) is generated in [api-overview.md](api-overview.md#error-codes); the `error.details` reasons are in [api-overview.md](api-overview.md#error-details-errordetails).\n\n**Fastest fix:** paste the failed status and body into the free `GET /v1/utility/explain-error?status=<code>&body=<error JSON>` (add `request=<the path and query you sent>` to get a corrected request back). It returns the fault in plain words, the steps that fix it, and whether retrying the same request can succeed. Nothing is fetched and it costs 0 credits.\n\n## Classify before retrying\n\nBranch on `error.retryable` first, then on `error.details`, never on the status alone.\n\n- **Fix before retrying (`retryable: false`):** `MISSING_API_KEY`, `INVALID_API_KEY`, `INSUFFICIENT_CREDITS`, `KEY_BUDGET_EXCEEDED`, `INVALID_REQUEST`, `METHOD_NOT_ALLOWED` (the `Allow` header names the right verb), `ENDPOINT_NOT_FOUND`, `PAYLOAD_TOO_LARGE`, `IDEMPOTENCY_KEY_CONFLICT`, `IDEMPOTENCY_KEY_PAYLOAD_MISMATCH` (use a fresh key for the changed payload), `IDEMPOTENCY_REPLAY_UNAVAILABLE`, and every `COHORT_*` code. Explain the corrective action and do not repeat the same request.\n- **Wait, then retry the same request:** `RATE_LIMITED`, `CONCURRENCY_LIMIT` (`Retry-After: 1`), `SERVICE_UNAVAILABLE`, and `409 IDEMPOTENCY_IN_PROGRESS` (`Retry-After` 1-30 s; resend with the **same** `Idempotency-Key`). Honour `Retry-After`, then back off exponentially with jitter. A `Retry-After` longer than a minute (for example `3600` for a source that is down in one market) means stop and report, not wait in a loop.\n- **Transient upstream failure:** `UPSTREAM_ERROR` (502, or 504 on a timeout) and `INTERNAL_ERROR`, refunded. If `error.details.retry_with` is present, `retryable` is `false` and there is no `Retry-After`: the same request fails the same way, so resend once with exactly the params it names (for example `proxy=auto` on `web/scrape`). If `error.incident` is present, stop calling that platform and poll `GET /v1/status/{platform}` every few minutes. Otherwise retry at most once, then report the outage with the endpoint and `request_id`, never the credential.\n- **Out of time on our side:** a request still unanswered at 54 s gets the standard error envelope with a request id and `Retry-After`, not the hosting platform's bare 504. A request with under 500 ms of its time left answers a refunded 503 with `Retry-After: 5` instead of starting a source call it cannot finish, and a busy database answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 5` within about 3 to 11 s. Wait the `Retry-After`, then resend the identical request once.\n- **Facebook page public but not readable on this attempt:** `facebook/profile` answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 15` when the page is public but could not be read, and `facebook/profile/posts` does the same when a first page (no `cursor`) comes back empty from every source. It is never cached and costs 0 credits: wait the `Retry-After` and resend the same request. A `since`/`until` window that matches no posts is still a normal `200` with an empty page.\n- **Not found:** `RESOURCE_NOT_FOUND` is a valid empty outcome, not a retry loop.\n- **Discover runs and the events feed:** `RUN_NOT_FOUND` / `SCHEDULE_NOT_FOUND` (wrong id, or another account's): list your runs or schedules, or start again. `RUN_STATE_CONFLICT` (409): read the run and do what `data.run.next_step` says (a completed run takes `more`, not `resume`). `RUN_EXPIRED` (410): retention passed, start a new run. `NEEDS_ASYNC` (422): drop `async=false` and follow the 202's `data.next.status_url`. `CURSOR_EXPIRED` (410): restart the feed from `details.oldest_cursor` (or `cursor=oldest`) and tell the user the events in `missed_from`..`missed_until` are gone (30-day retention).\n\n## Act on `error.details`\n\nEvery error carries `error.retryable`, and many carry `error.details.reason`; act on it rather than on the status alone:\n\n- **402** (`balance_too_low`, `key_budget_reached`) always says `retry_will_succeed: false`: **never retry a 402 unchanged**. The same request fails until the balance or that key's limit changes. Point the user at `top_up_url` or `key_settings_url`; `key_name`, `key_prefix` and `account_email_masked`, when present, say which key and account ran out. A key budget is a lifetime cap on that key's net spend (refunds give it back; it never resets on its own), so on `key_budget_reached` the `credits_remaining` is the healthy account balance: the user raises the limit or resets the key's usage in Dashboard \u2192 API Keys, or uses another key. On a metered call `pricing: \"ceiling\"` means the quoted credits are the maximum hold (unused credits are refunded) and `credits_typical` is what a call like it is usually charged; `pricing: \"exact\"` means it is charged what it holds. `lower_cost_options` lists each param that lowers the hold, with the `value` to send (`null`: leave it out) and the `credits_required` it gives, and `credits_required_cheapest` is the hold with all of them. When one of those fits `credits_remaining`, offer the user that smaller request, or a top-up for the full one. A team member's 402 keeps the code `INSUFFICIENT_CREDITS` but carries no `checkout_url`, no `top_up_url` and no pack, because a member does not buy credits: `error.details.billing.credits_added_by` names who adds credits for the team and `next_step` says to ask the team's owner, so relay that and never offer a top-up. When the team balance is not available to that member, `credits_added_by` is `null` and `next_step` says that leaving the team returns them to their own balance.\n- **400 `page_limit`** (`max_page`, `narrow_with`): the source has no further pages for this query; stop paging and narrow the query instead. It is the end of the walk, not a failure.\n- **400 with `did_you_mean`**: a parameter or value was misnamed. `error.details.received_unknown` lists the names the endpoint did not recognise, `missing` the required one it did not get, and `did_you_mean` the name it takes (`You sent term; this endpoint takes query`). Resend under that name; it is free.\n- **400 `INVALID_REQUEST` naming a param on a single-source lane** (for example `weibo/profile`, `goodreads/quotes`, `airbnb/search`, `airbnb/listing/availability`): the value you sent is wrong for that source (an id or URL it cannot read, a date it refuses). It is free and final; fix the param named in `error.details.param` and resend. These lanes used to answer a refunded, retryable 502 for the same input, so do not retry one unchanged.\n- **400 `unsupported_date_filter`**: `since` / `until` (or a copied spelling such as `published_after`) on a list whose rows carry no date. Drop the date.\n- **404 `account_gone` / `account_private` / `handle_unresolved`**: follow `error.details.suggestion` once (for a YouTube handle, retry with the stored `channelId` to tell a rename from a removal), then report. On Facebook (`facebook/profile`, `facebook/profile/posts`) an `account_private` 404 also carries `details.account_status`: `age_restricted` (Facebook shows the page only to signed-in viewers who meet its age restriction, so retrying will not help) or `private`. `details.reason` stays `account_private` and the call costs 0 credits. `site_not_supported` on `web/scrape` is final; its `suggestion` names the SocialCrawl endpoint for a social link.\n- **404 `ENDPOINT_NOT_FOUND`** may carry `details.did_you_mean` (paths), `did_you_mean_platform` and `retry_with` (the whole corrected URL, for example for a bare `/search`); check the live registry (`GET /v1/utility/endpoints?search=`, free) before saying something is unsupported. On `/v1/web/jobs|monitors|sessions/{id}` it means the id is unknown for this key.\n- **404 `url_unreachable`** on `web/scrape` and `web/extract`: the address is dead or does not resolve. Free and final; check the URL with the user. `site_not_supported` answers the same way on `web/extract` as on `web/scrape`.\n- **503 `breaker_open`**: that source is paused. The request was refused without being sent and was not billed. Until the time the message states, the same request fails the same way; the same request **without the option the message names** works now. With no stated time, wait for `Retry-After`.\n- **503 \"retry the same cursor\"** on a later search page (`facebook/search/posts`, and `not_found_unconfirmed` on `tiktok/search`): refunded. Resend the **same** cursor once later. When that cursor answers empty again on a later request (`facebook/search/posts`: at least 10 minutes after its first empty answer), the answer is a free `200` with `items: []` and `has_more: false`: the walk has ended.\n- **502 `profile_lookup_timeout`** on `tiktok/user/live`: TikTok did not return the account in time. Refunded; retry later.\n- **5xx** carry `error.status_url` and, during an open incident, `error.incident` (`id`, `title`, `status`, `impact`, `url`). A refunded **504** carries `Retry-After: 30`: wait that long before the one automatic retry.\n- **429** bodies carry `error.details` as well as the headers (`reason`, for example `concurrency`, `limit`, `current`, `remaining`, `retry_after_s`), for clients that drop headers.\n\n## Not errors: `data._warnings` and `meta.hint`\n\nA `200` can still carry advice. `data._warnings` reports a parameter that was ignored or cleaned (a `Query:` label stripped from a search term, a `fields=` path that does not exist, with the path it probably meant) and a handle that resolved to a different account. `meta.hint`, at the envelope root, names one other call that does the job in fewer steps; when that call costs more, its `message` says both prices, so follow it only within what the user authorised. It reaches a key at most once a day per pattern, never on an error; send `X-SocialCrawl-Hints: off` to stop it.\n\n## Retrying paid calls\n\nFor a retryable paid non-streaming request, send an `Idempotency-Key` before the first attempt and reuse it only for the identical payload (same params, same `fields`). A GET with `Accept: text/event-stream` cannot carry an `Idempotency-Key` (free 400); do not automatically retry streaming requests. Never exceed one automatic retry unless the user explicitly asks for continued retries.\n\n**Some POSTs ignore `Idempotency-Key`, so never auto-retry them:** `POST /v1/web/agent`, `/v1/web/sessions`, `/v1/web/monitors`, `/v1/web/parse`, `/v1/monitors` and `/v1/trustpilot/reviews/history`. A resend creates (and, where it bills, bills) a second run, session, monitor or job. Read the list route (`GET /v1/web/jobs`, `GET /v1/web/sessions`, `GET /v1/monitors`) to see whether the first one landed. On `POST /v1/web/crawl` and `/v1/web/batch-scrape` a repeated key returns the existing job (200, 0 credits) without comparing the body.\n\n**A client timeout does not cancel the call.** The server finishes it, charges it and writes it to the cache. Resend the identical request (same or new key) and, within the endpoint's cache TTL, it comes back free from cache (`X-Cache: HIT`). Size your timeout from `recommended_timeout_s` in `GET /v1/utility/endpoint?id=` (60 s is safe almost everywhere).\n\nFailed calls are refunded (upstream errors, circuit-breaker rejections, timeouts, not-found, empty results). `credits_used` on an error envelope is the committed net charge: 0 in almost every case, the kept legs on a partially failed composite. A request rejected for bad params, a page past the source's last page, or a rate limit never deducts at all.";
@@ -1,4 +1,4 @@
1
1
  /** The skill's SKILL.md body and errors reference. Generated by scripts/generate-data.ts (T28) - do not hand-edit. */
2
2
  export const GUIDE = "# SocialCrawl API\n\nOne API key and one response envelope for social, commerce, and research data. Lists are `{ items, next_cursor?, total? }`; add `?format=raw` to skip the transform pipeline. Every file below lives in `references/`; open only the one the task needs.\n\n## API Key\n\nResolve the API key only when a live API call is needed. Documentation, capability, pricing, and code-generation questions do not need a key.\n\nCheck these sources in order without displaying their contents:\n\n1. **Environment variable:** use `SOCIALCRAWL_API_KEY` when it starts with `sc_` and is not an example placeholder.\n2. **Config file:** if the environment variable is absent, load `~/.config/socialcrawl/api_key` into `SOCIALCRAWL_API_KEY` in the current process. On POSIX shells, use `SOCIALCRAWL_API_KEY=\"$(<\"$HOME/.config/socialcrawl/api_key\")\"; export SOCIALCRAWL_API_KEY`. On PowerShell, use `$env:SOCIALCRAWL_API_KEY = (Get-Content -LiteralPath \"$HOME/.config/socialcrawl/api_key\" -Raw).Trim()`.\n3. **Missing key:** tell the user to create or rotate a key at https://socialcrawl.dev/dashboard and configure it as `SOCIALCRAWL_API_KEY` or in `~/.config/socialcrawl/api_key`. Do not ask them to paste a secret into chat. Stop before the live call until they say it is configured.\n\nNever print, paste, log, or return the key. Never place a literal key in generated code, a command, a URL, an error message, or a saved transcript. Keep `$SOCIALCRAWL_API_KEY` (POSIX) or `$env:SOCIALCRAWL_API_KEY` (PowerShell) as a variable reference in examples. If the key appeared in chat or output, advise the user to revoke it in the dashboard and create a replacement.\n\n## First Live Call\n\nBefore the first live call in a session:\n\n1. Resolve the API key using the steps above. If it is missing or a placeholder, stop before making the call.\n2. Verify it with the free balance endpoint (0 credits):\n ```bash\n curl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \"https://www.socialcrawl.dev/v1/credits/balance\"\n ```\n3. If successful, show the user `data.balance` (it equals `credits_remaining`) and continue with the user's request. Do not print the whole response: it also carries account links (`top_up_url`, `checkout_url`) that belong to the account owner and should stay out of transcripts and logs. Share `checkout_url` only with the account owner when `runway.days_left` is under 3; it opens checkout only after they sign in to the dashboard.\n4. If it fails, report the error without including request headers or the key, then follow [references/errors.md](references/errors.md).\n\n## Freshness Check (do this once per session)\n\nThis file is a snapshot of the registry with this fingerprint:\n\n<!-- BEGIN:GENERATED:FRESHNESS (auto-generated by generate-skills.ts - SK-08) -->\n```text\nregistry_fingerprint: d43ece429e2fc9a07a5e2bc8e5dd73d15818f2455d2c1f9d3e45491f000f4c2b\ngenerated_at: 2026-12-03\n```\n<!-- END:GENERATED:FRESHNESS -->\n\nBeside the balance check, make one free call:\n\n```bash\ncurl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \"https://www.socialcrawl.dev/v1/utility/endpoints?fingerprint=1\" | head -c 400\n```\n\n- **`data.fingerprint` equals `registry_fingerprint` above** - use the bundled files and move on.\n- **It differs** - this copy and the live API are out of sync (the skill or the server may be newer): a price, parameter or endpoint changed. Treat the live registry as the source of truth. For the section a task needs, read the current copy of this skill, published with every deploy and readable with no API key: https://www.socialcrawl.dev/skills/socialcrawl/references/<platform>.md (same file names and headings as here; https://www.socialcrawl.dev/skills/socialcrawl/SKILL.md for this file), and resolve exact prices and params through `/v1/utility/*` (all free except `utility/ai-detection`, 1 credit). Tell the user **once**, briefly: \"this SocialCrawl skill does not match the live API; run `npx skills update socialcrawl --yes` to refresh it.\" When it was installed as a Claude Code plugin, the command is `claude plugin update socialcrawl@socialcrawl` instead. If you can run shell commands, offer once to run that update for them and run it only on a yes, then re-read this file. A copy uploaded to claude.ai is refreshed by uploading the latest package, https://github.com/socialcrawl/skills/raw/main/socialcrawl.skill. Then answer their actual question. Do not repeat it.\n- **No `data.fingerprint`** (a 404, or an older server that answers with the plain list) - fall back to counts: compare `data.stats.platforms` and `data.stats.endpoints` from `/v1/utility/endpoints` with the totals at the top of [references/index.md](references/index.md). Live numbers HIGHER means behind, as above.\n- **The call fails** (no key yet, offline, non-200) - skip it silently. This check must never block the request.\n\n## Workflow\n\n1. **Find the call first (free, 0 credits, runs nothing).** `GET /v1/utility/find?task=<the job in plain words>` ranks the endpoints for the job, each with `method`, `path`, `params_filled` (taken from your words), `missing`, `estimated_credits` (the most that call can cost with the params shown) and `credits_ceiling` (the most it can cost once the params in `ceiling_params` are added too, such as `coverage=full` or a higher `limit`). Call `results[0]` directly when `uncertain` is false: its method, path and params are the ready call (add any `missing` param, then apply the Cost rule). Before you add a param the row did not fill, gate on `credits_ceiling`, not `estimated_credits`. Check `params_filled` against the task: a search value should be the product or topic name only, and `country`/`language` filled from Hangul (KR, ko) are marked in `inferred_params`. When `uncertain` is true, show the options. For a job that needs several calls (a profile, then posts, then comments; a brand watch), `GET /v1/utility/plan?query=<the job>` returns the calls in order with params, price, and which step feeds which. Write or billing requests return no results. `find` and `plan` share a limit of 30 calls a minute and 1,000 a day per key; past it they still answer 200 but with `uncertain: true` keyword guesses, so in a loop over many tasks route from the bundled files.\n2. **Fall back to the bundled files** when offline, when `find` or `plan` answers 404 (an older server: fall back to the existing flow), or when `uncertain` is true. Route with [Common jobs](#common-jobs) below, or grep [references/index.md](references/index.md): its Job to recipe table, then one line per endpoint (`grep -i transcript references/index.md`). For a recipe, read only its section: `grep -n '^## ' references/recipes.md` gives the line numbers; do not open the whole file. For an endpoint, read the platform file's TOC (from the top until the first `## `), then only its section: `grep -nE '^## (GET|POST|PUT|PATCH|DELETE) /v1/<platform>/<resource> - ' references/<platform>.md`, and read from that line to the next `## `. The section carries the exact cost, cache TTL, pagination, every parameter, the response fields, and the constraints checked before billing.\n3. **Estimate.** Build the exact request and apply the cost gate below (one line for a small flat call, the full preflight in [references/cost-gate.md](references/cost-gate.md) for anything metered or large). A heading's number can be a per-row or per-page unit, not the request total. **When an endpoint's heading price is a range** (`1-178 credits`), its price depends on its params: read `GET /v1/utility/endpoint?id=<platform/resource>` (free) for the live price rule before calling, then quote the exact request with `utility/estimate`, even when this copy of the skill matches the live fingerprint.\n4. **Call.** Resolve the key, then run the request exactly as the section shows it, keeping its HTTP method and body shape. If the user already asked to run this exact paid request, the cost disclosure is enough, except the Ask level: always ask (see the gate in the Cost rule); otherwise ask only before a paid call or wider scope they did not authorise.\n5. **Report.** Return the data, then `credits_used` and `credits_remaining`. For an async job report the hold at submission and the settled charge on completion.\n\n## Common jobs\n\nThe first call for the asks agents meet most, generated from the registry recipes (`{x}` is yours to fill). `find` gives the same answer with your values filled in.\n\n<!-- BEGIN:GENERATED:COMMON_JOBS (auto-generated by generate-skills.ts from registry recipes) -->\n| Job | First call | Then |\n|-----|------------|------|\n| Comments on a post to CSV | `GET /v1/tiktok/post/comments?url={url}&sort=recent&scan_pages=3` | `paginate.py` piped to `to_csv.py --archetype Comment`; any platform's `<platform>/post/comments`; [recipe](references/recipes.md#export-the-latest-n-comments-on-a-tiktok-video) |\n| Creators or influencers by niche, size or country | `GET /v1/prism/creators?keywords={niche}&country={country}&min_followers={min_followers}` | a `202` continues in the background (follow `data.next.status_url`); a product to promote goes in `campaign`, creators you already have in `handles` with `purpose`; [guide](https://www.socialcrawl.dev/docs/prism/creators) |\n| A product's reviews across retailers | `GET /v1/prism/product-reviews?query={product}` | covers Amazon, Google Shopping and Trustpilot reviews; Walmart, Target, Home Depot: `<retailer>/reviews`; [recipe](references/recipes.md#one-report-on-a-products-reviews-across-marketplaces) |\n| Stock price and news | `GET /v1/finance/ticker-search?keyword={company}` | then `finance/quote` (`quote.price.current`) and `finance/news`; [recipe](references/recipes.md#a-stocks-current-price-and-latest-headlines) |\n| YouTube transcript | `GET /v1/youtube/video/transcript?url={url}` | [recipe](references/recipes.md#transcribe-a-video) |\n| Alert on new posts or changes | `POST /v1/monitors` (body `recipe: instagram/profile/posts`) | only when `GET /v1/utility/estimate?id=monitors` returns 200, send `?dry_run=1` first to validate and price without creating; otherwise describe the request and create nothing until the user agrees; for a recurring digest of what is new about a topic, keyword or brand, every 1h or slower, call `POST /v1/search/everywhere` with `schedule` (every `1h` or slower, `dry_run` first), at 20 credits a search per fire and only rows that watch has not delivered, read through `GET /v1/events`, a webhook endpoint or the watch's own `last_fire`; a page: `web/monitors`; [recipe](references/recipes.md#track-a-creators-new-posts-every-day) |\n| Stats for a list of post URLs | `POST /v1/prism/post-stats` (JSON body `urls`) | a file of URLs: `batch.py --urls`; [recipe](references/recipes.md#engagement-stats-for-a-list-of-post-urls) |\n| Korean / Naver search | `GET /v1/naver/brief?query={keyword}&corpora=news,blog,cafearticle,kin` | one corpus: `naver/blog/search`, `naver/news/search`; [recipe](references/recipes.md#what-korean-consumers-say-about-a-product-and-search-interest) |\n| Profile lookup | `GET /v1/tiktok/profile?handle={handle}` | any `<platform>/profile`; many handles: `prism/profiles`; [recipe](references/recipes.md#a-creators-profile-recent-posts-and-the-comments-on-them) |\n| Scrape a web page | `GET /v1/web/scrape?url={url}` | structured fields: `web/extract`; a whole site: `web/crawl` |\n| One topic on several platforms | `GET /v1/search/multi?query={topic}&platforms=tiktok,instagram,youtube&relevance=filter` | [recipe](references/recipes.md#search-a-topic-on-several-platforms-at-once) |\n<!-- END:GENERATED:COMMON_JOBS -->\n\n## Helpers\n\nBundled scripts in `scripts/` (Python 3). They read the key from `SOCIALCRAWL_API_KEY` or `~/.config/socialcrawl/api_key` and never print it; `--help` on each gives the rest. On Windows Git Bash an argument that starts with `/` is rewritten into a path like `C:/Program Files/Git/v1/...`: `sc.py` recovers a `/v1/...` id, but for curl or your own code drop the leading slash or `export MSYS_NO_PATHCONV=1`.\n\n```bash\npython3 scripts/sc.py tiktok/profile handle=nike # one call; JSON to stdout, credits_used to stderr\npython3 scripts/paginate.py tiktok/post/comments --items 500 --max-credits 20 url=<post_url> > rows.jsonl # page to N rows within a budget\npython3 scripts/to_csv.py --archetype Comment --in rows.jsonl --out comments.csv # rows to CSV with stable columns\npython3 scripts/batch.py --urls links.txt > stats.jsonl # stats for a file of post URLs (prism/post-stats, or one prism/jobs job past 500)\npython3 scripts/estimate.py tiktok/post/comments --items 500 --offline url=<post_url> # quote offline from assets/endpoints.json\n```\n\n**Code requests:** read the section and cost-gate, write a snippet that reads `SOCIALCRAWL_API_KEY` from the environment with a comment stating the billing unit, and present it without running it.\n\n**Capability and pricing questions:** answer from the index and [references/pricing.md](references/pricing.md) (cost, tiers, packs, refunds, the free-endpoint list). Auth, envelope, pagination, labels, caching, idempotency: [references/api-overview.md](references/api-overview.md). The free `/v1/utility/*` calls answer from the live registry: `endpoints` (filter `?platform=`, `?search=`), `endpoint?id=tiktok/profile` (one endpoint, with measured field fill rates and production latency), `explain-error` (paste a failed response, get the fix), `plan?query=`, `resolve?input=<url or @handle>` (platform and every endpoint that takes it), `capabilities` (cross-cutting params and where each works), `docs-search?query=`, `recipes`, `quickstart`. `utility/ai-detection` is the one paid utility (1 credit a text).\n\n**Ambiguous platform:** if the user says \"get @nike's profile\" with no platform, ask which one.\n\n## Where to look\n\n| Need | Open |\n|------|------|\n| Any single platform (social, commerce, reviews and places, app stores, search/news/finance, research and dev, link-in-bio) | [index.md](references/index.md) lists every platform file with its endpoint count; open `references/<platform>.md` |\n| One call over many platforms: Prism composites, `search/multi`, `search/everywhere` | [prism.md](references/prism.md), [search.md](references/search.md) |\n| A watch on a known account or post, with webhook delivery (Monitors); a keyword or topic digest is a discover schedule | [monitors.md](references/monitors.md); [discover schedules](references/api-overview.md#discover-schedules-v1prismdiscoverschedules) |\n| Follow, resume, extend or schedule a `prism/discover` run (all free) | [api-overview.md](references/api-overview.md#discover-runs-v1prismdiscoverruns), [schedules](references/api-overview.md#discover-schedules-v1prismdiscoverschedules) |\n| Be told when a discover run or schedule produces something: event feed or signed push | [api-overview.md](references/api-overview.md#account-event-feed-v1events), [webhook endpoints](references/api-overview.md#webhook-endpoints-v1webhook-endpoints) |\n| \"Which of MY list of accounts posted about X\" (Cohorts, not listening) | [cohorts.md](references/cohorts.md) |\n| Cost of a request or a whole paged walk; spend per API key | [cost-gate.md](references/cost-gate.md), [pricing.md](references/pricing.md), [credits usage](references/api-overview.md#credit-balance) |\n| A failed call | [errors.md](references/errors.md) |\n\n> **Never answer \"not supported\" from this table alone.** It is only as new as this file, and a missing row is far more often a stale copy than a real gap. Before telling a user a platform, endpoint or capability does not exist, check the live registry - it is free:\n>\n> ```bash\n> curl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \\\n> \"https://www.socialcrawl.dev/v1/utility/endpoints?search=douyin\"\n> ```\n>\n> Each row carries `path`, `method`, `credits_label`, `required_params`, `one_of`, `optional_params`, `paginated` and `cache_ttl_seconds`: enough to make the call without this file. Only say it is unsupported when the search returns `total: 0`.\n\n**Comparing products across retailers:** Amazon, Walmart, Target, eBay and Home Depot share the canonical Product / Review / Seller schemas, so rows line up. Resolve each retailer's product id (ASIN, item id, TCIN, ...) with its own search, then fetch detail and reviews per retailer. `/v1/prism/product-reviews` is one composite over Amazon, Google Shopping and Trustpilot reviews only; for Walmart, Target or Home Depot call `<retailer>/reviews`.\n\n**Several platforms at once:** To search one platform, call that platform's own search. To search several platforms over a date window with every row judged and de-duplicated, call `/v1/prism/discover`. For a quick fused sweep at a flat 20 credits, call `/v1/search/everywhere`, which drops rows outside `from_date`, `to_date`, `since` or `until` but reads one page per source, so a past window can come back thin. `/v1/prism/discover` answers in the call, or answers `202` with a run you poll at `data.next.poll_url`, a light status read (never resubmit a running request; read it with `wait_s=25` for a free long-poll rather than sleeping between reads, and send `x-client-tag: <name>` to split spend per agent at `GET /v1/credits/usage?group_by=tag`, which the run's searches, comment pages and judging keep); put 2 to 6 topic words in `keywords` and the user's question in `context` ([guide](https://www.socialcrawl.dev/docs/prism/discover)). `/v1/search/multi` runs one query over several platforms' own search, one page per platform, with an optional `since`/`until` window and no background run (each platform's page price, charged only for those that returned rows). Many profiles or post URLs go to `POST /v1/prism/profiles` / `POST /v1/prism/post-stats`, or the background job `POST /v1/prism/jobs`. The comments of up to 25 post URLs across platforms go to `POST /v1/prism/post-comments` in one call. From a person's or company's name to ranked candidate accounts with a match level, call `GET /v1/prism/find-accounts` rather than looping each platform's user search.\n\n**One fused search:** For one fused, ranked search across the platforms it covers at a flat 20 credits a search, call `/v1/search/everywhere`; for a collection of more than 100 rows or more than one page per platform, call `/v1/prism/discover`; for creators, `/v1/prism/creators`; to be told what is new, send `since_watermark` with the `data.next.watermark` of your last answer, or turn the search into a watch with its `data.next.watch`. ([guide](https://www.socialcrawl.dev/docs/search/everywhere)).\n\n**Creators or influencers:** To find creators or influencers (by topic, market, size, or a product to promote), lookalikes of creators, or to measure and rank a list of creators you already have, call `/v1/prism/creators`. For shops, businesses and sellers, call `/v1/prism/discover` with `view=accounts`. It answers in the call or answers `202` with a run you follow at `data.next.status_url`; put 2 to 6 topic words in `keywords` and what the creators post about in `context`, a product to promote in `campaign`, or creators you already have in `handles` with `purpose` ([guide](https://www.socialcrawl.dev/docs/prism/creators)).\n\n\n**Alerts and recurring watches:** To be told when something new appears, match the ask to its job: for a recurring digest of what is new about a topic, keyword or brand, every 1h or slower, call `POST /v1/search/everywhere` with `schedule` (every `1h` or slower, `dry_run` first), at 20 credits a search per fire and only rows that watch has not delivered, read through `GET /v1/events`, a webhook endpoint or the watch's own `last_fire`; for the new posts or comments of an account or post you already know, call `POST /v1/monitors` with `webhook_rows: \"new\"`; for a one-off check of what is new since your last check, on an endpoint that takes `since` or `since_id`, call the endpoint's own `since` or `since_id` (for example `GET /v1/twitter/tweet/replies` with `since_id`, which returns an empty list and costs nothing when nothing is new); for metric snapshots of accounts you name (followers, views, likes), taken on a schedule, call `POST /v1/monitors` with a `track` metric; for reading what your watches produced, from a feed you poll or an endpoint that receives a signed push, call `GET /v1/events` with a named `consumer` for reading, and `/v1/webhook-endpoints` for push; a keyword or topic alert is never a Monitor.\n\n## Making calls\n\nBase URL `https://www.socialcrawl.dev`. Most endpoints are GET with query parameters (URL-encode values):\n\n```\ncurl -s -H \"x-api-key: $SOCIALCRAWL_API_KEY\" \\\n \"https://www.socialcrawl.dev/v1/{platform}/{resource}?{param}={value}\"\n```\n\n**Never assume the method.** Each endpoint section is headed by its real verb with a runnable curl. Batch reads, Prism jobs, web jobs, monitors, and cohorts use POST, PATCH, PUT, or DELETE with `content-type: application/json` (`web/parse` is multipart); the list, plus streaming (`Accept: text/event-stream`) and two-step endpoints that need an id from an earlier call, is in [api-overview.md](references/api-overview.md#non-get-routes-streaming-and-two-step-endpoints). Rate limits: 600 requests per minute and 50 concurrent per key; both return 429 with `Retry-After` and are never billed. Many endpoints take 10-45 s (task-polled sources, social profiles on a slow day): use a 60 s client timeout, or the endpoint's `recommended_timeout_s` from `GET /v1/utility/endpoint?id=` (free). Never time out early and resend a different request: an aborted JSON call still runs, is charged and is cached, so resend the **identical** request and it comes back from cache at 0 credits. A streamed call (`Accept: text/event-stream`) that you abort is refunded and is not cached, so its resend is billed as a new call. A 429 body repeats the wait as `error.details.retry_after_s`; a 504 with `error.details.reason: \"task_queued\"` is picked up by the identical request within the hour, or send it with `Prefer: respond-async` for a job to poll at `data.next.status_url`. `POST` to `web/agent`, `web/sessions`, `web/monitors`, `web/parse`, `monitors` and `trustpilot/reviews/history` ignores `Idempotency-Key`: never auto-retry those, or you create (and pay for) a second one.\n\n## Reading a response\n\nDetails are in [api-overview.md](references/api-overview.md). Seven rules before the first call:\n\n- **Placement.** `pagination` (`next_cursor`, `has_more`, `page_size`) and the optional `meta.hint` sit at the envelope root. `dropped`, `_warnings` and every page report (`labels`, `relevance`, `label_share`, `hydration`, `walk`, ...) sit inside `data`. Read `data._warnings`: a parameter applied under the endpoint's own name (`sort was applied as sort_by, this endpoint's name for it.`), an ignored one (`limit was ignored: this endpoint's page size is fixed. ...`) or a handle that resolved to a different account (`resolved_to_different_handle`) is reported there, not as an error.\n- **Paging.** Send `pagination.next_cursor` back as `cursor` and stop on `has_more: false`, not on a short page or on `total`. A page with no rows and `has_more: true` is not the end, so call again with `next_cursor`. A page the source returned empty costs nothing; a page your `since` or `until` emptied costs what a page costs. A zero-match list is `200` with `items: []` at 0 credits.\n- **Get more in one call; do not loop.** Most list endpoints take `max_items=N` (walk pages until N rows), `max_credits=N` (never spend past it) and `max_pages` (1-50); check the endpoint's parameters first, because self-walking endpoints, the `-full` lanes, job reads and `prism/discover` do not. Each page is billed as one call, `data.walk.stopped` says why it ended (`end`, `max_items`, `max_credits`, `time_budget`, ...) and `pagination.next_cursor` resumes ([details](references/api-overview.md#get-more-in-one-call-max_items-max_credits-max_pages)).\n- **Empty lists say why.** Every `items: []` carries `data.empty_reason` and a one-sentence `data.empty_reason_note`: `no_matches`, `end_of_list`, `nothing_new_since` (your `since` / `stop_at_id` poll found nothing new), `window_filtered`, `relevance_filtered`, `row_filtered`, `already_seen`, or `source_empty_unverified`, the only one worth a retry. Tell the user which it is instead of reporting \"no data\" ([codes](references/api-overview.md#empty-lists-empty_reason)).\n- **Default judgments are free.** Comment, post, review and keyword-search rows carry labels (`computed.labels`) and search rows a relevance score (`computed.relevance`) at no extra cost; `judgments=off` returns the raw page. Opt-in presets (`label=spam|toxic|low_quality|quality|ai_style|ai_written|injection|mention|reports|incentivized`, `relevant_to=`) add **1 credit per started 25 freshly judged rows**, held as `ceil(row cap / 25)` and refunded to the rows actually judged. `relevance=filter` against the query itself is free.\n- **Date windows.** `since` / `until` (`YYYY-MM-DD` or a timestamp) work on about 155 dated lists and on `search/everywhere`. On 25 newest-first lists (the creator feeds and some comment, review and search lists) sending `since` sets their recency sort and the page that reaches the date ends the walk (`pagination.stopped_at`); every other list filters each page, keeps its cursor and bills every page walked, so an empty page that still has `next_cursor` is normal: keep paging. `published_after`, `start_date`, `from_date`, `publish_time=this-week` and `max_age_days` are read as `since`; `published_before`, `end_date` and `to_date` as `until` ([date window](references/api-overview.md#date-window-since-until)). A date on a list whose rows carry none is a free 400 (`unsupported_date_filter`).\n- **Spend controls.** Creator post lists also take `stop_at_id`, so a poll pays only for new pages. Keyword searches take `min_views`, `country` / `exclude_country`, `sort_rows=views`, `seen=<id>` (repeats refunded) on top of the walk (**each page billed**).\n- **`meta.hint`** names one other call that does the job in fewer steps. Its message states the price when that call costs more; follow it only within what the user authorised.\n\n`include=` hydration joins rows to a sibling endpoint and is charged **per row on top of the page**, so never quote the plain heading cost for a hydrated call; the ceilings are in [cost-gate.md](references/cost-gate.md#row-hydration-include) and the traps in [api-overview.md](references/api-overview.md#row-hydration-include).\n\n## Cost rule\n\nCache hits, idempotent replays, every `/v1/utility/*` endpoint except `utility/ai-detection` (1 credit), and `/v1/credits/*` cost 0 credits. Failed calls are refunded, and a request rejected for bad params, a page past the last page, or a rate limit never deducts. Metered endpoints hold an upfront ceiling and refund down to the work done, so the response `credits_used` is the real charge. A band that starts at 0 can settle at 0 (its legs bill only when they return rows), and the top of a wide band is a cap, not the expected charge: `prism/discover` never spends past its `max_credits`. Quote the total for the exact request, not the endpoint's base or unit cost. Scale the gate to the call:\n\n| Call | Gate |\n| --- | --- |\n| Flat price ≤ 5 credits, user asked for it | One line: `≈ N credits` |\n| Metered, multi-page, batch, monitor/cohort, or > 25 credits | Full preflight via `estimate.py` / `utility/estimate` |\n| Upfront hold (worst case) > 500 credits or over budget (the user's stated budget) | Ask before calling |\n\nAnything in between, or unsure of the price or params: quote first with the free `GET /v1/utility/estimate?id=<platform/resource>&<params>`. Any reply except a 404 means a current server (a 5xx or network failure is no reply: retry the estimate): use its quote and gate on `hold`, which is the most the request can bill (every page of a `max_pages` or `max_items` walk, and the legs a composite bills itself); `upfront_hold` is only what is deducted when the call starts, and `quote_basis` names the params that were priced, so check it matches the request you will send. `dry_run=1` is then free on any endpoint (validates, fetches nothing). A 404 or `ENDPOINT_NOT_FOUND` means an older server: do **not** send `dry_run=1` (it bills a normal call there, except the labelled dry run an endpoint documents); quote with `scripts/estimate.py` (offline, `assets/endpoints.json`) or the section's **Pricing** line. At every level, report `credits_used` after.\n\n**If the task needs a whole list, price the whole walk before the first page.** Paging to completion multiplies the page cost by the page count, and a heading only shows one page. `instagram/followers` and `instagram/following` are the common case: about 50 accounts a page. A plain walk (5 credits a page) usually ends within a few rows of the profile's count (large verified accounts stop at about 50 rows on every route); `coverage=full` (10 credits a page) is only for a walk that fell short of `data.total`, and at that rate a 2,600-account list is roughly 520 credits, half that on a plain walk. Quote the total and get agreement before starting ([Multi-page walks](references/cost-gate.md#multi-page-walks-coveragefull)).\n\nErrors: classify before retrying with [references/errors.md](references/errors.md), or paste the status and body into the free `GET /v1/utility/explain-error` for the fix. Never retry a 402 unchanged. Credits and balance: `GET /v1/credits/balance` (0 credits); the ledger is `GET /v1/credits/transactions?limit=50`; spend per API key per UTC day (up to 92 days) is `GET /v1/credits/usage?from=&to=&group_by=api_key,day` (both 0 credits). When several agents share one key, have each send `x-client-tag: <name>` (1 to 64 letters, digits, `.`, `_`, `:` or `-`); `GET /v1/credits/usage?group_by=tag` then splits the spend per agent and `GET /v1/credits/transactions?tag=<name>` lists one agent's rows.";
3
- export const ERRORS_GUIDE = "# Errors\n\nRead this when a call fails. The full code table (status, retryable, what to do) is generated in [api-overview.md](api-overview.md#error-codes); the `error.details` reasons are in [api-overview.md](api-overview.md#error-details-errordetails).\n\n**Fastest fix:** paste the failed status and body into the free `GET /v1/utility/explain-error?status=<code>&body=<error JSON>` (add `request=<the path and query you sent>` to get a corrected request back). It returns the fault in plain words, the steps that fix it, and whether retrying the same request can succeed. Nothing is fetched and it costs 0 credits.\n\n## Classify before retrying\n\nBranch on `error.retryable` first, then on `error.details`, never on the status alone.\n\n- **Fix before retrying (`retryable: false`):** `MISSING_API_KEY`, `INVALID_API_KEY`, `INSUFFICIENT_CREDITS`, `KEY_BUDGET_EXCEEDED`, `INVALID_REQUEST`, `METHOD_NOT_ALLOWED` (the `Allow` header names the right verb), `ENDPOINT_NOT_FOUND`, `PAYLOAD_TOO_LARGE`, `IDEMPOTENCY_KEY_CONFLICT`, `IDEMPOTENCY_KEY_PAYLOAD_MISMATCH` (use a fresh key for the changed payload), `IDEMPOTENCY_REPLAY_UNAVAILABLE`, and every `COHORT_*` code. Explain the corrective action and do not repeat the same request.\n- **Wait, then retry the same request:** `RATE_LIMITED`, `CONCURRENCY_LIMIT` (`Retry-After: 1`), `SERVICE_UNAVAILABLE`, and `409 IDEMPOTENCY_IN_PROGRESS` (`Retry-After` 1-30 s; resend with the **same** `Idempotency-Key`). Honour `Retry-After`, then back off exponentially with jitter. A `Retry-After` longer than a minute (for example `3600` for a source that is down in one market) means stop and report, not wait in a loop.\n- **Transient upstream failure:** `UPSTREAM_ERROR` (502, or 504 on a timeout) and `INTERNAL_ERROR`, refunded. If `error.details.retry_with` is present, `retryable` is `false` and there is no `Retry-After`: the same request fails the same way, so resend once with exactly the params it names (for example `proxy=auto` on `web/scrape`). If `error.incident` is present, stop calling that platform and poll `GET /v1/status/{platform}` every few minutes. Otherwise retry at most once, then report the outage with the endpoint and `request_id`, never the credential.\n- **Out of time on our side:** a request still unanswered at 54 s gets the standard error envelope with a request id and `Retry-After`, not the hosting platform's bare 504. A request with under 500 ms of its time left answers a refunded 503 with `Retry-After: 5` instead of starting a source call it cannot finish, and a busy database answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 5` within about 3 to 11 s. Wait the `Retry-After`, then resend the identical request once.\n- **Facebook page public but not readable on this attempt:** `facebook/profile` answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 15` when the page is public but could not be read, and `facebook/profile/posts` does the same when a first page (no `cursor`) comes back empty from every source. It is never cached and costs 0 credits: wait the `Retry-After` and resend the same request. A `since`/`until` window that matches no posts is still a normal `200` with an empty page.\n- **Not found:** `RESOURCE_NOT_FOUND` is a valid empty outcome, not a retry loop.\n- **Discover runs and the events feed:** `RUN_NOT_FOUND` / `SCHEDULE_NOT_FOUND` (wrong id, or another account's): list your runs or schedules, or start again. `RUN_STATE_CONFLICT` (409): read the run and do what `data.run.next_step` says (a completed run takes `more`, not `resume`). `RUN_EXPIRED` (410): retention passed, start a new run. `NEEDS_ASYNC` (422): drop `async=false` and follow the 202's `data.next.status_url`. `CURSOR_EXPIRED` (410): restart the feed from `details.oldest_cursor` (or `cursor=oldest`) and tell the user the events in `missed_from`..`missed_until` are gone (30-day retention).\n\n## Act on `error.details`\n\nEvery error carries `error.retryable`, and many carry `error.details.reason`; act on it rather than on the status alone:\n\n- **402** (`balance_too_low`, `key_budget_reached`) always says `retry_will_succeed: false`: **never retry a 402 unchanged**. The same request fails until the balance or that key's limit changes. Point the user at `top_up_url` or `key_settings_url`; `key_name`, `key_prefix` and `account_email_masked`, when present, say which key and account ran out. A key budget is a lifetime cap on that key's net spend (refunds give it back; it never resets on its own), so on `key_budget_reached` the `credits_remaining` is the healthy account balance: the user raises the limit or resets the key's usage in Dashboard → API Keys, or uses another key. On a metered call `pricing: \"ceiling\"` means the quoted credits are the maximum hold (unused credits are refunded) and `credits_typical` is what a call like it is usually charged; `pricing: \"exact\"` means it is charged what it holds. `lower_cost_options` lists each param that lowers the hold, with the `value` to send (`null`: leave it out) and the `credits_required` it gives, and `credits_required_cheapest` is the hold with all of them. When one of those fits `credits_remaining`, offer the user that smaller request, or a top-up for the full one.\n- **400 `page_limit`** (`max_page`, `narrow_with`): the source has no further pages for this query; stop paging and narrow the query instead. It is the end of the walk, not a failure.\n- **400 with `did_you_mean`**: a parameter or value was misnamed. `error.details.received_unknown` lists the names the endpoint did not recognise, `missing` the required one it did not get, and `did_you_mean` the name it takes (`You sent term; this endpoint takes query`). Resend under that name; it is free.\n- **400 `INVALID_REQUEST` naming a param on a single-source lane** (for example `weibo/profile`, `goodreads/quotes`, `airbnb/search`, `airbnb/listing/availability`): the value you sent is wrong for that source (an id or URL it cannot read, a date it refuses). It is free and final; fix the param named in `error.details.param` and resend. These lanes used to answer a refunded, retryable 502 for the same input, so do not retry one unchanged.\n- **400 `unsupported_date_filter`**: `since` / `until` (or a copied spelling such as `published_after`) on a list whose rows carry no date. Drop the date.\n- **404 `account_gone` / `account_private` / `handle_unresolved`**: follow `error.details.suggestion` once (for a YouTube handle, retry with the stored `channelId` to tell a rename from a removal), then report. On Facebook (`facebook/profile`, `facebook/profile/posts`) an `account_private` 404 also carries `details.account_status`: `age_restricted` (Facebook shows the page only to signed-in viewers who meet its age restriction, so retrying will not help) or `private`. `details.reason` stays `account_private` and the call costs 0 credits. `site_not_supported` on `web/scrape` is final; its `suggestion` names the SocialCrawl endpoint for a social link.\n- **404 `ENDPOINT_NOT_FOUND`** may carry `details.did_you_mean` (paths), `did_you_mean_platform` and `retry_with` (the whole corrected URL, for example for a bare `/search`); check the live registry (`GET /v1/utility/endpoints?search=`, free) before saying something is unsupported. On `/v1/web/jobs|monitors|sessions/{id}` it means the id is unknown for this key.\n- **404 `url_unreachable`** on `web/scrape` and `web/extract`: the address is dead or does not resolve. Free and final; check the URL with the user. `site_not_supported` answers the same way on `web/extract` as on `web/scrape`.\n- **503 `breaker_open`**: that source is paused. The request was refused without being sent and was not billed. Until the time the message states, the same request fails the same way; the same request **without the option the message names** works now. With no stated time, wait for `Retry-After`.\n- **503 \"retry the same cursor\"** on a later search page (`facebook/search/posts`, and `not_found_unconfirmed` on `tiktok/search`): refunded. Resend the **same** cursor once later. When that cursor answers empty again on a later request (`facebook/search/posts`: at least 10 minutes after its first empty answer), the answer is a free `200` with `items: []` and `has_more: false`: the walk has ended.\n- **502 `profile_lookup_timeout`** on `tiktok/user/live`: TikTok did not return the account in time. Refunded; retry later.\n- **5xx** carry `error.status_url` and, during an open incident, `error.incident` (`id`, `title`, `status`, `impact`, `url`). A refunded **504** carries `Retry-After: 30`: wait that long before the one automatic retry.\n- **429** bodies carry `error.details` as well as the headers (`reason`, for example `concurrency`, `limit`, `current`, `remaining`, `retry_after_s`), for clients that drop headers.\n\n## Not errors: `data._warnings` and `meta.hint`\n\nA `200` can still carry advice. `data._warnings` reports a parameter that was ignored or cleaned (a `Query:` label stripped from a search term, a `fields=` path that does not exist, with the path it probably meant) and a handle that resolved to a different account. `meta.hint`, at the envelope root, names one other call that does the job in fewer steps; when that call costs more, its `message` says both prices, so follow it only within what the user authorised. It reaches a key at most once a day per pattern, never on an error; send `X-SocialCrawl-Hints: off` to stop it.\n\n## Retrying paid calls\n\nFor a retryable paid non-streaming request, send an `Idempotency-Key` before the first attempt and reuse it only for the identical payload (same params, same `fields`). A GET with `Accept: text/event-stream` cannot carry an `Idempotency-Key` (free 400); do not automatically retry streaming requests. Never exceed one automatic retry unless the user explicitly asks for continued retries.\n\n**Some POSTs ignore `Idempotency-Key`, so never auto-retry them:** `POST /v1/web/agent`, `/v1/web/sessions`, `/v1/web/monitors`, `/v1/web/parse`, `/v1/monitors` and `/v1/trustpilot/reviews/history`. A resend creates (and, where it bills, bills) a second run, session, monitor or job. Read the list route (`GET /v1/web/jobs`, `GET /v1/web/sessions`, `GET /v1/monitors`) to see whether the first one landed. On `POST /v1/web/crawl` and `/v1/web/batch-scrape` a repeated key returns the existing job (200, 0 credits) without comparing the body.\n\n**A client timeout does not cancel the call.** The server finishes it, charges it and writes it to the cache. Resend the identical request (same or new key) and, within the endpoint's cache TTL, it comes back free from cache (`X-Cache: HIT`). Size your timeout from `recommended_timeout_s` in `GET /v1/utility/endpoint?id=` (60 s is safe almost everywhere).\n\nFailed calls are refunded (upstream errors, circuit-breaker rejections, timeouts, not-found, empty results). `credits_used` on an error envelope is the committed net charge: 0 in almost every case, the kept legs on a partially failed composite. A request rejected for bad params, a page past the source's last page, or a rate limit never deducts at all.";
3
+ export const ERRORS_GUIDE = "# Errors\n\nRead this when a call fails. The full code table (status, retryable, what to do) is generated in [api-overview.md](api-overview.md#error-codes); the `error.details` reasons are in [api-overview.md](api-overview.md#error-details-errordetails).\n\n**Fastest fix:** paste the failed status and body into the free `GET /v1/utility/explain-error?status=<code>&body=<error JSON>` (add `request=<the path and query you sent>` to get a corrected request back). It returns the fault in plain words, the steps that fix it, and whether retrying the same request can succeed. Nothing is fetched and it costs 0 credits.\n\n## Classify before retrying\n\nBranch on `error.retryable` first, then on `error.details`, never on the status alone.\n\n- **Fix before retrying (`retryable: false`):** `MISSING_API_KEY`, `INVALID_API_KEY`, `INSUFFICIENT_CREDITS`, `KEY_BUDGET_EXCEEDED`, `INVALID_REQUEST`, `METHOD_NOT_ALLOWED` (the `Allow` header names the right verb), `ENDPOINT_NOT_FOUND`, `PAYLOAD_TOO_LARGE`, `IDEMPOTENCY_KEY_CONFLICT`, `IDEMPOTENCY_KEY_PAYLOAD_MISMATCH` (use a fresh key for the changed payload), `IDEMPOTENCY_REPLAY_UNAVAILABLE`, and every `COHORT_*` code. Explain the corrective action and do not repeat the same request.\n- **Wait, then retry the same request:** `RATE_LIMITED`, `CONCURRENCY_LIMIT` (`Retry-After: 1`), `SERVICE_UNAVAILABLE`, and `409 IDEMPOTENCY_IN_PROGRESS` (`Retry-After` 1-30 s; resend with the **same** `Idempotency-Key`). Honour `Retry-After`, then back off exponentially with jitter. A `Retry-After` longer than a minute (for example `3600` for a source that is down in one market) means stop and report, not wait in a loop.\n- **Transient upstream failure:** `UPSTREAM_ERROR` (502, or 504 on a timeout) and `INTERNAL_ERROR`, refunded. If `error.details.retry_with` is present, `retryable` is `false` and there is no `Retry-After`: the same request fails the same way, so resend once with exactly the params it names (for example `proxy=auto` on `web/scrape`). If `error.incident` is present, stop calling that platform and poll `GET /v1/status/{platform}` every few minutes. Otherwise retry at most once, then report the outage with the endpoint and `request_id`, never the credential.\n- **Out of time on our side:** a request still unanswered at 54 s gets the standard error envelope with a request id and `Retry-After`, not the hosting platform's bare 504. A request with under 500 ms of its time left answers a refunded 503 with `Retry-After: 5` instead of starting a source call it cannot finish, and a busy database answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 5` within about 3 to 11 s. Wait the `Retry-After`, then resend the identical request once.\n- **Facebook page public but not readable on this attempt:** `facebook/profile` answers a free `503 SERVICE_UNAVAILABLE` with `Retry-After: 15` when the page is public but could not be read, and `facebook/profile/posts` does the same when a first page (no `cursor`) comes back empty from every source. It is never cached and costs 0 credits: wait the `Retry-After` and resend the same request. A `since`/`until` window that matches no posts is still a normal `200` with an empty page.\n- **Not found:** `RESOURCE_NOT_FOUND` is a valid empty outcome, not a retry loop.\n- **Discover runs and the events feed:** `RUN_NOT_FOUND` / `SCHEDULE_NOT_FOUND` (wrong id, or another account's): list your runs or schedules, or start again. `RUN_STATE_CONFLICT` (409): read the run and do what `data.run.next_step` says (a completed run takes `more`, not `resume`). `RUN_EXPIRED` (410): retention passed, start a new run. `NEEDS_ASYNC` (422): drop `async=false` and follow the 202's `data.next.status_url`. `CURSOR_EXPIRED` (410): restart the feed from `details.oldest_cursor` (or `cursor=oldest`) and tell the user the events in `missed_from`..`missed_until` are gone (30-day retention).\n\n## Act on `error.details`\n\nEvery error carries `error.retryable`, and many carry `error.details.reason`; act on it rather than on the status alone:\n\n- **402** (`balance_too_low`, `key_budget_reached`) always says `retry_will_succeed: false`: **never retry a 402 unchanged**. The same request fails until the balance or that key's limit changes. Point the user at `top_up_url` or `key_settings_url`; `key_name`, `key_prefix` and `account_email_masked`, when present, say which key and account ran out. A key budget is a lifetime cap on that key's net spend (refunds give it back; it never resets on its own), so on `key_budget_reached` the `credits_remaining` is the healthy account balance: the user raises the limit or resets the key's usage in Dashboard → API Keys, or uses another key. On a metered call `pricing: \"ceiling\"` means the quoted credits are the maximum hold (unused credits are refunded) and `credits_typical` is what a call like it is usually charged; `pricing: \"exact\"` means it is charged what it holds. `lower_cost_options` lists each param that lowers the hold, with the `value` to send (`null`: leave it out) and the `credits_required` it gives, and `credits_required_cheapest` is the hold with all of them. When one of those fits `credits_remaining`, offer the user that smaller request, or a top-up for the full one. A team member's 402 keeps the code `INSUFFICIENT_CREDITS` but carries no `checkout_url`, no `top_up_url` and no pack, because a member does not buy credits: `error.details.billing.credits_added_by` names who adds credits for the team and `next_step` says to ask the team's owner, so relay that and never offer a top-up. When the team balance is not available to that member, `credits_added_by` is `null` and `next_step` says that leaving the team returns them to their own balance.\n- **400 `page_limit`** (`max_page`, `narrow_with`): the source has no further pages for this query; stop paging and narrow the query instead. It is the end of the walk, not a failure.\n- **400 with `did_you_mean`**: a parameter or value was misnamed. `error.details.received_unknown` lists the names the endpoint did not recognise, `missing` the required one it did not get, and `did_you_mean` the name it takes (`You sent term; this endpoint takes query`). Resend under that name; it is free.\n- **400 `INVALID_REQUEST` naming a param on a single-source lane** (for example `weibo/profile`, `goodreads/quotes`, `airbnb/search`, `airbnb/listing/availability`): the value you sent is wrong for that source (an id or URL it cannot read, a date it refuses). It is free and final; fix the param named in `error.details.param` and resend. These lanes used to answer a refunded, retryable 502 for the same input, so do not retry one unchanged.\n- **400 `unsupported_date_filter`**: `since` / `until` (or a copied spelling such as `published_after`) on a list whose rows carry no date. Drop the date.\n- **404 `account_gone` / `account_private` / `handle_unresolved`**: follow `error.details.suggestion` once (for a YouTube handle, retry with the stored `channelId` to tell a rename from a removal), then report. On Facebook (`facebook/profile`, `facebook/profile/posts`) an `account_private` 404 also carries `details.account_status`: `age_restricted` (Facebook shows the page only to signed-in viewers who meet its age restriction, so retrying will not help) or `private`. `details.reason` stays `account_private` and the call costs 0 credits. `site_not_supported` on `web/scrape` is final; its `suggestion` names the SocialCrawl endpoint for a social link.\n- **404 `ENDPOINT_NOT_FOUND`** may carry `details.did_you_mean` (paths), `did_you_mean_platform` and `retry_with` (the whole corrected URL, for example for a bare `/search`); check the live registry (`GET /v1/utility/endpoints?search=`, free) before saying something is unsupported. On `/v1/web/jobs|monitors|sessions/{id}` it means the id is unknown for this key.\n- **404 `url_unreachable`** on `web/scrape` and `web/extract`: the address is dead or does not resolve. Free and final; check the URL with the user. `site_not_supported` answers the same way on `web/extract` as on `web/scrape`.\n- **503 `breaker_open`**: that source is paused. The request was refused without being sent and was not billed. Until the time the message states, the same request fails the same way; the same request **without the option the message names** works now. With no stated time, wait for `Retry-After`.\n- **503 \"retry the same cursor\"** on a later search page (`facebook/search/posts`, and `not_found_unconfirmed` on `tiktok/search`): refunded. Resend the **same** cursor once later. When that cursor answers empty again on a later request (`facebook/search/posts`: at least 10 minutes after its first empty answer), the answer is a free `200` with `items: []` and `has_more: false`: the walk has ended.\n- **502 `profile_lookup_timeout`** on `tiktok/user/live`: TikTok did not return the account in time. Refunded; retry later.\n- **5xx** carry `error.status_url` and, during an open incident, `error.incident` (`id`, `title`, `status`, `impact`, `url`). A refunded **504** carries `Retry-After: 30`: wait that long before the one automatic retry.\n- **429** bodies carry `error.details` as well as the headers (`reason`, for example `concurrency`, `limit`, `current`, `remaining`, `retry_after_s`), for clients that drop headers.\n\n## Not errors: `data._warnings` and `meta.hint`\n\nA `200` can still carry advice. `data._warnings` reports a parameter that was ignored or cleaned (a `Query:` label stripped from a search term, a `fields=` path that does not exist, with the path it probably meant) and a handle that resolved to a different account. `meta.hint`, at the envelope root, names one other call that does the job in fewer steps; when that call costs more, its `message` says both prices, so follow it only within what the user authorised. It reaches a key at most once a day per pattern, never on an error; send `X-SocialCrawl-Hints: off` to stop it.\n\n## Retrying paid calls\n\nFor a retryable paid non-streaming request, send an `Idempotency-Key` before the first attempt and reuse it only for the identical payload (same params, same `fields`). A GET with `Accept: text/event-stream` cannot carry an `Idempotency-Key` (free 400); do not automatically retry streaming requests. Never exceed one automatic retry unless the user explicitly asks for continued retries.\n\n**Some POSTs ignore `Idempotency-Key`, so never auto-retry them:** `POST /v1/web/agent`, `/v1/web/sessions`, `/v1/web/monitors`, `/v1/web/parse`, `/v1/monitors` and `/v1/trustpilot/reviews/history`. A resend creates (and, where it bills, bills) a second run, session, monitor or job. Read the list route (`GET /v1/web/jobs`, `GET /v1/web/sessions`, `GET /v1/monitors`) to see whether the first one landed. On `POST /v1/web/crawl` and `/v1/web/batch-scrape` a repeated key returns the existing job (200, 0 credits) without comparing the body.\n\n**A client timeout does not cancel the call.** The server finishes it, charges it and writes it to the cache. Resend the identical request (same or new key) and, within the endpoint's cache TTL, it comes back free from cache (`X-Cache: HIT`). Size your timeout from `recommended_timeout_s` in `GET /v1/utility/endpoint?id=` (60 s is safe almost everywhere).\n\nFailed calls are refunded (upstream errors, circuit-breaker rejections, timeouts, not-found, empty results). `credits_used` on an error envelope is the committed net charge: 0 in almost every case, the kept legs on a partially failed composite. A request rejected for bad params, a page past the source's last page, or a rate limit never deducts at all.";
4
4
  //# sourceMappingURL=guide.js.map
@@ -161,7 +161,7 @@ export const OUTPUTS = {
161
161
  "GET tiktok/trending": { "archetype": "PostList", "rows_at": "data.items[].post", "fields": [{ "path": "post.author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to author profile picture", "fill": 1, "live": true }, { "path": "post.author.display_name", "type": "string", "nullable": false, "meaning": "Author display name", "fill": 1, "live": true }, { "path": "post.author.username", "type": "string", "nullable": false, "meaning": "Author username", "fill": 1, "live": true }, { "path": "post.content.duration_seconds", "type": "number", "nullable": false, "meaning": "Video/clip duration in seconds (null for non-video posts)", "fill": 1, "live": true }, { "path": "post.content.media_urls", "type": "string|array", "nullable": false, "meaning": "URL(s) of the primary media. Single string for video/photo posts; array of strings for carousels.", "fill": 1, "live": true }, { "path": "post.content.thumbnail_url", "type": "string", "nullable": false, "meaning": "URL to thumbnail image", "fill": 1, "live": true }, { "path": "post.engagement.comments", "type": "number", "nullable": false, "meaning": "Comment count. Note: on `GET /v1/instagram/post` this is Instagram's `edge_media_to_parent_comment.count` (top-level comments); the IG list endpoints report the mobile `comment_count` total (includes replies). Both land on this same field.", "fill": 1, "live": true }, { "path": "post.engagement.likes", "type": "number", "nullable": false, "meaning": "Like / reaction count", "fill": 1, "live": true }, { "path": "post.engagement.saves", "type": "number", "nullable": false, "meaning": "Save / bookmark count. `null` on Instagram: the save count is platform-private and Instagram exposes no numeric save metric on any surface (never fabricated).", "fill": 1, "live": true }, { "path": "post.engagement.shares", "type": "number", "nullable": false, "meaning": "Share / repost / retweet count. On Instagram this is `reshare_count` (the paper-plane Share / Send count) and it exists only on Instagram's mobile surface, so it is returned by `/v1/instagram/post/stats`, `/v1/instagram/profile/reels/full`, and `/v1/instagram/profile/posts/full`. The web-sourced Instagram list and search endpoints return `null` (never fabricated).", "fill": 1, "live": true }, { "path": "post.engagement.views", "type": "number", "nullable": false, "meaning": "View count (if available). For Instagram video/reels this is the play count: the headline 'Views' the IG app shows. Instagram removed per-post play counts from its public web pages in August 2026, so `GET /v1/instagram/post` now fills the count automatically from a second source within the same call: videos and reels keep a numeric `views` with no extra endpoint or workaround. Note: since mid-July 2026 Instagram's play count is Instagram-only. It no longer includes Facebook crosspost views (Meta-side change; the app UI changed identically). For combined reach, also fetch the Facebook crosspost via `/v1/facebook/post`.", "fill": 1, "live": true }, { "path": "post.ext.author_id", "type": "string", "nullable": true, "meaning": "The creator's platform-native numeric user id. On TikTok search and list items, pass to `/v1/tiktok/profile?user_id=` for the creator's current follower count (survives username changes). On Instagram `/v1/instagram/search/reels`, `/v1/instagram/search/hashtag` and `/v1/instagram/location/posts` items it is present on every row, accepted by `/v1/instagram/profile/country?user_id=` and `/v1/instagram/basic-profile?userId=`. On Facebook it appears when the upstream exposed a numeric actor id and no real handle. On X post lanes it is the author's numeric account id, the same as `author.id` on `/v1/twitter/profile`.", "fill": 1, "live": true }, { "path": "post.ext.music_id", "type": "string", "nullable": true, "meaning": "TikTok music/clip id (exact string): pass to `/v1/tiktok/song/videos?clipId=` to find videos using the same sound. On Instagram, the sound's audio id (exact string), which `/v1/instagram/audio/reels?audio_id=` takes.", "fill": 1, "live": true }, { "path": "post.ext.region", "type": "string", "nullable": true, "meaning": "TikTok only: the country TikTok registers the video to, as an ISO 3166-1 alpha-2 code (normally the creator's account country when they posted). It is not the viewer's country, not the `region` you requested, and not a language. On `/v1/tiktok/trending`, `/v1/tiktok/search`, `/v1/tiktok/search/top`, `/v1/tiktok/profile/videos`, `/v1/tiktok/search/hashtag` and `/v1/tiktok/song/videos` it is how you tell which rows are from a given country: filter on it when you need only that country. A row whose source omits the country stays null. The `region` request parameter still only sets the proxy.", "fill": 1, "live": true }, { "path": "post.id", "type": "string", "nullable": false, "meaning": "Platform-specific post ID (always a string; numeric upstream IDs are stringified)", "fill": 1, "live": true }, { "path": "post.published_at", "type": "string|number", "nullable": false, "meaning": "Post creation timestamp as an ISO 8601 UTC string. When the upstream sent a Unix epoch it is converted here and the raw epoch is preserved under `post.ext.published_at_epoch` for one deprecation cycle.", "fill": 1, "live": true }, { "path": "post.url", "type": "string", "nullable": false, "meaning": "Direct URL to the post on the source platform", "fill": 1, "live": true }, { "path": "post.content.text", "type": "string", "nullable": true, "meaning": "Post caption, description, or text content", "fill": 0.9, "live": true }, { "path": "post.flags.pinned", "type": "boolean", "nullable": true, "meaning": "Pinned-to-profile flag (null when platform does not surface)", "fill": 0, "live": false }, { "path": "computed.content_category", "type": "string", "nullable": true, "meaning": "Keyword-classified content category (e.g. tech, food, gaming). Null when undetectable.", "fill": null, "live": null }, { "path": "computed.engagement_rate", "type": "number", "nullable": true, "meaning": "Computed engagement rate (0..1). Null when the upstream lacks enough signal.", "fill": null, "live": null }, { "path": "computed.estimated_reach", "type": "number", "nullable": true, "meaning": "Estimated reach based on views or follower count. Null when uncomputable.", "fill": null, "live": null }, { "path": "computed.language", "type": "string", "nullable": true, "meaning": "ISO 639-1 language code detected from the post text. Null when undetectable.", "fill": null, "live": null }, { "path": "computed.save_rate", "type": "number", "nullable": true, "meaning": "Saves divided by views, rounded to six places. Present only when the post has both a save count and a view count above zero.", "fill": null, "live": null }, { "path": "post.author.verified", "type": "boolean", "nullable": false, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": true }, { "path": "post.ext.author_instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_sec_uid", "type": "string", "nullable": true, "meaning": "TikTok's stable secUid for the author, the id TikTok's own user lookups take. TikTok.", "fill": null, "live": null, "source_hint": "fallback" }, { "path": "post.ext.author_twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.collaborators", "type": "array", "nullable": true, "meaning": "TikTok: the post's collaborators, each `{ id, username, display_name }`, null when the row names none.", "fill": null, "live": null }, { "path": "post.ext.content_language", "type": "string", "nullable": true, "meaning": "The language the platform itself tags the post with, when it sends one: Reddit's own language tag on Reddit lanes, and TikTok's caption-language tag (for example `de`) on `/v1/tiktok/trending?feed=local`. Null when the platform could not tell (Reddit `und`, TikTok `un`, common on short or emoji-only captions); absent where the source sends no tag. Never inferred from the text by us: that is `post.computed.language`.", "fill": null, "live": true }, { "path": "post.ext.created_by_ai", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok's AI-made label is on the video, false when the label block is present without it, null when the row has no label block. `/v1/youtube/video?include=details`: true when the creator disclosed the video as altered or synthetic content.", "fill": null, "live": true }, { "path": "post.ext.media", "type": "array", "nullable": true, "meaning": "The slides of an Instagram carousel, in order; on X, each photo or video of the post with its width and height (a video's `url` is its best mp4), null on a post with no media.", "fill": null, "live": null }, { "path": "post.ext.media_type", "type": "string", "nullable": true, "meaning": "Media kind: image, video or carousel.", "fill": null, "live": null }, { "path": "post.ext.mentioned_user_ids", "type": "array", "nullable": true, "meaning": "Numeric ids of the accounts TikTok links in the row, in order and once each. Null when none.", "fill": null, "live": null }, { "path": "post.ext.place.address", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.category", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.city_code", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.id", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.latitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.longitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.name", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.video_count", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.ran_as_ad", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok marks the video as having run as an ad, false when the source says it did not, null when it does not say.", "fill": null, "live": true }, { "path": "post.flags.deleted", "type": "boolean", "nullable": false, "meaning": "Whether the post is tombstoned (always present)", "fill": null, "live": null }, { "path": "post.ext.published_at_epoch", "type": "number", "nullable": true, "meaning": "Raw Unix epoch for `published_at` (seconds, or milliseconds when the upstream sent millis). Present only when the upstream sent a numeric epoch that was normalised to the ISO 8601 `published_at` string. Kept for one deprecation cycle for integrations pinned to the numeric form.", "fill": null, "live": null, "source_hint": "sample" }], "never_filled": ["post.flags.nsfw", "post.flags.spoiler"], "page_level": ["data._warnings", "data.country", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.hydration"], "source": "field_map" },
162
162
  "GET tiktok/search/hashtag": { "archetype": "PostList", "rows_at": "data.items[].post", "fields": [{ "path": "computed.content_category", "type": "string", "nullable": true, "meaning": "Keyword-classified content category (e.g. tech, food, gaming). Null when undetectable.", "fill": null, "live": null }, { "path": "computed.engagement_rate", "type": "number", "nullable": true, "meaning": "Computed engagement rate (0..1). Null when the upstream lacks enough signal.", "fill": null, "live": null }, { "path": "computed.estimated_reach", "type": "number", "nullable": true, "meaning": "Estimated reach based on views or follower count. Null when uncomputable.", "fill": null, "live": null }, { "path": "computed.labels.ai_style", "type": "object", "nullable": true, "meaning": "ai_style: writing patterns common in AI-generated text, judged on the text alone.", "fill": null, "live": null, "opt_in": "label=ai_style" }, { "path": "computed.labels.ai_written", "type": "object", "nullable": true, "meaning": "ai_written: how likely the post was written by an AI model, from SocialCrawl's own text classifier, reading the opening of the post (about 1,000 characters): p (0 to 1, calibrated), level (likely (p 0.95 or higher), possible (p 0.71 or higher) or unlikely) and model (the model name; a new name means a new scale).", "fill": null, "live": null, "opt_in": "label=ai_written" }, { "path": "computed.labels.injection", "type": "object", "nullable": true, "meaning": "injection flags text that addresses an AI system and tries to direct it (flagged, p); it never drops or rewrites a row.", "fill": null, "live": null, "opt_in": "label=injection" }, { "path": "computed.labels.intent", "type": "object", "nullable": true, "meaning": "intent: what the author is mainly doing (label: asking_for_recommendation, comparing_options, switching_away, complaining, promoting, news_or_discussion, other, or null when unsure, with confidence), whether they read as a potential buyer rather than a seller (buyer, seller), how pressing the need is (urgency, 0 to 3), and, when you pass offer=, whether your offer would plausibly help them (fits_offer).", "fill": null, "live": null }, { "path": "computed.labels.mention", "type": "object", "nullable": true, "meaning": "mention (needs brand=): is the post about that brand rather than something that shares its name (about_brand, 0 to 1), how it feels about the brand on five levels (sentiment_level 0 to 4 and sentiment_score 0 to 1, null when the post is not about the brand), is it sarcastic, which aspect it talks about (taste_or_quality, price_or_value, availability_or_delivery, health_or_safety, advertising_or_campaign, customer_service, none), and did the author buy or use it (first_hand).", "fill": null, "live": null, "opt_in": "label=mention" }, { "path": "computed.labels.niche", "type": "object", "nullable": true, "meaning": "niche: which of the 33 niches of the published taxonomy sc-niche-v1 the caption belongs to, or personal_no_niche, or other (label, confidence, taxonomy), with label null when the caption is too thin to tell or the pick is unsure.", "fill": null, "live": null }, { "path": "computed.labels.quality", "type": "object", "nullable": true, "meaning": "quality: how much checkable detail the caption carries (fact_density 0 to 3), whether it mainly asks for likes, replies, shares, follows or tags (engagement_bait, 0 to 1), whether it is written to provoke anger as a way to get engagement (rage_bait, 0 to 1; about the writing, never the side taken), whether it only repeats someone else's news or view (secondhand, 0 to 1), and what the post is mainly doing (post_aim: inform, opinion, sell, entertain, provoke, other).", "fill": null, "live": null, "opt_in": "label=quality" }, { "path": "computed.labels.sponsored", "type": "object", "nullable": true, "meaning": "sponsored: is the post a paid or gifted promotion (p, 0 to 1), did it carry a disclosure marker such as #ad, 광고, 협찬, 체험단, 원고료, 제공받아 or 쿠팡 파트너스 (disclosed; a clear written disclosure such as #ad, 협찬 or 체험단 sets p to at least 0.95), is it likely paid with no marker (undisclosed), and which of the accounts it mentions does it promote (brand, or null).", "fill": null, "live": null }, { "path": "computed.labels_evidence", "type": "object", "nullable": true, "meaning": "When 1, every labelled row also carries computed.labels_evidence.<preset> = { quote, sentence_index }: the sentence in the row that most clearly shows the label, copied verbatim.", "fill": null, "live": null, "opt_in": "label_evidence=1" }, { "path": "computed.language", "type": "string", "nullable": true, "meaning": "ISO 639-1 language code detected from the post text. Null when undetectable.", "fill": null, "live": null }, { "path": "computed.save_rate", "type": "number", "nullable": true, "meaning": "Saves divided by views, rounded to six places. Present only when the post has both a save count and a view count above zero.", "fill": null, "live": null }, { "path": "post.author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to author profile picture", "fill": null, "live": true }, { "path": "post.author.display_name", "type": "string", "nullable": false, "meaning": "Author display name", "fill": null, "live": true }, { "path": "post.author.username", "type": "string", "nullable": false, "meaning": "Author username", "fill": null, "live": true }, { "path": "post.author.verified", "type": "boolean", "nullable": false, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": null }, { "path": "post.content.duration_seconds", "type": "number", "nullable": false, "meaning": "Video/clip duration in seconds (null for non-video posts)", "fill": null, "live": true }, { "path": "post.content.media_urls", "type": "string|array", "nullable": false, "meaning": "URL(s) of the primary media. Single string for video/photo posts; array of strings for carousels.", "fill": null, "live": true }, { "path": "post.content.text", "type": "string", "nullable": false, "meaning": "Post caption, description, or text content", "fill": null, "live": true }, { "path": "post.content.thumbnail_url", "type": "string", "nullable": false, "meaning": "URL to thumbnail image", "fill": null, "live": true }, { "path": "post.engagement.comments", "type": "number", "nullable": false, "meaning": "Comment count. Note: on `GET /v1/instagram/post` this is Instagram's `edge_media_to_parent_comment.count` (top-level comments); the IG list endpoints report the mobile `comment_count` total (includes replies). Both land on this same field.", "fill": null, "live": true }, { "path": "post.engagement.likes", "type": "number", "nullable": false, "meaning": "Like / reaction count", "fill": null, "live": true }, { "path": "post.engagement.saves", "type": "number", "nullable": false, "meaning": "Save / bookmark count. `null` on Instagram: the save count is platform-private and Instagram exposes no numeric save metric on any surface (never fabricated).", "fill": null, "live": true }, { "path": "post.engagement.shares", "type": "number", "nullable": false, "meaning": "Share / repost / retweet count. On Instagram this is `reshare_count` (the paper-plane Share / Send count) and it exists only on Instagram's mobile surface, so it is returned by `/v1/instagram/post/stats`, `/v1/instagram/profile/reels/full`, and `/v1/instagram/profile/posts/full`. The web-sourced Instagram list and search endpoints return `null` (never fabricated).", "fill": null, "live": true }, { "path": "post.engagement.views", "type": "number", "nullable": false, "meaning": "View count (if available). For Instagram video/reels this is the play count: the headline 'Views' the IG app shows. Instagram removed per-post play counts from its public web pages in August 2026, so `GET /v1/instagram/post` now fills the count automatically from a second source within the same call: videos and reels keep a numeric `views` with no extra endpoint or workaround. Note: since mid-July 2026 Instagram's play count is Instagram-only. It no longer includes Facebook crosspost views (Meta-side change; the app UI changed identically). For combined reach, also fetch the Facebook crosspost via `/v1/facebook/post`.", "fill": null, "live": true }, { "path": "post.ext.author_id", "type": "string", "nullable": true, "meaning": "The creator's platform-native numeric user id. On TikTok search and list items, pass to `/v1/tiktok/profile?user_id=` for the creator's current follower count (survives username changes). On Instagram `/v1/instagram/search/reels`, `/v1/instagram/search/hashtag` and `/v1/instagram/location/posts` items it is present on every row, accepted by `/v1/instagram/profile/country?user_id=` and `/v1/instagram/basic-profile?userId=`. On Facebook it appears when the upstream exposed a numeric actor id and no real handle. On X post lanes it is the author's numeric account id, the same as `author.id` on `/v1/twitter/profile`.", "fill": null, "live": true }, { "path": "post.ext.author_instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_sec_uid", "type": "string", "nullable": true, "meaning": "TikTok's stable secUid for the author, the id TikTok's own user lookups take. TikTok.", "fill": null, "live": true }, { "path": "post.ext.author_twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.captions", "type": "array", "nullable": true, "meaning": "TikTok's caption files for the video, each `{ language, auto_generated, format, url, expires_at }`; `[]` when it has none, null when the row says nothing. The signed `url` stops working at `expires_at`.", "fill": null, "live": null }, { "path": "post.ext.collaborators", "type": "array", "nullable": true, "meaning": "TikTok: the post's collaborators, each `{ id, username, display_name }`, null when the row names none.", "fill": null, "live": null }, { "path": "post.ext.content_language", "type": "string", "nullable": true, "meaning": "The language the platform itself tags the post with, when it sends one: Reddit's own language tag on Reddit lanes, and TikTok's caption-language tag (for example `de`) on `/v1/tiktok/trending?feed=local`. Null when the platform could not tell (Reddit `und`, TikTok `un`, common on short or emoji-only captions); absent where the source sends no tag. Never inferred from the text by us: that is `post.computed.language`.", "fill": null, "live": true }, { "path": "post.ext.created_by_ai", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok's AI-made label is on the video, false when the label block is present without it, null when the row has no label block. `/v1/youtube/video?include=details`: true when the creator disclosed the video as altered or synthetic content.", "fill": null, "live": true }, { "path": "post.ext.download_count", "type": "number", "nullable": false, "meaning": "How many times the video has been saved to a device. TikTok only, and distinct from `engagement.saves`: a save keeps the video in a private collection on the platform, a download takes a copy off it, and TikTok counts the two separately. Present on TikTok post, search and post-list responses; absent everywhere else.", "fill": null, "live": true }, { "path": "post.ext.media", "type": "array", "nullable": true, "meaning": "The slides of an Instagram carousel, in order; on X, each photo or video of the post with its width and height (a video's `url` is its best mp4), null on a post with no media.", "fill": null, "live": null }, { "path": "post.ext.media_type", "type": "string", "nullable": true, "meaning": "Media kind: image, video or carousel.", "fill": null, "live": null }, { "path": "post.ext.mentioned_user_ids", "type": "array", "nullable": true, "meaning": "Numeric ids of the accounts TikTok links in the row, in order and once each. Null when none.", "fill": null, "live": null }, { "path": "post.ext.music_id", "type": "string", "nullable": true, "meaning": "TikTok music/clip id (exact string): pass to `/v1/tiktok/song/videos?clipId=` to find videos using the same sound. On Instagram, the sound's audio id (exact string), which `/v1/instagram/audio/reels?audio_id=` takes.", "fill": null, "live": true }, { "path": "post.ext.place.address", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.category", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.city_code", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.id", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.latitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.longitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.name", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.video_count", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.ran_as_ad", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok marks the video as having run as an ad, false when the source says it did not, null when it does not say.", "fill": null, "live": true }, { "path": "post.ext.region", "type": "string", "nullable": true, "meaning": "TikTok only: the country TikTok registers the video to, as an ISO 3166-1 alpha-2 code (normally the creator's account country when they posted). It is not the viewer's country, not the `region` you requested, and not a language. On `/v1/tiktok/trending`, `/v1/tiktok/search`, `/v1/tiktok/search/top`, `/v1/tiktok/profile/videos`, `/v1/tiktok/search/hashtag` and `/v1/tiktok/song/videos` it is how you tell which rows are from a given country: filter on it when you need only that country. A row whose source omits the country stays null. The `region` request parameter still only sets the proxy.", "fill": null, "live": true }, { "path": "post.flags.deleted", "type": "boolean", "nullable": false, "meaning": "Whether the post is tombstoned (always present)", "fill": null, "live": null }, { "path": "post.flags.pinned", "type": "boolean", "nullable": true, "meaning": "Pinned-to-profile flag (null when platform does not surface)", "fill": null, "live": true }, { "path": "post.id", "type": "string", "nullable": false, "meaning": "Platform-specific post ID (always a string; numeric upstream IDs are stringified)", "fill": null, "live": true }, { "path": "post.published_at", "type": "string|number", "nullable": false, "meaning": "Post creation timestamp as an ISO 8601 UTC string. When the upstream sent a Unix epoch it is converted here and the raw epoch is preserved under `post.ext.published_at_epoch` for one deprecation cycle.", "fill": null, "live": true }, { "path": "post.url", "type": "string", "nullable": true, "meaning": "Direct URL to the post on the source platform", "fill": null, "live": null }, { "path": "post.ext.on_screen_texts", "type": "array", "nullable": true, "meaning": "Text the creator typed onto the video with TikTok's text tool.", "fill": null, "live": null, "source_hint": "sample" }, { "path": "post.ext.published_at_epoch", "type": "number", "nullable": true, "meaning": "Raw Unix epoch for `published_at` (seconds, or milliseconds when the upstream sent millis). Present only when the upstream sent a numeric epoch that was normalised to the ISO 8601 `published_at` string. Kept for one deprecation cycle for integrations pinned to the numeric form.", "fill": null, "live": null, "source_hint": "sample" }], "never_filled": ["post.flags.nsfw", "post.flags.spoiler"], "page_level": ["data._warnings", "data.adoption", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.estimate", "data.held_back", "data.hydration", "data.labels", "data.walk"], "source": "field_map" },
163
163
  "GET tiktok/search/top": { "archetype": "PostList", "rows_at": "data.items[].post", "fields": [{ "path": "computed.content_category", "type": "string", "nullable": true, "meaning": "Keyword-classified content category (e.g. tech, food, gaming). Null when undetectable.", "fill": null, "live": null }, { "path": "computed.engagement_rate", "type": "number", "nullable": true, "meaning": "Computed engagement rate (0..1). Null when the upstream lacks enough signal.", "fill": null, "live": null }, { "path": "computed.estimated_reach", "type": "number", "nullable": true, "meaning": "Estimated reach based on views or follower count. Null when uncomputable.", "fill": null, "live": null }, { "path": "computed.language", "type": "string", "nullable": true, "meaning": "ISO 639-1 language code detected from the post text. Null when undetectable.", "fill": null, "live": null }, { "path": "computed.save_rate", "type": "number", "nullable": true, "meaning": "Saves divided by views, rounded to six places. Present only when the post has both a save count and a view count above zero.", "fill": null, "live": null }, { "path": "post.author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to author profile picture", "fill": null, "live": true }, { "path": "post.author.display_name", "type": "string", "nullable": false, "meaning": "Author display name", "fill": null, "live": true }, { "path": "post.author.username", "type": "string", "nullable": false, "meaning": "Author username", "fill": null, "live": true }, { "path": "post.author.verified", "type": "boolean", "nullable": false, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": null }, { "path": "post.content.duration_seconds", "type": "number", "nullable": false, "meaning": "Video/clip duration in seconds (null for non-video posts)", "fill": null, "live": true }, { "path": "post.content.media_urls", "type": "string|array", "nullable": false, "meaning": "URL(s) of the primary media. Single string for video/photo posts; array of strings for carousels.", "fill": null, "live": true }, { "path": "post.content.text", "type": "string", "nullable": false, "meaning": "Post caption, description, or text content", "fill": null, "live": true }, { "path": "post.content.thumbnail_url", "type": "string", "nullable": false, "meaning": "URL to thumbnail image", "fill": null, "live": true }, { "path": "post.engagement.comments", "type": "number", "nullable": false, "meaning": "Comment count. Note: on `GET /v1/instagram/post` this is Instagram's `edge_media_to_parent_comment.count` (top-level comments); the IG list endpoints report the mobile `comment_count` total (includes replies). Both land on this same field.", "fill": null, "live": true }, { "path": "post.engagement.likes", "type": "number", "nullable": false, "meaning": "Like / reaction count", "fill": null, "live": true }, { "path": "post.engagement.saves", "type": "number", "nullable": false, "meaning": "Save / bookmark count. `null` on Instagram: the save count is platform-private and Instagram exposes no numeric save metric on any surface (never fabricated).", "fill": null, "live": true }, { "path": "post.engagement.shares", "type": "number", "nullable": false, "meaning": "Share / repost / retweet count. On Instagram this is `reshare_count` (the paper-plane Share / Send count) and it exists only on Instagram's mobile surface, so it is returned by `/v1/instagram/post/stats`, `/v1/instagram/profile/reels/full`, and `/v1/instagram/profile/posts/full`. The web-sourced Instagram list and search endpoints return `null` (never fabricated).", "fill": null, "live": true }, { "path": "post.engagement.views", "type": "number", "nullable": false, "meaning": "View count (if available). For Instagram video/reels this is the play count: the headline 'Views' the IG app shows. Instagram removed per-post play counts from its public web pages in August 2026, so `GET /v1/instagram/post` now fills the count automatically from a second source within the same call: videos and reels keep a numeric `views` with no extra endpoint or workaround. Note: since mid-July 2026 Instagram's play count is Instagram-only. It no longer includes Facebook crosspost views (Meta-side change; the app UI changed identically). For combined reach, also fetch the Facebook crosspost via `/v1/facebook/post`.", "fill": null, "live": true }, { "path": "post.ext.author_followers", "type": "number", "nullable": true, "meaning": "The creator's follower count as embedded in the search payload itself, when the search source happens to carry one. On Instagram `search/reels` it is null on a plain call, because Instagram stopped sending follower counts in its search payload in August 2026; send `include=creator` (or `country`) and it is filled from the creator's profile, 2 credits per creator looked up. It stays null when that lookup does not resolve.", "fill": null, "live": true }, { "path": "post.ext.author_following", "type": "number", "nullable": true, "meaning": "Accounts the author follows, as of when the list source captured the row. Not live.", "fill": null, "live": true }, { "path": "post.ext.author_id", "type": "string", "nullable": true, "meaning": "The creator's platform-native numeric user id. On TikTok search and list items, pass to `/v1/tiktok/profile?user_id=` for the creator's current follower count (survives username changes). On Instagram `/v1/instagram/search/reels`, `/v1/instagram/search/hashtag` and `/v1/instagram/location/posts` items it is present on every row, accepted by `/v1/instagram/profile/country?user_id=` and `/v1/instagram/basic-profile?userId=`. On Facebook it appears when the upstream exposed a numeric actor id and no real handle. On X post lanes it is the author's numeric account id, the same as `author.id` on `/v1/twitter/profile`.", "fill": null, "live": true }, { "path": "post.ext.author_instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_likes_count", "type": "number", "nullable": true, "meaning": "Likes the author's posts have received in total, as of when the list source captured the row. Not live. TikTok.", "fill": null, "live": null, "source_hint": "fallback" }, { "path": "post.ext.author_posts_count", "type": "number", "nullable": true, "meaning": "Posts the author has made, as of when the list source captured the row. Not live.", "fill": null, "live": null, "source_hint": "fallback" }, { "path": "post.ext.author_sec_uid", "type": "string", "nullable": true, "meaning": "TikTok's stable secUid for the author, the id TikTok's own user lookups take. TikTok.", "fill": null, "live": null, "source_hint": "fallback" }, { "path": "post.ext.author_twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.author_youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the author links on their profile, null when none.", "fill": null, "live": null }, { "path": "post.ext.captions", "type": "array", "nullable": true, "meaning": "TikTok's caption files for the video, each `{ language, auto_generated, format, url, expires_at }`; `[]` when it has none, null when the row says nothing. The signed `url` stops working at `expires_at`.", "fill": null, "live": null }, { "path": "post.ext.collaborators", "type": "array", "nullable": true, "meaning": "TikTok: the post's collaborators, each `{ id, username, display_name }`, null when the row names none.", "fill": null, "live": null }, { "path": "post.ext.content_language", "type": "string", "nullable": true, "meaning": "The language the platform itself tags the post with, when it sends one: Reddit's own language tag on Reddit lanes, and TikTok's caption-language tag (for example `de`) on `/v1/tiktok/trending?feed=local`. Null when the platform could not tell (Reddit `und`, TikTok `un`, common on short or emoji-only captions); absent where the source sends no tag. Never inferred from the text by us: that is `post.computed.language`.", "fill": null, "live": true }, { "path": "post.ext.created_by_ai", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok's AI-made label is on the video, false when the label block is present without it, null when the row has no label block. `/v1/youtube/video?include=details`: true when the creator disclosed the video as altered or synthetic content.", "fill": null, "live": true }, { "path": "post.ext.download_count", "type": "number", "nullable": false, "meaning": "How many times the video has been saved to a device. TikTok only, and distinct from `engagement.saves`: a save keeps the video in a private collection on the platform, a download takes a copy off it, and TikTok counts the two separately. Present on TikTok post, search and post-list responses; absent everywhere else.", "fill": null, "live": true }, { "path": "post.ext.media", "type": "array", "nullable": true, "meaning": "The slides of an Instagram carousel, in order; on X, each photo or video of the post with its width and height (a video's `url` is its best mp4), null on a post with no media.", "fill": null, "live": null }, { "path": "post.ext.media_type", "type": "string", "nullable": true, "meaning": "Media kind: image, video or carousel.", "fill": null, "live": null }, { "path": "post.ext.mentioned_user_ids", "type": "array", "nullable": true, "meaning": "Numeric ids of the accounts TikTok links in the row, in order and once each. Null when none.", "fill": null, "live": null }, { "path": "post.ext.music_id", "type": "string", "nullable": true, "meaning": "TikTok music/clip id (exact string): pass to `/v1/tiktok/song/videos?clipId=` to find videos using the same sound. On Instagram, the sound's audio id (exact string), which `/v1/instagram/audio/reels?audio_id=` takes.", "fill": null, "live": true }, { "path": "post.ext.place.address", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.category", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.city_code", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.id", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.latitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.longitude", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.name", "type": "string", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.place.video_count", "type": "number", "nullable": true, "meaning": null, "fill": null, "live": null }, { "path": "post.ext.ran_as_ad", "type": "boolean", "nullable": true, "meaning": "TikTok: true when TikTok marks the video as having run as an ad, false when the source says it did not, null when it does not say.", "fill": null, "live": true }, { "path": "post.ext.region", "type": "string", "nullable": true, "meaning": "TikTok only: the country TikTok registers the video to, as an ISO 3166-1 alpha-2 code (normally the creator's account country when they posted). It is not the viewer's country, not the `region` you requested, and not a language. On `/v1/tiktok/trending`, `/v1/tiktok/search`, `/v1/tiktok/search/top`, `/v1/tiktok/profile/videos`, `/v1/tiktok/search/hashtag` and `/v1/tiktok/song/videos` it is how you tell which rows are from a given country: filter on it when you need only that country. A row whose source omits the country stays null. The `region` request parameter still only sets the proxy.", "fill": null, "live": true }, { "path": "post.flags.deleted", "type": "boolean", "nullable": false, "meaning": "Whether the post is tombstoned (always present)", "fill": null, "live": null }, { "path": "post.flags.pinned", "type": "boolean", "nullable": true, "meaning": "Pinned-to-profile flag (null when platform does not surface)", "fill": null, "live": true }, { "path": "post.id", "type": "string", "nullable": false, "meaning": "Platform-specific post ID (always a string; numeric upstream IDs are stringified)", "fill": null, "live": true }, { "path": "post.published_at", "type": "string|number", "nullable": false, "meaning": "Post creation timestamp as an ISO 8601 UTC string. When the upstream sent a Unix epoch it is converted here and the raw epoch is preserved under `post.ext.published_at_epoch` for one deprecation cycle.", "fill": null, "live": true }, { "path": "post.url", "type": "string", "nullable": true, "meaning": "Direct URL to the post on the source platform", "fill": null, "live": null }, { "path": "post.ext.on_screen_texts", "type": "array", "nullable": true, "meaning": "Text the creator typed onto the video with TikTok's text tool.", "fill": null, "live": null, "source_hint": "sample" }, { "path": "post.ext.published_at_epoch", "type": "number", "nullable": true, "meaning": "Raw Unix epoch for `published_at` (seconds, or milliseconds when the upstream sent millis). Present only when the upstream sent a numeric epoch that was normalised to the ISO 8601 `published_at` string. Kept for one deprecation cycle for integrations pinned to the numeric form.", "fill": null, "live": null, "source_hint": "sample" }], "never_filled": ["post.flags.nsfw", "post.flags.spoiler"], "page_level": ["data._warnings", "data.adoption", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.hydration", "data.walk"], "source": "field_map" },
164
- "GET tiktok/search/users": { "archetype": "AuthorList", "rows_at": "data.items[].author", "fields": [{ "path": "author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to profile picture", "fill": null, "live": true }, { "path": "author.bio", "type": "string", "nullable": true, "meaning": "Profile biography or description", "fill": null, "live": false, "opt_in": "include=profile" }, { "path": "author.display_name", "type": "string", "nullable": false, "meaning": "Display name or full name", "fill": null, "live": true }, { "path": "author.ext.bio_link", "type": "string", "nullable": true, "meaning": "The website set in the Threads bio.", "fill": null, "live": null, "opt_in": "include=profile", "source_hint": "fallback" }, { "path": "author.ext.business_category", "type": "string", "nullable": true, "meaning": "Professional or page category label, for example 'Live Music Venue'. Instagram and Facebook.", "fill": null, "live": null, "opt_in": "include=profile" }, { "path": "author.ext.business_hours", "type": "array", "nullable": false, "meaning": "The page's opening hours as the source reports them. The source's format is not normalised and the field is null on every sampled page.", "fill": null, "live": null }, { "path": "author.ext.instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.products", "type": "array", "nullable": false, "meaning": "The products the company page lists, as the source sends them. Null when it lists none.", "fill": null, "live": null }, { "path": "author.ext.twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.followers", "type": "number", "nullable": false, "meaning": "Follower or subscriber count as an integer. Exact on Instagram and on TikTok when the source exposes an unrounded figure. YouTube above 1,000 subscribers is YouTube's published three-significant-figure figure. When the integer is a published/rounded value, `author.ext.followers_approximate` is true.", "fill": null, "live": true }, { "path": "author.following", "type": "number", "nullable": false, "meaning": "Number of accounts followed", "fill": null, "live": true }, { "path": "author.id", "type": "string", "nullable": false, "meaning": "Platform-specific user ID (always a string; platform-specific prefixes like `did:`, `spotify:artist:`, `t2_` are stripped)", "fill": null, "live": true }, { "path": "author.likes_count", "type": "number", "nullable": false, "meaning": "Total likes received across the author's content (when surfaced)", "fill": null, "live": true }, { "path": "author.location", "type": "string", "nullable": true, "meaning": "ISO region code (e.g. `US`) or freeform location string when surfaced", "fill": null, "live": null, "opt_in": "include=profile", "source_hint": "fallback" }, { "path": "author.posts_count", "type": "number", "nullable": false, "meaning": "Total number of posts / videos / tracks / episodes", "fill": null, "live": true }, { "path": "author.private", "type": "boolean", "nullable": true, "meaning": "Whether the account is private.", "fill": null, "live": true }, { "path": "author.url", "type": "string", "nullable": true, "meaning": "Direct URL to the profile page", "fill": null, "live": null }, { "path": "author.username", "type": "string", "nullable": false, "meaning": "User handle or username", "fill": null, "live": true }, { "path": "author.verified", "type": "boolean", "nullable": true, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": true }], "never_filled": [], "page_level": ["data._warnings", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.hydration", "data.walk"], "source": "field_map" },
164
+ "GET tiktok/search/users": { "archetype": "AuthorList", "rows_at": "data.items[].author", "fields": [{ "path": "author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to profile picture", "fill": null, "live": true }, { "path": "author.bio", "type": "string", "nullable": true, "meaning": "Profile biography or description", "fill": null, "live": false, "opt_in": "include=profile" }, { "path": "author.display_name", "type": "string", "nullable": false, "meaning": "Display name or full name", "fill": null, "live": true }, { "path": "author.ext.bio_link", "type": "string", "nullable": true, "meaning": "The website set in the Threads bio.", "fill": null, "live": null, "opt_in": "include=profile", "source_hint": "fallback" }, { "path": "author.ext.business_category", "type": "string", "nullable": true, "meaning": "Professional or page category label, for example 'Live Music Venue'. Instagram and Facebook.", "fill": null, "live": null, "opt_in": "include=profile" }, { "path": "author.ext.business_hours", "type": "array", "nullable": false, "meaning": "The page's opening hours as the source reports them. The source's format is not normalised and the field is null on every sampled page.", "fill": null, "live": null }, { "path": "author.ext.instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.products", "type": "array", "nullable": false, "meaning": "The products the company page lists, as the source sends them. Null when it lists none.", "fill": null, "live": null }, { "path": "author.ext.twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.followers", "type": "number", "nullable": false, "meaning": "Follower or subscriber count as an integer. Exact on Instagram and on TikTok when the source exposes an unrounded figure. YouTube above 1,000 subscribers is YouTube's published three-significant-figure figure. When the integer is a published/rounded value, `author.ext.followers_approximate` is true.", "fill": null, "live": true }, { "path": "author.following", "type": "number", "nullable": false, "meaning": "Number of accounts followed", "fill": null, "live": true }, { "path": "author.id", "type": "string", "nullable": false, "meaning": "Platform-specific user ID (always a string; platform-specific prefixes like `did:`, `spotify:artist:`, `t2_` are stripped)", "fill": null, "live": true }, { "path": "author.likes_count", "type": "number", "nullable": false, "meaning": "Total likes received across the author's content (when surfaced)", "fill": null, "live": true }, { "path": "author.location", "type": "string", "nullable": true, "meaning": "ISO region code (e.g. `US`) or freeform location string when surfaced", "fill": null, "live": null, "opt_in": "include=profile", "source_hint": "fallback" }, { "path": "author.posts_count", "type": "number", "nullable": false, "meaning": "Total number of posts / videos / tracks / episodes", "fill": null, "live": true }, { "path": "author.private", "type": "boolean", "nullable": true, "meaning": "Whether the account is private.", "fill": null, "live": true }, { "path": "author.url", "type": "string", "nullable": true, "meaning": "Direct URL to the profile page", "fill": null, "live": null }, { "path": "author.username", "type": "string", "nullable": false, "meaning": "User handle or username", "fill": null, "live": true }, { "path": "author.verified", "type": "boolean", "nullable": true, "meaning": "Whether the account carries a TikTok verification badge, the personal one or the organisation one. False when the row carries a badge field that is empty, and null when the row carries no badge field.", "fill": null, "live": true }], "never_filled": [], "page_level": ["data._warnings", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.hydration", "data.walk"], "source": "field_map" },
165
165
  "GET tiktok/similar": { "archetype": "AuthorList", "rows_at": "data.items[].author", "fields": [{ "path": "author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to profile picture", "fill": null, "live": true }, { "path": "author.bio", "type": "string", "nullable": false, "meaning": "Profile biography or description", "fill": null, "live": true }, { "path": "author.display_name", "type": "string", "nullable": false, "meaning": "Display name or full name", "fill": null, "live": true }, { "path": "author.ext.business_hours", "type": "array", "nullable": false, "meaning": "The page's opening hours as the source reports them. The source's format is not normalised and the field is null on every sampled page.", "fill": null, "live": null }, { "path": "author.ext.instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.products", "type": "array", "nullable": false, "meaning": "The products the company page lists, as the source sends them. Null when it lists none.", "fill": null, "live": null }, { "path": "author.ext.twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.followers", "type": "number", "nullable": false, "meaning": "Follower or subscriber count as an integer. Exact on Instagram and on TikTok when the source exposes an unrounded figure. YouTube above 1,000 subscribers is YouTube's published three-significant-figure figure. When the integer is a published/rounded value, `author.ext.followers_approximate` is true.", "fill": null, "live": true }, { "path": "author.following", "type": "number", "nullable": false, "meaning": "Number of accounts followed", "fill": null, "live": true }, { "path": "author.id", "type": "string", "nullable": false, "meaning": "Platform-specific user ID (always a string; platform-specific prefixes like `did:`, `spotify:artist:`, `t2_` are stripped)", "fill": null, "live": true }, { "path": "author.joined_at", "type": "string", "nullable": true, "meaning": "When the account was created, as an ISO 8601 date (YYYY-MM-DD).", "fill": null, "live": true }, { "path": "author.likes_count", "type": "number", "nullable": false, "meaning": "Total likes received across the author's content (when surfaced)", "fill": null, "live": true }, { "path": "author.posts_count", "type": "number", "nullable": false, "meaning": "Total number of posts / videos / tracks / episodes", "fill": null, "live": true }, { "path": "author.private", "type": "boolean", "nullable": true, "meaning": "Whether the account is private.", "fill": null, "live": true }, { "path": "author.url", "type": "string", "nullable": true, "meaning": "Direct URL to the profile page", "fill": null, "live": null }, { "path": "author.username", "type": "string", "nullable": false, "meaning": "User handle or username", "fill": null, "live": true }, { "path": "author.verified", "type": "boolean", "nullable": true, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": true }], "never_filled": ["author.location"], "page_level": ["data._warnings", "data.dropped", "data.empty_reason", "data.empty_reason_note"], "source": "field_map" },
166
166
  "GET tiktok/user/audience": { "archetype": "Audience", "rows_at": "data", "fields": [{ "path": "audienceAges", "type": "array", "nullable": false, "meaning": null, "fill": null, "live": null }, { "path": "audienceGenders", "type": "array", "nullable": false, "meaning": null, "fill": null, "live": null }, { "path": "audienceLocations", "type": "array", "nullable": false, "meaning": null, "fill": null, "live": null }, { "path": "audienceStates", "type": "array", "nullable": false, "meaning": null, "fill": null, "live": null }], "never_filled": [], "page_level": ["data._warnings"], "source": "inferred_sample", "inferred_from": { "file": "src/docs/examples/endpoints/tiktok.user-audience.json" } },
167
167
  "GET tiktok/user/followers": { "archetype": "AuthorList", "rows_at": "data.items[].author", "fields": [{ "path": "author.avatar_url", "type": "string", "nullable": false, "meaning": "URL to profile picture", "fill": null, "live": true }, { "path": "author.bio", "type": "string", "nullable": false, "meaning": "Profile biography or description", "fill": null, "live": true }, { "path": "author.display_name", "type": "string", "nullable": false, "meaning": "Display name or full name", "fill": null, "live": true }, { "path": "author.ext.business_hours", "type": "array", "nullable": false, "meaning": "The page's opening hours as the source reports them. The source's format is not normalised and the field is null on every sampled page.", "fill": null, "live": null }, { "path": "author.ext.instagram_handle", "type": "string", "nullable": true, "meaning": "TikTok: the Instagram handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.products", "type": "array", "nullable": false, "meaning": "The products the company page lists, as the source sends them. Null when it lists none.", "fill": null, "live": null }, { "path": "author.ext.twitter_handle", "type": "string", "nullable": true, "meaning": "TikTok: the X handle the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.ext.youtube_channel_id", "type": "string", "nullable": true, "meaning": "TikTok: the YouTube channel id the account links on its profile, null when none.", "fill": null, "live": null }, { "path": "author.followers", "type": "number", "nullable": false, "meaning": "Follower or subscriber count as an integer. Exact on Instagram and on TikTok when the source exposes an unrounded figure. YouTube above 1,000 subscribers is YouTube's published three-significant-figure figure. When the integer is a published/rounded value, `author.ext.followers_approximate` is true.", "fill": null, "live": true }, { "path": "author.following", "type": "number", "nullable": false, "meaning": "Number of accounts followed", "fill": null, "live": true }, { "path": "author.id", "type": "string", "nullable": false, "meaning": "Platform-specific user ID (always a string; platform-specific prefixes like `did:`, `spotify:artist:`, `t2_` are stripped)", "fill": null, "live": true }, { "path": "author.joined_at", "type": "string", "nullable": true, "meaning": "When the account was created, as an ISO 8601 date (YYYY-MM-DD).", "fill": null, "live": true }, { "path": "author.likes_count", "type": "number", "nullable": false, "meaning": "Total likes received across the author's content (when surfaced)", "fill": null, "live": true }, { "path": "author.location", "type": "string", "nullable": true, "meaning": "ISO region code (e.g. `US`) or freeform location string when surfaced", "fill": null, "live": true }, { "path": "author.posts_count", "type": "number", "nullable": false, "meaning": "Total number of posts / videos / tracks / episodes", "fill": null, "live": true }, { "path": "author.private", "type": "boolean", "nullable": true, "meaning": "Whether the account is private.", "fill": null, "live": true }, { "path": "author.url", "type": "string", "nullable": true, "meaning": "Direct URL to the profile page", "fill": null, "live": null }, { "path": "author.username", "type": "string", "nullable": false, "meaning": "User handle or username", "fill": null, "live": true }, { "path": "author.verified", "type": "boolean", "nullable": true, "meaning": "Whether the account carries TikTok's verification badge. The source sends a badge label rather than a flag, and the API writes false when no label is present, so false can also mean the source sent no verification signal.", "fill": null, "live": null }], "never_filled": [], "page_level": ["data._warnings", "data.dropped", "data.empty_reason", "data.empty_reason_note", "data.walk"], "source": "field_map" },
@@ -3,7 +3,7 @@
3
3
  * Copied from codebase/packages/social-api/src/docs/test/skills-source-opacity.test.ts
4
4
  * (SUPPLIER_TOKENS / INTERNAL_TOKENS). Keep in sync with that file.
5
5
  */
6
- export declare const SUPPLIER_TOKENS: readonly ["scrapecreators", "scrape creators", "tiktok-api23", "api23", "pro social", "prosocial", "rapidapi", "poix", "tokapi", "flashapi", "dataforseo", "crawlio", "firecrawl", "apify", "bright data", "yourhomedepot", "hikerapi", "algolia"];
6
+ export declare const SUPPLIER_TOKENS: readonly ["scrapecreators", "scrape creators", "tiktok-api23", "api23", "pro social", "prosocial", "rapidapi", "poix", "tokapi", "flashapi", "dataforseo", "crawlio", "firecrawl", "apify", "bright data", "yourhomedepot", "hikerapi", "rocketapi", "fetchlayer", "anyapi", "twitterapi", "litescrape", "lurkapi", "steadyfetch", "scraptik", "importyeti", "bridgly", "hasdata", "algolia"];
7
7
  export declare const INTERNAL_TOKENS: readonly ["triage-", "UPSTREAM_ERROR)", "-fieldmaps"];
8
8
  /** First banned token found in `text` (case-insensitive), or undefined. */
9
9
  export declare function findBanned(text: string): string | undefined;
@@ -21,6 +21,18 @@ export const SUPPLIER_TOKENS = [
21
21
  "bright data",
22
22
  "yourhomedepot",
23
23
  "hikerapi",
24
+ // Synced with the codebase list on 04/12/2026 (MCP-14).
25
+ "rocketapi",
26
+ "fetchlayer",
27
+ "anyapi",
28
+ "twitterapi",
29
+ "litescrape",
30
+ "lurkapi",
31
+ "steadyfetch",
32
+ "scraptik",
33
+ "importyeti",
34
+ "bridgly",
35
+ "hasdata",
24
36
  // Hacker News search's provider (codebase-40 ruling, 29/11/2026).
25
37
  "algolia",
26
38
  ];
@@ -36,6 +48,9 @@ export function findBanned(text) {
36
48
  return t;
37
49
  if (/\bDFS\b/.test(text))
38
50
  return "DFS";
51
+ // Whole word only: a substring match would hit every "fetching".
52
+ if (/\bfetchin\b/i.test(text))
53
+ return "fetchin";
39
54
  return undefined;
40
55
  }
41
56
  //# sourceMappingURL=supplier-tokens.js.map
package/dist/result.js CHANGED
@@ -100,7 +100,7 @@ export function errorFromText(text) {
100
100
  const line = body.find((l) => l.startsWith(`${key}: `));
101
101
  return line ? line.slice(key.length + 2).trim() : undefined;
102
102
  };
103
- const isMeta = (l) => /^(reason|did_you_mean|request_id|status|error_code|retry_after_s): /.test(l);
103
+ const isMeta = (l) => /^(reason|did_you_mean|next_step|request_id|status|error_code|retry_after_s): /.test(l);
104
104
  const messageLines = [];
105
105
  for (const l of body) {
106
106
  if (isMeta(l) || l.trim() === "")
@@ -141,7 +141,9 @@ export function errorFromText(text) {
141
141
  retryable,
142
142
  reason: meta("reason") ?? first,
143
143
  };
144
- const fix = FIXES[code];
144
+ // The server's own next step outranks the generic fix: a team member's 402
145
+ // says to ask the owner, where the generic one would say to top up (API-480).
146
+ const fix = meta("next_step") ?? FIXES[code];
145
147
  if (fix)
146
148
  out.fix = fix;
147
149
  if (suggestions.length > 0)
@@ -89,6 +89,22 @@ export async function checkBalanceStructured(ctx, params = {}) {
89
89
  ].join("\n");
90
90
  return format(header, response, view, ctx);
91
91
  }
92
+ /**
93
+ * API-479: on a member of a team, `balance` is the team's spendable balance and
94
+ * credits are added by the team's owner, so say so before the agent offers a
95
+ * top-up. A personal account gets no line.
96
+ */
97
+ function teamLine(parsed) {
98
+ const data = parsed.data;
99
+ const billing = data?.billing;
100
+ if (billing?.source !== "team")
101
+ return "";
102
+ const name = typeof billing.team?.name === "string" && billing.team.name ? `team ${billing.team.name}` : "the team";
103
+ const aside = typeof billing.own_balance_set_aside === "number" && billing.own_balance_set_aside > 0
104
+ ? ` Your own ${billing.own_balance_set_aside} credits are set aside while the team pays.`
105
+ : "";
106
+ return `**Paid by:** ${name}. \`balance\` is what the team can spend; credits are added by the team's owner, not bought by a member.${aside}\n`;
107
+ }
92
108
  function format(header, response, view, ctx) {
93
109
  if (/^Error(?::| \(\d+\):)/.test(response)) {
94
110
  const text = `${header}${response}`;
@@ -100,7 +116,7 @@ function format(header, response, view, ctx) {
100
116
  const spent = sessionTotal(ctx.apiKey);
101
117
  const structured = { ok: true, view, ...env, credits: { ...env.credits, session_total: spent } };
102
118
  return {
103
- text: `${header}**Session spend:** ${spent} credits through this server since it started.\n**Result:** ${summaryLine(structured)}\n\n\`\`\`json\n${JSON.stringify(parsed)}\n\`\`\``,
119
+ text: `${header}${view === "balance" ? teamLine(parsed) : ""}**Session spend:** ${spent} credits through this server since it started.\n**Result:** ${summaryLine(structured)}\n\n\`\`\`json\n${JSON.stringify(parsed)}\n\`\`\``,
104
120
  structured,
105
121
  };
106
122
  }
@@ -108,7 +108,7 @@ function detailBlock(e) {
108
108
  if (e.emptyOn404) {
109
109
  notes.push("**Empty is not an error:** an upstream 404 here means zero items — returned as 200 `{items: []}` with the credit refunded.");
110
110
  }
111
- if (e.upstream.fallbackKinds && e.upstream.fallbackKinds.length > 0) {
111
+ if (e.multiSource) {
112
112
  notes.push("**Reliability:** multi-source with automatic fallback; charged once.");
113
113
  }
114
114
  for (const lane of e.hydration ?? []) {
package/dist/types.d.ts CHANGED
@@ -93,12 +93,6 @@ export interface CacheInfo {
93
93
  /** Resolved TTL in seconds. `0` means this endpoint is never cached. */
94
94
  ttlSeconds: number;
95
95
  }
96
- export interface UpstreamInfo {
97
- /** Dispatch strategy (`scrapecreators` is the default proxy). */
98
- kind: string;
99
- /** Ordered fallback sources tried when the primary fails or returns empty. */
100
- fallbackKinds?: string[];
101
- }
102
96
  /**
103
97
  * One opt-in row-join lane declared on an endpoint (the backend's "hydration
104
98
  * engine", `packages/social-api/src/hydrate-list.ts`).
@@ -294,7 +288,8 @@ export interface Endpoint {
294
288
  /** Upstream 404 means "zero items": coerced to 200 `{items:[]}` + refund. */
295
289
  emptyOn404?: boolean;
296
290
  cache: CacheInfo;
297
- upstream: UpstreamInfo;
291
+ /** True when another source takes over if the first fails or returns empty (charged once). */
292
+ multiSource?: boolean;
298
293
  /** `prism` marks a server-side composite that fans out across many legs. */
299
294
  family?: string;
300
295
  /** Human action name for UI surfaces (e.g. "Cancel Job"). */