Tavily

站内爬取

从一个起始 URL 出发,按图遍历站内页面并抽取内容。

POST /tavily/crawl● 支持

Tavily 官方文档 ↗

请求体

  • urlstring必填

    The root URL to begin the crawl.

  • limitinteger可选
    默认 50

    Total number of links the crawler will process before stopping.

  • instructionsstring可选

    Natural language instructions for the crawler. When specified, the mapping cost increases to 2 API credits per 10 successful pages instead of 1 API credit per 10 pages.

  • 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 `instructions` are provided. Must be between 1 and 5.

  • max_depthinteger可选
    默认 1

    Max depth of the crawl. Defines how far from the base URL the crawler can explore.

  • max_breadthinteger可选
    默认 20

    Max number of links to follow per level of the tree (i.e., per page).

  • select_pathsarray可选
    默认 null

    Regex patterns to select only URLs with specific path patterns (e.g., `/docs/.*`, `/api/v1.*`).

  • select_domainsarray可选
    默认 null

    Regex patterns to select crawling to specific domains or subdomains (e.g., `^docs\.example\.com$`).

  • exclude_pathsarray可选
    默认 null

    Regex patterns to exclude URLs with specific path patterns (e.g., `/private/.*`, `/admin/.*`).

  • exclude_domainsarray可选
    默认 null

    Regex patterns to exclude specific domains or subdomains from crawling (e.g., `^private\.example\.com$`).

  • ▸ 更多参数(7)
    • allow_externalboolean可选
      默认 true

      Whether to include external domain links in the final results list.

    • include_imagesboolean可选
      默认 false

      Whether to include images in the crawl results.

    • extract_depthstring可选
      默认 "basic"

      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 extractions, while `advanced` extraction costs 2 credits per 5 successful extractions.

      取值 basicadvanced
    • 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
    • include_faviconboolean可选
      默认 false

      Whether to include the favicon URL for each result.

    • timeoutnumber可选
      默认 150

      Maximum time in seconds to wait for the crawl operation before timing out. Must be between 10 and 150 seconds.

    • include_usageboolean可选
      默认 false

      Whether to include credit usage information in the response. `NOTE:`The value may be 0 if the total use of /extract and /map have not yet reached minimum requirements. See our [Credits & Pricing documentation](https://docs.tavily.com/documentation/api-credits) for details.

返回

200

调用前要求账户余额大于 0;按 Tavily 返回的 usage.credits 计费,每 credit $0.01;Tavily 未返回用量时,按本次请求可能消耗的上限计费。

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

响应

HTTP 200

Crawl results returned successfully

application/json

名称类型说明
base_urlstringThe base URL that was crawled.
resultsarray<object>A list of extracted content from the crawled URLs.
results[].urlstringThe URL that was crawled.
results[].raw_contentstringThe full content extracted from the page. When `query` is provided, contains the top-ranked chunks joined by `[...]` separator.
results[].faviconstringThe favicon URL for the result.
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.