RankParse

Node.js SDK

Official TypeScript SDK for the RankParse API. Zero dependencies, dual ESM/CJS, typed responses.

Installation

npm install rankparse
pnpm add rankparse
yarn add rankparse

Requires Node.js 18+. No runtime dependencies; it uses native fetch. See the Node.js landing page for framework-specific examples.

Quick start

import { RankParse } from 'rankparse';

const client = new RankParse({ apiKey: process.env.RANKPARSE_API_KEY! });

const result = await client.domainAuthority('github.com');
console.log(result.data.score);          // 94
console.log(result.credits_remaining);  // 9995

CommonJS

const { RankParse } = require('rankparse');

const client = new RankParse({ apiKey: process.env.RANKPARSE_API_KEY });

Configuration

const client = new RankParse({
  apiKey: 'rp_...',
  baseUrl: 'https://api.rankparse.com/v1', // optional override
  timeout: 30_000,                          // ms, default 30s
});

Error handling

import { RankParse, AuthError, InsufficientCreditsError, RateLimitError } from 'rankparse';

try {
  const result = await client.backlinks('stripe.com');
} catch (err) {
  if (err instanceof AuthError) {
    // Invalid API key
  } else if (err instanceof InsufficientCreditsError) {
    // Top up at rankparse.com/dashboard
  } else if (err instanceof RateLimitError) {
    // Back off and retry
  }
}

All methods

MethodEndpointCredits
backlinks(domain, opts?)GET /backlinks2
referringDomains(domain, opts?)GET /referring-domains2
outboundLinks(domain, opts?)GET /outbound-links2
anchorText(domain, opts?)GET /anchor-text2
linkIntersect(domainA, domainB, opts?)GET /link-intersect5
linkVelocity(domain)GET /link-velocity0 (v2)
newLinks(domain)GET /new-links0 (v2)
lostLinks(domain)GET /lost-links0 (v2)

Domain intelligence

MethodEndpointCredits
domainAuthority(domain)GET /domain-authority1
domainRank(domain)GET /domain-rank2
domainOverlap(domains[], opts?)GET /domain-overlap5
similarDomains(domain, opts?)GET /similar-domains5
competitorGap(domain, vs, opts?)GET /competitor-gap5
linkAudit(domain)GET /link-audit8
siteExplorer(domain, opts?)GET /site-explorer10

Page & site

MethodEndpointCredits
pageSeo(url)GET /page-seo3
pagePerformance(url, opts?)GET /page-performance3
techStack(url)GET /tech-stack2
siteHealth(domain)GET /site-health2
sitemap(domain)GET /sitemap2
crawlHistory(domain, opts?)GET /crawl-history2
topPages(domain, opts?)GET /top-pages2
schemaMarkup(url)GET /schema-markup2
internalLinks(url, opts?)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
createKey(name?)Create a new API key
revokeKey(keyId)Revoke an API key
usage(opts?)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. Node 18+ has fetch built in:

Plain HTTP call
const BASE = "https://api.rankparse.com/v1";
const headers = { "X-API-Key": process.env.RANKPARSE_API_KEY! };

// GET with query parameters
const params = new URLSearchParams({ url: "https://stripe.com", strategy: "desktop" });
const res = await fetch(`${BASE}/page-performance?${params}`, { headers });
if (!res.ok) {
  const err = await res.json(); // { error, code, message? }
  throw new Error(`${res.status} ${err.code}`);
}
const { data, credits_remaining } = await res.json();

// POST with a JSON body
const submit = await fetch(`${BASE}/indexnow`, {
  method: "POST",
  headers: { ...headers, "Content-Type": "application/json" },
  body: JSON.stringify({ urls: ["https://example.com/new-page"] }),
});

Errors use the shape documented in Errors; branch on code. The SDK's own error classes only cover the errors it maps.

Pagination

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

const links = await 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: string[]) takes up to 50 domains 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.

const result = await client.batch(['stripe.com', 'github.com', 'vercel.com']);

for (const item of result.data) {
  console.log(item.domain, item.success ? item.total : item.error);
}

console.log(result.credits_used, result.credits_remaining);

Return value: Promise<ApiResponse<BatchResultItem[]>>, the standard envelope. result.data holds one entry per valid input domain, in input order. Each BatchResultItem has domain, success, and optional total, data (up to 100 backlink rows) and error (set when success is false).

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 throw, so check success on each entry. Request-level problems throw: 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.

Source & issues

GitHub: abhibavishi/rankparse-node

On this page