Complete guide to integrating search results into your application.
Getting Started
Serpent API provides programmatic access to search results from Google, Bing, Yahoo, and DuckDuckGo, plus AI ranking and social media data. It supports three categories of endpoints:
SERP Endpoints
Quick Search — 1 page, ~10 results. Flat per-call pricing. Use pages= to fetch up to 10 pages (max 100 results). "Web search" here means SERP results from Google · Bing · Yahoo · DuckDuckGo.
Deep Search — Up to 10 pages (~100 results) with related searches, ads, PAA, featured snippets, and AI overviews. Defaults to 5 pages.
News Search — News articles with sources, timestamps, and snippets
Image Search — Images with thumbnails, originals, dimensions, and sources
Video Search — Video results with titles, thumbnails, durations, and views
AI Ranking Endpoints
Combined AI Rank — Check how AI models (Claude, ChatGPT, Gemini, Perplexity) cite your domain
Single Engine Rank — Query a specific LLM for citation analysis
Social Media Endpoints
YouTube Search — Search for videos, channels, and playlists
YouTube Video/Channel — Get detailed video and channel information
Instagram Profile — Scrape public profile data and recent posts
Quick Start
Create an account — Sign up with your Google account (free)
Generate an API key — Go to the API Keys page and create a key
Make your first request — Use your API key to search
You get 10 free web searches to try the API. No credit card required. Free calls work on Quick Search and Deep Search (any engine). News, Images, Videos, Social, and AI Ranking require paid credits from call 1 (minimum $10 deposit).
Base URL
All API requests use the following base URL:
https://apiserpent.com
All endpoints are relative to this base. For example, the web search endpoint is:
https://apiserpent.com/api/search
Authentication
All search endpoints require an API key. You can authenticate in two ways:
Option 1: HTTP Header (Recommended)
X-API-Key: sk_live_your_api_key_here
Option 2: Query Parameter
GET /api/search?q=keyword&api_key=sk_live_your_api_key_here
Keep your API key secret. Never expose it in client-side code or public repositories. The header method is strongly preferred for security — query parameters may appear in server logs and browser history.
Credit cost: Flat per-category pricing — engine and page count don't change the rate. Web from $0.60/10K pages Default, $0.06/10K pages Growth, $0.03/10K pages Scale. New accounts get 10 free web searches. Deposit $100+ for Growth (10× off) or $500+ for Scale (20× off). See Pricing for full details.
Free Tier
Every new account receives 10 free web searches with no credit card required. Free calls are available on the following endpoints:
Quick Search (/api/search/quick) — all engines (Google, Bing, Yahoo, DDG)
Only Web Search (Quick + Deep, any engine) is free-tier eligible. News, Images, Videos, YouTube, Instagram, and AI Ranking all require paid credits from call 1 — minimum deposit is $10.
Quick Search
Perform a fast web search. Defaults to 1 page (~10 results); pass pages= (or num=) to fetch up to 10 pages (max 100 results). "Web search" here means SERP results from Google · Bing · Yahoo · DuckDuckGo. Uses lighter page loading for faster responses and lower bandwidth. Flat per-call pricing — page count does not multiply the cost.
GET/api/search/quick
Parameters
Parameter
Type
Description
qrequired
string
The search query
num
integer
Desired total results: 1–100 (default: 10). Auto-calculates pages needed. Takes precedence over pages.
pages
integer
Number of pages to scrape: 1–10 (default: 1). Used only when num is not set.
engine
string
google, bing, yahoo, or ddg(default: "google")
country
string
Country code for localized results (default: "us")
2-letter ISO language code (e.g., en, es, de, fr, ja). Restricts results to that language. Supported by Google, Yahoo, and DDG. (optional)
format
string
full (default) or simple. Simple returns position, title, and url only.
pixel_positionBETA
boolean
When true, every item in the response (organic, AI Overview, PAA, ads, featured snippet, knowledge panel, local pack, shopping, videos) gets two sibling fields: a pixel_position integer (y-coordinate in pixels from the top of the rendered desktop SERP) and a pixel_box object with the element's full bounding rectangle ({ x, y, w, h }). Supported on all four engines (Google, Yahoo, Bing, DuckDuckGo) on desktop, US locale. Paid tiers only — free-tier responses include metadata.pixelPositionUnavailable: 'free_tier'. No price increase. Full spec →
Quick Search is free-tier eligible — it counts against your 10 free web searches. No credit card or paid credits required.
Quick Search supports multi-page scraping (up to 100 results) with flat per-call pricing — the cost is the same whether you scrape 1 page or 10. The response includes all SERP features for the selected engine (organic results, ads, People Also Ask, related searches, featured snippets, AI overviews when present, inline videos, and shopping). Use Deep Search (/api/search) for richer SERP features like full AI Overview sources and PAA answers.
Deep Search
Perform a deep web search that returns up to 100 organic results with related searches, ads, People Also Ask, featured snippets, AI overviews, and more. For more than 10 results, the API automatically scrapes multiple pages. This endpoint is free-tier eligible.
GET/api/search
Parameters
Parameter
Type
Description
qrequired
string
The search query (max 2,048 characters)
num
integer
Number of results: 10–100 (default: 10). Automatically determines pages to scrape. Rounded up to the nearest 10 (e.g., num=15 returns up to 20).
engine
string
google, bing, yahoo, or ddg(default: "google")
country
string
Country code for localized results (default: "us"). See Country Support.
format
string
Response format: full or simple(default: "full"). Simple returns just position, title, and URL.
pages
integer
Number of pages to scrape: 1–10 (default: 1). Alternative to num.
2-letter ISO language code (e.g., en, es, de, fr, ja). Restricts results to that language. Supported by Google, Yahoo, and DDG. (optional)
pixel_positionBETA
boolean
When true, every item in the response (organic, AI Overview, PAA, ads, featured snippet, knowledge panel, local pack, shopping, videos) gets two sibling fields: a pixel_position integer (y-coordinate in pixels from the top of the rendered desktop SERP) and a pixel_box object with the element's full bounding rectangle ({ x, y, w, h }). Supported on all four engines (Google, Yahoo, Bing, DuckDuckGo) on desktop, US locale. Paid tiers only — free-tier responses include metadata.pixelPositionUnavailable: 'free_tier'. No price increase. Full spec →
Use num or pages, not both. If you pass num=50, the API will automatically scrape 5 pages. Each page yields ~10 results. Pricing is flat per call — page count does not multiply the cost.
Search for videos from DuckDuckGo or Yahoo/Bing. Returns video titles, thumbnails, durations, view counts, and source URLs. Available with engine=ddg (default) or engine=yahoo/engine=bing.
GET/api/videos
Parameters
Parameter
Type
Description
qrequired
string
The search query
num
integer
Number of results: 1–100 (default: all available)
engine
string
ddg, yahoo, or bing(default: "ddg"). Google video search is not supported — Google videos appear inline in web search results.
country
string
Country code for localized results (default: "us")
duration
string
Filter by duration: short, medium, or long(optional, DDG & Yahoo/Bing)
resolution
string
Filter by resolution: high or standard (DDG); 360p, 480p, 720p, hd, 1080p (Yahoo/Bing) (optional)
time
string
Time filter: day, week, month, year(optional, Yahoo/Bing)
Add pixel_position=true to /api/search or /api/search/quick and every item in the response — organic, AI Overview, PAA, ads, featured snippet, knowledge panel, local pack, shopping, videos — gets two extra fields: a pixel_position integer (y-coordinate in pixels from the top of the rendered desktop SERP) and a pixel_box object with the element's full bounding rectangle ({ x, y, w, h }). Useful for above-the-fold analysis, share-of-voice scoring, and SERP layout audits.
Supported on all four engines (Google, Yahoo, Bing, DuckDuckGo) on desktop, US locale. Paid tiers only — free-tier responses include metadata.pixelPositionUnavailable: 'free_tier' instead of the pixel fields. No price increase over a normal call. Not supported on News, Images, or Videos endpoints. Full spec →
AI Ranking API — Combined
Check how AI language models cite and rank your domain or brand. This endpoint queries multiple LLMs (Claude, ChatGPT, Gemini, Perplexity) simultaneously and returns citation analysis for each.
GET/api/ai/rank
Parameters
Parameter
Type
Description
keywordrequired
string
The search keyword/topic to query. Also accepts q as an alias.
domain
string
Your domain to track in citations (e.g., example.com) (optional)
engines
string
Comma-separated list of AI engines: claude, chatgpt, gemini, perplexity(default: all four)
prompt_type
string
Prompt style: standard, deep, or brand(default: "standard")
true if the requested domain (or any of its subdomains) appears in this engine's citations
target_position
integer | null
1-indexed citation position where the domain was first matched. null if not found.
target_match_type
string | null
"exact" (cited domain equals domain after stripping www.), "subdomain" (a subdomain of domain was cited — e.g. docs.example.com for example.com), or null if not found.
target_matched_domain
string | null
The actual domain that matched. Equals domain for exact matches; equals the subdomain hostname for subdomain matches.
citations
array
List of citations returned by this engine, each with position, url, title, domain.
total_citations
integer
Number of citations parsed.
response_text
string
The full LLM response text used to derive the citations.
latency_ms
integer
Time the engine took to answer, in milliseconds.
Subdomain matching is implicit — the API tries an exact match first, then falls back to a subdomain match. Use target_match_type on the client to differentiate the two when displaying ranking results.
AI Ranking endpoints require paid credits. They are not eligible for the free tier. Pricing varies by engine — see Pricing for details.
AI Ranking API — Single Engine
Query a specific AI engine for citation analysis. Available engines: claude, chatgpt, gemini, perplexity.
GET/api/ai/rank/:engine
URL Paths
Path
Engine
Cost per 1K
/api/ai/rank/claude
Anthropic Claude
$12.00
/api/ai/rank/chatgpt
OpenAI ChatGPT
$10.00
/api/ai/rank/gemini
Google Gemini
$2.20
/api/ai/rank/perplexity
Perplexity
$20.00
Prices shown are Default tier. Growth (10× off, $100+ deposit) and Scale (20× off, $500+ deposit) tiers available.
Parameters
Parameter
Type
Description
keywordrequired
string
The search keyword/topic. Also accepts q as an alias.
domain
string
Your domain to track in citations (optional)
prompt_type
string
Prompt style: standard, deep, or brand(default: "standard")
Get detailed information about one or more YouTube videos, including statistics (views, likes, comments), descriptions, and tags. This endpoint is free-tier eligible.
GET/api/social/youtube/video
Parameters
Parameter
Type
Description
id
string
A single YouTube video ID (e.g., dQw4w9WgXcQ)
ids
string
Comma-separated list of video IDs (max 50). Use id or ids, not both.
Instagram profile scraping works with public profiles only. Private profiles will return a 404 error. Credits are automatically refunded if the profile cannot be accessed.
Search Engines
Serpent API supports four search engines: Google (default), Bing, Yahoo, and DuckDuckGo. Use the engine parameter on any SERP endpoint to choose.
Engine
Value
Supported Endpoints
Google
google
Web, News, Images. Includes ads, PAA, featured snippets, AI overviews, inline videos, shopping.
Web, News, Images, Videos. Includes ads and related searches.
Pricing varies by both engine and endpoint type. Google web search costs more than DDG web search due to higher infrastructure requirements. Video search is only supported on DDG, Yahoo, and Bing — Google videos appear inline in web search results.
Country/Region Support
Get localized search results by specifying a country code. This affects the language, regional rankings, and availability of results.
GET/api/countries
Returns a list of all supported country codes programmatically. This endpoint does not require an API key.
Restrict search results to a specific language by passing a 2-letter ISO 639-1 code to the language parameter. Supported by Google, Yahoo / Bing, and DuckDuckGo across web, news, and image search.
Tip:language filters by content language; country sets the geographic search context. Combine both for the best localization (e.g., country=de&language=de for German searches in Germany).
Common Languages
Code
Language
Code
Language
en
English
es
Spanish
fr
French
de
German
pt
Portuguese
it
Italian
ja
Japanese
zh
Chinese
ar
Arabic
hi
Hindi
View All Supported Languages
Germanic
Code
Language
Code
Language
en
English
de
German
nl
Dutch
sv
Swedish
da
Danish
no
Norwegian
is
Icelandic
af
Afrikaans
Romance
Code
Language
Code
Language
es
Spanish
fr
French
it
Italian
pt
Portuguese
ro
Romanian
ca
Catalan
gl
Galician
Slavic
Code
Language
Code
Language
ru
Russian
pl
Polish
cs
Czech
sk
Slovak
uk
Ukrainian
bg
Bulgarian
sr
Serbian
hr
Croatian
bs
Bosnian
mk
Macedonian
sl
Slovenian
Baltic / Celtic / Other European
Code
Language
Code
Language
lt
Lithuanian
lv
Latvian
el
Greek
sq
Albanian
cy
Welsh
ga
Irish
eu
Basque
mt
Maltese
Uralic / Turkic
Code
Language
Code
Language
fi
Finnish
et
Estonian
hu
Hungarian
tr
Turkish
az
Azerbaijani
kk
Kazakh
uz
Uzbek
Indic / Iranian
Code
Language
Code
Language
hi
Hindi
bn
Bengali
ur
Urdu
pa
Punjabi
mr
Marathi
gu
Gujarati
ne
Nepali
si
Sinhala
fa
Persian
ps
Pashto
ku
Kurdish
Dravidian
Code
Language
Code
Language
ta
Tamil
te
Telugu
kn
Kannada
ml
Malayalam
East & Southeast Asian
Code
Language
Code
Language
zh
Chinese
ja
Japanese
ko
Korean
my
Burmese
vi
Vietnamese
th
Thai
km
Khmer
lo
Lao
id
Indonesian
ms
Malay
tl
Filipino
Semitic / African
Code
Language
Code
Language
ar
Arabic
he
Hebrew
am
Amharic
sw
Swahili
ha
Hausa
yo
Yoruba
ig
Igbo
zu
Zulu
xh
Xhosa
so
Somali
Caucasian
Code
Language
Code
Language
ka
Georgian
hy
Armenian
Pass any valid ISO 639-1 code as language. Engine support varies — Google has the broadest coverage.
Flat per-call: A 10-page Deep Web search costs the same as a single Quick search. Engine choice (Google/Yahoo/Bing/DDG) doesn't change the price. Failed requests (non-2xx) are auto-refunded.
Full pricing details available programmatically at GET /api/pricing (no API key required). New accounts get 10 free web searches; minimum deposit is $10.
Response Format
All responses are JSON. Every response includes a success boolean. Search responses include engine, country, and a meta object with timing info.
Full Response (Web Search)
The default format=full response includes all available data:
SERP features: Google web search may include featuredSnippet, aiOverview, videos, and shopping data. Yahoo/Bing includes peopleAlsoAsk, videos, and shopping. DDG includes ads and relatedSearches. All fields are always present in the response (empty arrays/null when not available).
Simple Response
Use format=simple for a lightweight response. Available on all five search endpoints (quick search, deep web search, news, images, videos).
Important: with format=simple, the results field is a flat array[{position, title, url}, …] — not an object. With format=full (the default), results is an object with organic, peopleAlsoAsk, relatedSearches, aiOverview, etc. A safe parser is: const organic = Array.isArray(r.results) ? r.results : (r.results?.organic || []);
format only changes the response shape — the same scraping work, proxy bandwidth, and compute cost happens either way. To actually save cost per request, use /api/search/quick instead of /api/search.
Web Search (/api/search)
Returns position, title, url. With pixel_position=true, each item also carries a pixel_position integer and a pixel_box object (see Pixel Position):
All error responses include an error field with a human-readable message. Some errors also include a message field with additional details.
Code
Meaning
Description
400
Bad Request
Missing or invalid parameters (e.g., no q param, invalid engine)
400
num must be a positive integer
The num parameter must be a positive integer (1 or greater). Values like 0, -1, or non-numeric strings are rejected.
401
Unauthorized
Invalid or missing API key
402
Payment Required
Insufficient credits. Free searches exhausted and no credit balance.
404
Not Found
Endpoint does not exist
429
Too Many Requests
Rate limit exceeded. See Rate Limits for tier-specific limits.
500
Server Error
Internal error — try again or contact support
502
Bad Gateway
Search backend returned no results. Retry with a different query or engine.
Error Response Example
// 400 Bad Request
{ "error": "Query parameter \"q\" is required" }
// 401 Unauthorized
{ "error": "Unauthorized", "message": "API key required. Provide X-API-Key header or api_key query parameter." }
// 402 Payment Required
{ "error": "Payment Required", "message": "Insufficient credits", "credits": 0, "costPerSearch": 0.0001 }
// 502 Bad Gateway
{ "error": "Search returned no results", "message": "Backend unavailable" }
Rate Limits
Rate limits are per account (shared across all your API keys) and scale with your current credit balance. Every account gets four ceilings — max concurrent in-flight requests, and max requests per minute, per hour, and per day. Higher brackets also get higher priority in the processing queue under load.
Bracket
Concurrent
Per minute
Per hour
Per day
Queue priority
Free (no deposit)
1
10
100
500
Lowest
Balance < $100
3
20
200
1,000
Standard
Balance $100–$499
10 → unlimited
100 → unlimited
1,000 → unlimited
8,000 → unlimited
High
Balance $500+
100 → unlimited
500 → unlimited
5,000 → unlimited
30,000 → unlimited
Highest
Published figures are standard allocations and "up to" maximums, not guaranteed floors — actual throughput may be lower when the platform is under heavy load. "→ unlimited" means the listed number is the standard starting allocation for that bracket and scales upward toward unlimited; higher custom limits are provided on request. The per-minute, per-hour and per-day windows reset on fixed UTC boundaries (top of each minute/hour, and 00:00 UTC for the day). A 429 response names which window you hit and includes a Retry-After header — back off and retry. Your bracket follows your live credit balance — topping up raises your limits immediately; spending down can lower them. This is separate from the permanent pricing discount tiers (Growth / Scale), which are unlocked by a single qualifying deposit and never downgrade. Need higher or custom limits? Contact us.
Other limits
Value
Demo API key
10/hour per IP
Typical Response Times
Endpoint
Typical Speed
Quick search (DDG)
2–5 seconds
Quick search (Yahoo/Bing)
4–8 seconds
Quick search (Google)
10–20 seconds
Web search (50–100 results)
10–30 seconds
News search (Google RSS)
0.5–2 seconds
News search (DDG/Yahoo)
4–12 seconds
Image search (DDG)
5–12 seconds
Image search (Google)
15–25 seconds
Video search
3–8 seconds
AI Ranking (single engine)
40–70 seconds
YouTube Search
1–3 seconds
Instagram Profile
3–10 seconds
Code Examples
JavaScript / Node.js
const API_KEY = 'sk_live_your_api_key';
const BASE = 'https://apiserpent.com';
const headers = { 'X-API-Key': API_KEY };
// Quick web search (free-tier eligible)async function quickSearch(query, engine = 'google') {
const res = await fetch(
`${BASE}/api/search/quick?q=${encodeURIComponent(query)}&engine=${engine}`,
{ headers }
);
return (await res.json()).results.organic;
}
// Deep web search (up to 100 results)async function webSearch(query, options = {}) {
const params = new URLSearchParams({
q: query,
num: options.num || 10,
engine: options.engine || 'google',
country: options.country || 'us',
});
const res = await fetch(`${BASE}/api/search?${params}`, { headers });
const data = await res.json();
if (!data.success) throw new Error(data.error);
return data.results.organic;
}
// News searchasync function newsSearch(query, num = 20) {
const res = await fetch(
`${BASE}/api/news?q=${encodeURIComponent(query)}&num=${num}`,
{ headers }
);
return (await res.json()).results.articles;
}
// Video searchasync function videoSearch(query, engine = 'ddg') {
const res = await fetch(
`${BASE}/api/videos?q=${encodeURIComponent(query)}&engine=${engine}`,
{ headers }
);
return (await res.json()).results.videos;
}
// AI Ranking checkasync function aiRank(keyword, domain) {
const res = await fetch(
`${BASE}/api/ai/rank?keyword=${encodeURIComponent(keyword)}&domain=${domain}`,
{ headers }
);
return (await res.json());
}
// YouTube search (free-tier eligible)async function ytSearch(query, num = 10) {
const res = await fetch(
`${BASE}/api/social/youtube/search?q=${encodeURIComponent(query)}&num=${num}`,
{ headers }
);
return (await res.json());
}
// Usageconst quick = await quickSearch('weather today');
const deep = await webSearch('best seo tools', { num: 50 });
const news = await newsSearch('artificial intelligence');
const videos = await videoSearch('python tutorial');
const ranking = await aiRank('best crm software', 'hubspot.com');
const yt = await ytSearch('machine learning');