AI 搜索数据 API 快速开始
创建 API 密钥,提交问题,并通过轮询或 Webhook 获取 AI 回答。
提交任务
curl -X POST https://api.querying.ai/v1/async/task \
-H "Authorization: Bearer vt_live_…" \
-H "Content-Type: application/json" \
-d '{
"taskType": "GEMINI",
"payload": { "prompt": "best wireless earbuds 2026" },
"webhook": { "url": "https://yours.app/hooks/querying" }
}'Webhook 接收
{
"task": {
"id": "8f2c1e40-…",
"taskType": "GEMINI",
"status": "COMPLETED",
"createdAt": "2026-07-17T04:12:00.000Z"
},
"credits": { "creditsToCharge": 1.25, "creditsCharged": 1.25 },
"response": {
"text": "The best wireless earbuds in 2026 are …",
"sources": [
{ "position": 1,
"url": "https://example.com/review",
"label": "Best earbuds, reviewed" }
],
"timing": { "totalMs": 7400 }
}
}1. 准备 API 密钥
创建免费账号,在仪表盘生成密钥。将其保存在服务器环境变量 QUERYING_API_KEY 中,仅从服务器调用。新账号可在添加支付方式前使用 500 积分。
2. 提交问题
以下命令用 CN 国家设置向 Gemini 提交问题。问题按你编写的语言原样发送,使用受理响应中的 task.id 进行下一步查询。
curl -X POST https://api.querying.ai/v1/async/task \
-H "Authorization: Bearer $QUERYING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskType": "GEMINI",
"payload": {
"prompt": "通勤无线耳机推荐",
"country": "CN"
}
}'3. 获取完成结果
将 TASK_ID 替换为受理时返回的 ID。QUEUED 或 PROCESSING 时隔一段时间再查询,COMPLETED 时读取 response,FAILED 时处理错误。请在完成后 24 小时内获取并保存需要的结果。
curl https://api.querying.ai/v1/async/task/TASK_ID \
-H "Authorization: Bearer $QUERYING_API_KEY"4. 通过 Webhook 接收结果
在提交的 JSON 中添加 webhook.url,准备 HTTPS 接收服务,并按文档验证签名。最多投递 5 次,包括首次请求和 4 次退避重试。通过 task.id 去重,保证重发结果只处理一次。
{
"taskType": "GEMINI",
"payload": {
"prompt": "通勤无线耳机推荐",
"country": "CN"
},
"webhook": {
"url": "https://your-server.example.com/querying-webhook"
}
}5. 扩展到其他引擎和定期测量
先核对各引擎的 taskType、prompt 或 query、支持国家及响应结构。遇到余额不足或并发限制时,解决原因后重试。持续跟踪品牌曝光时,在 Monitors 中保存固定问题集。




