搜索

提取网页内容

从一个或多个 URL 提取正文内容,供大模型使用。

POST /search/v1/extract● 支持

Tavily 官方文档 ↗

请求体

  • querystring可选

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

  • urlsstring | array必填

    URL to extract, or an array of up to 20 URLs. Per-URL failures are listed in `failed_results` of the response, which can come with HTTP 200.

  • chunks_per_sourceinteger可选
    默认 3

    Chunks are short content snippets (maximum 500 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>`. Available only when `query` is provided. Must be between 1 and 5.

  • extract_depthstring可选
    默认 "basic"

    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.

    取值 basicadvanced
  • include_imagesboolean可选
    默认 false

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

  • include_faviconboolean可选
    默认 false

    Whether to include the favicon URL for each result.

  • formatstring可选
    默认 "markdown"

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

    取值 markdowntext
  • timeoutnumber可选
    默认 "None"

    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可选
    默认 false

    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](https://docs.tavily.com/documentation/api-credits) for details.

返回

200

错误按 Tavily 格式返回,参见 错误码

响应

HTTP 200

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.

application/json

名称类型说明
resultsarray<object>A list of extracted content from the provided URLs.
results[].urlstringThe URL from which the content was extracted.
results[].raw_contentstringThe full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator.
results[].imagesarray<string>This is only available if `include_images` is set to `true`. A list of image URLs extracted from the page.
results[].faviconstringThe favicon URL for the result.
failed_resultsarray<object>A list of URLs that could not be processed.
failed_results[].urlstringThe URL that failed to be processed.
failed_results[].errorstringAn error message describing why the URL couldn't be processed.
response_timenumberTime in seconds it took to complete the request.
usageobjectCredit usage details for the request.
request_idstringA unique request identifier you can share with customer support to help resolve issues with specific requests.