openalex-api¶
Turns bibliometric questions into reproducible OpenAlex REST pulls (works, authors, institutions, sources, concepts, topics, funders, publishers) through a bundled scripts/query_openalex.py that builds filter-safe URLs, handles cursor pagination, and writes JSON/JSONL. Keep the raw export before cleaning, use repeated --filter flags for AND logic, and validate IDs, dates, citation counts and authorships before analysis.
literatureMIT (repo LICENSE, "Copyright (c) 2026 John Barrios"). The vendored third-party skills keep their own terms: the Anthropic document skills say "Proprietary. LICENSE.txt has complete terms", and the K-Dense skills carry per-library licence lines.literature-discoveryBarrios Skills — John Barrios's curated workflow for economists and accountants. Prioritize reproducible empirical work, clear identification language, and journal-ready output.
OpenAlex API¶
Overview¶
Use this skill to turn research questions into reliable OpenAlex API queries and structured outputs. Prefer scripts/query_openalex.py for repeatable retrieval, pagination, and filter-safe URL construction.
Workflow¶
- Define the target entity:
works,authors,institutions,sources,concepts,topics,funders, orpublishers. - Define retrieval scope: exact ID lookup, search, or filtered dataset pull.
- Build query parameters with
scripts/query_openalex.pyinstead of handcrafting URLs. - Retrieve data to JSON/JSONL and keep the raw export before downstream cleaning.
- Validate key fields (IDs, dates, citation counts, authorships) before analysis.
Query Rules¶
- Use repeated
--filterflags for AND logic. - Use OpenAlex pipe syntax (for example
value1|value2) inside one filter for OR logic. - Use
--selectto reduce payload size for large pulls. - Use
--cursor '*'for deep paging beyond basic page limits. - Include
--mailto you@domain.edufor polite-pool style identification. - Use
OPENALEX_API_KEYor--api-keywhen available for higher-rate access.
Common Commands¶
## Fetch one work by OpenAlex ID
python3 scripts/query_openalex.py works --entity-id W2741809807 --select "id,display_name,publication_year,cited_by_count"
## Search works and save first 200 records
python3 scripts/query_openalex.py works \
--search "political polarization" \
--filter "from_publication_date:2020-01-01" \
--sort "cited_by_count:desc" \
--per-page 100 \
--pages 2 \
--output polarization_works.json
## Cursor-paginate author records to JSONL
python3 scripts/query_openalex.py authors \
--filter "last_known_institutions.country_code:US" \
--cursor "*" \
--max-results 500 \
--format jsonl \
--output us_authors.jsonl
Output Guidance¶
- Prefer JSON for full response bundles and JSONL for row-wise pipelines.
- Keep original IDs (
id,ids.openalex, DOI fields) unchanged in exports. - When reporting findings, cite exact query parameters used to ensure reproducibility.
Resources¶
- Use
scripts/query_openalex.pyfor all API calls. - Use
references/openalex-query-patterns.mdfor entity routing, filter templates, and reusable query patterns.