DataForSEO CLI for AI agents — SERP, Keywords, Site Audit, Backlinks from your terminal
Project description
dfseo-cli — DataForSEO CLI for AI Agents
SEO data from your terminal. JSON-first for agents, human-friendly for you.
# Auto-detects your terminal — outputs table for humans, JSON for pipes
dfseo serp google "sovranità digitale" --location Italy
Installation
pip install dfseo
Quick Start
Set your DataForSEO credentials:
# Via environment variables (recommended for agents)
export DATAFORSEO_LOGIN="your@email.com"
export DATAFORSEO_PASSWORD="your_api_password"
# Or via interactive setup
dfseo auth setup
Test your setup:
dfseo auth status
Usage Examples
Google SERP
# Basic search — auto-detects output format (table in terminal)
dfseo serp google "email hosting provider"
# With location and language
dfseo serp google "email hosting" --location "Italy" --language "Italian"
# Force JSON for scripting
dfseo serp google "email hosting" --output json | jq '.organic_results[0].url'
# CSV for Excel import
dfseo serp google "email hosting" --output csv > results.csv
Example output:
Query: email hosting provider
Location: Italy | Language: Italian | Device: desktop
Results: 100 | Cost: $0.0020
SERP Features: featured_snippet, people_also_ask
┏━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ # ┃ Domain ┃ Title / Description ┃
┡━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 1 │ example.com │ Best Email Hosting Provider 2026 │
│ │ │ Compare the top email hosting services... │
│ 2 │ another.com │ Email Hosting for Small Business │
│ │ │ Affordable and reliable email solutions... │
└────┴────────────────┴────────────────────────────────────────────────┘
Keyword Research
# Get search volume and keyword difficulty
dfseo keywords volume "email hosting" "smtp provider" "email server" \
--location "Italy"
# Find long-tail keyword suggestions
dfseo keywords suggestions "email hosting" \
--min-volume 100 \
--max-difficulty 40 \
--limit 50
# Bulk keyword difficulty (up to 1000 keywords)
dfseo keywords difficulty --from-file keywords.txt --location "Italy"
Site Audit
# Full site audit (crawls up to 100 pages)
dfseo site audit "example.com" --max-pages 100
# Quick single-page check
dfseo site audit "https://example.com/page" --max-pages 1
# With JavaScript execution
dfseo site audit "example.com" --enable-javascript --load-resources
Backlink Analysis
# Backlink profile summary
dfseo backlinks summary "example.com"
# List backlinks with filters
dfseo backlinks list "example.com" --dofollow-only --sort rank --limit 50
# Referring domains
dfseo backlinks referring-domains "example.com" --min-backlinks 5
# Link gap analysis (find competitor backlinks you're missing)
dfseo backlinks gap "your-site.com" "competitor1.com" "competitor2.com"
Compare Search Engines
dfseo serp compare "email hosting" --engines google,bing --location "Italy"
Available Locations & Languages
# List all locations
dfseo serp locations
# Search for specific location
dfseo serp locations --search "italy"
# List languages
dfseo serp languages --search "italian"
Output Formats
The CLI auto-detects your environment:
- Interactive terminal →
table(human-readable, uses rich) - Pipe/redirect →
json(compact, machine-readable)
Override with --output:
dfseo serp google "keyword" --output json # Force JSON
dfseo serp google "keyword" --output json-pretty # Indented JSON
dfseo serp google "keyword" --output table # Human table
dfseo serp google "keyword" --output csv # CSV export
Configuration
Set defaults to avoid repeating flags:
# Set defaults
dfseo config set location "Italy"
dfseo config set language "Italian"
dfseo config set device desktop
# Show current config
dfseo config show
Now you can run:
dfseo serp google "keyword" # Uses Italy/Italian/desktop automatically
Authentication Priority
Credentials are resolved in this order:
- CLI flags —
--loginand--password - Environment variables —
DATAFORSEO_LOGINandDATAFORSEO_PASSWORD - Config file —
~/.config/dfseo/config.toml
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Generic error |
| 2 | Authentication error (check credentials) |
| 3 | Rate limit exceeded (wait and retry) |
| 4 | Invalid parameters |
| 5 | Insufficient balance (add funds) |
API Coverage
| API | Commands | Status |
|---|---|---|
| SERP | google, bing, youtube, compare, locations, languages | ✅ |
| Keywords | volume, suggestions, ideas, difficulty, search-intent, for-site, ads-volume, ads-suggestions | ✅ |
| On-Page | crawl, summary, audit, pages, links, duplicates, redirects, non-indexable, resources, lighthouse, tasks | ✅ |
| Backlinks | summary, list, anchors, referring-domains, gap, bulk | ✅ |
For AI Agents
# JSON output for parsing
dfseo serp google "keyword" --output json | jq -r '.organic_results[0].url'
# Quiet mode (no progress bars)
dfseo serp google "keyword" --quiet
# Check SKILL.md for integration examples
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dfseo-1.1.0.tar.gz.
File metadata
- Download URL: dfseo-1.1.0.tar.gz
- Upload date:
- Size: 260.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ceee3c182f3a8e08d9ace7ce3e6d074669559c8d713fff3912bc11946045c9e
|
|
| MD5 |
6beba4f2f77ed8728234d5742b492c91
|
|
| BLAKE2b-256 |
c160cffb6130b130584da48318fefef592c5b7bd88a38e3a5fd685f50fb81715
|
Provenance
The following attestation bundles were made for dfseo-1.1.0.tar.gz:
Publisher:
publish.yml on ricca91/dfseo-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dfseo-1.1.0.tar.gz -
Subject digest:
8ceee3c182f3a8e08d9ace7ce3e6d074669559c8d713fff3912bc11946045c9e - Sigstore transparency entry: 1155477338
- Sigstore integration time:
-
Permalink:
ricca91/dfseo-cli@8e55831e2be0f82e95bc2e15c2d158cd93ade291 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/ricca91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e55831e2be0f82e95bc2e15c2d158cd93ade291 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dfseo-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dfseo-1.1.0-py3-none-any.whl
- Upload date:
- Size: 73.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
135b64ccc505b9bb1f56a3f059a1ff010f967b5513fca943f6f57a4aaf38a93d
|
|
| MD5 |
95d82bcf566e1b1e837522202b7e3bd3
|
|
| BLAKE2b-256 |
309c05195491bcc3a62a46e0b00231888824e1d42f0c5fa0abe22cbd1d6ed19c
|
Provenance
The following attestation bundles were made for dfseo-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on ricca91/dfseo-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dfseo-1.1.0-py3-none-any.whl -
Subject digest:
135b64ccc505b9bb1f56a3f059a1ff010f967b5513fca943f6f57a4aaf38a93d - Sigstore transparency entry: 1155477345
- Sigstore integration time:
-
Permalink:
ricca91/dfseo-cli@8e55831e2be0f82e95bc2e15c2d158cd93ade291 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/ricca91
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e55831e2be0f82e95bc2e15c2d158cd93ade291 -
Trigger Event:
release
-
Statement type: