task_id。任务完成后,您可以使用该 task_id 获取请求结果。
排队单个任务
单个查询或 URL 端点: https://data.decodo.com/v1/task
使用您需要的参数向此端点发送 POST 请求,即可获得用于在任务完成后获取结果的 task_id,以及本次请求所用的参数。
# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'POST' \
--url 'https://data.decodo.com/v1/task' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://ip.decodo.com"
}
'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task", {
method: "POST",
body: JSON.stringify({
"url": "https://ip.decodo.com"
}),
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
url = "https://data.decodo.com/v1/task"
payload = {
"url": "https://ip.decodo.com"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
响应示例:
{
"url": "https://ip.decodo.com",
"page_from": 1,
"limit": 10,
"geo": null,
"device_type": "desktop",
"headless": null,
"parse": false,
"locale": null,
"domain": "com",
"output_schema": null,
"created_at": "2026-03-04 11:51:04",
"id": "7434928397127555073",
"status": "pending",
"content_encoding": "utf-8",
"updated_at": "2026-03-04 11:51:04",
"page_count": 1,
"http_method": "get",
"cookies": [],
"force_headers": false,
"force_cookies": false,
"headers": [],
"session_id": null,
"successful_status_codes": [],
"follow_redirect": null,
"payload": null,
"store_id": null,
"headers_cookies_policy": false
}
使用 task_id 获取结果
单个查询或 URL 端点: https://data.decodo.com/v1/task/{task_id}/results
向此端点发送 GET 请求,并将 {task_id} 替换为上一个 POST 请求返回的 ID,即可获取结果。
在初始请求后的 24 小时内,结果可无限次获取。
# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'GET' \
--url 'https://data.decodo.com/v1/task/{task_id}/results' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task/{task_id}/results", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
task_id = "TASK_ID"
url = f"https://data.decodo.com/v1/task/{task_id}/results"
headers = {
"accept": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.get(url, headers=headers)
使用 task_id 查询任务状态
您可以手动查询异步任务的状态:# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'GET' \
--url 'https://data.decodo.com/v1/task/{task_id}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task/{task_id}", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
task_id = "TASK_ID"
url = f"https://data.decodo.com/v1/task/{task_id}"
headers = {
"accept": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.get(url, headers=headers)
pending:
{
"status": "pending",
"id": "7447868801825135617",
"created_at": "2026-04-09 04:51:37",
"updated_at": "2026-04-09 04:51:37",
"target": "google_ai_mode",
"query": "best health trackers under $200",
"page_from": 1,
"limit": 10,
"device_type": "desktop",
"headless": "html",
"parse": true,
"domain": "com",
"page_count": 1,
"force_headers": false,
"force_cookies": false,
"headers_cookies_policy": false
}
done:
{
"status": "done",
"id": "7447866391652228097",
"created_at": "2026-04-09 04:42:02",
"updated_at": "2026-04-09 04:42:16",
"target": "google_ai_mode",
"query": "best health trackers under $200",
"page_from": 1,
"limit": 10,
"device_type": "desktop",
"headless": "html",
"parse": true,
"domain": "com",
"page_count": 1,
"force_headers": false,
"force_cookies": false,
"headers_cookies_policy": false
}
faulted。
排队多个任务
批量查询或 URL 端点: https://data.decodo.com/v1/task/batch
向此端点发送 POST 请求,并以 JSON 格式提供多个查询或 URL。
批量请求的频率限制为每秒 1 次。
单个批量请求中只能提交多个查询或多个 URL,不能同时提交两者。此外,一个批量请求只能包含一个
target,例如下方第二个示例中的 google_search。可提交的 URL/查询数量取决于您订阅套餐的速率限制。# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'POST' \
--url 'https://data.decodo.com/v1/task/batch' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE' \
--header 'Content-Type: application/json' \
--data '
{
"url": [
"https://ip.decodo.com",
"https://ip.decodo.com",
"https://ip.decodo.com"
]
}
'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task/batch", {
method: "POST",
body: JSON.stringify({
"url": ["https://ip.decodo.com", "https://ip.decodo.com", "https://ip.decodo.com"]
}),
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
url = "https://data.decodo.com/v1/task/batch"
payload = {
"url": [
"https://ip.decodo.com",
"https://ip.decodo.com",
"https://ip.decodo.com"
]
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
query 中,并指定一个 target:
# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'POST' \
--url 'https://data.decodo.com/v1/task/batch' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE' \
--header 'Content-Type: application/json' \
--data '
{
"target": "google_search",
"query": [
"pizza",
"coffee"
],
"parse": true
}
'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task/batch", {
method: "POST",
body: JSON.stringify({
"target": "google_search",
"query": ["pizza", "coffee"],
"parse": true
}),
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
url = "https://data.decodo.com/v1/task/batch"
payload = {
"target": "google_search",
"query": ["pizza", "coffee"],
"parse": True
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
通过 callback_url 接收任务状态
在任意异步端点中添加 callback_url 参数即可使用此功能
任务完成后,我们会向您的 URL 发送一个 POST 请求,其中包含 task_id、status_code 和时间戳。回调中不包含结果本身,请使用 task_id 获取结果。您可以使用此类网站测试接收响应。
使用单个任务端点的示例:
# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'POST' \
--url 'https://data.decodo.com/v1/task' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://ip.decodo.com",
"callback_url": "https://your.url"
}
'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
body: JSON.stringify({
url: "https://ip.decodo.com",
callback_url: "https://your.url"
})
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
url = "https://data.decodo.com/v1/task"
payload = {
"url": "https://ip.decodo.com",
"callback_url": "https://your.url"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
您将收到的响应示例:
{
"task_id": "7515697022976960513",
"status_code": 200,
"created_at": "2026-10-13 08:56:45",
"updated_at": "2026-10-13 08:56:45"
}
task_id 获取任务结果:
https://data.decodo.com/v1/task/{task_id}/results
GET 请求:
https://data.decodo.com/v1/task/7515697022976960513/results
验证回调
如需验证回调请求确实来自网页数据 API,请在passthrough 参数中添加备注。passthrough 参数及其内容会包含在发送回您端点的数据中。
# 将 'TOKEN VALUE' 替换为您的 API 密钥
curl --request 'POST' \
--url 'https://data.decodo.com/v1/task' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer TOKEN VALUE' \
--header 'Content-Type: application/json' \
--data '
{
"target": "amazon_pricing",
"query": "B0BS1QCFHX",
"parse": true,
"callback_url": "https://your.callback.url",
"passthrough": "your_note"
}
'
const scrape = async() => {
const response = await fetch("https://data.decodo.com/v1/task", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer TOKEN VALUE" // 替换为您的 API 密钥
},
body: JSON.stringify({
target: "amazon_pricing",
query: "B0BS1QCFHX",
parse: true,
callback_url: "https://your.callback.url",
passthrough: "your_note"
})
}).catch(error => console.log(error));
console.log(await response.json())
}
scrape()
import requests
url = "https://data.decodo.com/v1/task"
payload = {
"target": "amazon_pricing",
"query": "B0BS1QCFHX",
"parse": True,
"callback_url": "https://your.callback.url",
"passthrough": "your_note"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": "Bearer TOKEN VALUE" # 替换为您的 API 密钥
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
{
"task_id": "7515716817046773761",
"status_code": 200,
"created_at": "2026-10-13 10:15:24",
"updated_at": "2026-10-13 10:15:24",
"passthrough": "your_note"
}
支持
需要帮助或只是想打个招呼?我们的支持团队全天候为您服务。
您也可以随时通过电子邮件 support@decodo.com 联系我们。
您也可以随时通过电子邮件 support@decodo.com 联系我们。
反馈
找不到您要找的内容?请求一篇文章!
有反馈意见?分享您对我们如何改进的想法。
有反馈意见?分享您对我们如何改进的想法。