Search API
Search the web with a single POST request
Endpoint
POST https://api.serpex.dev/api/search
GET https://api.serpex.dev/api/searchBoth GET (query params) and POST (JSON body) are supported. POST is recommended for production.
Authentication
Pass your API key as a Bearer token in the Authorization header.
Authorization: Bearer sk_...The x-api-key header is also accepted as a fallback.
Request Parameters
Prop
Type
Code Examples
curl -X POST https://api.serpex.dev/api/search \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{"q": "best JavaScript frameworks 2025"}'import { SerpexClient } from "serpex";
const client = new SerpexClient("sk_your_api_key");
const results = await client.search({
q: "best JavaScript frameworks 2025",
});
console.log(results.results[0].title);
console.log(results.metadata.credits_used);from serpex import SerpexClient
client = SerpexClient("sk_your_api_key")
results = client.search({
"q": "best JavaScript frameworks 2025",
})
print(results.results[0].title)
print(results.metadata.credits_used)Response
{
"id": "srp_01j9abc...",
"query": "best JavaScript frameworks 2025",
"engines": ["duckduckgo"],
"results": [
{
"title": "Top JavaScript Frameworks in 2025",
"url": "https://example.com/js-frameworks",
"snippet": "React, Vue, and Svelte remain the top choices for JavaScript developers...",
"position": 1,
"engine": "duckduckgo"
}
],
"metadata": {
"number_of_results": 10,
"credits_used": 1,
"from_cache": false,
"status": "success",
"response_time": 1240,
"timestamp": "2025-06-21T10:30:00.000Z"
}
}Response Fields
Prop
Type
Credits
- 1 credit per fresh successful search.
- 0 credits when results are served from cache (
from_cache: true). - 0 credits when the query returns no results.
- Errors are never charged.