Serpent API Documentation
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 — Fast web search (up to 100 results, per-page pricing)
- Web Search — Up to 100 organic results with related searches, ads, PAA, featured snippets, and AI overviews
- 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
curl "https://apiserpent.com/api/search?q=hello+world" \
-H "X-API-Key: YOUR_KEY"
You get 100 free API calls to try the API. No credit card required. Free calls work on all SERP endpoints (Quick Search, Deep Search, News, Images, Videos), YouTube, and Instagram. The only endpoint not free-eligible is AI Ranking.
Base URL
All API requests use the following base URL:
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
Free Tier
Every new account receives 100 free API calls with no credit card required. Free calls are available on the following endpoints:
- Quick Search (
/api/search/quick) — all engines (Google, Bing, Yahoo, DDG) - Deep Web Search (
/api/search) — all engines - News Search (
/api/news) — all engines - Image Search (
/api/images) — all engines - Video Search (
/api/videos) — DDG, Yahoo, Bing - YouTube Search (
/api/social/youtube/search) - YouTube Video Details (
/api/social/youtube/video) - YouTube Channel Details (
/api/social/youtube/channel) - Instagram Profile (
/api/social/instagram/profile)
Quick Search
Perform a fast web search returning up to 100 results with multi-page support. Uses lighter page loading for faster responses and lower bandwidth. Per-page pricing applies for multi-page results.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | 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") |
| freshness | string | Time filter: h/1h (hour), d/1d (day), 7d (week), w, m/1m, y/1y (optional) |
| safe | string | SafeSearch: off, moderate, or strict (optional) |
| language | string | 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. |
Example Request
curl "https://apiserpent.com/api/search/quick?q=weather+today&engine=google&country=uk" \
-H "X-API-Key: sk_live_your_api_key"
Example Response
{
"success": true,
"query": "weather today",
"engine": "google",
"country": "uk",
"results": {
"organic": [
{
"position": 1,
"title": "Weather Forecast - Today",
"url": "https://example.com/weather",
"snippet": "Today's weather forecast...",
"displayedUrl": "example.com"
}
],
"ads": { "top": [], "bottom": [], "totalCount": 0 },
"peopleAlsoAsk": [],
"relatedSearches": [{ "query": "weather tomorrow" }, { "query": "weather this week" }],
"featuredSnippet": null,
"aiOverview": null,
"richSnippets": [],
"videos": [],
"shopping": []
},
"meta": {
"totalOrganic": 7,
"elapsed": "1200ms",
"timestamp": "2026-03-03T10:30:00.000Z"
}
}
/api/search) for richer SERP features like full AI Overview sources and PAA answers.Web Search API (Deep)
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | 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. |
| freshness | string | Time filter: h/1h (hour), d/1d (day), 7d (week), w, m/1m, y/1y (optional) |
| safe | string | SafeSearch: off, moderate, or strict (optional) |
| language | string | 2-letter ISO language code (e.g., en, es, de, fr, ja). Restricts results to that language. Supported by Google, Yahoo, and DDG. (optional) |
num or pages, not both. If you pass num=50, the API will automatically scrape 5 pages. Each page yields ~10 results. Multi-page searches are charged per page scraped.Example Request
curl "https://apiserpent.com/api/search?q=best+seo+tools&num=30&engine=google&country=us" \
-H "X-API-Key: sk_live_your_api_key"
Example Response
{
"success": true,
"query": "best seo tools",
"engine": "google",
"country": "us",
"pagesScraped": 3,
"results": {
"organic": [
{
"position": 1,
"title": "10 Best SEO Tools for 2026",
"url": "https://example.com/seo-tools",
"snippet": "Discover the top SEO tools...",
"displayedUrl": "example.com"
}
],
"relatedSearches": [{ "query": "free seo tools" }],
"ads": { "top": [], "bottom": [], "totalCount": 0 },
"peopleAlsoAsk": [],
"featuredSnippet": null,
"aiOverview": null,
"richSnippets": [],
"videos": [],
"shopping": []
},
"metadata": {
"totalOrganicResults": 30,
"hasAds": false,
"hasRelatedSearches": true,
"hasPeopleAlsoAsk": false,
"hasVideos": false,
"hasShopping": false,
"hasFeaturedSnippet": false,
"hasAiOverview": false,
"source": "google"
},
"meta": {
"totalOrganic": 30,
"requestedNum": 30,
"elapsed": "8500ms",
"timestamp": "2026-03-10T10:30:00.000Z"
}
}
News Search API
Search for news articles from various sources. Returns article titles, sources, publication times, and snippets.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | string | The search query |
| num | integer | Number of articles: 1–50 (default: all available) |
| pages | integer | Number of pages to scrape: 1–5 (default: 1). Alternative to num. |
| engine | string | google, bing, yahoo, or ddg (default: "google") |
| country | string | Country code for localized news (default: "us") |
| freshness | string | Time filter: h/1h (hour), d/1d (day), 7d (week), w, m/1m, y/1y (optional) |
| language | string | 2-letter ISO language code (e.g., en, es, de). Supported by Google, Yahoo, and DDG. (optional) |
| sort | string | Sort order: relevance or date (optional, Yahoo/Bing only) |
| safe | string | SafeSearch: off, moderate, or strict (optional, Yahoo/Bing only) |
| format | string | full (default) or simple. Simple returns position, title, url, and source only. |
Example Request
curl "https://apiserpent.com/api/news?q=artificial+intelligence&num=20&country=us" \
-H "X-API-Key: sk_live_your_api_key"
Example Response
{
"success": true,
"query": "artificial intelligence",
"type": "news",
"engine": "google",
"country": "us",
"pagesScraped": 2,
"results": {
"articles": [
{
"position": 1,
"title": "AI Breakthroughs Reshape Industry",
"url": "https://example.com/ai-news",
"source": "Tech News Daily",
"publishedTime": "2 hours ago",
"snippet": "Major advances in AI...",
"image": "https://example.com/ai-news-thumb.jpg",
}
],
"totalResults": 20
},
"meta": {
"totalArticles": 20,
"elapsed": "1800ms",
"timestamp": "2026-03-03T10:30:00.000Z"
}
}
Image Search API
Search for images across the web. Returns thumbnails, original image URLs, and source websites. A single request can return up to 100 images.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | string | The search query |
| num | integer | Number of results: 1–100 (default: all available) |
| engine | string | google, bing, yahoo, or ddg (default: "google") |
| country | string | Country code for localized results (default: "us") |
| size | string | Filter by image size: small, medium, large, wallpaper (optional) |
| type | string | Filter by image type: photo, clipart, lineart, animated, face (optional) |
| color | string | Filter by color: red, blue, green, yellow, etc. (optional) |
| aspect | string | Aspect ratio: square, wide, or tall (optional) |
| layout | string | Layout: square, tall, or wide (optional, DDG only) |
| license | string | License filter: cc, public, share, sharecommercial, modify, modifycommercial, any (optional) |
| people | string | People filter: face, portrait, or nonportrait (optional, Yahoo only) |
| time | string | Time filter: day, week, month, year (DDG/Yahoo only) |
| language | string | 2-letter ISO language code (e.g., en, es, de). Restricts image results by language. Supported by Google and Yahoo. (optional) |
| format | string | full (default) or simple. Simple returns position, title, original, and thumbnail only. |
Example Request
curl "https://apiserpent.com/api/images?q=mountain+landscape&num=20" \
-H "X-API-Key: sk_live_your_api_key"
Example Response
{
"success": true,
"query": "mountain landscape",
"type": "images",
"engine": "google",
"country": "us",
"results": {
"images": [
{
"position": 1,
"title": "Beautiful Mountain View",
"thumbnail": "https://example.com/thumb/...",
"original": "https://example.com/image.jpg",
"width": null, // reserved, not currently populated
"height": null, // reserved, not currently populated
"source": "example.com",
"pageUrl": "https://example.com/gallery"
}
],
"totalResults": 20
},
"meta": {
"totalImages": 20,
"elapsed": "2100ms",
"timestamp": "2026-03-03T10:30:00.000Z"
}
}
Video Search API
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | 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) |
| freshness | string | Time filter: h/1h (hour), d/1d (day), 7d (week), w, m/1m, y/1y (optional) |
| safe | string | SafeSearch: off, moderate, or strict (optional) |
| format | string | full (default) or simple. Simple returns position, title, url, and duration only. |
Example Request
curl "https://apiserpent.com/api/videos?q=python+tutorial&num=20&engine=ddg" \
-H "X-API-Key: sk_live_your_api_key"
Example Response
{
"success": true,
"query": "python tutorial",
"type": "videos",
"engine": "ddg",
"country": "us",
"results": {
"videos": [
{
"position": 1,
"title": "Python Tutorial for Beginners",
"url": "https://www.youtube.com/watch?v=...",
"thumbnail": "https://tse2.mm.bing.net/th?...",
"duration": "6:14:07",
"viewCount": 45000000,
"publishedTime": "2023-08-09T00:00:00.0000000",
"publisher": "YouTube"
}
],
"totalResults": 20
},
"meta": {
"totalVideos": 20,
"elapsed": "3800ms",
"timestamp": "2026-03-10T10:30:00.000Z"
}
}
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
| keyword required | 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") |
Example Request
curl "https://apiserpent.com/api/ai/rank?keyword=best+seo+tools&domain=ahrefs.com&engines=claude,chatgpt" \
-H "X-API-Key: sk_live_your_api_key"
AI Ranking API — Single Engine
Query a specific AI engine for citation analysis. Available engines: claude, chatgpt, gemini, perplexity.
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 Pay-as-you-go tier. Growth (~22% off) and Scale (~44% off) tiers available.
Parameters
| Parameter | Type | Description |
|---|---|---|
| keyword required | 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") |
Example Request
curl "https://apiserpent.com/api/ai/rank/claude?keyword=best+crm+software&domain=hubspot.com" \
-H "X-API-Key: sk_live_your_api_key"
YouTube Search API
Search for YouTube videos, channels, and playlists using the YouTube Data API. This endpoint is free-tier eligible.
Parameters
| Parameter | Type | Description |
|---|---|---|
| q required | string | The search query |
| type | string | Result type: video, channel, or playlist (default: "video") |
| order | string | Sort order: relevance, date, viewCount, rating, title (default: "relevance") |
| num | integer | Number of results: 1–50 (default: 10) |
| duration | string | Video duration: any, short (<4 min), medium (4-20 min), long (>20 min) (optional) |
| country | string | Country code for regional results (default: "us") |
| details | boolean | Include detailed video statistics (true or 1) (default: false) |
| published_after | string | ISO 8601 datetime to filter videos published after (optional) |
Example Request
curl "https://apiserpent.com/api/social/youtube/search?q=machine+learning&type=video&num=10&order=viewCount" \
-H "X-API-Key: sk_live_your_api_key"
YouTube Video Details
Get detailed information about one or more YouTube videos, including statistics (views, likes, comments), descriptions, and tags. This endpoint is free-tier eligible.
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. |
Example Request
curl "https://apiserpent.com/api/social/youtube/video?id=dQw4w9WgXcQ" \
-H "X-API-Key: sk_live_your_api_key"
YouTube Channel Details
Get channel information including subscriber count, video count, total views, and optionally recent videos. This endpoint is free-tier eligible.
Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | YouTube channel ID (e.g., UCBcRF18a7Qf58cCRy5xuWwQ) |
| handle | string | YouTube handle (e.g., @mkbhd). Use id, handle, or url. |
| url | string | Full YouTube channel URL |
| include_videos | boolean | Include recent videos (true or 1) (default: false) |
| video_count | integer | Number of recent videos to include: 1–50 (default: 10) |
Example Request
curl "https://apiserpent.com/api/social/youtube/channel?handle=@mkbhd&include_videos=true&video_count=5" \
-H "X-API-Key: sk_live_your_api_key"
Instagram Profile API
Scrape public Instagram profile data including follower counts, bio, and recent posts. This endpoint is free-tier eligible.
Parameters
| Parameter | Type | Description |
|---|---|---|
| username required | string | Instagram username (e.g., natgeo). Also accepts handle (with @) or url. |
Example Request
curl "https://apiserpent.com/api/social/instagram/profile?username=natgeo" \
-H "X-API-Key: sk_live_your_api_key"
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 |
Web, News, Images. Includes ads, PAA, featured snippets, AI overviews, inline videos, shopping. | |
| Bing | bing |
Web, News, Images, Videos. Includes ads, PAA, inline videos, shopping data. |
| Yahoo | yahoo |
Web, News, Images, Videos. Includes ads, PAA, inline videos, shopping data. |
| DuckDuckGo | ddg |
Web, News, Images, Videos. Includes ads and related searches. |
Country/Region Support
Get localized search results by specifying a country code. This affects the language, regional rankings, and availability of results.
Returns a list of all supported country codes programmatically. This endpoint does not require an API key.
Example Response
{
"success": true,
"count": 112,
"countries": [
{ "code": "us", "region": "us" },
{ "code": "uk", "region": "uk" },
...
]
}
Supported Countries
We support 112 countries for localized search results (gb is an alias for uk).
gb is accepted as an alias for uk — both work and return United Kingdom results.Popular Countries
| Code | Country | Code | Country |
|---|---|---|---|
us | United States | uk | United Kingdom |
ca | Canada | au | Australia |
de | Germany | fr | France |
in | India | jp | Japan |
View All Supported Countries
English-Speaking
| Code | Country | Code | Country |
|---|---|---|---|
us | United States | uk | United Kingdom |
ca | Canada | au | Australia |
nz | New Zealand | ie | Ireland |
sg | Singapore | ph | Philippines |
my | Malaysia | in | India |
za | South Africa |
Europe
| Code | Country | Code | Country |
|---|---|---|---|
de | Germany | fr | France |
es | Spain | it | Italy |
nl | Netherlands | be | Belgium |
at | Austria | ch | Switzerland |
pt | Portugal | se | Sweden |
no | Norway | dk | Denmark |
fi | Finland | is | Iceland |
pl | Poland | ro | Romania |
cz | Czech Republic | sk | Slovakia |
hu | Hungary | bg | Bulgaria |
hr | Croatia | si | Slovenia |
ee | Estonia | lv | Latvia |
lt | Lithuania | ua | Ukraine |
ru | Russia | gr | Greece |
tr | Turkey |
Asia
| Code | Country | Code | Country |
|---|---|---|---|
jp | Japan | tw | Taiwan |
hk | Hong Kong | kr | South Korea |
cn | China | id | Indonesia |
th | Thailand | vn | Vietnam |
Middle East
| Code | Country | Code | Country |
|---|---|---|---|
il | Israel | sa | Saudi Arabia |
pk | Pakistan |
Latin America
| Code | Country | Code | Country |
|---|---|---|---|
mx | Mexico | br | Brazil |
ar | Argentina | cl | Chile |
co | Colombia | pe | Peru |
ve | Venezuela |
Sub-Saharan Africa
| Code | Country | Code | Country |
|---|---|---|---|
ng | Nigeria | ke | Kenya |
gh | Ghana | et | Ethiopia |
tz | Tanzania | ug | Uganda |
zw | Zimbabwe | bw | Botswana |
na | Namibia | sn | Senegal |
North Africa
| Code | Country | Code | Country |
|---|---|---|---|
eg | Egypt | ma | Morocco |
tn | Tunisia | ly | Libya |
dz | Algeria |
Caribbean
| Code | Country | Code | Country |
|---|---|---|---|
cu | Cuba | jm | Jamaica |
tt | Trinidad and Tobago |
Others
| Code | Country | Code | Country |
|---|---|---|---|
mt | Malta | am | Armenia |
az | Azerbaijan |
Use GET /api/countries for the full programmatic list of all supported country codes.
Example: Search in Germany
curl "https://apiserpent.com/api/search?q=beste+seo+tools&country=de" \
-H "X-API-Key: sk_live_your_api_key"
Check Status
Check your API key status, credit balance, free search usage, and pricing tier.
Example Response
{
"success": true,
"data": {
"plan": "paid",
"credits": 45.50,
"costPerSearch": 0.0001,
"priceTier": "default",
"freeSearches": {
"used": 87,
"limit": 100,
"remaining": 13
}
}
}
Pricing
Pricing is per API call, varying by engine and endpoint type. Three tiers are available based on total amount deposited. All tiers are pay-as-you-go with no monthly commitments.
Pricing Tiers
| Tier | Min Deposit | Discount |
|---|---|---|
| Pay-as-you-go | $0 | Full price |
| Growth | $50 | ~22% off all pricing |
| Scale | $200 | ~44% off all pricing |
SERP Pricing (per 1,000 calls — Default / Growth / Scale)
| Endpoint | Default | Growth | Scale |
|---|---|---|---|
| Quick Web | $0.09 | $0.07 | $0.05 |
| Deep Web | $1.30 | $1.10 | $0.90 |
| News (RSS) | $0.01 | $0.01 | $0.01 |
| Images | $2.75 | $2.14 | $1.53 |
DuckDuckGo
| Endpoint | Default | Growth | Scale |
|---|---|---|---|
| Quick / Deep Web | $0.02 | $0.02 | $0.01 |
| News | $0.02 | $0.02 | $0.01 |
| Images | $0.01 | $0.01 | $0.01 |
| Videos | $0.01 | $0.01 | $0.01 |
Yahoo / Bing
| Endpoint | Default | Growth | Scale |
|---|---|---|---|
| Quick Web | $0.02 | $0.02 | $0.01 |
| Deep Web | $0.03 | $0.03 | $0.02 |
| News | $0.02 | $0.02 | $0.01 |
| Images | $0.06 | $0.04 | $0.03 |
| Videos | $0.04 | $0.03 | $0.02 |
Google does not support dedicated video search. Google video results appear inline in web search results. Quick and Deep web searches are charged per page scraped.
AI Ranking Pricing (per 1,000 calls)
| Engine | Per 1K |
|---|---|
| Claude | $12.00 |
| ChatGPT | $10.00 |
| Gemini | $2.20 |
| Perplexity | $20.00 |
| All 4 combined | $44.20 |
Social Media Pricing (per 1,000 calls)
| Endpoint | Per 1K |
|---|---|
| YouTube (search, video, channel) | $0.20 |
| Instagram Profile | $1.05 |
GET /api/pricing (no API key required). All three tiers shown above. Growth tier receives ~22% off and Scale tier receives ~44% off. DDG and Yahoo/Bing endpoints start as low as $0.01/1K.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:
{
"success": true,
"query": "best seo tools",
"engine": "google",
"country": "us",
"pagesScraped": 5,
"results": {
"organic": [{ "position", "title", "url", "snippet", "displayedUrl" }],
"relatedSearches": [{ "query": "free seo tools" }, ...],
"ads": { "top": [], "bottom": [], "totalCount": 0 },
"peopleAlsoAsk": [],
"featuredSnippet": null, // Google only
"aiOverview": null, // Google only
"richSnippets": [],
"videos": [], // Google, Yahoo/Bing
"shopping": [] // Google, Yahoo/Bing
},
"metadata": {
"totalOrganicResults": 50,
"hasAds": false,
"hasRelatedSearches": true,
"hasPeopleAlsoAsk": false,
"hasVideos": false,
"hasShopping": false,
"hasFeaturedSnippet": false,
"hasAiOverview": false,
"source": "google"
},
"meta": { "totalOrganic", "requestedNum", "elapsed", "timestamp" }
}
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):
Web Search (/api/search)
Returns position, title, url:
{
"success": true,
"query": "best seo tools",
"engine": "google",
"country": "us",
"results": [
{ "position": 1, "title": "...", "url": "..." }
],
"meta": { "total": 50, "requestedNum": 50, "elapsed": "2450ms" }
}
News Search (/api/news)
Returns position, title, url, source:
{
"success": true,
"query": "artificial intelligence",
"type": "news",
"engine": "google",
"country": "us",
"results": [
{ "position": 1, "title": "...", "url": "...", "source": "..." }
],
"meta": { "total": 20, "elapsed": "1800ms" }
}
Image Search (/api/images)
Returns position, title, original, thumbnail:
{
"success": true,
"query": "mountain landscape",
"type": "images",
"engine": "google",
"country": "us",
"results": [
{ "position": 1, "title": "...", "original": "...", "thumbnail": "..." }
],
"meta": { "total": 50, "elapsed": "1200ms" }
}
Error Codes
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
| Tier | Requests/Minute | Queue Priority |
|---|---|---|
| Free | 30 | Lowest (3) |
| Pay-as-you-go (Paid) | 200 | Normal (2) |
| Growth ($50+ deposited) | 400 | High (1) |
| Scale ($200+ deposited) | 600 | Highest (0) |
| Limit | Value |
|---|---|
| Global IP rate limit | 100/min |
| Demo API key | 10/hour per IP |
| Daily limit | None (pay per use) |
| Concurrent requests per key | 4 simultaneous (5th returns 429) |
retryAfter: 10.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 search
async 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 search
async 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 check
async 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());
}
// Usage
const 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');
Python
import requests
API_KEY = 'sk_live_your_api_key'
BASE = 'https://apiserpent.com'
HEADERS = {'X-API-Key': API_KEY}
# Quick search (free-tier eligible)
def quick_search(query, engine='google'):
resp = requests.get(f'{BASE}/api/search/quick', headers=HEADERS,
params={'q': query, 'engine': engine})
return resp.json()['results']['organic']
# Deep web search (up to 100 results)
def web_search(query, num=10, engine='google', country='us'):
resp = requests.get(f'{BASE}/api/search', headers=HEADERS,
params={'q': query, 'num': num, 'engine': engine, 'country': country})
data = resp.json()
if not data.get('success'):
raise Exception(data.get('error', 'Search failed'))
return data['results']['organic']
# News search
def news_search(query, num=20):
resp = requests.get(f'{BASE}/api/news', headers=HEADERS,
params={'q': query, 'num': num})
return resp.json()['results']['articles']
# Image search
def image_search(query, num=50):
resp = requests.get(f'{BASE}/api/images', headers=HEADERS,
params={'q': query, 'num': num})
return resp.json()['results']['images']
# Video search
def video_search(query, engine='ddg'):
resp = requests.get(f'{BASE}/api/videos', headers=HEADERS,
params={'q': query, 'engine': engine})
return resp.json()['results']['videos']
# AI Ranking
def ai_rank(keyword, domain=None, engines='claude,chatgpt'):
params = {'keyword': keyword, 'engines': engines}
if domain:
params['domain'] = domain
resp = requests.get(f'{BASE}/api/ai/rank', headers=HEADERS, params=params)
return resp.json()
# YouTube search (free-tier eligible)
def yt_search(query, num=10):
resp = requests.get(f'{BASE}/api/social/youtube/search', headers=HEADERS,
params={'q': query, 'num': num})
return resp.json()
# Instagram profile (free-tier eligible)
def ig_profile(username):
resp = requests.get(f'{BASE}/api/social/instagram/profile', headers=HEADERS,
params={'username': username})
return resp.json()
# Usage
results = web_search('best seo tools', num=50, engine='google')
news = news_search('AI breakthroughs')
images = image_search('sunset beach')
videos = video_search('python tutorial')
ranking = ai_rank('best crm software', domain='hubspot.com')
yt = yt_search('machine learning')
ig = ig_profile('natgeo')
cURL
# Quick search (free-tier eligible)
curl "https://apiserpent.com/api/search/quick?q=weather+today&engine=google" \
-H "X-API-Key: sk_live_your_api_key"
# Deep web search (30 results from Google in Germany)
curl "https://apiserpent.com/api/search?q=beste+seo+tools&num=30&engine=google&country=de" \
-H "X-API-Key: sk_live_your_api_key"
# News search with freshness filter
curl "https://apiserpent.com/api/news?q=technology&num=20&freshness=w" \
-H "X-API-Key: sk_live_your_api_key"
# Image search with filters
curl "https://apiserpent.com/api/images?q=mountain+landscape&num=50&size=large" \
-H "X-API-Key: sk_live_your_api_key"
# Video search
curl "https://apiserpent.com/api/videos?q=python+tutorial&engine=ddg&duration=medium" \
-H "X-API-Key: sk_live_your_api_key"
# AI Ranking (Claude + ChatGPT)
curl "https://apiserpent.com/api/ai/rank?keyword=best+crm+software&domain=hubspot.com&engines=claude,chatgpt" \
-H "X-API-Key: sk_live_your_api_key"
# Single AI engine ranking
curl "https://apiserpent.com/api/ai/rank/gemini?keyword=best+seo+tools" \
-H "X-API-Key: sk_live_your_api_key"
# YouTube search (free-tier eligible)
curl "https://apiserpent.com/api/social/youtube/search?q=machine+learning&num=10" \
-H "X-API-Key: sk_live_your_api_key"
# YouTube video details
curl "https://apiserpent.com/api/social/youtube/video?id=dQw4w9WgXcQ" \
-H "X-API-Key: sk_live_your_api_key"
# YouTube channel details
curl "https://apiserpent.com/api/social/youtube/channel?handle=@mkbhd&include_videos=true" \
-H "X-API-Key: sk_live_your_api_key"
# Instagram profile (free-tier eligible)
curl "https://apiserpent.com/api/social/instagram/profile?username=natgeo" \
-H "X-API-Key: sk_live_your_api_key"
# Check credits and usage
curl "https://apiserpent.com/api/status" \
-H "X-API-Key: sk_live_your_api_key"
# Get pricing (no API key required)
curl "https://apiserpent.com/api/pricing"