HELP CENTER

How to Get Google Rankings with Python: A DataForSEO SERP API Tutorial

Checking one keyword’s position in Google sounds like a weekend script. Then the request has to come from the right location, the parser has to survive the next time Google reshuffles the page, and both need proxies underneath. Teams that start with a homemade scraper usually end up maintaining collection infrastructure instead of shipping the rank tracking feature.

There is a shorter route. This tutorial uses Python and our SERP API to pull a single position, then turns the same request into a scheduled batch across a keyword list. Every JSON response below came out of a live call made while writing the article.

What a Google rank API returns

Google does not publish a ranking endpoint. Our SERP API fetches the search results page for a keyword, location, language and device, and returns it as structured JSON where every element already carries its position.

Two fields carry that position, and mixing them up is the most common integration bug we see.

  • The rank_group is the position within elements of the same type. On an item where "type": "organic", this is the organic position an SEO would recognize.
  • The rank_absolute is the position among all elements on the page, counting AI Overviews, People Also Ask blocks, ads and whatever else Google rendered.

In the live response further down, stripe.com domain comes back with "rank_group": 1 and "rank_absolute": 2, because an AI Overview took the first absolute slot. Push the absolute number into a dashboard and you have just told the user they lost a top position they still hold. Our Help Center article on the difference between rank absolute and rank group has more cases.

Below is a list of the SERP API endpoints used in this tutorial:

Authenticate and send your first request

Before sending your first Python request, make sure you have the following things: an active DataForSEO account, and the API credentials in the API Access tab of your dashboard. We generate that API password for you, and it is not the one you log in with, which catches people out surprisingly often. Registration is free and includes a $1 testing credit, so the entire tutorial runs on real data before you spend anything. Our Help Center article on how the free trial works has the details.

Authentication is HTTP Basic over a base64-encoded login:password string, covered in our Authentication docs. The snippet below builds those headers once and sends the smallest request the live endpoint will accept. Everything else in this Python Google rank checker is a variation on it.

Endpoint used: POST https://api.dataforseo.com/v3/serp/google/organic/live/advanced

import base64
import requests

# The API password comes from the API Access tab, not your dashboard login password
CRED = base64.b64encode(b"your_login:your_password").decode()
HEADERS = {"Authorization": f"Basic {CRED}", "Content-Type": "application/json"}

response = requests.post(
    "https://api.dataforseo.com/v3/serp/google/organic/live/advanced",
    headers=HEADERS,
    # Tasks always travel inside a list, even when you send exactly one
    json=[{
        "keyword": "online payment processing",
        "location_code": 2840,   # United States
        "language_code": "en",
        "depth": 10,
    }],
    timeout=120,
)

print(response.json()["status_message"])   # Ok.

The request needs a location, and location_code is the practical choice: rankings differ between countries and cities, so a position collected without one cannot be compared to anything. Get the location codes using the SERP Google Locations List endpoint.

Read the position out of the response

The response nests one level deeper than most APIs. Your task sits in the tasks array, the retrieved SERP is located inside it in the result array, and the items array holds individual elements of the response. Those elements share a single array, so filtering on type separates organic results from the AI Overview and People Also Ask blocks.

data = response.json()
items = data["tasks"][0]["result"][0]["items"]

for item in items:
    # ai_overview, people_also_ask and related_searches live in the same array
    if item["type"] != "organic":
        continue
    print(item["rank_group"], item["rank_absolute"], item["domain"], item["url"])

The loop prints the organic ladder for this SERP, starting with 1 2 stripe.com https://stripe.com/payments. The two numbers drift apart the lower you go, as more non-organic blocks pile up above.

Below is the full response from that call. We collapsed the AI Overview content for readability; the live response returns it in full.

