Retrieve raw web content from specified URLs

Changed on

Extract content from one URL or batch up to 20 URLs in one request. Successful URLs appear in results; per-URL failures appear in failed_results. Check both arrays even when the response is HTTP 200. Request options apply to every URL in the batch.

post/extract

Request

  • Base URL
    https://api.tavily.com
  • URL
    https://api.tavily.com/extract
  • Auth
    HTTP bearer

Request body

querystring

User intent for reranking extracted content chunks. When provided, chunks are reranked based on relevance to this query.

chunks_per_sourceinteger

Chunks are short content snippets (about 800 characters each) pulled directly from the source. Use chunks_per_source to define the maximum number of relevant chunks returned per source and to control the raw_content length. Chunks will appear in the raw_content field as: <chunk 1> [...] <chunk 2> [...] <chunk 3>. If a page splits into no more chunks than chunks_per_source, its full content is returned. Available only when query is provided. Must be between 1 and 5.

extract_depth'basic' | 'advanced'

The depth of the extraction process. advanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latency.basic extraction costs 1 credit per 5 successful URL extractions, while advanced extraction costs 2 credits per 5 successful URL extractions.

include_imagesboolean

Include a list of images extracted from the URLs in the response. Default is false.

include_faviconboolean

Whether to include the favicon URL for each result.

format'markdown' | 'text'

The format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency.

timeoutnumber float

Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction.

include_usageboolean

Whether to include credit usage information in the response. NOTE:The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our Credits & Pricing documentation for details.

Example request

{
  "urls": "https://en.wikipedia.org/wiki/Artificial_intelligence"
}

Response

Extraction completed. Check results and failed_results for each URL. HTTP 200 can have an empty results array when all valid URLs fail during extraction; output order is not guaranteed.

response_timenumber float

Time in seconds it took to complete the request.

usageobject

Credit usage details for the request.

request_idstring

A unique request identifier you can share with customer support to help resolve issues with specific requests.

Example response

{
  "results": [
    {
      "url": "https://en.wikipedia.org/wiki/Artificial_intelligence",
      "raw_content": "\"Jump to content\\nMain menu\\nSearch\\nAppearance\\nDonate\\nCreate account\\nLog in\\nPersonal tools\\n        Photograph your local culture, help Wikipedia and win!\\nToggle the table of contents\\nArtificial intelligence\\n161 languages\\nArticle\\nTalk\\nRead\\nView source\\nView history\\nTools\\nFrom Wikipedia, the free encyclopedia\\n\\\"AI\\\" redirects here. For other uses, see AI (disambiguation) and Artificial intelligence (disambiguation).\\nPart of a series on\\nArtificial intelligence (AI)\\nshow\\nMajor goals\\nshow\\nApproaches\\nshow\\nApplications\\nshow\\nPhilosophy\\nshow\\nHistory\\nshow\\nGlossary\\nvte\\nArtificial intelligence (AI), in its broadest sense, is intelligence exhibited by machines, particularly computer systems. It is a field of research in computer science that develops and studies methods and software that enable machines to perceive their environment and use learning and intelligence to take actions that maximize their chances of achieving defined goals.[1] Such machines may be called AIs.\\nHigh-profile applications of AI include advanced web search engines (e.g., Google Search); recommendation systems (used by YouTube, Amazon, and Netflix); virtual assistants (e.g., Google Assistant, Siri, and Alexa); autonomous vehicles (e.g., Waymo); generative and creative tools (e.g., ChatGPT and AI art); and superhuman play and analysis in strategy games (e.g., chess and Go)...................",
      "images": [],
      "favicon": "https://en.wikipedia.org/static/favicon/wikipedia.ico"
    }
  ],
  "failed_results": [],
  "response_time": 0.02,
  "usage": {
    "credits": 1
  },
  "request_id": "123e4567-e89b-12d3-a456-426614174111"
}

Changes

    • breaking

      the / request property's minItems was increased to 1

    • breaking

      the response's body type changed from object to no type for status

    • warning

      removed the optional property from the response with the status

    • info

      api operation id extract was added

    • info

      added subschema #2 to the response body allOf list for the response status