跳转到主要内容
POST
https://api.aisa.one/apis/v1
/
tavily
/
map
使用 Tavily Map 生成全面的站点地图。
curl --request POST \
  --url https://api.aisa.one/apis/v1/tavily/map \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "docs.tavily.com",
  "instructions": "<string>",
  "max_depth": 1,
  "max_breadth": 20,
  "limit": 50,
  "select_paths": [
    "<string>"
  ],
  "select_domains": [
    "<string>"
  ],
  "exclude_paths": [
    "<string>"
  ],
  "exclude_domains": [
    "<string>"
  ],
  "allow_external": true,
  "timeout": 150,
  "include_usage": false
}
'
import requests

url = "https://api.aisa.one/apis/v1/tavily/map"

payload = {
"url": "docs.tavily.com",
"instructions": "<string>",
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"select_paths": ["<string>"],
"select_domains": ["<string>"],
"exclude_paths": ["<string>"],
"exclude_domains": ["<string>"],
"allow_external": True,
"timeout": 150,
"include_usage": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'docs.tavily.com',
instructions: '<string>',
max_depth: 1,
max_breadth: 20,
limit: 50,
select_paths: ['<string>'],
select_domains: ['<string>'],
exclude_paths: ['<string>'],
exclude_domains: ['<string>'],
allow_external: true,
timeout: 150,
include_usage: false
})
};

fetch('https://api.aisa.one/apis/v1/tavily/map', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/tavily/map",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'docs.tavily.com',
'instructions' => '<string>',
'max_depth' => 1,
'max_breadth' => 20,
'limit' => 50,
'select_paths' => [
'<string>'
],
'select_domains' => [
'<string>'
],
'exclude_paths' => [
'<string>'
],
'exclude_domains' => [
'<string>'
],
'allow_external' => true,
'timeout' => 150,
'include_usage' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.aisa.one/apis/v1/tavily/map"

payload := strings.NewReader("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"timeout\": 150,\n \"include_usage\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/tavily/map")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"timeout\": 150,\n \"include_usage\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.aisa.one/apis/v1/tavily/map")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"docs.tavily.com\",\n \"instructions\": \"<string>\",\n \"max_depth\": 1,\n \"max_breadth\": 20,\n \"limit\": 50,\n \"select_paths\": [\n \"<string>\"\n ],\n \"select_domains\": [\n \"<string>\"\n ],\n \"exclude_paths\": [\n \"<string>\"\n ],\n \"exclude_domains\": [\n \"<string>\"\n ],\n \"allow_external\": true,\n \"timeout\": 150,\n \"include_usage\": false\n}"

response = http.request(request)
puts response.read_body
{
  "base_url": "<string>",
  "results": [
    "<string>"
  ],
  "response_time": 123,
  "usage": {
    "credits": 123
  },
  "request_id": "<string>"
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
url
string
必填

开始映射的根 URL。

示例:

"docs.tavily.com"

instructions
string

用于爬虫的自然语言指令。

max_depth
integer
默认值:1

映射的最大深度。

必填范围: 1 <= x <= 5
max_breadth
integer
默认值:20

树中每一层可跟踪的最大链接数量。

必填范围: 1 <= x <= 500
limit
integer
默认值:50

爬虫停止前将处理的链接总数。

必填范围: x >= 1
select_paths
string[]

用于仅选择具有特定路径模式的 URL 的正则表达式模式。

select_domains
string[]

用于选择仅抓取特定域名或子域名的正则表达式模式。

exclude_paths
string[]

用于排除具有特定路径模式的 URL 的正则表达式模式。

exclude_domains
string[]

用于从映射中排除特定域名或子域名的正则表达式模式。

allow_external
boolean
默认值:true

在最终结果列表中包含外部域名链接。

timeout
number<float>
默认值:150

等待 map 操作完成的最长时间(秒)。

必填范围: 10 <= x <= 150
include_usage
boolean
默认值:false

在响应中包含信用额度用量信息。

响应

200 - application/json

已成功返回地图结果。

base_url
string

已映射的基础 URL。

results
string[]

映射期间发现的 URL。

response_time
number<float>

完成请求所用的时间(秒)。

usage
object
request_id
string

唯一请求标识符。