RankParse

Python SDK

Official Python SDK for the RankParse API. Sync and async clients, single dependency (httpx).

Installation

pip install rankparse
uv add rankparse
poetry add rankparse

Requires Python 3.9+. Single runtime dependency: httpx. See the Python landing page for framework-specific examples.

Quick start

from rankparse import RankParseClient

client = RankParseClient(api_key="rp_...")

result = client.domain_authority("github.com")
print(result["data"]["score"])          # 94
print(result["credits_remaining"])      # 9995

Async client

import asyncio
from rankparse import AsyncRankParseClient

async def main():
    async with AsyncRankParseClient(api_key="rp_...") as client:
        result = await client.domain_authority("github.com")
        print(result["data"]["score"])

asyncio.run(main())

Configuration

from rankparse import RankParseClient

client = RankParseClient(
    api_key="rp_...",
    base_url="https://api.rankparse.com/v1",  # optional override
    timeout=30.0,                              # seconds, default 30
)

Context managers

# Sync
with RankParseClient(api_key="rp_...") as client:
    result = client.backlinks("stripe.com")

# Async
async with AsyncRankParseClient(api_key="rp_...") as client:
    result = await client.backlinks("stripe.com")

Error handling

from rankparse.errors import AuthError, InsufficientCreditsError, RateLimitError

try:
    result = client.backlinks("stripe.com")
except AuthError:
    print("Invalid API key")
except InsufficientCreditsError:
    print("Top up at rankparse.com/dashboard")
except RateLimitError:
    print("Back off and retry")

All methods

MethodEndpointCredits
backlinks(domain, *, limit, offset, sort, from_domain, link_type)GET /backlinks2
referring_domains(domain, *, limit, offset)GET /referring-domains2
outbound_links(domain, *, limit)GET /outbound-links2
anchor_text(domain, *, limit)GET /anchor-text2
link_intersect(domain_a, domain_b, *, limit)GET /link-intersect5
link_velocity(domain)GET /link-velocity0 (v2)
new_links(domain)GET /new-links0 (v2)
lost_links(domain)GET /lost-links0 (v2)

Domain intelligence

MethodEndpointCredits
domain_authority(domain)GET /domain-authority1
domain_rank(domain)GET /domain-rank2
domain_overlap(domains, *, limit)GET /domain-overlap5
similar_domains(domain, *, limit)GET /similar-domains5
competitor_gap(domain, vs, *, limit)GET /competitor-gap5
link_audit(domain)GET /link-audit8
site_explorer(domain, *, limit)GET /site-explorer10

Page & site

MethodEndpointCredits
page_seo(url)GET /page-seo3
page_performance(url, *, strategy)GET /page-performance3
tech_stack(url)GET /tech-stack2
site_health(domain)GET /site-health2
sitemap(domain)GET /sitemap2
crawl_history(domain, *, limit, offset)GET /crawl-history2
top_pages(domain, *, limit)GET /top-pages2
schema_markup(url)GET /schema-markup2
internal_links(url, *, limit, offset)GET /internal-links0 (v2)

Batch & dashboard

MethodDescription
batch(domains)Backlinks for up to 50 domains in one call, 2 credits per successful domain
me()Current user profile + credit balance
credits()Credit balance
keys()List API keys
create_key(name)Create a new API key
revoke_key(key_id)Revoke an API key
usage(*, limit, offset)Paginated usage logs

Method parameters mirror the matching endpoint pages, and every response keeps the API's envelope (data, credits_used, credits_remaining).

Calling endpoints not yet wrapped

The method tables above list what the SDK wraps. Any endpoint without a method, for example page-performance if your installed version lacks it, IndexNow, Google Search Console or rank tracking, can be called over plain HTTP with the same API key. httpx is already installed with the SDK:

Plain HTTP call
import os
import httpx

BASE = "https://api.rankparse.com/v1"
headers = {"X-API-Key": os.environ["RANKPARSE_API_KEY"]}

# GET with query parameters
resp = httpx.get(
    f"{BASE}/page-performance",
    params={"url": "https://stripe.com", "strategy": "desktop"},
    headers=headers,
    timeout=60,
)
if resp.is_error:
    err = resp.json()  # {"error": ..., "code": ..., "message": ...}
    raise RuntimeError(f"{resp.status_code} {err['code']}")
body = resp.json()
print(body["data"]["performance_score"], body["credits_remaining"])

# POST with a JSON body
httpx.post(
    f"{BASE}/indexnow",
    json={"urls": ["https://example.com/new-page"]},
    headers=headers,
    timeout=60,
)

For async code, use httpx.AsyncClient the same way. Errors use the shape documented in Errors; branch on code. The SDK's own exception classes only cover the errors it maps.

Pagination

List endpoints accept limit (default 100, max 1000, larger values are clamped):

links = client.backlinks("stripe.com", limit=500)

The link-graph endpoints return the top limit rows rather than pages, so there is no offset to walk. Only endpoints that document an offset parameter, such as rank tracking and usage, paginate. See Response format.

Batch lookup

batch(domains) takes a list of up to 50 domain strings and runs a backlinks lookup for each one. It is a wrapper for POST /v1/batch and needs SDK version 0.1.1 or later. It does not take mixed endpoints or per-domain options; for those, call the individual methods.

result = client.batch(["stripe.com", "github.com", "vercel.com"])

for item in result["data"]:
    if item["success"]:
        print(item["domain"], item["total"], "backlinks returned")
    else:
        print(item["domain"], "failed:", item["error"])

print(result["credits_used"], result["credits_remaining"])

The async client has the same method: await client.batch(domains).

Return value: the standard response envelope. result["data"] holds one entry per valid input domain, in input order. Each entry has domain, success, total and data (up to 100 backlink rows), plus an error string when success is False. credits_used and credits_remaining sit beside data.

Credits and limits:

  • 2 credits per domain that succeeds. Failed domains are not charged.
  • 50 domains per call, after invalid entries are dropped. Chunk longer lists.
  • Rate limit: 60 requests per minute per key, and a batch counts as one request.

Errors: a failing domain does not raise, so check success on each entry. Request-level problems raise: InsufficientCreditsError (402), RateLimitError (429), AuthError (401), or APIError for the rest, such as invalid_domains or too_many_domains (400). See the batch endpoint page for the full response shape.

Pandas enrichment

import pandas as pd
from rankparse import RankParseClient

client = RankParseClient(api_key="rp_...")

df = pd.read_csv("domains.csv")
df["score"] = df["domain"].apply(
    lambda d: client.domain_authority(d)["data"]["score"]
)
df.sort_values("score", ascending=False).to_csv("enriched.csv")

Source & issues

GitHub: abhibavishi/rankparse-python

On this page