curl --request POST \
--url https://api.valyu.ai/v1/contents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://en.wikipedia.org/wiki/Quantum_computing"
]
}
'{
"success": true,
"error": null,
"tx_id": "tx_c1d2e3f4-a5b6-7890-cdef-123456789abc",
"urls_requested": 1,
"urls_processed": 1,
"urls_failed": 0,
"results": [
{
"url": "https://example.com/article",
"status": "success",
"title": "Illustrative article",
"content": "# Illustrative article\n\nPlaceholder text representing extracted page content.",
"description": "Placeholder article for demonstrating extraction.",
"source": "web",
"price": 0.00125,
"length": 77,
"data_type": "unstructured",
"source_type": "website",
"image_url": {}
}
],
"total_cost_dollars": 0.00125,
"total_characters": 77
}Contents
POST /v1/contents reference: extract clean text, summaries or structured JSON from up to 50 URLs, with sync and async modes, response fields and error codes.
curl --request POST \
--url https://api.valyu.ai/v1/contents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://en.wikipedia.org/wiki/Quantum_computing"
]
}
'{
"success": true,
"error": null,
"tx_id": "tx_c1d2e3f4-a5b6-7890-cdef-123456789abc",
"urls_requested": 1,
"urls_processed": 1,
"urls_failed": 0,
"results": [
{
"url": "https://example.com/article",
"status": "success",
"title": "Illustrative article",
"content": "# Illustrative article\n\nPlaceholder text representing extracted page content.",
"description": "Placeholder article for demonstrating extraction.",
"source": "web",
"price": 0.00125,
"length": 77,
"data_type": "unstructured",
"source_type": "website",
"image_url": {}
}
],
"total_cost_dollars": 0.00125,
"total_characters": 77
}Synchronous or asynchronous
Submit up to 10 URLs synchronously. Requests with more than 10 URLs must setasync: 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) hasstatus: "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.
Remove image links
Setinclude_image_links to false to replace each image with its alt text. For example,  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 insummary, 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 hasstatus: "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 hasfinal_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
Setmax_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 whensummary 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
API key for authentication. Get yours at platform.valyu.ai.
Body
Content extraction request parameters.
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
short, medium, large, max 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
Keep image URLs in the content. When true (default), images stay as markdown, for example . 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 [](href) becomes [[Image: alt]](href). Other links do not change. Set false to use fewer tokens.
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.
0 <= x <= 25920003600
Response
All URLs processed successfully (synchronous).
Synchronous content extraction response.
Was this page helpful?