Search

Search the web

Search the web for a query and get back ranked results: title, url and snippet. Costs 1 credit. Set scrapeResults to true to also fetch each result as clean data, which costs 1 additional credit per page scraped.

post/v1/web/search

Request

  • Base URL: https://api.hydrafetch.com
  • URL: https://api.hydrafetch.com/v1/web/search
  • Auth: API key in header X-API-Key

Request body

querystring required

What to search the web for.

limitnumber

How many ranked results to return. Omit for the default.

scrapeResultsboolean

When true, each result also comes back with its page fetched and returned as clean data, at 1 additional credit per page scraped. Defaults to false, which returns just the ranked title, url and snippet for the flat search credit.

timeRange'day' | 'week' | 'month' | 'year'

Restrict results to a recency window relative to now.

countrystring

ISO 3166 alpha-2 country code to bias results toward a region.

includeDomainsstring[]

Only return results from these domains.

excludeDomainsstring[]

Drop results from these domains.

Example request

{
  "query": "best open source vector databases",
  "limit": 5,
  "scrapeOptions": {
    "formats": [
      "markdown"
    ],
    "location": {
      "country": "us",
      "languages": [
        "en-US",
        "en"
      ]
    }
  },
  "timeRange": "week",
  "country": "us",
  "includeDomains": [
    "github.com",
    "arxiv.org"
  ],
  "excludeDomains": [
    "pinterest.com"
  ]
}

Response

The ranked search results.

Example response

{
  "data": {
    "query": "best open source vector databases",
    "status": "ok",
    "results": [
      {
        "title": "Best open source vector databases",
        "url": "https://example.com/vector-databases",
        "snippet": "A rundown of the leading open source vector databases and how they compare.",
        "rank": 1,
        "data": {
          "url": "https://example.com",
          "finalUrl": "https://example.com/",
          "status": 200,
          "metadata": {
            "structure": "markdown",
            "pageType": "article",
            "wordCount": 214
          },
          "usage": {
            "creditsUsed": 1,
            "creditsRemaining": 4999,
            "freshness": "fresh"
          },
          "quality": {
            "confidence": 0.94,
            "complete": true
          },
          "structured": {
            "entities": [
              {
                "type": "Product"
              }
            ]
          }
        }
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.