{
  "version": "0.1.20260806",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "4.5544 sec.",
  "cost": 0.002,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "08251157-1535-0139-0000-0635c6938c86",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "4.4074 sec.",
      "cost": 0.002,
      "result_count": 1,
      "path": ["v3", "serp", "google", "organic", "live", "advanced"],
      "data": {
        "api": "serp",
        "function": "live",
        "se": "google",
        "se_type": "organic",
        "keyword": "online payment processing",
        "location_code": 2840,
        "language_code": "en",
        "depth": 10,
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "keyword": "online payment processing",
          "type": "organic",
          "se_domain": "google.com",
          "location_code": 2840,
          "language_code": "en",
          "check_url": "https://www.google.com/search?q=online%20payment%20processing&hl=en&gl=US&ie=UTF-8&uule=w+CAIQIFISCQs2MuSEtepUEUK33kOSuTsc",
          "datetime": "2026-08-25 11:57:14 +00:00",
          "spell": null,
          "refinement_chips": null,
          "item_types": ["ai_overview", "organic", "people_also_ask", "related_searches"],
          "se_results_count": 129,
          "pages_count": 1,
          "items_count": 12,
          "items": [
            {
              "type": "ai_overview",
              "rank_group": 1,
              "rank_absolute": 1,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]",
              "asynchronous_ai_overview": false,
              "markdown": "[collapsed: full AI Overview markdown]",
              "items": "[collapsed: 4 ai_overview_element objects]",
              "references": "[collapsed: 5 ai_overview_reference objects]",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 1,
              "rank_absolute": 2,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]",
              "domain": "stripe.com",
              "title": "Global Payment Processing Platform",
              "url": "https://stripe.com/payments",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://stripe.com › payments",
              "website_name": "Stripe",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Accept payments online, in person, and around the world with a payments solution built for any business—from scaling startups to global enterprises.",
              "pre_snippet": null,
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Accept payments online"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": null,
              "rectangle": null
            },
            {
              "type": "people_also_ask",
              "rank_group": 1,
              "rank_absolute": 3,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[3]/div[1]/div[1]/div[1]",
              "items": "[collapsed: 4 people_also_ask_element objects]",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 2,
              "rank_absolute": 4,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[5]/div[1]/div[1]",
              "domain": "www.elavon.com",
              "title": "Elavon: Merchant Services & Payment Processing",
              "url": "https://www.elavon.com/",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://www.elavon.com",
              "website_name": "Elavon",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Provide first-rate experiences to customers by using Elavon merchant services. Accept payments securely and efficiently with our powerful payment processing ...",
              "pre_snippet": null,
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Accept payments securely and efficiently"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": null,
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 3,
              "rank_absolute": 5,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[7]/div[1]/div[1]",
              "domain": "connectpay.com",
              "title": "12 Best Online Payment Processing Services (2026)",
              "url": "https://connectpay.com/blog/online-payment-processing-services/",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://connectpay.com › blog › online-payment-proces...",
              "website_name": "connectpay.com",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Feb 27, 2026 — 12 best online payment processing services · 1. ConnectPay · 2. Stripe · 3. Adyen · 4. PayPal · 5. Whop · 6. Square (Block) · 7. Checkout.com. Read more",
              "pre_snippet": "02/27/2026 00:00:00",
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["1. ConnectPay"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": "2026-02-27 00:00:00 +00:00",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 4,
              "rank_absolute": 6,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[9]/div[1]/div[1]",
              "domain": "squareup.com",
              "title": "Accept Payments Online, In-Store, or On The Go",
              "url": "https://squareup.com/us/en/payments",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://squareup.com › payments",
              "website_name": "Square",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Take payments anywhere with Square—online, in person, or on the go. Secure, flexible payment processing software and hardware built to power businesses",
              "pre_snippet": null,
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["payments", "online", "payment processing"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": null,
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 5,
              "rank_absolute": 7,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[11]/div[1]/div[1]",
              "domain": "www.airwallex.com",
              "title": "5 best online payment processing services of 2026",
              "url": "https://www.airwallex.com/en-us/blog/best-online-payment-processing",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://www.airwallex.com › en-us › blog › best-online-p...",
              "website_name": "Airwallex",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Aug 5, 2026 — The best online payment processing services for businesses are Airwallex, Stripe, and PayPal due to low transaction fees and vast international ... Read more",
              "pre_snippet": "08/05/2026 00:00:00",
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Airwallex, Stripe, and PayPal"],
              "links": "[collapsed: 2 link_element objects]",
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": "2026-08-05 00:00:00 +00:00",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 6,
              "rank_absolute": 8,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[13]/div[1]/div[1]",
              "domain": "www.paypal.com",
              "title": "How Online Payment Processing Works",
              "url": "https://www.paypal.com/us/brc/article/how-online-payments-processing-works",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://www.paypal.com › brc › article › how-online-pa...",
              "website_name": "PayPal",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Oct 1, 2025 — Online payment processing is how money gets from the customer (payer) to the business (payee). A payment processing system handles the full ...",
              "pre_snippet": "10/01/2025 00:00:00",
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Online payment processing", "payment processing"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": "2025-10-01 00:00:00 +00:00",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 7,
              "rank_absolute": 9,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[15]/div[1]/div[1]",
              "domain": "zapier.com",
              "title": "The 7 best online payment processing services in 2026",
              "url": "https://zapier.com/blog/best-payment-gateways/",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://zapier.com › App picks › Best apps",
              "website_name": "Zapier",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Jan 7, 2026 — The 7 best online payment processing services in 2026 · PayPal · Stripe · Shopify Payments · Square · HubSpot Payments · Helcim · Airwallex (Web ... Read more",
              "pre_snippet": "01/07/2026 00:00:00",
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["PayPal"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": "2026-01-07 00:00:00 +00:00",
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 8,
              "rank_absolute": 10,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[17]/div[1]/div[1]",
              "domain": "aico.ai",
              "title": "What is Online Payment Processing?",
              "url": "https://aico.ai/glossary/online-payment-processing",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://aico.ai › glossary › online-payment-processing",
              "website_name": "Aico Group",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Online payment processing is the electronic system that enables businesses to accept, authorise and settle customer payments through digital channels,",
              "pre_snippet": null,
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Online payment processing"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": null,
              "rectangle": null
            },
            {
              "type": "organic",
              "rank_group": 9,
              "rank_absolute": 11,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[19]/div[1]/div[1]",
              "domain": "fintechmagazine.com",
              "title": "Top 10: Payment Processors",
              "url": "https://fintechmagazine.com/top10/top-10-payment-processors",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://fintechmagazine.com › top10 › top-10-payment-...",
              "website_name": "FinTech Magazine",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Jun 3, 2025 — Top 10: Payment Processors · 10. Payoneer · 9. Worldline · 8. Checkout.com · 7. Block (Square) · 6. PayPal · 5. Fiserv · 4. FIS · 3. Adyen. Read more",
              "pre_snippet": "06/03/2025 00:00:00",
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["10. Payoneer"],
              "links": "[collapsed: 3 link_element objects]",
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": "2025-06-03 00:00:00 +00:00",
              "rectangle": null
            },
            {
              "type": "related_searches",
              "rank_group": 1,
              "rank_absolute": 12,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[2]/div[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[2]",
              "items": [
                "Online payment processing paypal",
                "Online payment processing credit card",
                "Online payment processing companies",
                "Online payment processing app",
                "Square online payment processing",
                "How to receive payments online for free",
                "Online payment platform app",
                "Payment processing companies list"
              ],
              "rectangle": null
            }
          ]
        }
      ]
    }
  ]
}

