socialcrawl-mcp 2.3.0 → 2.6.0
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.
- package/README.md +9 -3
- package/dist/app.js +71 -12
- package/dist/chatgpt-text.d.ts +23 -0
- package/dist/chatgpt-text.js +310 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +9 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/context.d.ts +7 -0
- package/dist/cost-guard.d.ts +28 -3
- package/dist/cost-guard.js +69 -6
- package/dist/data/docs-async.d.ts +1 -1
- package/dist/data/docs-async.js +147 -137
- package/dist/data/docs-handwritten.js +968 -947
- package/dist/data/docs.js +5 -1
- package/dist/data/endpoints.js +2050 -941
- package/dist/data/examples.js +2 -2
- package/dist/data/guide.d.ts +2 -2
- package/dist/data/guide.js +2 -2
- package/dist/data/outputs.js +196 -159
- package/dist/data/platforms.js +13 -13
- package/dist/data/recipes.js +1 -1
- package/dist/data/registry-meta.d.ts +9 -9
- package/dist/data/registry-meta.js +9 -9
- package/dist/endpoint-resolve.d.ts +1 -0
- package/dist/endpoint-resolve.js +10 -1
- package/dist/endpoint-surface.d.ts +64 -0
- package/dist/endpoint-surface.js +478 -0
- package/dist/held-surfaces.d.ts +13 -2
- package/dist/held-surfaces.js +16 -3
- package/dist/hydration.js +7 -0
- package/dist/instructions.md +18 -18
- package/dist/listings.d.ts +24 -0
- package/dist/listings.js +55 -0
- package/dist/oauth/config.d.ts +20 -0
- package/dist/oauth/config.js +19 -0
- package/dist/oauth/resource-server.d.ts +12 -2
- package/dist/oauth/resource-server.js +5 -20
- package/dist/oauth/scopes.d.ts +2 -2
- package/dist/oauth/scopes.js +4 -4
- package/dist/param-aliases.d.ts +7 -0
- package/dist/param-aliases.js +15 -0
- package/dist/pricing.js +5 -1
- package/dist/resources/sample-gate.js +34 -1
- package/dist/resources/supplier-tokens.d.ts +1 -1
- package/dist/resources/supplier-tokens.js +2 -0
- package/dist/result.js +8 -0
- package/dist/schemas/async.d.ts +39 -12
- package/dist/schemas/async.js +40 -4
- package/dist/schemas/outputs.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/timeouts.d.ts +24 -1
- package/dist/timeouts.js +32 -0
- package/dist/tools/async-common.d.ts +4 -2
- package/dist/tools/async-common.js +10 -2
- package/dist/tools/discover-runs.d.ts +6 -3
- package/dist/tools/discover-runs.js +126 -7
- package/dist/tools/discover.js +3 -0
- package/dist/tools/list-endpoints.js +5 -3
- package/dist/tools/manage.js +5 -4
- package/dist/tools/pricing.js +41 -10
- package/dist/tools/request.js +10 -2
- package/dist/tools/search-runs.js +27 -3
- package/dist/types.d.ts +9 -1
- package/dist/unit-meters.d.ts +32 -0
- package/dist/unit-meters.js +137 -0
- package/dist/value-prices.d.ts +38 -0
- package/dist/value-prices.js +168 -0
- package/package.json +3 -3
package/dist/cost-guard.js
CHANGED
|
@@ -4,18 +4,51 @@ import { priceDrivingParams } from "./pricing.js";
|
|
|
4
4
|
import { joinsCeiling, laneMaxCredits, quoteHydration } from "./hydration.js";
|
|
5
5
|
import { judgmentHoldMax, quoteJudgments } from "./judgments.js";
|
|
6
6
|
import { confirmThreshold } from "./session-spend.js";
|
|
7
|
+
import { perHandleHold, rowMeter, valueAndAddOnCeiling, valueAndAddOnCredits } from "./value-prices.js";
|
|
8
|
+
import { unitMeter } from "./unit-meters.js";
|
|
7
9
|
const present = (v) => v !== undefined && v !== null && v !== "";
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* The `pages` lever (API-280, API-281): `{platform}/profile/full` and
|
|
12
|
+
* `prism/format-lift` read up to `max` pages in one call, the first at the flat
|
|
13
|
+
* price and each further page at `step` credits (the posts endpoint's own page
|
|
14
|
+
* price), refunding pages not read. The step is the band's spread over the
|
|
15
|
+
* further pages; undefined when the band does not split into whole credits.
|
|
16
|
+
*/
|
|
17
|
+
export function pagesLever(e) {
|
|
18
|
+
const param = e.optionalParams.find((o) => o.name === "pages");
|
|
19
|
+
if (!param || e.pricing.model !== "metered" || e.pricing.maxCost === undefined)
|
|
20
|
+
return undefined;
|
|
21
|
+
const fromText = /\b1-(\d+)\b/.exec(param.description ?? "");
|
|
22
|
+
const max = param.maximum ?? (fromText ? Number(fromText[1]) : undefined);
|
|
23
|
+
if (!max || max < 2)
|
|
24
|
+
return undefined;
|
|
25
|
+
const spread = e.pricing.maxCost - e.pricing.cost - joinsCeiling(e);
|
|
26
|
+
const step = spread / (max - 1);
|
|
27
|
+
return Number.isInteger(step) && step > 0 ? { max, step } : undefined;
|
|
28
|
+
}
|
|
29
|
+
/** Credits the further pages asked with `pages` add to the first page's price. */
|
|
30
|
+
function pagesCredits(e, params) {
|
|
31
|
+
const lever = pagesLever(e);
|
|
32
|
+
const pages = Number(params.pages);
|
|
33
|
+
if (!lever || !Number.isFinite(pages) || pages <= 1)
|
|
34
|
+
return 0;
|
|
35
|
+
return (Math.min(Math.floor(pages), lever.max) - 1) * lever.step;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Whether a metered band is fully explained by the page, its `include=` joins,
|
|
39
|
+
* its metered judgments, its `pages` lever, and the value prices and include
|
|
40
|
+
* add-ons its text states (`value-prices.ts`) — then local arithmetic is exact.
|
|
41
|
+
* Any other meter (per-row `limit`, page walks the rule describes) is not.
|
|
12
42
|
*/
|
|
13
43
|
export function bandExplained(e) {
|
|
14
44
|
if (e.pricing.model !== "metered" || e.pricing.maxCost === undefined)
|
|
15
45
|
return true;
|
|
16
46
|
const labels = e.judgments?.labels;
|
|
17
|
-
const
|
|
47
|
+
const lever = pagesLever(e);
|
|
48
|
+
const explained = (unitMeter(e)?.ceiling ?? rowMeter(e)?.ceiling ?? e.pricing.cost) +
|
|
49
|
+
(lever ? (lever.max - 1) * lever.step : 0) +
|
|
18
50
|
joinsCeiling(e) +
|
|
51
|
+
valueAndAddOnCeiling(e) +
|
|
19
52
|
(labels && (labels.metered.length > 0 || labels.free.includes("intent")) ? judgmentHoldMax(e) : 0) +
|
|
20
53
|
(e.judgments?.relevance ? judgmentHoldMax(e) : 0);
|
|
21
54
|
return e.pricing.maxCost <= explained;
|
|
@@ -31,16 +64,46 @@ export function unaskedJoinCredits(e, include) {
|
|
|
31
64
|
* the band's ceiling when a param the pricing rule names is present (a
|
|
32
65
|
* plain call stays at the page price). `max_pages` multiplies the lot.
|
|
33
66
|
*/
|
|
67
|
+
/**
|
|
68
|
+
* What the call itself holds before joins, judgments, further pages and add-ons,
|
|
69
|
+
* when its rule meters it on something the params name: a batch priced per
|
|
70
|
+
* handle (prism/profiles), a per-row meter on `limit` (comments/full: ceil(limit
|
|
71
|
+
* / 4), at least 3; the affiliate lanes: limit x 107), or a unit price times
|
|
72
|
+
* the units named (Trends places, Naver segments, find-accounts platforms).
|
|
73
|
+
* `whole` means nothing else adds to it. Undefined: the page price.
|
|
74
|
+
*/
|
|
75
|
+
export function meteredBase(endpoint, params) {
|
|
76
|
+
const byHandle = perHandleHold(endpoint, params);
|
|
77
|
+
if (byHandle !== undefined)
|
|
78
|
+
return { credits: byHandle, basis: "each handle at its platform's price", whole: true };
|
|
79
|
+
const units = unitMeter(endpoint);
|
|
80
|
+
if (units)
|
|
81
|
+
return units.hold(params);
|
|
82
|
+
const rows = rowMeter(endpoint);
|
|
83
|
+
if (rows) {
|
|
84
|
+
const credits = rows.hold(params.limit);
|
|
85
|
+
return { credits, basis: `metered on \`limit\` (${params.limit === undefined || params.limit === "" ? "its default" : String(params.limit)})` };
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
34
89
|
export function localQuote(endpoint, params) {
|
|
35
90
|
const p = endpoint.pricing;
|
|
36
|
-
|
|
91
|
+
const metered = meteredBase(endpoint, params);
|
|
92
|
+
if (metered?.whole)
|
|
93
|
+
return metered.credits;
|
|
94
|
+
const base = metered ? metered.credits : p.cost;
|
|
95
|
+
let hold = base;
|
|
37
96
|
const include = typeof params.include === "string" ? params.include : undefined;
|
|
38
97
|
if ((endpoint.hydration?.length ?? 0) > 0) {
|
|
39
98
|
const limit = Number(params.limit);
|
|
40
|
-
hold = quoteHydration(endpoint, include, Number.isFinite(limit) ? limit : undefined).held;
|
|
99
|
+
hold = quoteHydration(endpoint, include, Number.isFinite(limit) ? limit : undefined).held - p.cost + base;
|
|
41
100
|
}
|
|
42
101
|
if (endpoint.judgments)
|
|
43
102
|
hold += quoteJudgments(endpoint, params).held;
|
|
103
|
+
hold += pagesCredits(endpoint, params);
|
|
104
|
+
// A value that sets the page price (sort=likes) and a fixed include add-on
|
|
105
|
+
// (include=segments, description, stats), as the rule states them.
|
|
106
|
+
hold += valueAndAddOnCredits(endpoint, params);
|
|
44
107
|
// A band that is nothing but the page, its joins and its judgments is
|
|
45
108
|
// quoted exactly above; only a band that meters on something else is
|
|
46
109
|
// budgeted at its ceiling — less the joins this call does not turn on.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* {routes,resume,more,schedule-routes}.ts, platforms/review-history/
|
|
7
7
|
* {http,engine}.ts, events/{feed,routes}.ts, webhooks/{http,limits}.ts.
|
|
8
8
|
*/
|
|
9
|
-
export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`). Runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n\n- **Long-poll:** `run_get` with `wait_s` (0-25) answers early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **Filters** (run_get and run_export): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. Any parameter the route does not take is a free 400. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; the last line is `{\"complete\":true}` or `{\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters).\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **No dry_run** on any run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Stored lists (`/v1/prism/discover/inputs`)\n\nMake one with `socialcrawl_request` on `POST prism/discover/inputs` (`{ kind: \"authors\", authors: [...] }` up to 10,000 handles, or `{ kind: \"exclude\", exclude: [...] }` up to 50,000 entries); the answer's `author_list_id` / `exclude_list_id` (`din_\u2026`) goes into a discover call. Then, free: `input_list` (every live list with `item_count` and `expires_at`, plus `live` of `limit` 500 per account), `input_append` (`id` + `{ exclude: [...] }`, 1 to 50,000 entries; duplicates skipped, the expiry moves to 31 days; past 50,000 in all it is a free 400 `exclude_list_full`), `input_delete`. An unknown, expired or foreign id, or an author list sent to append, is a 404 `input_not_found`. Lists live 30 days.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart a job with `socialcrawl_request` on the POST for the platform \u2014 it holds the price and answers 202 with `job_id` (`job_\u2026`):\n\n| Start (POST) | Poll with `platform` | Price |\n|---|---|---|\n| `trustpilot/reviews/history` | `trustpilot` (default) | holds `depth` + 5 |\n| `tripadvisor/reviews/history` | `tripadvisor` | holds `depth` |\n| `google/business/reviews/history` (exactly one of `place_id` or `cid`, `depth` 1-10,000) | `google` | 5 per started 100 reviews collected; none collected is refunded in full |\n| `yelp/business/reviews/history` | `yelp` | 1 per started 4 pages (held at 52 a language; `languages=all` holds 154); honours `Idempotency-Key` |\n\nPoll with `socialcrawl_manage` `area: \"review_history\"`, `action: \"get\"`, `id` = the job id, free. Trustpilot, Tripadvisor and Google: status queued \u2192 running \u2192 polling \u2192 succeeded | failed; once settled each page carries `data.items` and `data.job` (`credits_hold`, the settled `credits_charged`, `expires_at`); page with `offset` and `limit` (1-100) until a page is shorter than `limit`. Yelp: rows are readable while the job runs, each page carries `data.job` (`pages_read`, `reviews_collected`, per-language progress), `total` and `next_offset` (null on the last page). Jobs live 7 days.\n\n## Bulk review history (`POST /v1/prism/reviews/bulk`)\n\nOne background job over up to 20,000 businesses or apps: `platform` (`yelp`, `tripadvisor`, `app_store`, `google_play`), `items`, optional `since` / `until`, `languages` (not Tripadvisor or App Store), `max_reviews_per_item`, `format` (`jsonl` | `csv`), `include` (`business`, `business_full` on Yelp, `none`), `country` (App Store, Google Play), `webhook_url` (https; the 202 shows its `webhook_secret` once) and `refresh_of` (an earlier job of this key: reuses its items and starts from the day it settled). Start it with `socialcrawl_request`. It bills 1 credit per started 4 pages over the whole job, reserved 25 credits at a time; a business that cannot be read costs nothing. When the next block cannot be held the job pauses as `paused_insufficient_credits` and resumes after a top-up (webhook events `reviews_bulk.paused`, `resumed`, `completed`, signed `x-socialcrawl-signature`). `Idempotency-Key` replays the job at 0 credits.\n\nThen, free: `action: \"bulk_get\"` (progress, each item's `status` pending | walking | waiting | done | unavailable, and signed links to the combined file, the manifest and each item's file, valid 1 hour; page items with `offset`/`limit`) and `action: \"bulk_cancel\"` (keeps and bills what was read; the job can still read `running` until it settles as `cancelled`). There is no list route: keep the job id.\n\n## follow\n\nAnswers carry ready next-step URLs in `data.next.*`. `socialcrawl_manage` `area: \"discover\"`, `action: \"follow\"`, `input: { url }` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). `status_url`, `results_url`, `changes_url` and `poll_url` are free reads. `continue_url` STARTS a billable continuation and is never followed (call `socialcrawl_request` after checking `continue_estimate`); `resume_url`/`more_url` are POSTs: use `run_resume`/`run_more`.\n";
|
|
9
|
+
export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). A background start answers 202 with `data.run` (`eta_s` with `eta_basis`), `data.next`, `credits_remaining` and, with `notify_url`, `data.notify` (its signing secret). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`). Runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_status` | `GET /runs/{run_id}/status` (`wait_s` only) | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_results_csv` / `run_comments_csv` | `GET /runs/{run_id}/results.csv` / `comments.csv` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` or `{ attach_stored_only: true }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n| `run_comments` | `POST /runs/{run_id}/comments` `{ top_posts?, per_post?, platforms?, labels?, max_credits? }` | comment pages bill at their lane prices; `dry_run` quotes free |\n\n- **Poll `run_status`** (`GET /runs/{run_id}/status`, `wait_s` 0-25): `run`, `next` and `_warnings` only, about 2 KB where `run_get` is about 100 KB. Every run answer carries `next.poll_url` pointing at it (`status_url` unchanged). `run.progress` names its stages: `progress.stages` (states from the work left: `reading_comments`, `waiting`, `stopped`, `done`) and `progress.current_stage`, with `rows_collected`, `rows_judging`, `rows_held` and `note`; a background run fills `eta_s` with `eta_basis` (`estimate` or `measured`) and `credits_remaining`. `summary.comments` adds `posts_selected`, `posts_walked`, `posts_attached`, `stored_unattached_pages` and `count_bases`.\n- **Long-poll:** `run_get` and `run_status` with `wait_s` (0-25) answer early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **notify_url** on the `prism/discover` POST (https, public host): one signed POST `discover.run_settled` (`run_id`, `status`, `stopped_because`, `credits_spent`, the run, poll and results URLs) when the run completes, is partial, pauses, fails or is cancelled. It is signed like webhook deliveries (`x-socialcrawl-signature`) with `data.notify.secret` from the POST answer.\n- **Filters** (run_get and the exports): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. `format` (evidence | compact | text) and `fields` override the run's own for this read. On `run_get` only: `summary` (full | kept | none) and `summary_extra=by_week,top_terms` (kept rows per week with the stance split and mean sentiment; top hashtags and words per group). Any parameter the route does not take is a free 400 naming the next step. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; every line carries `kind` (`post`, `account`, `warning`, `removed`, `trailer`), and the last is the trailer: `{\"kind\":\"trailer\",\"complete\":true}` or `{\"kind\":\"trailer\",\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters). A settled run's arrival-order export fills `engagement.percentile`.\n- **CSV:** `results.csv` is one line per kept post row (fixed columns, then one `question.<id>` column per question); `comments.csv` one line per comment, keyed by `post_id`. RFC 4180, UTF-8 with a BOM, formula-like cells guarded, the same filters and cursor as `results.jsonl`. A run that is not posts is a free 400 `csv_posts_only`.\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice. `{ attach_stored_only: true }` (alone) attaches comment pages the run stored but no row shows, bills 0 and keeps the status (`data.attached`); a stopped run's `next_step` names those pages and any unsent `include=interest` calls.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **run_comments** (`POST /runs/{run_id}/comments`) reads comments for an existing posts run: `top_posts` 1-50 and `per_post` 1-200 (default the run's own, else 3 and 20), `platforms`, `labels` (up to 10), `max_credits` (default the quote's max). `dry_run` answers the quote free. Pages an earlier pass stored replay free. Refused free while the run runs (409 `run_running`) or owes other work (409 `run_has_unsent_work`: resume it first). The answer is 202: poll `run_status`.\n- **Background runs** write comments to each post as it is read and read up to 4 slices of 5 posts at once; `include=interest` calls run once searches end. A run started with `x-client-tag` tags every background charge, so `credits/usage?group_by=tag` equals the run's spend.\n- **Rows** carry `language_source` (`detected`, `platform`, `requested`), `author.display_name` and `author.url` (`username` null when only a name is known), `judgments.stance.best` and `scores` beside `label`, and `geo.country.known`. A windowed run with Naver cafe or web documents warns how many kept rows have no date.\n- **Caps:** a dry run and a `max_credits_below_estimate` refusal carry `recommended_max_credits` (expected cost x 2, between the minimum and `suggested_max_credits`), and `next_step` leads with it; `plan=omit` leaves `plan` out of the answer.\n- **No dry_run** on any other run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Stored lists (`/v1/prism/discover/inputs`)\n\nMake one with `socialcrawl_request` on `POST prism/discover/inputs` (`{ kind: \"authors\", authors: [...] }` up to 10,000 handles, or `{ kind: \"exclude\", exclude: [...] }` up to 50,000 entries); the answer's `author_list_id` / `exclude_list_id` (`din_\u2026`) goes into a discover call. Then, free: `input_list` (every live list with `item_count` and `expires_at`, plus `live` of `limit` 500 per account), `input_append` (`id` + `{ exclude: [...] }`, 1 to 50,000 entries; duplicates skipped, the expiry moves to 31 days; past 50,000 in all it is a free 400 `exclude_list_full`), `input_delete`. An unknown, expired or foreign id, or an author list sent to append, is a 404 `input_not_found`. Lists live 30 days.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart a job with `socialcrawl_request` on the POST for the platform \u2014 it holds the price and answers 202 with `job_id` (`job_\u2026`):\n\n| Start (POST) | Poll with `platform` | Price |\n|---|---|---|\n| `trustpilot/reviews/history` | `trustpilot` (default) | holds `depth` + 5 |\n| `tripadvisor/reviews/history` | `tripadvisor` | holds `depth` |\n| `google/business/reviews/history` (exactly one of `place_id` or `cid`, `depth` 1-10,000) | `google` | 5 per started 100 reviews collected; none collected is refunded in full |\n| `yelp/business/reviews/history` | `yelp` | 1 per started 4 pages (held at 52 a language; `languages=all` holds 154); honours `Idempotency-Key` |\n\nPoll with `socialcrawl_manage` `area: \"review_history\"`, `action: \"get\"`, `id` = the job id, free. Trustpilot, Tripadvisor and Google: status queued \u2192 running \u2192 polling \u2192 succeeded | failed; once settled each page carries `data.items` and `data.job` (`credits_hold`, the settled `credits_charged`, `expires_at`); page with `offset` and `limit` (1-100) until a page is shorter than `limit`. Yelp: rows are readable while the job runs, each page carries `data.job` (`pages_read`, `reviews_collected`, per-language progress), `total` and `next_offset` (null on the last page). Jobs live 7 days.\n\n## Bulk review history (`POST /v1/prism/reviews/bulk`)\n\nOne background job over up to 20,000 businesses or apps: `platform` (`yelp`, `tripadvisor`, `app_store`, `google_play`), `items`, optional `since` / `until`, `languages` (not Tripadvisor or App Store), `max_reviews_per_item`, `format` (`jsonl` | `csv`), `include` (`business`, `business_full` on Yelp, `none`), `country` (App Store, Google Play), `webhook_url` (https; the 202 shows its `webhook_secret` once) and `refresh_of` (an earlier job of this key: reuses its items and starts from the day it settled). Start it with `socialcrawl_request`. It bills 1 credit per started 4 pages over the whole job, reserved 25 credits at a time; a business that cannot be read costs nothing. When the next block cannot be held the job pauses as `paused_insufficient_credits` and resumes after a top-up (webhook events `reviews_bulk.paused`, `resumed`, `completed`, signed `x-socialcrawl-signature`). `Idempotency-Key` replays the job at 0 credits.\n\nThen, free: `action: \"bulk_get\"` (progress, each item's `status` pending | walking | waiting | done | unavailable, and signed links to the combined file, the manifest and each item's file, valid 1 hour; page items with `offset`/`limit`) and `action: \"bulk_cancel\"` (keeps and bills what was read; the job can still read `running` until it settles as `cancelled`). There is no list route: keep the job id.\n\n## follow\n\nAnswers carry ready next-step URLs in `data.next.*`. `socialcrawl_manage` `area: \"discover\"`, `action: \"follow\"`, `input: { url }` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). `status_url`, `results_url`, `changes_url` and `poll_url` are free reads. `continue_url` STARTS a billable continuation and is never followed (call `socialcrawl_request` after checking `continue_estimate`); `resume_url`/`more_url` are POSTs: use `run_resume`/`run_more`.\n";
|
|
10
10
|
export declare const EVENTS_DOC = "# SocialCrawl API \u2014 Account events feed and webhook endpoints\n\nThe account event log records what happens to this key's background work: discover runs (`discover.completed`, `discover.partial`, `discover.paused`, `discover.failed`, `discover.progress`, `discover.accounts_ready`, `discover.new_rows`, `discover.new_accounts`, `discover.new_items`), schedules (`discover.run_skipped`, `discover.run_failed`) and webhook endpoint health (`endpoint.disabled`). Pull it with the feed or have it pushed to a webhook endpoint. Use `socialcrawl_manage` `area: \"events\"`. Everything here costs **0 credits**, and no route here takes `dry_run`.\n\n## Feed (`GET /v1/events`)\n\n- **Your own cursor:** `cursor` = `oldest` (start of the 30-day retention), `now` (only new events), an event id (`evt_\u2026`) or `pagination.next_cursor` exactly as returned. Save `next_cursor` after each page.\n- **Named consumer:** `id` = a consumer name (a-z, 0-9, _ and -, up to 64). The server keeps its position; `start` (now | oldest) sets where a new consumer begins; its `types`/`subject_ids` filters bind at first use. A read commits nothing: process the page, then `ack` its `pagination.next_cursor` (`POST /v1/events/consumers/{name}/ack`, same `id`, `input: { cursor }`). Until you ack, the read returns the same page.\n- Not both `cursor` and a consumer (a free 400).\n- **Filters:** `types` (up to 50 types or patterns: `discover.completed`, `discover.*`, `*`) and `subject_ids` (up to 100 run_\u2026 or dsch_\u2026 ids). `limit` 1-500 (default 100).\n- **Long-poll:** `wait_s` (0-25) holds an empty read until an event arrives. At most 5 long-polls per key; a sixth answers at once.\n- **410 CURSOR_EXPIRED:** the position is older than the 30-day retention, so events were missed. Restart from `oldest` (a consumer restarts there on its next read and says `restarted_from` once) and tell the user which window was missed.\n- `data.next.poll_url` is a free read: `area: \"discover\"` action `follow` can GET it.\n\n## Webhook endpoints (`/v1/webhook-endpoints`)\n\nAt most **20 per API key**; an endpoint answers only to the key that created it. `id` is the endpoint id (`we_\u2026`, `data.endpoint.id`).\n\n| Action | Route |\n|--------|-------|\n| `endpoint_create` | `POST /` `{ url, types?, description?, subject_ids? }` (201) |\n| `endpoint_list` | `GET /` (limit \u2264100, cursor, status) |\n| `endpoint_get` | `GET /{id}` |\n| `endpoint_update` | `PATCH /{id}` (url, types, description, subject_ids, status enabled/disabled) |\n| `endpoint_delete` | `DELETE /{id}` |\n| `endpoint_rotate_secret` | `POST /{id}/rotate-secret` |\n| `endpoint_test` | `POST /{id}/test` `{ type? }` |\n| `endpoint_attempts` | `GET /{id}/attempts` (limit \u2264100, cursor) |\n\n- **The secret is shown ONCE.** `endpoint_create` and `endpoint_rotate_secret` return a `whsec_` secret in `data.secret`; store it immediately. Both send an Idempotency-Key (generated when you omit it, and echoed): a replay never creates a second endpoint and never shows the secret again. If it is lost, rotate with a NEW key.\n- **Rotation:** for 24 hours every delivery is signed with both the old and the new secret, so deploy the new one before then.\n- **URL rules:** a public HTTPS receiver. Private hosts and chat-app incoming webhooks are refused (400 invalid_webhook_url).\n- **Types** default to `[\"*\"]`. `endpoint_test` sends one signed sample of a subscribed type; the receiver has 15 s to answer 2xx. Answering 410 to a real delivery disables the endpoint.\n- **Retries:** a failing delivery gets 8 attempts in all, backing off over roughly 41 hours; `endpoint_attempts` shows the log. Setting `status: \"enabled\"` on a disabled endpoint resumes its parked deliveries at once.\n- **Links are full URLs.** An event's `links` (`run`, `results`, `changes`) start with the API's https origin; pass any of them to action `follow` (areas `discover`, `search_runs`, `creator_runs`).\n";
|
|
11
11
|
/**
|
|
12
12
|
* Universal search runs, lists and watches (UPGRADE-LOG API-073, API-077,
|
package/dist/data/docs-async.js
CHANGED
|
@@ -6,100 +6,110 @@
|
|
|
6
6
|
* {routes,resume,more,schedule-routes}.ts, platforms/review-history/
|
|
7
7
|
* {http,engine}.ts, events/{feed,routes}.ts, webhooks/{http,limits}.ts.
|
|
8
8
|
*/
|
|
9
|
-
export const DISCOVER_RUNS_DOC = `# SocialCrawl API — Discover runs, schedules and review history
|
|
10
|
-
|
|
11
|
-
Work that keeps running after the call that started it. Start it with \`socialcrawl_request\`; read, export, steer and stop it with \`socialcrawl_manage\` (areas \`discover\` and \`review_history\`). Every read here is free; only the searches a run goes on to make are billed.
|
|
12
|
-
|
|
13
|
-
## Discover runs (\`/v1/prism/discover/runs\`)
|
|
14
|
-
|
|
15
|
-
Start a run with \`socialcrawl_request\` on \`prism/discover\` (\`max_credits\` is required; \`async\` runs it in the background). Manage it with \`socialcrawl_manage\` \`area: "discover"\`; \`id\` is the run id (\`run_…\`, \`data.run.run_id\`). Runs created since 14/11/2026 are kept 30 days by default (was 7); \`retention_days\` is 1 to 30.
|
|
16
|
-
|
|
17
|
-
| Action | Route | Cost |
|
|
18
|
-
|--------|-------|------|
|
|
19
|
-
| \`run_list\` | \`GET /runs\` (status, kind, created_after, cursor, page_size ≤100; \`id\` = a schedule id lists that schedule's runs) | 0 |
|
|
20
|
-
| \`run_get\` | \`GET /runs/{run_id}\` | 0 |
|
|
21
|
-
| \`
|
|
22
|
-
| \`
|
|
23
|
-
| \`
|
|
24
|
-
| \`
|
|
25
|
-
| \`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
##
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
9
|
+
export const DISCOVER_RUNS_DOC = `# SocialCrawl API — Discover runs, schedules and review history
|
|
10
|
+
|
|
11
|
+
Work that keeps running after the call that started it. Start it with \`socialcrawl_request\`; read, export, steer and stop it with \`socialcrawl_manage\` (areas \`discover\` and \`review_history\`). Every read here is free; only the searches a run goes on to make are billed.
|
|
12
|
+
|
|
13
|
+
## Discover runs (\`/v1/prism/discover/runs\`)
|
|
14
|
+
|
|
15
|
+
Start a run with \`socialcrawl_request\` on \`prism/discover\` (\`max_credits\` is required; \`async\` runs it in the background). A background start answers 202 with \`data.run\` (\`eta_s\` with \`eta_basis\`), \`data.next\`, \`credits_remaining\` and, with \`notify_url\`, \`data.notify\` (its signing secret). Manage it with \`socialcrawl_manage\` \`area: "discover"\`; \`id\` is the run id (\`run_…\`, \`data.run.run_id\`). Runs created since 14/11/2026 are kept 30 days by default (was 7); \`retention_days\` is 1 to 30.
|
|
16
|
+
|
|
17
|
+
| Action | Route | Cost |
|
|
18
|
+
|--------|-------|------|
|
|
19
|
+
| \`run_list\` | \`GET /runs\` (status, kind, created_after, cursor, page_size ≤100; \`id\` = a schedule id lists that schedule's runs) | 0 |
|
|
20
|
+
| \`run_get\` | \`GET /runs/{run_id}\` | 0 |
|
|
21
|
+
| \`run_status\` | \`GET /runs/{run_id}/status\` (\`wait_s\` only) | 0 |
|
|
22
|
+
| \`run_export\` | \`GET /runs/{run_id}/results.jsonl\` | 0 |
|
|
23
|
+
| \`run_results_csv\` / \`run_comments_csv\` | \`GET /runs/{run_id}/results.csv\` / \`comments.csv\` | 0 |
|
|
24
|
+
| \`run_legs\` | \`GET /runs/{run_id}/legs\` (page_size ≤500) | 0 |
|
|
25
|
+
| \`run_cancel\` | \`DELETE /runs/{run_id}\` | 0 — rows kept, resume continues |
|
|
26
|
+
| \`run_resume\` | \`POST /runs/{run_id}/resume\` \`{ max_credits?, retry_failed? }\` or \`{ attach_stored_only: true }\` | 0 itself; continued searches bill as they run |
|
|
27
|
+
| \`run_more\` | \`POST /runs/{run_id}/more\` \`{ new_searches?, feedback?, max_credits?, pages? }\` | each new search bills at its lane price |
|
|
28
|
+
| \`run_comments\` | \`POST /runs/{run_id}/comments\` \`{ top_posts?, per_post?, platforms?, labels?, max_credits? }\` | comment pages bill at their lane prices; \`dry_run\` quotes free |
|
|
29
|
+
|
|
30
|
+
- **Poll \`run_status\`** (\`GET /runs/{run_id}/status\`, \`wait_s\` 0-25): \`run\`, \`next\` and \`_warnings\` only, about 2 KB where \`run_get\` is about 100 KB. Every run answer carries \`next.poll_url\` pointing at it (\`status_url\` unchanged). \`run.progress\` names its stages: \`progress.stages\` (states from the work left: \`reading_comments\`, \`waiting\`, \`stopped\`, \`done\`) and \`progress.current_stage\`, with \`rows_collected\`, \`rows_judging\`, \`rows_held\` and \`note\`; a background run fills \`eta_s\` with \`eta_basis\` (\`estimate\` or \`measured\`) and \`credits_remaining\`. \`summary.comments\` adds \`posts_selected\`, \`posts_walked\`, \`posts_attached\`, \`stored_unattached_pages\` and \`count_bases\`.
|
|
31
|
+
- **Long-poll:** \`run_get\` and \`run_status\` with \`wait_s\` (0-25) answer early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.
|
|
32
|
+
- **notify_url** on the \`prism/discover\` POST (https, public host): one signed POST \`discover.run_settled\` (\`run_id\`, \`status\`, \`stopped_because\`, \`credits_spent\`, the run, poll and results URLs) when the run completes, is partial, pauses, fails or is cancelled. It is signed like webhook deliveries (\`x-socialcrawl-signature\`) with \`data.notify.secret\` from the POST answer.
|
|
33
|
+
- **Filters** (run_get and the exports): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and \`tags\` sent as \`tag.<key>=<value>\`. \`format\` (evidence | compact | text) and \`fields\` override the run's own for this read. On \`run_get\` only: \`summary\` (full | kept | none) and \`summary_extra=by_week,top_terms\` (kept rows per week with the stance split and mean sentiment; top hashtags and words per group). Any parameter the route does not take is a free 400 naming the next step. A cursor is signed with the filters it was issued for: send the SAME filters with it.
|
|
34
|
+
- **run_export** streams every matching row; every line carries \`kind\` (\`post\`, \`account\`, \`warning\`, \`removed\`, \`trailer\`), and the last is the trailer: \`{"kind":"trailer","complete":true}\` or \`{"kind":"trailer","next_cursor":"…"}\` (stopped after about 45 s; send it back with the same filters). A settled run's arrival-order export fills \`engagement.percentile\`.
|
|
35
|
+
- **CSV:** \`results.csv\` is one line per kept post row (fixed columns, then one \`question.<id>\` column per question); \`comments.csv\` one line per comment, keyed by \`post_id\`. RFC 4180, UTF-8 with a BOM, formula-like cells guarded, the same filters and cursor as \`results.jsonl\`. A run that is not posts is a free 400 \`csv_posts_only\`.
|
|
36
|
+
- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER \`max_credits\`. Searches already paid for are never paid twice. \`{ attach_stored_only: true }\` (alone) attaches comment pages the run stored but no row shows, bills 0 and keeps the status (\`data.attached\`); a stopped run's \`next_step\` names those pages and any unsent \`include=interest\` calls.
|
|
37
|
+
- **run_more** works on completed runs only: \`pages\` 1-10, \`feedback.accept\`/\`feedback.reject\` up to 100 ids each (\`accept\` needs \`new_searches: true\`). Read only the new rows with \`changes_since\` = \`data.more.since_version\`. \`data.more.nothing_more\` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.
|
|
38
|
+
- **run_comments** (\`POST /runs/{run_id}/comments\`) reads comments for an existing posts run: \`top_posts\` 1-50 and \`per_post\` 1-200 (default the run's own, else 3 and 20), \`platforms\`, \`labels\` (up to 10), \`max_credits\` (default the quote's max). \`dry_run\` answers the quote free. Pages an earlier pass stored replay free. Refused free while the run runs (409 \`run_running\`) or owes other work (409 \`run_has_unsent_work\`: resume it first). The answer is 202: poll \`run_status\`.
|
|
39
|
+
- **Background runs** write comments to each post as it is read and read up to 4 slices of 5 posts at once; \`include=interest\` calls run once searches end. A run started with \`x-client-tag\` tags every background charge, so \`credits/usage?group_by=tag\` equals the run's spend.
|
|
40
|
+
- **Rows** carry \`language_source\` (\`detected\`, \`platform\`, \`requested\`), \`author.display_name\` and \`author.url\` (\`username\` null when only a name is known), \`judgments.stance.best\` and \`scores\` beside \`label\`, and \`geo.country.known\`. A windowed run with Naver cafe or web documents warns how many kept rows have no date.
|
|
41
|
+
- **Caps:** a dry run and a \`max_credits_below_estimate\` refusal carry \`recommended_max_credits\` (expected cost x 2, between the minimum and \`suggested_max_credits\`), and \`next_step\` leads with it; \`plan=omit\` leaves \`plan\` out of the answer.
|
|
42
|
+
- **No dry_run** on any other run or schedule route (resume and more refuse any query parameter).
|
|
43
|
+
- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).
|
|
44
|
+
|
|
45
|
+
## Discover schedules (\`/v1/prism/discover/schedules\`)
|
|
46
|
+
|
|
47
|
+
Created by \`prism/discover\` with a \`schedule\` field. All free; each scheduled run bills like a run within \`max_credits_per_run\` and \`max_credits_per_month\`. \`id\` is the schedule id (\`dsch_…\`).
|
|
48
|
+
|
|
49
|
+
\`schedule_list\` (status active | paused | stopped, cursor, page_size ≤100), \`schedule_get\` (its recent runs, this month's spend, next fire), \`schedule_pause\`, \`schedule_resume\` (\`{ max_credits_per_run?, max_credits_per_month? }\`, null clears the month cap), \`schedule_delete\` (runs keep their rows). \`run_list\` with the schedule id lists one schedule's runs.
|
|
50
|
+
|
|
51
|
+
## Stored lists (\`/v1/prism/discover/inputs\`)
|
|
52
|
+
|
|
53
|
+
Make one with \`socialcrawl_request\` on \`POST prism/discover/inputs\` (\`{ kind: "authors", authors: [...] }\` up to 10,000 handles, or \`{ kind: "exclude", exclude: [...] }\` up to 50,000 entries); the answer's \`author_list_id\` / \`exclude_list_id\` (\`din_…\`) goes into a discover call. Then, free: \`input_list\` (every live list with \`item_count\` and \`expires_at\`, plus \`live\` of \`limit\` 500 per account), \`input_append\` (\`id\` + \`{ exclude: [...] }\`, 1 to 50,000 entries; duplicates skipped, the expiry moves to 31 days; past 50,000 in all it is a free 400 \`exclude_list_full\`), \`input_delete\`. An unknown, expired or foreign id, or an author list sent to append, is a 404 \`input_not_found\`. Lists live 30 days.
|
|
54
|
+
|
|
55
|
+
## Review history (\`/v1/{platform}/reviews/history/{job_id}\`)
|
|
56
|
+
|
|
57
|
+
Start a job with \`socialcrawl_request\` on the POST for the platform — it holds the price and answers 202 with \`job_id\` (\`job_…\`):
|
|
58
|
+
|
|
59
|
+
| Start (POST) | Poll with \`platform\` | Price |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| \`trustpilot/reviews/history\` | \`trustpilot\` (default) | holds \`depth\` + 5 |
|
|
62
|
+
| \`tripadvisor/reviews/history\` | \`tripadvisor\` | holds \`depth\` |
|
|
63
|
+
| \`google/business/reviews/history\` (exactly one of \`place_id\` or \`cid\`, \`depth\` 1-10,000) | \`google\` | 5 per started 100 reviews collected; none collected is refunded in full |
|
|
64
|
+
| \`yelp/business/reviews/history\` | \`yelp\` | 1 per started 4 pages (held at 52 a language; \`languages=all\` holds 154); honours \`Idempotency-Key\` |
|
|
65
|
+
|
|
66
|
+
Poll with \`socialcrawl_manage\` \`area: "review_history"\`, \`action: "get"\`, \`id\` = the job id, free. Trustpilot, Tripadvisor and Google: status queued → running → polling → succeeded | failed; once settled each page carries \`data.items\` and \`data.job\` (\`credits_hold\`, the settled \`credits_charged\`, \`expires_at\`); page with \`offset\` and \`limit\` (1-100) until a page is shorter than \`limit\`. Yelp: rows are readable while the job runs, each page carries \`data.job\` (\`pages_read\`, \`reviews_collected\`, per-language progress), \`total\` and \`next_offset\` (null on the last page). Jobs live 7 days.
|
|
67
|
+
|
|
68
|
+
## Bulk review history (\`POST /v1/prism/reviews/bulk\`)
|
|
69
|
+
|
|
70
|
+
One background job over up to 20,000 businesses or apps: \`platform\` (\`yelp\`, \`tripadvisor\`, \`app_store\`, \`google_play\`), \`items\`, optional \`since\` / \`until\`, \`languages\` (not Tripadvisor or App Store), \`max_reviews_per_item\`, \`format\` (\`jsonl\` | \`csv\`), \`include\` (\`business\`, \`business_full\` on Yelp, \`none\`), \`country\` (App Store, Google Play), \`webhook_url\` (https; the 202 shows its \`webhook_secret\` once) and \`refresh_of\` (an earlier job of this key: reuses its items and starts from the day it settled). Start it with \`socialcrawl_request\`. It bills 1 credit per started 4 pages over the whole job, reserved 25 credits at a time; a business that cannot be read costs nothing. When the next block cannot be held the job pauses as \`paused_insufficient_credits\` and resumes after a top-up (webhook events \`reviews_bulk.paused\`, \`resumed\`, \`completed\`, signed \`x-socialcrawl-signature\`). \`Idempotency-Key\` replays the job at 0 credits.
|
|
71
|
+
|
|
72
|
+
Then, free: \`action: "bulk_get"\` (progress, each item's \`status\` pending | walking | waiting | done | unavailable, and signed links to the combined file, the manifest and each item's file, valid 1 hour; page items with \`offset\`/\`limit\`) and \`action: "bulk_cancel"\` (keeps and bills what was read; the job can still read \`running\` until it settles as \`cancelled\`). There is no list route: keep the job id.
|
|
73
|
+
|
|
74
|
+
## follow
|
|
75
|
+
|
|
76
|
+
Answers carry ready next-step URLs in \`data.next.*\`. \`socialcrawl_manage\` \`area: "discover"\`, \`action: "follow"\`, \`input: { url }\` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). \`status_url\`, \`results_url\`, \`changes_url\` and \`poll_url\` are free reads. \`continue_url\` STARTS a billable continuation and is never followed (call \`socialcrawl_request\` after checking \`continue_estimate\`); \`resume_url\`/\`more_url\` are POSTs: use \`run_resume\`/\`run_more\`.
|
|
67
77
|
`;
|
|
68
|
-
export const EVENTS_DOC = `# SocialCrawl API — Account events feed and webhook endpoints
|
|
69
|
-
|
|
70
|
-
The account event log records what happens to this key's background work: discover runs (\`discover.completed\`, \`discover.partial\`, \`discover.paused\`, \`discover.failed\`, \`discover.progress\`, \`discover.accounts_ready\`, \`discover.new_rows\`, \`discover.new_accounts\`, \`discover.new_items\`), schedules (\`discover.run_skipped\`, \`discover.run_failed\`) and webhook endpoint health (\`endpoint.disabled\`). Pull it with the feed or have it pushed to a webhook endpoint. Use \`socialcrawl_manage\` \`area: "events"\`. Everything here costs **0 credits**, and no route here takes \`dry_run\`.
|
|
71
|
-
|
|
72
|
-
## Feed (\`GET /v1/events\`)
|
|
73
|
-
|
|
74
|
-
- **Your own cursor:** \`cursor\` = \`oldest\` (start of the 30-day retention), \`now\` (only new events), an event id (\`evt_…\`) or \`pagination.next_cursor\` exactly as returned. Save \`next_cursor\` after each page.
|
|
75
|
-
- **Named consumer:** \`id\` = a consumer name (a-z, 0-9, _ and -, up to 64). The server keeps its position; \`start\` (now | oldest) sets where a new consumer begins; its \`types\`/\`subject_ids\` filters bind at first use. A read commits nothing: process the page, then \`ack\` its \`pagination.next_cursor\` (\`POST /v1/events/consumers/{name}/ack\`, same \`id\`, \`input: { cursor }\`). Until you ack, the read returns the same page.
|
|
76
|
-
- Not both \`cursor\` and a consumer (a free 400).
|
|
77
|
-
- **Filters:** \`types\` (up to 50 types or patterns: \`discover.completed\`, \`discover.*\`, \`*\`) and \`subject_ids\` (up to 100 run_… or dsch_… ids). \`limit\` 1-500 (default 100).
|
|
78
|
-
- **Long-poll:** \`wait_s\` (0-25) holds an empty read until an event arrives. At most 5 long-polls per key; a sixth answers at once.
|
|
79
|
-
- **410 CURSOR_EXPIRED:** the position is older than the 30-day retention, so events were missed. Restart from \`oldest\` (a consumer restarts there on its next read and says \`restarted_from\` once) and tell the user which window was missed.
|
|
80
|
-
- \`data.next.poll_url\` is a free read: \`area: "discover"\` action \`follow\` can GET it.
|
|
81
|
-
|
|
82
|
-
## Webhook endpoints (\`/v1/webhook-endpoints\`)
|
|
83
|
-
|
|
84
|
-
At most **20 per API key**; an endpoint answers only to the key that created it. \`id\` is the endpoint id (\`we_…\`, \`data.endpoint.id\`).
|
|
85
|
-
|
|
86
|
-
| Action | Route |
|
|
87
|
-
|--------|-------|
|
|
88
|
-
| \`endpoint_create\` | \`POST /\` \`{ url, types?, description?, subject_ids? }\` (201) |
|
|
89
|
-
| \`endpoint_list\` | \`GET /\` (limit ≤100, cursor, status) |
|
|
90
|
-
| \`endpoint_get\` | \`GET /{id}\` |
|
|
91
|
-
| \`endpoint_update\` | \`PATCH /{id}\` (url, types, description, subject_ids, status enabled/disabled) |
|
|
92
|
-
| \`endpoint_delete\` | \`DELETE /{id}\` |
|
|
93
|
-
| \`endpoint_rotate_secret\` | \`POST /{id}/rotate-secret\` |
|
|
94
|
-
| \`endpoint_test\` | \`POST /{id}/test\` \`{ type? }\` |
|
|
95
|
-
| \`endpoint_attempts\` | \`GET /{id}/attempts\` (limit ≤100, cursor) |
|
|
96
|
-
|
|
97
|
-
- **The secret is shown ONCE.** \`endpoint_create\` and \`endpoint_rotate_secret\` return a \`whsec_\` secret in \`data.secret\`; store it immediately. Both send an Idempotency-Key (generated when you omit it, and echoed): a replay never creates a second endpoint and never shows the secret again. If it is lost, rotate with a NEW key.
|
|
98
|
-
- **Rotation:** for 24 hours every delivery is signed with both the old and the new secret, so deploy the new one before then.
|
|
99
|
-
- **URL rules:** a public HTTPS receiver. Private hosts and chat-app incoming webhooks are refused (400 invalid_webhook_url).
|
|
100
|
-
- **Types** default to \`["*"]\`. \`endpoint_test\` sends one signed sample of a subscribed type; the receiver has 15 s to answer 2xx. Answering 410 to a real delivery disables the endpoint.
|
|
101
|
-
- **Retries:** a failing delivery gets 8 attempts in all, backing off over roughly 41 hours; \`endpoint_attempts\` shows the log. Setting \`status: "enabled"\` on a disabled endpoint resumes its parked deliveries at once.
|
|
102
|
-
- **Links are full URLs.** An event's \`links\` (\`run\`, \`results\`, \`changes\`) start with the API's https origin; pass any of them to action \`follow\` (areas \`discover\`, \`search_runs\`, \`creator_runs\`).
|
|
78
|
+
export const EVENTS_DOC = `# SocialCrawl API — Account events feed and webhook endpoints
|
|
79
|
+
|
|
80
|
+
The account event log records what happens to this key's background work: discover runs (\`discover.completed\`, \`discover.partial\`, \`discover.paused\`, \`discover.failed\`, \`discover.progress\`, \`discover.accounts_ready\`, \`discover.new_rows\`, \`discover.new_accounts\`, \`discover.new_items\`), schedules (\`discover.run_skipped\`, \`discover.run_failed\`) and webhook endpoint health (\`endpoint.disabled\`). Pull it with the feed or have it pushed to a webhook endpoint. Use \`socialcrawl_manage\` \`area: "events"\`. Everything here costs **0 credits**, and no route here takes \`dry_run\`.
|
|
81
|
+
|
|
82
|
+
## Feed (\`GET /v1/events\`)
|
|
83
|
+
|
|
84
|
+
- **Your own cursor:** \`cursor\` = \`oldest\` (start of the 30-day retention), \`now\` (only new events), an event id (\`evt_…\`) or \`pagination.next_cursor\` exactly as returned. Save \`next_cursor\` after each page.
|
|
85
|
+
- **Named consumer:** \`id\` = a consumer name (a-z, 0-9, _ and -, up to 64). The server keeps its position; \`start\` (now | oldest) sets where a new consumer begins; its \`types\`/\`subject_ids\` filters bind at first use. A read commits nothing: process the page, then \`ack\` its \`pagination.next_cursor\` (\`POST /v1/events/consumers/{name}/ack\`, same \`id\`, \`input: { cursor }\`). Until you ack, the read returns the same page.
|
|
86
|
+
- Not both \`cursor\` and a consumer (a free 400).
|
|
87
|
+
- **Filters:** \`types\` (up to 50 types or patterns: \`discover.completed\`, \`discover.*\`, \`*\`) and \`subject_ids\` (up to 100 run_… or dsch_… ids). \`limit\` 1-500 (default 100).
|
|
88
|
+
- **Long-poll:** \`wait_s\` (0-25) holds an empty read until an event arrives. At most 5 long-polls per key; a sixth answers at once.
|
|
89
|
+
- **410 CURSOR_EXPIRED:** the position is older than the 30-day retention, so events were missed. Restart from \`oldest\` (a consumer restarts there on its next read and says \`restarted_from\` once) and tell the user which window was missed.
|
|
90
|
+
- \`data.next.poll_url\` is a free read: \`area: "discover"\` action \`follow\` can GET it.
|
|
91
|
+
|
|
92
|
+
## Webhook endpoints (\`/v1/webhook-endpoints\`)
|
|
93
|
+
|
|
94
|
+
At most **20 per API key**; an endpoint answers only to the key that created it. \`id\` is the endpoint id (\`we_…\`, \`data.endpoint.id\`).
|
|
95
|
+
|
|
96
|
+
| Action | Route |
|
|
97
|
+
|--------|-------|
|
|
98
|
+
| \`endpoint_create\` | \`POST /\` \`{ url, types?, description?, subject_ids? }\` (201) |
|
|
99
|
+
| \`endpoint_list\` | \`GET /\` (limit ≤100, cursor, status) |
|
|
100
|
+
| \`endpoint_get\` | \`GET /{id}\` |
|
|
101
|
+
| \`endpoint_update\` | \`PATCH /{id}\` (url, types, description, subject_ids, status enabled/disabled) |
|
|
102
|
+
| \`endpoint_delete\` | \`DELETE /{id}\` |
|
|
103
|
+
| \`endpoint_rotate_secret\` | \`POST /{id}/rotate-secret\` |
|
|
104
|
+
| \`endpoint_test\` | \`POST /{id}/test\` \`{ type? }\` |
|
|
105
|
+
| \`endpoint_attempts\` | \`GET /{id}/attempts\` (limit ≤100, cursor) |
|
|
106
|
+
|
|
107
|
+
- **The secret is shown ONCE.** \`endpoint_create\` and \`endpoint_rotate_secret\` return a \`whsec_\` secret in \`data.secret\`; store it immediately. Both send an Idempotency-Key (generated when you omit it, and echoed): a replay never creates a second endpoint and never shows the secret again. If it is lost, rotate with a NEW key.
|
|
108
|
+
- **Rotation:** for 24 hours every delivery is signed with both the old and the new secret, so deploy the new one before then.
|
|
109
|
+
- **URL rules:** a public HTTPS receiver. Private hosts and chat-app incoming webhooks are refused (400 invalid_webhook_url).
|
|
110
|
+
- **Types** default to \`["*"]\`. \`endpoint_test\` sends one signed sample of a subscribed type; the receiver has 15 s to answer 2xx. Answering 410 to a real delivery disables the endpoint.
|
|
111
|
+
- **Retries:** a failing delivery gets 8 attempts in all, backing off over roughly 41 hours; \`endpoint_attempts\` shows the log. Setting \`status: "enabled"\` on a disabled endpoint resumes its parked deliveries at once.
|
|
112
|
+
- **Links are full URLs.** An event's \`links\` (\`run\`, \`results\`, \`changes\`) start with the API's https origin; pass any of them to action \`follow\` (areas \`discover\`, \`search_runs\`, \`creator_runs\`).
|
|
103
113
|
`;
|
|
104
114
|
/**
|
|
105
115
|
* Universal search runs, lists and watches (UPGRADE-LOG API-073, API-077,
|
|
@@ -108,49 +118,49 @@ At most **20 per API key**; an endpoint answers only to the key that created it.
|
|
|
108
118
|
* meta-search/{list-http,list-start,list-actions,list-more,list-followups,
|
|
109
119
|
* list-watch,list-watch-routes,stored-runs}.ts and prism/creators/follow.ts.
|
|
110
120
|
*/
|
|
111
|
-
export const SEARCH_RUNS_DOC = `# SocialCrawl API — Universal search runs, lists, watches and creator runs
|
|
112
|
-
|
|
113
|
-
\`GET /v1/search/everywhere\` answers one search in the call (20 credits, flat). Everything that keeps working after the call — a list of searches, a scheduled watch, the next page, follow-up reads — is a **run**, read and steered with \`socialcrawl_manage\` area \`search_runs\`. Every read is free.
|
|
114
|
-
|
|
115
|
-
## Start one (socialcrawl_request, \`POST /v1/search/everywhere\`)
|
|
116
|
-
|
|
117
|
-
The JSON body takes every search field of the GET (\`query\` or \`keywords\`, \`context\`, \`platforms\`, \`exclude_platforms\`, \`period\`/\`since\`/\`until\`, \`languages\`, \`country\`, \`depth\`, \`label\`, …) plus exactly one of:
|
|
118
|
-
|
|
119
|
-
- **\`queries\`** — up to 100 search strings (≤512 chars each). One background run; each search is a job that reserves its own **20 credits**.
|
|
120
|
-
- **\`groups\`** — 1-100 \`{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}\`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in \`also_in_groups\`.
|
|
121
|
-
- **\`schedule\`** — \`{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}\` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows \`baseline: true\`).
|
|
122
|
-
|
|
123
|
-
**Price:** 20 credits per search plus any extras' ceilings (\`comments.*\`, \`authors.*\`). A list needs \`max_credits\` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at \`max_credits\`, the key budget or the balance with \`data.next.resume_url\` — nothing is paid twice. A watch needs \`max_credits_per_run\` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). \`dry_run: true\` answers the plan and estimate for free — on a watch, the price of a fire (\`credits_per_fire\`) and of 30 days (\`credits_per_30_days\`). The answer is **202** with \`data.run\` and \`data.next.status_url\` (a watch adds \`data.watch\`). \`Idempotency-Key\` replays the first answer; the same request sent again while its run is live returns that run (\`run.deduplicated\`).
|
|
124
|
-
|
|
125
|
-
## Runs (area \`search_runs\`)
|
|
126
|
-
|
|
127
|
-
Universal-search runs created since 14/11/2026 are kept 30 days by default (was 7); \`retention_days\` is 1 to 30.
|
|
128
|
-
|
|
129
|
-
| Action | Route | Cost |
|
|
130
|
-
|---|---|---|
|
|
131
|
-
| \`run_list\` | \`GET /v1/search/everywhere/runs\` — status, created_after, cursor, page_size 1-100; a watch id as \`id\` lists its fires | 0 |
|
|
132
|
-
| \`run_get\` | \`GET …/runs/{run_id}\` — \`wait_s\` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |
|
|
133
|
-
| \`run_export\` | \`GET …/runs/{run_id}/results.jsonl\` — the same filters, no paging; ends with \`{"complete":true,"changes_url":…}\` | 0 |
|
|
134
|
-
| \`run_legs\` | \`GET …/runs/{run_id}/legs\` — every search with its outcome and credits | 0 |
|
|
135
|
-
| \`run_cancel\` | \`DELETE …/runs/{run_id}\` — a list only (409 \`run_not_a_list\` on a one-off) | 0 |
|
|
136
|
-
| \`run_resume\` | \`POST …/runs/{run_id}/resume\` — \`max_credits\` (higher, if it paused at its cap), \`retry_failed\` | 0 + the searches it runs |
|
|
137
|
-
| \`run_more\` | \`POST …/runs/{run_id}/more\` — the next page of every search that has one; \`max_credits\` is the run's new total cap | **20 credits per search** with another page; \`nothing_more\` is free; dry_run quotes it |
|
|
138
|
-
| \`run_include\` | \`POST …/runs/{run_id}/include\` — \`include\` comments\\|authors\\|body, \`ids\` (1-200 rows), \`comments.per_post\` 5-50, \`comments.replies\`, \`authors.top\` 1-100, \`max_credits\` | metered per read, capped by max_credits (default: the quote); dry_run answers \`estimate.credits {min, expected, max}\` |
|
|
139
|
-
|
|
140
|
-
\`run_more\` and \`run_include\` take \`Idempotency-Key\` and \`dry_run\`. Read only what a step added with \`run_get\` + \`changes_since\`, or follow \`data.next.changes_url\` — the page that serves a run's last row names it.
|
|
141
|
-
|
|
142
|
-
## Watches (area \`search_runs\`)
|
|
143
|
-
|
|
144
|
-
\`watch_list\` (status active\\|paused\\|stopped), \`watch_get\` (with its 10 latest fires), \`watch_delete\` — all free on \`/v1/search/everywhere/watches\`. \`watch_pause\` / \`watch_resume\` (new \`max_credits_per_run\` / \`max_credits_per_month\`) use the discover schedule routes a watch is built on. A watch view carries \`caps\`, \`spend.month\`, \`next_fire_at\`, \`last_fire {run_id, new_rows, results_url}\`.
|
|
145
|
-
|
|
146
|
-
## Creator runs (area \`creator_runs\`)
|
|
147
|
-
|
|
148
|
-
\`prism/creators\` (GET or POST, socialcrawl_request) works toward \`limit\` until it has the creators, runs dry or reaches \`max_credits\`, and says which (\`stopped_because\`, \`short_reason\`). Its run is read like a search run on \`/v1/prism/creators/runs\` (\`run_list\`, \`run_get\` with country / account_kind / platform / sort / order filters, \`run_export\`, \`run_legs\`, \`run_cancel\`, \`run_resume\`, \`run_more\`) — reads free.
|
|
149
|
-
|
|
150
|
-
\`run_save\` (\`POST …/runs/{run_id}/save\`, \`keys\` optional, Idempotency-Key) stores the creators as author lists — **free**, kept 30 days, counted in the 500 live stored lists per account (see Stored lists in the \`discover-runs\` topic), 10,000 handles each — and answers \`data.next.follow\`: a ready \`POST prism/discover\` schedule body (daily, event \`discover.new_rows\`) that watches those creators for new posts. It costs what its runs cost, with no premium.
|
|
151
|
-
|
|
152
|
-
## follow
|
|
153
|
-
|
|
154
|
-
Any \`data.next.*\` read URL (status_url, results_url, legs_url, changes_url, a watch's links) goes to action \`follow\` — absolute or relative, on the configured API only. POST links are refused with the action to use: more_url → \`run_more\`, include_url → \`run_include\`, resume_url → \`run_resume\`, a creator save → \`run_save\`.
|
|
121
|
+
export const SEARCH_RUNS_DOC = `# SocialCrawl API — Universal search runs, lists, watches and creator runs
|
|
122
|
+
|
|
123
|
+
\`GET /v1/search/everywhere\` answers one search in the call (20 credits, flat). Everything that keeps working after the call — a list of searches, a scheduled watch, the next page, follow-up reads — is a **run**, read and steered with \`socialcrawl_manage\` area \`search_runs\`. Every read is free.
|
|
124
|
+
|
|
125
|
+
## Start one (socialcrawl_request, \`POST /v1/search/everywhere\`)
|
|
126
|
+
|
|
127
|
+
The JSON body takes every search field of the GET (\`query\` or \`keywords\`, \`context\`, \`platforms\`, \`exclude_platforms\`, \`period\`/\`since\`/\`until\`, \`languages\`, \`country\`, \`depth\`, \`label\`, …) plus exactly one of:
|
|
128
|
+
|
|
129
|
+
- **\`queries\`** — up to 100 search strings (≤512 chars each). One background run; each search is a job that reserves its own **20 credits**.
|
|
130
|
+
- **\`groups\`** — 1-100 \`{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}\`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in \`also_in_groups\`.
|
|
131
|
+
- **\`schedule\`** — \`{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}\` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows \`baseline: true\`).
|
|
132
|
+
|
|
133
|
+
**Price:** 20 credits per search plus any extras' ceilings (\`comments.*\`, \`authors.*\`). A list needs \`max_credits\` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at \`max_credits\`, the key budget or the balance with \`data.next.resume_url\` — nothing is paid twice. A watch needs \`max_credits_per_run\` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). \`dry_run: true\` answers the plan and estimate for free — on a watch, the price of a fire (\`credits_per_fire\`) and of 30 days (\`credits_per_30_days\`). The answer is **202** with \`data.run\` and \`data.next.status_url\` (a watch adds \`data.watch\`). \`Idempotency-Key\` replays the first answer; the same request sent again while its run is live returns that run (\`run.deduplicated\`).
|
|
134
|
+
|
|
135
|
+
## Runs (area \`search_runs\`)
|
|
136
|
+
|
|
137
|
+
Universal-search runs created since 14/11/2026 are kept 30 days by default (was 7); \`retention_days\` is 1 to 30.
|
|
138
|
+
|
|
139
|
+
| Action | Route | Cost |
|
|
140
|
+
|---|---|---|
|
|
141
|
+
| \`run_list\` | \`GET /v1/search/everywhere/runs\` — status, created_after, cursor, page_size 1-100; a watch id as \`id\` lists its fires | 0 |
|
|
142
|
+
| \`run_get\` | \`GET …/runs/{run_id}\` — \`wait_s\` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |
|
|
143
|
+
| \`run_export\` | \`GET …/runs/{run_id}/results.jsonl\` — the same filters, no paging; ends with \`{"complete":true,"changes_url":…}\` | 0 |
|
|
144
|
+
| \`run_legs\` | \`GET …/runs/{run_id}/legs\` — every search with its outcome and credits | 0 |
|
|
145
|
+
| \`run_cancel\` | \`DELETE …/runs/{run_id}\` — a list only (409 \`run_not_a_list\` on a one-off) | 0 |
|
|
146
|
+
| \`run_resume\` | \`POST …/runs/{run_id}/resume\` — \`max_credits\` (higher, if it paused at its cap), \`retry_failed\` | 0 + the searches it runs |
|
|
147
|
+
| \`run_more\` | \`POST …/runs/{run_id}/more\` — the next page of every search that has one; \`max_credits\` is the run's new total cap | **20 credits per search** with another page; \`nothing_more\` is free; dry_run quotes it |
|
|
148
|
+
| \`run_include\` | \`POST …/runs/{run_id}/include\` — \`include\` comments\\|authors\\|body, \`ids\` (1-200 rows), \`comments.per_post\` 5-50, \`comments.replies\`, \`authors.top\` 1-100, \`max_credits\` | metered per read, capped by max_credits (default: the quote); dry_run answers \`estimate.credits {min, expected, max}\` |
|
|
149
|
+
|
|
150
|
+
\`run_more\` and \`run_include\` take \`Idempotency-Key\` and \`dry_run\`. Read only what a step added with \`run_get\` + \`changes_since\`, or follow \`data.next.changes_url\` — the page that serves a run's last row names it.
|
|
151
|
+
|
|
152
|
+
## Watches (area \`search_runs\`)
|
|
153
|
+
|
|
154
|
+
\`watch_list\` (status active\\|paused\\|stopped), \`watch_get\` (with its 10 latest fires), \`watch_delete\` — all free on \`/v1/search/everywhere/watches\`. \`watch_pause\` / \`watch_resume\` (new \`max_credits_per_run\` / \`max_credits_per_month\`) use the discover schedule routes a watch is built on. A watch view carries \`caps\`, \`spend.month\`, \`next_fire_at\`, \`last_fire {run_id, new_rows, results_url}\`.
|
|
155
|
+
|
|
156
|
+
## Creator runs (area \`creator_runs\`)
|
|
157
|
+
|
|
158
|
+
\`prism/creators\` (GET or POST, socialcrawl_request) works toward \`limit\` until it has the creators, runs dry or reaches \`max_credits\`, and says which (\`stopped_because\`, \`short_reason\`). Its run is read like a search run on \`/v1/prism/creators/runs\` (\`run_list\`, \`run_get\` with country / account_kind / platform / sort / order filters, \`run_export\`, \`run_legs\`, \`run_cancel\`, \`run_resume\`, \`run_more\`) — reads free.
|
|
159
|
+
|
|
160
|
+
\`run_save\` (\`POST …/runs/{run_id}/save\`, \`keys\` optional, Idempotency-Key) stores the creators as author lists — **free**, kept 30 days, counted in the 500 live stored lists per account (see Stored lists in the \`discover-runs\` topic), 10,000 handles each — and answers \`data.next.follow\`: a ready \`POST prism/discover\` schedule body (daily, event \`discover.new_rows\`) that watches those creators for new posts. It costs what its runs cost, with no premium.
|
|
161
|
+
|
|
162
|
+
## follow
|
|
163
|
+
|
|
164
|
+
Any \`data.next.*\` read URL (status_url, results_url, legs_url, changes_url, a watch's links) goes to action \`follow\` — absolute or relative, on the configured API only. POST links are refused with the action to use: more_url → \`run_more\`, include_url → \`run_include\`, resume_url → \`run_resume\`, a creator save → \`run_save\`.
|
|
155
165
|
`;
|
|
156
166
|
//# sourceMappingURL=docs-async.js.map
|