data-for-seo
data-for-seo is a Rust client library for the DataForSEO API v3. It covers every API domain of v3 with typed request/response models, while staying resilient to API changes (unknown fields and item types never break deserialization).
[]
= "0.3"
Quick start
use ;
async
The client is organized by API domain, mirroring the DataForSEO documentation:
client.serp().google() client.dataforseo_labs().google()
client.serp().bing() client.dataforseo_labs().amazon()
client.serp().youtube() client.dataforseo_labs().apple()
client.keywords_data().google_ads()
client.keywords_data().bing() client.merchant().amazon()
client.on_page() client.merchant().google()
client.backlinks() client.app_data().google()
client.domain_analytics().technologies()
client.content_analysis() client.business_data().google()
client.content_generation() client.ai_optimization().chat_gpt()
Task-based endpoints
Many endpoints follow DataForSEO's task flow (task_post → tasks_ready → task_get):
use ;
async
Response helpers
Every call returns DataForSeoApiResponse<T> (= Result<DataForSeoApiResponseData<T>, DataForSeoError>). The response data exposes:
response.tasks()— all tasks as a slice (never panics onnull)response.results()/response.into_results()— iterate every result of every taskresponse.first_result()— first result across all taskstask.results(),task.is_success(),task.task_status()— per-task access
Credentials
You need a DataForSEO account (affiliate link) to get API credentials.
Pass your API login and password directly (DataForSeoClient::new), or read them
from the DATAFORSEO_LOGIN / DATAFORSEO_PASSWORD environment variables:
use DataForSeoClient;
let client = from_env?; // DATAFORSEO_LOGIN / DATAFORSEO_PASSWORD
Sandbox
DataForSEO's sandbox is free and returns mock data:
use DataForSeoClient;
let client = new.sandbox;
Error handling
DataForSeoError implements std::error::Error and distinguishes:
Api— the API returned an error envelope (status_code,status_message, see error codes)Http— a non-JSON HTTP failureSystem— transport or deserialization failure
Supported API domains (all v3 domains)
| Domain | Coverage |
|---|---|
| SERP | Google (Organic, AI Mode, Maps, Local Finder, News, Events, Images, Jobs, Autocomplete, Dataset Search/Info, Ads Advertisers, Ads Search), Bing, YouTube (Organic, Video Info/Subtitles/Comments), Baidu, Yahoo, Seznam, Naver |
| Keywords Data | Google Ads (Search Volume, Keywords For Site/Keywords, Ad Traffic), Bing (Search Volume, Keyword Performance, Search Volume History, Keyword Suggestions For URL, Audience Estimation, ...), Google Trends, DataForSEO Trends, Clickstream Data |
| DataForSEO Labs | Google (Ranked Keywords, Keyword Ideas/Suggestions, Related Keywords, Competitors, Domain/Page Intersection, Traffic Estimation, Search Intent, Historical data, ...), Amazon, Apple App Store |
| Backlinks | Summary, History, Backlinks, Anchors, Domain Pages, Referring Domains/Networks, Competitors, Intersections, Timeseries, Bulk endpoints, Index |
| OnPage | Task Post, Summary, Pages, Resources, Links, Duplicate Tags/Content, Redirect Chains, Non-Indexable, Waterfall, Keyword Density, Microdata, Raw HTML, Screenshot, Content Parsing, Instant Pages, Lighthouse |
| Domain Analytics | Technologies (full), Whois |
| Content Analysis | Search, Summary, Sentiment Analysis, Rating Distribution, Phrase/Category Trends |
| Content Generation | Generate (Text/Meta Tags/Sub Topics), Paraphrase, Check Grammar, Text Summary |
| Merchant | Amazon (Products, ASIN, Sellers), Google Shopping (Products, Sellers, Product Spec/Info) |
| App Data | Google Play, Apple App Store (App Searches, App List, App Info, App Reviews) |
| Business Data | Google (My Business, Hotels, Reviews, Q&A), Trustpilot, Tripadvisor, Social Media, Business Listings |
| AI Optimization | AI Keyword Data, LLM Mentions, LLM Responses (ChatGPT, Claude, Gemini, Perplexity), LLM Scraper |
A few endpoints whose response schema is not documented return serde_json::Value so the raw data is still accessible.
Examples
Runnable examples for the most common workflows live in examples/:
quick_start.rs— minimal setup: live call + posting a taskserp_live.rs— check Google rankings with one live request, matching SERP item typesserp_task_flow.rs— the full task flow: post → polltasks_ready→ fetch resultskeywords_search_volume.rs— Google Ads search volume for a keyword listbacklinks_overview.rs— backlink profile: summary, referring domains, newest linkslabs_keyword_research.rs— keyword ideas and related keywords with metricsonpage_audit.rs— crawl a site and read OnPage scores per page
DATAFORSEO_LOGIN=... DATAFORSEO_PASSWORD=...
Testing
License
MIT