Check one domain with the target parameter

Pulling the entire SERP and hunting through it for a single domain works. It also moves the filtering into your code and the bandwidth into your bill. The target parameter moves that work back to our side and returns only the elements that match.

Wildcards set how wide the match goes. The stripe.com matches only the home page, stripe.com* matches the domain and all its pages, and *stripe.com* matches subdomains. One limitation is worth planning around: target works on the two live Google Organic SERP endpoints but not on the Google Organic SERP Task POST, so batch workflows have to filter in Python. Our guide on how to track rankings with SERP API covers both paths.

payload = [{
    "keyword": "online payment processing",
    "location_code": 2840,
    "language_code": "en",
    "depth": 20,
    # "stripe.com" alone would match the home page only
    "target": "stripe.com*",
}]

result = requests.post(
    "https://api.dataforseo.com/v3/serp/google/organic/live/advanced",
    headers=HEADERS, json=payload, timeout=120,
).json()["tasks"][0]["result"][0]

# items comes back empty when the target is not found within the requested depth
position = result["items"][0]["rank_group"] if result["items"] else None
print(position)   # 1

The filtered response carries one item instead of the whole page. The item_types array still lists everything Google rendered, so you can see what the SERP looked like without walking the array.

{
  "version": "0.1.20260806",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "18.6429 sec.",
  "cost": 0.0035,
  "tasks_count": 1,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "08251157-1535-0139-0000-4ffc796c57de",
      "status_code": 20000,
      "status_message": "Ok.",
      "time": "18.4844 sec.",
      "cost": 0.0035,
      "result_count": 1,
      "path": ["v3", "serp", "google", "organic", "live", "advanced"],
      "data": {
        "api": "serp",
        "function": "live",
        "se": "google",
        "se_type": "organic",
        "keyword": "online payment processing",
        "location_code": 2840,
        "language_code": "en",
        "depth": 20,
        "target": "stripe.com*",
        "device": "desktop",
        "os": "windows"
      },
      "result": [
        {
          "keyword": "online payment processing",
          "type": "organic",
          "se_domain": "google.com",
          "location_code": 2840,
          "language_code": "en",
          "check_url": "https://www.google.com/search?q=online%20payment%20processing&hl=en&gl=US&ie=UTF-8&uule=w+CAIQIFISCQs2MuSEtepUEUK33kOSuTsc",
          "datetime": "2026-08-25 11:57:45 +00:00",
          "spell": null,
          "refinement_chips": null,
          "item_types": ["ai_overview", "organic", "people_also_ask", "people_also_search", "related_searches"],
          "se_results_count": 129,
          "pages_count": 2,
          "items_count": 1,
          "items": [
            {
              "type": "organic",
              "rank_group": 1,
              "rank_absolute": 2,
              "page": 1,
              "position": "left",
              "xpath": "/html[1]/body[1]/div[3]/div[1]/div[13]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]",
              "domain": "stripe.com",
              "title": "Global Payment Processing Platform",
              "url": "https://stripe.com/payments",
              "cache_url": null,
              "related_search_url": null,
              "breadcrumb": "https://stripe.com › payments",
              "website_name": "Stripe",
              "is_image": false,
              "is_video": false,
              "is_featured_snippet": false,
              "is_malicious": false,
              "is_web_story": false,
              "checks": null,
              "description": "Accept payments online, in person, and around the world with a payments solution built for any business—from scaling startups to global enterprises.",
              "pre_snippet": null,
              "extended_snippet": null,
              "images": null,
              "amp_version": false,
              "rating": null,
              "price": null,
              "highlighted": ["Accept payments online"],
              "links": null,
              "faq": null,
              "extended_people_also_search": null,
              "about_this_result": null,
              "related_result": null,
              "timestamp": null,
              "rectangle": null
            }
          ]
        }
      ]
    }
  ]
}

