Skip to main content
POST
/
v1
/
search
Search the web
curl --request POST \
  --url https://api.hasp.sh/v1/search \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "queries": [
    "golang"
  ],
  "limit": 5,
  "fetch_content": true,
  "max_page_tokens": 500,
  "max_tokens": 2000,
  "summary": false,
  "location": "US",
  "category": "news",
  "date_range": "w",
  "include_domains": [
    "github.com",
    "stackoverflow.com"
  ],
  "exclude_domains": [
    "pinterest.com"
  ]
}
'
{
  "queries": [
    {
      "query": "golang",
      "results": [
        {
          "title": "Go (programming language) - Wikipedia",
          "url": "https://en.wikipedia.org/wiki/Go_(programming_language)",
          "description": "It is often referred to as Golang..."
        },
        {
          "title": "r/golang - Reddit",
          "url": "https://www.reddit.com/r/golang/",
          "description": "TL;DR: building a library..."
        }
      ],
      "count": 2
    }
  ],
  "total": 2,
  "cost": 0.0005,
  "remaining_credits": 3
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Body

application/json
queries
string[]
required

Search queries to execute

Example:
["golang"]
limit
integer
default:10

Results per query

Example:

5

fetch_content
boolean
default:false

Fetch full content for search results

Example:

true

max_page_tokens
integer

Truncate each individual result to N tokens

Example:

500

max_tokens
integer

Global token budget - stop fetching when total tokens across all results reaches this limit

Example:

2000

summary
boolean
default:false

Generate AI-powered summaries for fetched content

location
string

ISO country code (e.g., US, GB, DE)

Example:

"US"

category
enum<string>

Filter by category

Available options:
news,
github,
twitter,
x,
research,
company
Example:

"news"

date_range
enum<string>

Time filter (d=day, w=week, m=month, y=year)

Available options:
d,
w,
m,
y
Example:

"w"

include_domains
string[]

Only search these domains

Example:
["github.com", "stackoverflow.com"]
exclude_domains
string[]

Exclude these domains

Example:
["pinterest.com"]

Response

Successful response

queries
object[]
total
number

Total results across all queries

cost
number

API call cost in dollars

remaining_credits
number

Remaining credits