Skip to main content
POST
Extract content from URLs you already have. Use Contents after Search, or with links selected by a user, to prepare material for your own application.

Synchronous or asynchronous

Submit up to 10 URLs synchronously. Requests with more than 10 URLs must set async: true (up to 50 URLs); save the returned job_id. Retrieve the result using Contents job status. extract_effort="auto" selects an extraction method. Use "high" when a page requires JavaScript rendering. Extraction can still fail because content is inaccessible or unsupported.

Check each result

A multi-URL request can partially succeed. A not-found page (a 404 with no real content) has status: "not_found" and error: "Page not found (404)". It is not charged. See pages that answer 404. Inspect individual results instead of treating an HTTP success as proof that every page was extracted. The synchronous endpoint uses 206 for partial success and 422 when all URLs fail. Use summary for a summary, guided extraction or a JSON schema. Preserve the original URL alongside extracted fields so your application can show their source. See Contents guide for a complete implementation. Set include_image_links to false to replace each image with its alt text. For example, ![Product photo](https://example.com/p.jpg) becomes [Image: Product photo]. The API removes an image with no alt text. Other links do not change. The default is true. See remove image links.

AI result checks

For a JSON schema in summary, Valyu checks each reply against the schema and asks once for a corrected reply if it does not match. A reply that still does not match is returned as extracted. The AI step has a time limit for each page. If Valyu cannot return usable AI output in time, the result has summary_success: false and keeps the page content. Read summary_success before you use summary.

Pages that answer 404

Some sites answer 404 but still send the real page. When the 404 body has the real content (at least 400 characters, with no not-found or sign-in wording), Contents returns the page as a success. The result has status: "success" and http_status: 404, and it is charged like any other success. A not-found template page still returns status: "not_found" and is not charged. This applies to Contents, sync and async. Search is not changed.

Pages that redirect

When a URL redirects to a different page, the result has final_url, the page that Contents read. For example, a closed job posting can redirect to the careers page, and the content is then the careers page. Compare final_url with url before you use the content. final_url is not set when there was no redirect. A change of scheme, host case, www., trailing slash or #fragment is not a different page.

Control caching

Set max_age to the oldest cached copy of a page, in seconds, that you accept. 0 forces a live crawl. Use an integer from 0 to 2592000 (30 days). Without max_age, Contents can return a copy up to 7 days old, and it refreshes a copy older than 30 minutes in the background. With max_age, Contents starts no background refresh. Do not use max_age with historical_cache. It also works with async: true. Billing does not change. Each successful result has cache_state (hit, miss or stale) and crawled_at (ISO 8601 time that the page copy was captured, or null). See control caching.

Cost

Each successfully extracted URL uses 0.2 credits, or 0.6 in total when summary is set (text summary or structured extraction; the same price for sync and async requests). If the AI step fails for a URL, you pay only the 0.2 credits for extraction. Failed URLs are free. A result’s price is the base extraction price only; total_cost_dollars is the amount charged, including any AI processing. Set max_price_dollars to cap a request: it returns 400 if the worst case exceeds the cap before processing, and 402 if the actual cost does. For point-in-time extraction, pass start_date, end_date and historical_cache: true. Contents then serves only snapshots captured inside the window, and a URL without one fails instead of falling back to a live crawl.

Authorizations

X-API-Key
string
header
required

API key for authentication. Get yours at platform.valyu.ai.

Body

application/json

Content extraction request parameters.

urls
string<uri>[]
required

URLs to extract content from. Must be valid HTTP/HTTPS URLs. Duplicates are silently removed.

Required array length: 1 - 50 elements
Example:
response_length
default:short

Maximum character length of extracted content per URL.

  • "short" - 25,000 characters (default)
  • "medium" - 50,000 characters
  • "large" - 100,000 characters
  • "max" - No limit
  • Any positive integer for a custom character limit
Available options:
short,
medium,
large,
max
max_price_dollars
number

Maximum budget for this request. Defaults to 2x the maximum possible cost.

  • If the worst-case cost exceeds this value, the request is rejected before processing with 400.
  • If the actual cost after processing exceeds it, the request returns 402.
Required range: x > 0
Example:

0.05

summary
default:false

Controls AI-powered content processing. Brings the price to 0.6 credits per successfully extracted URL in total (0.2 base plus 0.4 for AI processing) when enabled. A text summary and structured extraction cost the same. If the AI step fails for a URL, only the 0.2 credit base is charged.

  • false - No AI processing, raw extracted content only (default)
  • true - Generate a text summary of each page
  • "string" - Generate a summary guided by custom instructions (max 500 characters)
  • {json_schema} - Extract structured data matching the provided JSON schema
extract_effort
enum<string>
default:auto

Controls how pages are rendered for extraction.

  • "auto" - Automatically selects the best method per URL (default)
  • "normal" - HTTP-only extraction, fastest
  • "high" - Full Chrome rendering, best for JavaScript-heavy pages
Available options:
auto,
normal,
high
start_date
string

Start of the date window for point-in-time extraction. Accepts YYYY, YYYY-MM-DD or an ISO-8601 datetime. Use with historical_cache.

Example:

"2024-01-01"

end_date
string

End of the date window (the cutoff) for point-in-time extraction. Accepts YYYY, YYYY-MM-DD or an ISO-8601 datetime. A year alone means the last day of that year. start_date must be on or before end_date.

Example:

"2024-12-31"

historical_cache
boolean
default:false

Serve a snapshot captured inside the date window instead of a live crawl. On Contents this always applies historical_cache_strict: "only": a URL with no qualifying snapshot fails rather than falling back to a live crawl.

historical_cache_strict
enum<string>

Snapshot policy. Accepted for parity with Search, but on Contents any request with historical_cache: true uses only, whatever value is passed.

Available options:
off,
prefer,
only
screenshot
boolean
default:false

Capture a screenshot of each page. The screenshot URL is returned in each result's screenshot_url field.

Keep image URLs in the content. When true (default), images stay as markdown, for example ![Product photo](https://example.com/p.jpg). When false, each image becomes [Image: Product photo]. The API removes the image URL and keeps the alt text. The API removes an image with no alt text. A linked image [![alt](src)](href) becomes [[Image: alt]](href). Other links do not change. Set false to use fewer tokens.

max_age
integer

The oldest cached copy of a page, in seconds, that you accept. 0 forces a live crawl. Omit it for the default cache policy: a copy up to 7 days old, with a background refresh when it is older than 5 minutes. A value from 1 to 2592000 (30 days) accepts a copy at most that old and starts no background refresh. Cannot be used with historical_cache. Works with async too. Billing does not change.

Required range: 0 <= x <= 2592000
Example:

3600

async
boolean
default:false

Process URLs asynchronously in the background. Returns a job_id to poll via GET /v1/contents/jobs/{job_id}. Required when submitting more than 10 URLs (maximum 50). Also useful for slow, JavaScript-heavy pages.

webhook_url
string<uri>

HTTPS URL to receive a webhook POST when async processing completes. Only used when async is true. The webhook payload is signed with HMAC-SHA256.

Example:

"https://example.com/webhooks/valyu"

Response

All URLs processed successfully (synchronous).

Synchronous content extraction response.

success
boolean
required

Whether the extraction completed successfully.

Example:

true

tx_id
string
required

Transaction ID for tracking.

Example:

"tx_a1b2c3d4-e5f6-7890-abcd-ef1234567890"

urls_requested
integer
required

Number of deduplicated URLs submitted.

Example:

3

urls_processed
integer
required

Number of URLs successfully processed.

Example:

3

urls_failed
integer
required

Number of URLs that failed processing.

Example:

0

results
object[]
required

Extraction results for each URL.

total_cost_dollars
number
required

Total amount charged, including AI processing (0.4 credits on top of the 0.2 credit base, 0.6 credits in total per URL). Only successfully extracted URLs are charged.

Example:

0.00375

total_characters
integer
required

Sum of all result content lengths.

Example:

45230

error
string | null

Error message if some URLs failed. null on complete success.

Example:

null