DuckDuckGo API — Parse a DuckDuckGo URL
Documentation menu
FetchLayer FetchLayer API

Parse a DuckDuckGo URL

Turn a DuckDuckGo URL into the request fields it encodes, without contacting DuckDuckGo. A search, news or video page (duckduckgo.com/?q=reddit+api&kl=uk-en&ia=news) comes back as its kind, query, region, safe search and time range; a topic page (duckduckgo.com/Python_(programming_language)) as its topic in query; a result or ad link through DuckDuckGo as its destination in targetUrl and, for an ad, the advertiser in adDomain. Fields the URL does not carry are null. Any other URL is a 400 saying why. Parsing a URL does not consume a credit.

POST /resolve-url Utility
https://api.fetchlayer.dev/duckduckgo/resolve-url
OpenAPI JSON

Headers

Authorization string required

Bearer token — your FetchLayer API key.

Parameters

url string required

A DuckDuckGo URL: a search, news or video page, a topic page, or a result or ad link.

format string optional

json or markdown. (default: json)

timeoutMs number optional

Time limit for each page read, in milliseconds (1000–120000).

Response Fields

resolve-url

Parse a DuckDuckGo URL

resultType string

Always "resolve-url".

url string

The URL you sent.

kind string

search, news, videos, images, maps, shopping, suggestions, topic, result-link or ad-link.

query string

The query — or, for a topic page, the topic. Pass it to search, news or videos.

region string

The region the URL carries, or null.

safeSearch string

The safe search level the URL carries, or null.

timeRange string

The time range the URL carries, or null.

targetUrl string

Where a result or ad link leads, or null.

adDomain string

The advertiser, for an ad link, or null.

Request

curl -X POST "https://api.fetchlayer.dev/duckduckgo/resolve-url" \
  -H "Authorization: Bearer ss-your-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://duckduckgo.com/?q=reddit+api&kl=uk-en&ia=web"}'

Response

{
  "resultType": "resolve-url",
  "url": "https://duckduckgo.com/?q=reddit+api&kl=uk-en&ia=web",
  "kind": "search",
  "query": "reddit api",
  "region": "uk-en",
  "safeSearch": null,
  "timeRange": null,
  "targetUrl": null,
  "adDomain": null
}