Scale to many keywords with the Standard method

Live endpoints accept one task per call, which suits an on-demand position check inside your tool. A nightly run across a keyword list is a different problem. For that, use the Standard method: you post the batch request, our servers work through it, and you collect the results when done.

Google Organic SERP Task POST takes up to 100 tasks per call, at up to 2,000 calls per minute, so a 10,000-keyword list comes out to 100 calls. Each task accepts the same fields as the live endpoint, plus an optional tag for matching results back to a run.

Endpoint used: POST https://api.dataforseo.com/v3/serp/google/organic/task_post

KEYWORDS = [
    "online payment processing",
    "payment gateway for startups",
    "accept credit card payments online",
]

tasks = [{
    "keyword": kw,
    "location_code": 2840,
    "language_code": "en",
    "depth": 20,
    "tag": "stripe-batch-2026-08-25",   # your own label, echoed back with the result
} for kw in KEYWORDS]

posted = requests.post(
    "https://api.dataforseo.com/v3/serp/google/organic/task_post",
    headers=HEADERS, json=tasks, timeout=120,
).json()

task_ids = {t["id"] for t in posted["tasks"]}

Each task comes back with status code 20100 and an id. You have not collected anything yet.

{
  "version": "0.1.20260806",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.0761 sec.",
  "cost": 0.00315,
  "tasks_count": 3,
  "tasks_error": 0,
  "tasks": [
    {
      "id": "08251157-1535-0066-0000-e4c92c4f2094",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0000 sec.",
      "cost": 0.00105,
      "result_count": 0,
      "path": ["v3", "serp", "google", "organic", "task_post"],
      "data": {
        "api": "serp",
        "function": "task_post",
        "se": "google",
        "se_type": "organic",
        "keyword": "online payment processing",
        "location_code": 2840,
        "language_code": "en",
        "depth": 20,
        "tag": "stripe-batch-2026-08-25",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    },
    {
      "id": "08251157-1535-0066-0000-0a4001a62eea",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0000 sec.",
      "cost": 0.00105,
      "result_count": 0,
      "path": ["v3", "serp", "google", "organic", "task_post"],
      "data": {
        "api": "serp",
        "function": "task_post",
        "se": "google",
        "se_type": "organic",
        "keyword": "payment gateway for startups",
        "location_code": 2840,
        "language_code": "en",
        "depth": 20,
        "tag": "stripe-batch-2026-08-25",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    },
    {
      "id": "08251157-1535-0066-0000-f070d347e21d",
      "status_code": 20100,
      "status_message": "Task Created.",
      "time": "0.0068 sec.",
      "cost": 0.00105,
      "result_count": 0,
      "path": ["v3", "serp", "google", "organic", "task_post"],
      "data": {
        "api": "serp",
        "function": "task_post",
        "se": "google",
        "se_type": "organic",
        "keyword": "accept credit card payments online",
        "location_code": 2840,
        "language_code": "en",
        "depth": 20,
        "tag": "stripe-batch-2026-08-25",
        "device": "desktop",
        "os": "windows"
      },
      "result": null
    }
  ]
}

To collect them, send a request to the Google Organic SERP Tasks Ready for what has finished. The endpoint hands back a ready-made path for each task, so you never assemble a Task GET URL yourself. We charge at post time, so collecting results is free for the next 30 days.

Endpoint used: GET https://api.dataforseo.com/v3/serp/google/organic/tasks_ready

ready = requests.get(
    "https://api.dataforseo.com/v3/serp/google/organic/tasks_ready",
    headers=HEADERS, timeout=120,
).json()["tasks"][0]["result"] or []

for task in ready:
    if task["id"] not in task_ids:
        continue   # the list holds every uncollected task on the account
    payload = requests.get(
        "https://api.dataforseo.com" + task["endpoint_regular"],
        headers=HEADERS, timeout=120,
    ).json()
    items = payload["tasks"][0]["result"][0]["items"]
    print(task["id"], [i["rank_group"] for i in items if i["domain"] == "stripe.com"])

If you would rather not poll, set postback_url or pingback_url when you post the task and we push the result to your server the moment it is ready. Our article on pingbacks and postbacks covers the setup.

Price usually decides between the two methods. In the runs above, the same keyword at the same depth cost $0.0035 through the live endpoint and $0.00105 through the Standard method, roughly 70% less in exchange for results that arrive a couple of minutes later rather than instantly.

Cut the cost per check further

We bill per SERP page crawled, so the depth parameter is the main lever on price. Live requests accept a depth value of up to 200 and Google Organic SERP Task POST up to 700, though tracking the full range daily is mostly money spent confirming what you knew yesterday.

Three parameters narrow the crawl. The max_crawl_pages parameter caps how many pages we fetch. The search_param with start= skips ahead, which helps when a page sits around position 24 and the two pages above it tell you nothing. Ranks then count from the first crawled page, so "rank_absolute": 1 means position 21. Finally, the stop_crawl_on_match parameter halts the crawl the moment a listed domain shows up, and find_targets_in keeps the match to the element types you care about.

{
  "keyword": "online payment processing",
  "location_code": 2840,
  "language_code": "en",
  "depth": 30,
  "search_param": "start=20",
  "max_crawl_pages": 3,
  "stop_crawl_on_match": [
    {"match_value": "stripe.com", "match_type": "with_subdomains"}
  ],
  "find_targets_in": ["organic"]
}

More on each in our Help Center articles on max crawl pages, Google search engine parameters, and the stop_crawl_on_match parameter.

Four mistakes that break Python rank checks

  1. Reporting rank_absolute as the organic position. AI Overviews, People Also Ask blocks and featured ads all take up absolute slots. In the response above, stripe.com holds organic position 1 while its absolute position reads 2. Take rank_group from items whose type is organic.
  2. Sending several keywords to a live endpoint in one call. Each live SERP API call carries exactly one task. Batching is what Google Organic SERP Task POST is for, at up to 100 tasks per call.
  3. Polling Task GET in a tight loop. A task still in the queue returns status code 40602 and the message “Task In Queue.” Ask Google Organic SERP Tasks Ready instead, or let a postback deliver the result.
  4. Comparing positions collected under different settings. location_code, language_code, device and os each change the SERP. Store them alongside every position you save, or your trend line will move for reasons that have nothing to do with rankings.

Wrap up

Getting Google rankings with Python comes down to one endpoint, a base64 credential string, and knowing which of the two rank fields to read. After that the same request shape stretches in whichever direction you need. Add target when only one domain matters. Move to Google Organic SERP Task POST when one keyword turns into a thousand, and use the crawl controls when the bill matters more than the extra depth. You never have to run a proxy pool or repair a parser.

Registration takes a minute and comes with a testing credit, so you can try for free and run every snippet here against live Google data.

Embed DataForSeo widget on your website


Embed code:
Preview: