API Documentation

Surfapi exposes a simple, stable JSON contract. Every request is a single GET to /search.json with an engine and query parameters; the response is JSON with search_metadata, search_parameters, and the parsed results.

Already using a hosted search API? Point your client at surf-api.com and use your Surfapi key — the request parameters and response shapes are standard and well-documented below.

Authentication

Pass your API key as api_key in the query string, or as an X-API-Key header.

curl "https://surf-api.com/search.json?engine=google_news&q=coffee&api_key=YOUR_API_KEY"

Sign up to get a key — your examples below will be pre-filled.

Endpoints

EndpointDescription
GET /search.jsonRun a search. Returns JSON.
GET /searchAlias of /search.json.
GET /accountYour plan, usage, and searches left.
GET /searches/:t/:id.jsonRetrieve an archived search.
GET /enginesList available engines.

Response format

Every successful request returns a single JSON object built from two metadata blocks plus one or more result arrays. The search_metadata block describes the request that ran, and search_parameters echoes the inputs you sent (the engine plus any engine-specific params).

FieldDescription
search_metadata.idUnique identifier for this search.
search_metadata.status"Success" when results are present.
search_metadata.created_atWhen the search was accepted.
search_metadata.processed_atWhen processing completed.
search_metadata.total_time_takenTotal processing time in seconds.
search_metadata.<engine>_urlThe upstream URL that was fetched (e.g. google_url).
search_metadata.json_endpointPermalink to this result as JSON.
search_metadata.raw_html_filePermalink to the captured raw HTML.
search_parametersThe engine and all other params you sent, echoed back.

The result array depends on the engine you call:

EngineResult key
googleorganic_results
google_imagesimages_results
google_newsnews_results
google_shoppingshopping_results
google_hotelsproperties
google_hotels_autocompletesuggestions
google_flightsbest_flights + other_flights

Many engines return additional blocks alongside the primary array — for example google also includes related_searches, related_questions, answer_box, pagination and serpapi_pagination; google_hotels adds brands and ads; and google_flights adds price_insights and airports. The per-engine sections below document the fields of each.

Errors

Errors are returned as JSON with a matching HTTP status code. A failed request never counts against your quota — only successful searches are metered.

StatusMeaningWhen
200SuccessResults returned in the response envelope.
401UnauthorizedThe api_key is missing or invalid.
402Quota reachedYour monthly search allowance is used up.
422UnprocessableThe engine needs a backend or proxy that is not configured.
429Rate limitedYou exceeded the per-hour request limit for your plan.
500Internal errorSomething went wrong on our side; retry shortly.

Every error uses the same shape:

{
  "error": "Invalid API key."
}

Rate limits & quotas

Each plan has a monthly pool of searches and a per-hour request ceiling. Usage is metered per successful search: requests that return an error status (401, 402, 422, 429, 500) are not counted.

PlanSearches / monthRequests / hour
Free250100
Hobby2,000400
Starter10,0001,000
Pro30,0002,000
Business75,0005,000

Check your live quota at any time with GET /account. It accepts the same authentication as the search endpoint and returns your plan and remaining balance:

// GET https://surf-api.com/account?api_key=YOUR_API_KEY
{
  "plan_name": "Starter",
  "searches_per_month": 10000,
  "total_searches_left": 8412,
  "this_month_usage": 1588
}

Localization & pagination

Use gl and hl to localize results, and start with num to page through them on engines that support pagination.

ParamDescription
glTwo-letter country code for the result region (e.g. us, gb, de).
hlTwo-letter language code for the interface language (e.g. en, fr, es).
startResult offset for pagination (e.g. 10 skips the first 10 results).
numNumber of results to return per page.
https://surf-api.com/search.json?engine=google&q=kaffee&gl=de&hl=de&start=10&num=10&api_key=YOUR_API_KEY

Quickstart in your language

The same request — a google_flights search from JFK to LHR — in four languages. Replace YOUR_API_KEY with your key.

cURL

curl "https://surf-api.com/search.json?engine=google_flights&departure_id=JFK&arrival_id=LHR&outbound_date=2026-07-10&return_date=2026-07-17&api_key=YOUR_API_KEY"

JavaScript (fetch)

