Wire up Valyu Contents extraction with the TypeScript SDK.
Basic usage
Common patterns
extractEffort: "high" for JS-heavy pages or complex layouts, and responseLength ("short" 25k, "medium" 50k, "large" 100k, "max", or a number) to control content per URL.
For arXiv, PubMed Central, bioRxiv, medRxiv, and ChemRxiv papers, Valyu serves clean processed markdown (with figures and equations) from its academic index when your plan covers the source - otherwise it uses the live crawler. Pass the paper URL (a
/pdf/ arXiv link or a DOI works best) or bare id. See Academic Papers.Reference
Parameters
Parameters
urls (string[], required) - URLs to process (max 10 sync, max 50 async).| Parameter | Type | Description | Default |
|---|---|---|---|
summary | boolean | string | object | false (none), true (auto), a string instruction, or a JSON schema for structured extraction | false |
extractEffort | "normal" | "high" | "auto" | Extraction effort. Use "high" for JS-heavy pages | ”auto” |
responseLength | string | number | "short" (25k), "medium" (50k), "large" (100k), "max", or a custom character count | ”short” |
screenshot | boolean | Request page screenshots. When true, results include screenshot_url | false |
Response format
Response format
Async jobs (11-50 URLs)
Async mode is required above 10 URLs. Max 50 URLs per request, processed in batches of 5 with a 120s timeout per URL (vs 25s sync). Jobs expire after 7 days.Manual polling and webhook verification
Manual polling and webhook verification
For full control, poll See the Content Extraction guide for details.
valyu.getContentsJob(job.job_id) yourself until status is completed, partial, or failed.The SDK exports verifyContentsWebhookSignature():Async parameters and response types
Async parameters and response types
| Parameter | Type | Description | Default |
|---|---|---|---|
asyncMode | boolean | Process URLs asynchronously. Required above 10 URLs | false |
webhookUrl | string | HTTPS URL to receive results via webhook POST | - |
waitForJob() options: pollInterval (ms, default 5000), maxWaitTime (ms, default 7200000), onProgress (callback).
