站点 URL 发现
从站点地图和链接中找出一个站点的 URL。
本参考页为英文。字段名、示例和错误码在所有语言版本中都一样。
Lists the URLs of one site from its sitemaps and a light pass over its links, without reading page content. The call is synchronous with a deadline of 60 seconds. With search, URLs are ordered by relevance to that text.
What is charged
Charged when at least one URL is found, per started block of 5,000 URLs. A site where nothing is found is free.
Units: map_call. usage.items in the response lists them.
Request
POST https://api.websearch.fast/v1/web/mapPlanned. Until it ships, calls return 501 api_not_implemented.
Body
| Name | Type | Description |
|---|---|---|
urlrequired | string | Public http(s) URL, at most 2048 bytes. At most 2048 characters. |
limit | integer | 1 to 30,000. Default 1000. |
search | string | At most 256 characters. |
include_paths | array of string | At most 50 items. |
exclude_paths | array of string | At most 50 items. |
include_subdomains | boolean | Default false. |
ignore_query | boolean | Default true. |
sitemap_only | boolean | Default false. |
Example request
curl https://api.websearch.fast/v1/web/map \
-H "Authorization: Bearer $WEBSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://docs.example.org/",
"limit": 500,
"include_paths": ["/guide/**"]
}'import os
import httpx
response = httpx.post(
"https://api.websearch.fast/v1/web/map",
headers={"Authorization": f"Bearer {os.environ['WEBSEARCH_API_KEY']}"},
json={
"url": "https://docs.example.org/",
"limit": 500,
"include_paths": ["/guide/**"],
},
timeout=60,
)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.websearch.fast/v1/web/map", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.WEBSEARCH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://docs.example.org/",
limit: 500,
include_paths: ["/guide/**"],
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Response fields
URLs.
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
objectrequired | string | Always web.map. | ||||||||||||||||||
request_idrequired | string | Same as the X-Request-Id header. | ||||||||||||||||||
createdrequired | integer | Unix seconds (UTC). | ||||||||||||||||||
inputrequired | object | The parameters as applied, defaults filled in. | ||||||||||||||||||
usagerequired | object | Show fields
| ||||||||||||||||||
cache | object | Show fields
| ||||||||||||||||||
warnings | array of object | Show fields
| ||||||||||||||||||
urlsrequired | array of object | Show fields
| ||||||||||||||||||
countrequired | integer | |||||||||||||||||||
truncatedrequired | boolean |
Errors
| Status | Codes |
|---|---|
400 | invalid_request, invalid_url, invalid_schema or invalid_image. Not charged. |
401 | invalid_token. Not charged. |
403 | pre_consume_token_quota_failed (the key's own spending limit), access_denied, web_not_allowed or model_not_in_plan (customer keys while plans cannot include the web tools). Not charged. |
404 | not_found or invalid_endpoint. Not charged. |
413 | read_request_body_failed: the request body is over the limit. Not charged. |
422 | fetch_failed, site_refused, page_too_large or extraction_failed. Not charged. |
429 | rate_limited, concurrency_limited, api_key_temporarily_frozen, or the failure guard. Not charged. |
500 | internal_error. Not charged. |
501 | api_not_implemented: the endpoint, type or option has not shipped. Not charged. |
503 | source_unavailable, web_api_disabled, token_cache_busy or billing_busy (the charge could not be prepared in time; retry after Retry-After). Not charged. |
504 | timeout. Not charged. |