What SEO Data Can Be Retrieved via OpenSEO's DataForSEO Integration?
OpenSEO's DataForSEO integration exposes nine major data categories through a typed TypeScript client, including live SERP results, backlink profiles, keyword insights, Google Ads metrics, Lighthouse audits, and AI-generated SEO recommendations.
The OpenSEO platform wraps the DataForSEO REST API behind a clean, modular client architecture. This integration allows users to programmatically access enterprise-grade SEO data without managing low-level API authentication or response parsing. Every data category maps to a dedicated module in src/server/lib/dataforseo/, with zod schemas ensuring runtime type safety.
SERP Data: Organic, Local, and Rank-Check Results
The SERP module (src/server/lib/dataforseo/serp.ts) handles all search engine results page queries. Three primary data types are available:
- Live organic results (
serp.live) — Real-time SERP snapshots for any keyword and location combination - Rank-check SERP snapshots (
serp.rankCheck) — Historical or cached SERP data for position tracking - Local SERP results (
serp.local) — Map pack and geographically targeted search results
import { createDataforseoClient } from '@/server/lib/dataforseo';
const client = createDataforseoClient(billingCustomer);
const serpResult = await client.serp.live({
target: 'https://example.com',
country: 2840, // United States location code
language: 'en',
columns: ['backlinks', 'rank_changes'],
});
console.log(serpResult.items);
Location and language codes are managed separately in src/server/lib/dataforseo/serp-locations.ts.
DataForSEO Labs: Keyword and Domain Intelligence
The Labs module (src/server/lib/dataforseo/labs.ts) provides the most comprehensive keyword research data in the integration:
- Keyword suggestions and related keyword ideas
- Keyword overview (search volume, CPC, competition level)
- Domain rank overview (top-performing keywords for any domain)
- Ranked keywords list for competitive analysis
- Relevant pages (URLs ranking for a specific keyword)
- SERP competitors identification
- Keyword metrics with trending data (CPC trends, volume trends)
const overview = await client.labs.keywordOverview({
target: 'open source seo',
language: 2840,
});
console.log(overview.search_volume, overview.cpc, overview.competition);
Backlink Profile Data
The backlinks module (src/server/lib/dataforseo/backlinks.ts) exposes complete link intelligence:
- Summary statistics — Total backlinks, broken backlinks, spam score
- Full backlink list — Individual link-level data
- Referring domains — Unique domain-level sources
- Domain-pages summary — Page-level breakdown
- Backlink history — Temporal trend data
const summary = await client.backlinks.summary({
target: 'example.com',
// exclude_internal_backlinks defaults to true
});
console.log('Backlinks:', summary.backlinks);
console.log('Spam score:', summary.backlinks_spam_score);
Google Ads Search Volume and Keyword Ideas
The Google Ads module (src/server/lib/dataforseo/google-ads.ts) bridges paid search data:
- Search volume, CPC, and competition metrics from Google Ads
- Keyword expansion and idea generation based on advertiser data
Business Data and Local SEO
The business module (src/server/lib/dataforseo/business.ts) covers local search presence:
- Business listings search
- Q&A content extraction
- Google My Business profile information
On-Page Performance: Lighthouse Audits
The Lighthouse module (src/server/lib/dataforseo/lighthouse.ts) retrieves Core Web Vitals and audit scores:
- Performance metrics
- Accessibility scores
- SEO-specific audits
- Best-practice evaluations
const lighthouse = await client.lighthouse({
target: 'https://example.com',
});
console.log(lighthouse.lhr.categories.seo.score);
AI-Generated SEO Recommendations
The AI module (src/server/lib/dataforseo/ai.ts) accesses DataForSEO's AI endpoint for automated optimization suggestions.
Client Architecture and Data Flow
Understanding the integration's structure helps clinicians debug and extend functionality:
| File | Responsibility |
|---|---|
src/server/lib/dataforseo/client.ts |
Factory function createDataforseoClient(billingCustomer) — creates per-customer authenticated instances |
src/server/lib/dataforseo/sections.ts |
Re-exports all data modules (serp, backlinks, labs, google-ads, business, lighthouse, ai) |
src/server/lib/dataforseo/core.ts |
Instantiates raw SDK objects (serpApi, backlinksApi, labsApi, etc.) |
src/server/lib/dataforseo/envelope.ts |
Response validation, error handling with assertOk/assertOptions, billing metadata attachment |
The client implements lazy loading — the underlying SDK initializes only when specific data is requested, minimizing runtime overhead. All responses pass through zod schema validation (e.g., backlinksSummaryItemSchema, serpSnapshotItemSchema) before reaching application code.
Billing Integration
Every data request carries billing metadata through the envelope system. The path and costUsd fields in src/server/lib/dataforseo/envelope.ts enable per-request cost tracking and credit consumption modeling.
Summary
- Nine data categories are available: SERP, Labs, Backlinks, Google Ads, Business, Lighthouse, AI, Appendix, and SERP Locations
- Type-safe client created via
createDataforseoClient()inclient.tswith per-customer API key injection - Modular architecture with dedicated files for each data domain in
src/server/lib/dataforseo/ - Runtime validation via zod schemas ensures API contract compliance
- Billing-aware design tracks costs per request through the envelope system
Frequently Asked Questions
How does OpenSEO authenticate with DataForSEO?
Authentication happens through the createDataforseoClient() factory in src/server/lib/dataforseo/client.ts. This function accepts a billingCustomer object and injects the appropriate API key and billing context into each request. The client is instantiated per-customer, ensuring proper access control and usage tracking.
What is the difference between serp.live and serp.rankCheck?
serp.live fetches real-time organic search results from DataForSEO's live crawling infrastructure, while serp.rankCheck retrieves cached or historical SERP snapshots suitable for position tracking workflows. Both are implemented in src/server/lib/dataforseo/serp.ts but map to different DataForSEO endpoints with distinct pricing and latency characteristics.
Can I retrieve historical backlink data through OpenSEO?
Yes. The client.backlinks.history method in src/server/lib/dataforseo/backlinks.ts exposes temporal backlink trends. This complements the snapshot data from summary and backlinks methods, enabling trend analysis and link velocity calculations.
Is there a way to get keyword data without live SERP crawling?
Absolutely. The Labs endpoints in src/server/lib/dataforseo/labs.ts provide keyword research data—search volume, CPC, competition, suggestions—without triggering a full SERP crawl. These endpoints are typically faster and more cost-effective for pure keyword intelligence versus live competitive analysis.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →