qstringbắt buộc
max 500 chars
https://api.sandbase.ai/v1/api/duckduckgo/searchDuckDuckGo organic search results for a keyword, with region and safe-search options.
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
This API returns DuckDuckGo organic search results for a keyword. Each result has a title, link, snippet and position, and the response also lists related searches. It needs a query in q and accepts an optional region code in kl.
us-en.sitelinks to see which sub-pages DuckDuckGo shows under a main result.related_searches to find follow-up queries for keyword research.curl -X POST "https://api.sandbase.ai/v1/api/duckduckgo/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"q": "apple", "kl": "us-en"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Yes | max 500 chars |
kl | string | No | region code, e.g. us-en |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"organic_results": [
{
"favicon": "https://external-content.duckduckgo.com/ip3/www.apple.com.ico",
"link": "https://www.apple.com/",
"position": 1,
"sitelinks": [
{
"link": "https://www.apple.com/shop/buy-iphone/iphone-18-pro",
"snippet": "Get $35-$885 off a new iPhone 18 Pro or iPhone 18 Pro Max when you trade in an i…",
"title": "Shop Iphone 18 Pro"
}
],
"snippet": "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple W…",
"title": "Apple"
}
],
"related_searches": [
{
"link": "https://duckduckgo.com/?q=apple%20music%20login&origin=related",
"query": "apple music login"
}
],
"search_information": {
"organic_results_state": "Results for exact spelling"
}
}
| Field | Meaning |
|---|---|
organic_results[].title | Title of the search result. |
organic_results[].link | URL of the result page. |
organic_results[].snippet | Short text excerpt shown under the result title. |
organic_results[].position | Rank of the result in the list. The first result has position 1. |
organic_results[].favicon | URL of the site's icon image. |
organic_results[].sitelinks[].title / organic_results[].sitelinks[].link / organic_results[].sitelinks[].snippet | Title, URL and snippet of a sub-page shown under a result. Only some results have sitelinks. |
related_searches[].query | Text of a related search suggestion. |
related_searches[].link | DuckDuckGo URL that runs the related search. |
search_information.organic_results_state | Short note on how the results match the query, for example Results for exact spelling. |
q is required and can be up to 500 characters. kl sets the region and language, for example us-en.$0.015 per successful call. Failed calls are not charged.
Bắt đầu xây dựng
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/duckduckgo/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "apple",
"kl": "us-en"
}'Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
qstringbắt buộcmax 500 chars
klstringregion code, e.g. us-en
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
Chưa có phản hồi đã lưu nào được công bố. Chạy API trong Playground để xem phản hồi.
Khám phá thêm
| API | Giá | Phản hồi |
|---|---|---|
DuckDuckGo SearchAPI này DuckDuckGo | $0.015 mỗi lần gọi | JSON |
DuckDuckGo | $0.01 mỗi lần gọi | JSON |
DuckDuckGo | $0.01 mỗi lần gọi | JSON |
DuckDuckGo | $0.00015 mỗi lần gọi | JSON bất đồng bộ |
DuckDuckGo | $0.015 mỗi lần gọi | JSON |
DuckDuckGo | $0.01 mỗi lần gọi | JSON |
Câu hỏi
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/duckduckgo/search với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
$0.015 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
Bắt buộc: q (string). Tùy chọn: kl (string). Bảng Parameters và Playground trên trang này liệt kê mọi trường.
Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.
Không. DuckDuckGo Search chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của DuckDuckGo.