Skip to main content

Command-line interface for the OpenAlex API

Project description

openalexcli

Command-line interface for the OpenAlex API.

Installation

pip install openalexcli

For development:

pip install -e .

Usage

Search for works

# Basic search
openalexcli search "machine learning"

# With filters
openalexcli search "transformers" --from-date 2020-01-01 --min-citations 100

# Open access only
openalexcli search "climate change" --open-access

# Output as JSON (auto-detected when piped)
openalexcli search "neural networks" --json

# Output as BibTeX
openalexcli search "attention mechanism" --bibtex

# Group by field (aggregated statistics)
openalexcli search "CRISPR" --group-by publication_year

# Use raw OpenAlex filter syntax
openalexcli search "deep learning" --filter "type:article,is_oa:true"

Get work details

# By OpenAlex ID
openalexcli work W2741809807

# By DOI
openalexcli work "10.1038/nature12373"

# Multiple works
openalexcli work W2741809807 W2100837269

# Export as BibTeX
openalexcli bibtex W2741809807 W2100837269

Citations and references

# Get works that cite a paper
openalexcli citations W2741809807

# Get works cited by a paper
openalexcli references W2741809807

Author commands

# Get author by ID or ORCID
openalexcli author get A5023888391
openalexcli author get "0000-0002-1825-0097"

# Search authors
openalexcli author search "Yann LeCun"

# Get author's works
openalexcli author works A5023888391 --from-date 2020-01-01

# Group author's works by year
openalexcli author works A5023888391 --group-by publication_year

Institution commands

# Get institution by ID or ROR
openalexcli institution get I136199984
openalexcli institution get "ror:03vek6s52"

# Search institutions
openalexcli institution search "MIT"

# Get works from an institution
openalexcli institution works I136199984 --from-date 2023-01-01

Source (journal) commands

# Get source by ID or ISSN
openalexcli source get S137773608
openalexcli source get "0028-0836"

# Search sources
openalexcli source search "Nature"

# Get works from a source
openalexcli source works S137773608 --from-date 2024-01-01

Output Formats

The CLI automatically selects the best output format:

  • Terminal: Human-readable tables (using Rich)
  • Piped output: Compact JSON for machine consumption
  • --json: Force JSON output
  • --bibtex: BibTeX citations (works only)

Polite Pool

OpenAlex provides higher rate limits when you identify yourself with an email:

# Per command
openalexcli search "query" --email your@email.com

# Or set environment variable
export OPENALEX_EMAIL="your@email.com"
openalexcli search "query"

Filter Syntax

Use --filter to pass raw OpenAlex filter expressions:

# Multiple filters (AND)
openalexcli search "AI" --filter "type:article,cited_by_count:>100"

# OR within a filter
openalexcli search "AI" --filter "publication_year:2023|2024"

# Negation
openalexcli search "AI" --filter "type:!book"

See OpenAlex filter documentation for all options.

Group By

Get aggregated statistics instead of individual results:

# Works by type
openalexcli search "machine learning" --group-by type

# Works by year
openalexcli search "quantum computing" --group-by publication_year

# Works by institution
openalexcli search "CRISPR" --group-by authorships.institutions.id

# Author's works by open access status
openalexcli author works A5023888391 --group-by open_access.is_oa

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

openalexcli-0.1.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

openalexcli-0.1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file openalexcli-0.1.1.tar.gz.

File metadata

  • Download URL: openalexcli-0.1.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for openalexcli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f128aea698dc8deef792922790582ee980dcd358e348e45181de7f922bb4c6e8
MD5 7d6ab048a37bb4936582dc1e596d36ad
BLAKE2b-256 61b8e417a115f949f48e4ad69066248da41b5ead9ac5dc8524c7822b9391dc17

See more details on using hashes here.

File details

Details for the file openalexcli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: openalexcli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for openalexcli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 130594da555f3aa36520a0f3a6d8965f1a9ca7d0aeee9f4642c2178bce0e565e
MD5 4c86c6f134df0777b376d84fb8038702
BLAKE2b-256 1380799de021f478f3779f807d66883d430804700548c31b6b86522cea6c238a

See more details on using hashes here.

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