Skip to main content

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 terminaltable (human-readable, uses rich)
  • Pipe/redirectjson (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:

  1. CLI flags--login and --password
  2. Environment variablesDATAFORSEO_LOGIN and DATAFORSEO_PASSWORD
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfseo-1.0.0.tar.gz (181.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dfseo-1.0.0-py3-none-any.whl (86.0 kB view details)

Uploaded Python 3

File details

Details for the file dfseo-1.0.0.tar.gz.

File metadata

  • Download URL: dfseo-1.0.0.tar.gz
  • Upload date:
  • Size: 181.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dfseo-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1a2ea67cf6a1b42cb0a8d61d41106e06c5cde9ae5d81a90979a69acc07a53edf
MD5 50eaf0fc01160dc156e83882816878fb
BLAKE2b-256 3ba49bdcd2f65f91f3a8e47c70f27c44c3ab83061edb3e25b7f93a171692e279

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfseo-1.0.0.tar.gz:

Publisher: publish.yml on ricca91/dfseo-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dfseo-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dfseo-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 86.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dfseo-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20271b58c3eeab3ef1ad07bb004ada68534fd946509a9e99dac202f5c0b355d4
MD5 2e60c096ec7ed583495bf9098658699b
BLAKE2b-256 4fb2eda76d40f4a817789e9be6e2820900f070d31b44ef1686b044292094779d

See more details on using hashes here.

Provenance

The following attestation bundles were made for dfseo-1.0.0-py3-none-any.whl:

Publisher: publish.yml on ricca91/dfseo-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page