Skip to content

Quickstart

  1. Mint a key. In the dashboard open Developers → API Keys and press New key. Copy the secret when it is shown; it starts with sk_live_ or sk_test_ and is never shown again.

  2. Run a search. Replace sk_live_your_key with your key.

    Terminal window
    curl -G "https://api.serpresult.com/v1/query" \
    -H "Authorization: Bearer sk_live_your_key" \
    --data-urlencode "query=serp api" \
    --data-urlencode "target=google_search" \
    --data-urlencode "geo=us" \
    --data-urlencode "num=3"
  3. Read the response. A 200 carries the organic results in rank order.

    {
    "id": "qry_bbadb104fad74005a996dcd379a072cb",
    "target": "google_search",
    "query": "serp api",
    "geo": "us",
    "locale": "en-us",
    "page": 1,
    "results": {
    "organic": [
    {
    "position": 1,
    "title": "Search engine results page - Wikipedia",
    "url": "https://en.wikipedia.org/wiki/Search_engine_results_page",
    "domain": "wikipedia.org",
    "snippet": "A search engine results page (SERP) is a webpage that is displayed by a search engine in response to a query by a user."
    },
    {
    "position": 2,
    "title": "In-depth guide to how Google Search works",
    "url": "https://developers.google.com/search/docs/fundamentals/how-search-works",
    "domain": "google.com",
    "snippet": "Google Search is a fully-automated search engine that uses software known as web crawlers that explore the web regularly to find pages to add to our index."
    },
    {
    "position": 3,
    "title": "SERP Features - What They Are & How to Rank For Them - Moz",
    "url": "https://moz.com/learn/seo/serp-features",
    "domain": "moz.com",
    "snippet": "A SERP feature is any result on a Google Search Engine Results Page (SERP) that is not a traditional organic result."
    }
    ]
    }
    }

    The response also carries X-Credits-Used, the three X-RateLimit-* headers and X-Request-Id. Understanding results explains each field.