const params = new URLSearchParams({
  engine: "google_flights", departure_id: "JFK", arrival_id: "LHR",
  outbound_date: "2026-07-10", return_date: "2026-07-17", api_key: "YOUR_API_KEY"
});
fetch("https://surf-api.com/search.json?" + params.toString())
  .then(function (res) { return res.json(); })
  .then(function (data) { console.log(data.best_flights); });

Python (requests)

import requests
params = {
    "engine": "google_flights", "departure_id": "JFK", "arrival_id": "LHR",
    "outbound_date": "2026-07-10", "return_date": "2026-07-17", "api_key": "YOUR_API_KEY",
}
res = requests.get("https://surf-api.com/search.json", params=params)
print(res.json()["best_flights"])

PHP (cURL)

$params = http_build_query([
    "engine" => "google_flights", "departure_id" => "JFK", "arrival_id" => "LHR",
    "outbound_date" => "2026-07-10", "return_date" => "2026-07-17", "api_key" => "YOUR_API_KEY",
]);
$ch = curl_init("https://surf-api.com/search.json?" . $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = json_decode(curl_exec($ch), true);
print_r($data["best_flights"]);

Google Search ● live, no proxy

Whole-web organic results in SerpApi-compatible shape: snippets, related searches, answer box, pagination. engine=google

Parameters

ParameterDescription
q requiredSearch query.
location Geographic location to originate the search from.
google_domain Domain, e.g. google.com (default).
gl Two-letter country code (default us).
hl Two-letter language code (default en).
num Number of results.
start Result offset for pagination.

Response — organic_results[]

FieldDescription
positionRank of the result on the page (1-based).
titleResult title.
linkDestination URL (real publisher link).
displayed_linkBreadcrumb-style URL shown by Google.
redirect_linkGoogle /url redirect wrapper for the link.
snippetResult description / excerpt.
sourceResult domain.
sitelinksInline sub-links when present ({ inline: [...] }).

Also returns related_searches, related_questions, answer_box and knowledge_graph (when present), plus pagination and serpapi_pagination.

# cURL
curl "https://surf-api.com/search.json?engine=google&q=coffee&gl=us&hl=en&api_key=YOUR_API_KEY"

Google Images ● live, no proxy

Image results with thumbnails, source, and original URLs (no proxy required). engine=google_images

Parameters

ParameterDescription
q requiredSearch query.
gl Country code.
hl Language code.
safe Safe search: active or off.

Response — images_results[]

FieldDescription
positionRank of the image (1-based).
titleImage title.
linkPage the image appears on.
originalDirect URL of the full-size image.
original_width / original_heightFull-size image dimensions in px.
thumbnailThumbnail image URL.
sourceHost site of the image.
# cURL
curl "https://surf-api.com/search.json?engine=google_images&q=coffee&api_key=YOUR_API_KEY"

Google News ● live, no proxy

News articles and story clusters with sources and timestamps. engine=google_news

Parameters

ParameterDescription
q Search query (omit for top headlines).
gl Country code.
hl Language code.

Response — news_results[]

FieldDescription
positionRank of the article / cluster (1-based).
titleHeadline.
linkArticle URL.
sourcePublisher name.
datePublish timestamp.
thumbnailArticle thumbnail when available.
storiesRelated articles in a story cluster (same fields).
# cURL
curl "https://surf-api.com/search.json?engine=google_news&q=coffee&api_key=YOUR_API_KEY"

Google Shopping ● needs residential proxy

Product listings with prices, ratings, sources, and thumbnails. engine=google_shopping

Parameters

ParameterDescription
q requiredSearch query.
gl Country code.
hl Language code.

Response — shopping_results[]

FieldDescription
positionRank of the product (1-based).
titleProduct title.
product_linkLink to the product.
priceDisplayed price string; extracted_price is the numeric value.
sourceMerchant / seller name.
ratingAverage rating; reviews is the review count.
thumbnailProduct image URL.
deliveryDelivery / shipping note when present.
# cURL
curl "https://surf-api.com/search.json?engine=google_shopping&q=coffee+maker&api_key=YOUR_API_KEY"

Google Hotels ● live, no proxy

Rich hotel listings (ratings, photos, tokens). With dates + currency, licensed bookable rates are merged in by name+geo. engine=google_hotels

Parameters

ParameterDescription
q requiredSearch query / city (or use property_token for details).
check_in_date YYYY-MM-DD — enables merged bookable rates.
check_out_date YYYY-MM-DD.
currency Convert merged rates (e.g. AED).
adults Number of adults.
property_token Fetch a single property’s details.

Response — properties[]

FieldDescription
nameProperty name.
typehotel or vacation_rental.
gps_coordinatesLatitude / longitude.
rate_per_night / total_rateLowest nightly and total rate (with dates).
pricesPer-source rates (with dates + currency).
overall_ratingAverage rating; reviews is the review count.
amenitiesList of amenities.
imagesProperty photos.
property_tokenToken to fetch full details.

Also returns brands, ads and serpapi_pagination. A property_token request returns a single property object.

# cURL
curl "https://surf-api.com/search.json?engine=google_hotels&q=Bali+Resorts&api_key=YOUR_API_KEY"

Google Hotels Autocomplete ● live, no proxy

Typeahead suggestions resolving to property tokens. engine=google_hotels_autocomplete

Parameters

ParameterDescription
q requiredPartial hotel/location query.

Response — suggestions[]

FieldDescription
valueSuggested display text.
typeSuggestion type (e.g. hotel, city).
property_tokenToken for a google_hotels details request.
locationLocation label for the suggestion.
thumbnailThumbnail when available.
# cURL
curl "https://surf-api.com/search.json?engine=google_hotels_autocomplete&q=Hilton+Malta&api_key=YOUR_API_KEY"

Google Flights ● live, no proxy

Best and other flight options with prices, segments, and carbon estimates. engine=google_flights

Parameters

ParameterDescription
departure_id requiredDeparture airport code, e.g. JFK.
arrival_id requiredArrival airport code, e.g. LHR.
outbound_date requiredYYYY-MM-DD.
return_date YYYY-MM-DD (round trip).
type 1 round trip (default), 2 one-way, 3 multi-city.
adults Number of adults.
currency Currency code, e.g. USD.

Response — best_flights[]

FieldDescription
priceTotal price for the itinerary.
total_durationTotal travel time in minutes.
typeRound trip, one way, etc.
carbon_emissionsEstimated CO₂ for the itinerary.
airline_logoLogo for the marketing carrier.
departure_tokenToken to fetch return legs / continue the booking flow.
flightsPer-segment details: airline, flight_number, departure_airport, arrival_airport, duration, airplane, travel_class, legroom.

Also returns other_flights (same shape), price_insights and airports.

# cURL
curl "https://surf-api.com/search.json?engine=google_flights&departure_id=JFK&arrival_id=LHR&outbound_date=2026-07-10&return_date=2026-07-17&api_key=YOUR_API_KEY"

Hotelbeds Hotels ● live, no proxy

Licensed, bookable hotels with real dated rates, any currency, rate keys — enriched with photos, descriptions, address (SerpApi-shaped). engine=hotelbeds

Parameters

ParameterDescription
q requiredCity name (e.g. Dubai) — resolved to a destination. Or pass destination/hotel_codes.
check_in_date requiredYYYY-MM-DD.
check_out_date requiredYYYY-MM-DD.
currency Convert displayed rates (e.g. AED, USD). Booking stays in the native rate currency.
adults Adults per room (default 2).
children Children per room.
rooms Number of rooms (default 1).
destination Hotelbeds destination code (e.g. PMI) — alternative to q.
hotel_codes Comma-separated Hotelbeds hotel codes — alternative to q.

Response — properties[]

FieldDescription
nameProperty name.
typeProperty type.
gps_coordinatesLatitude / longitude.
rate_per_night / total_rateLowest nightly and total rate in the requested currency.
pricesBookable rates with rate keys for booking.
amenitiesList of amenities.
imagesProperty photos.
property_tokenHotelbeds hotel code for a details request.
# cURL
curl "https://surf-api.com/search.json?engine=hotelbeds&q=Dubai&check_in_date=2026-08-01&check_out_date=2026-08-04&adults=2&currency=AED&api_key=YOUR_API_KEY"