# Quick Recipes

Quick solutions for common OpenAlex tasks.

## Find works by an author (Under 1¢)

```bash
# Get all works by a specific author
https://api.openalex.org/works?filter=author.id:A5023888391&sort=-publication_date

# Get highly cited works by an author
https://api.openalex.org/works?filter=author.id:A5023888391,cited_by_count:>10&sort=-cited_by_count
```

To audit a profile end-to-end — find works that should be attached but aren't, plus works that are wrongly attached and should be removed — see the [Audit an Author Profile's Works recipe](/learn/audit-an-author-profiles-works/).

## Find works from an institution (Under 1¢)

```bash
# Works from Harvard
https://api.openalex.org/works?filter=institutions.id:I136199984&sort=-publication_date

# Open access works from MIT since 2020
https://api.openalex.org/works?filter=institutions.id:I63966007,open_access.is_oa:true,publication_year:>2019
```

## Find works on a topic (Under 1¢)

```bash
# Works about machine learning
https://api.openalex.org/works?filter=topics.id:T10000&sort=-cited_by_count

# Keyword search for "CRISPR"
https://api.openalex.org/works?search=CRISPR&sort=-relevance_score
```

## Find citations to a work (Under 1¢)

```bash
# Works that cite a specific paper
https://api.openalex.org/works?filter=cites:W2741809807&sort=-publication_date
```

## Find co-authors (Under 1¢)

```bash
# Other authors who published with a specific author
https://api.openalex.org/authors?filter=x_concepts.id:C41008148&sort=-works_count
```

## Find internationally co-authored works (Under 1¢)

Use `countries_distinct_count` to find works with authors from multiple countries — the standard scientometric definition of international collaboration.

```bash
# Indian articles co-authored with at least one non-Indian institution
https://api.openalex.org/works?filter=institutions.country_code:IN,countries_distinct_count:>1,type:article
```

## Get publication trends (Under 1¢)

```bash
# Count works per year (2020-2024)
https://api.openalex.org/works?filter=publication_year:2020-2024&group_by=publication_year

# Count open access works per year
https://api.openalex.org/works?filter=publication_year:2020-2024,open_access.is_oa:true&group_by=publication_year
```

## Find open access works (Under 1¢)

```bash
# All OA works from 2024
https://api.openalex.org/works?filter=publication_year:2024,open_access.is_oa:true

# Gold OA works (published in OA journals)
https://api.openalex.org/works?filter=open_access.oa_status:gold

# Works with CC-BY license
https://api.openalex.org/works?filter=best_oa_location.license:cc-by
```

## Find works with full text (Under 1¢)

```bash
# Works with downloadable PDFs
https://api.openalex.org/works?filter=has_content.pdf:true

# Works with abstracts
https://api.openalex.org/works?filter=has_abstract:true
```

## Get institution rankings (Under 1¢)

```bash
# Top US universities by citation count
https://api.openalex.org/institutions?filter=country_code:US,type:education&sort=-cited_by_count&per_page=20
```

## Get journal metrics (Under 1¢)

```bash
# Top journals by work count
https://api.openalex.org/sources?filter=type:journal&sort=-works_count&per_page=20

# Open access journals
https://api.openalex.org/sources?filter=type:journal,is_oa:true&sort=-works_count
```

## Batch fetch multiple IDs (Under 1¢)

Use the OR operator (`|`) to fetch up to 100 IDs at once:

```bash
# Get multiple works by DOI
https://api.openalex.org/works?filter=doi:https://doi.org/10.1234/a|https://doi.org/10.1234/b|https://doi.org/10.1234/c&per_page=100

# Get multiple authors by ORCID
https://api.openalex.org/authors?filter=orcid:0000-0001-2345-6789|0000-0002-3456-7890&per_page=100
```

## Random sample (Under 1¢)

```bash
# 100 random works from 2024
https://api.openalex.org/works?filter=publication_year:2024&sample=100&per_page=100&seed=42
```

## Combine filters (Under 1¢)

```bash
# Highly cited OA articles about cancer from 2023
https://api.openalex.org/works?search=cancer&filter=publication_year:2023,type:article,open_access.is_oa:true,cited_by_count:>50&sort=-cited_by_count
```

## Python example (~$2.12 for this query)

```python
import requests

def get_works(filter_str, per_page=100):
    """Fetch works with pagination."""
    url = "https://api.openalex.org/works"
    params = {
        "filter": filter_str,
        "per_page": per_page,
        "cursor": "*",
        "api_key": "YOUR_KEY"
    }

    all_works = []
    while True:
        response = requests.get(url, params=params).json()
        all_works.extend(response["results"])

        cursor = response["meta"].get("next_cursor")
        if not cursor:
            break
        params["cursor"] = cursor

    return all_works

# Get all 2024 works about AI
works = get_works("publication_year:2024,fulltext.search:artificial intelligence")
```

## Find funded works (Under 1¢)

Discover research funded by a specific organization or grant.

```bash
# Step 1: Find a funder by name
https://api.openalex.org/funders?search=national+institutes+of+health

# Step 2: Filter works funded by that funder (NIH = F4320306076)
https://api.openalex.org/works?filter=awards.funder_id:F4320306076&sort=-publication_date

# Step 3: Narrow to works acknowledging a specific grant number
https://api.openalex.org/works?filter=awards.funder_id:F4320306076,awards.funder_award_id:R01-GM123456

# Step 4: Combine with other filters — e.g., funded OA works from 2024
https://api.openalex.org/works?filter=awards.funder_id:F4320306076,publication_year:2024,open_access.is_oa:true&sort=-cited_by_count
```

## Explore publisher hierarchy (Under 1¢)

Navigate the parent-subsidiary structure of publishers.

```bash
# Step 1: Search for a publisher by name
https://api.openalex.org/publishers?search=elsevier

# Step 2: Get the publisher and check hierarchy_level and lineage
# (hierarchy_level 0 = top-level parent, 1+ = subsidiary)
https://api.openalex.org/publishers/P4310319965

# Step 3: List all subsidiaries of a parent publisher
https://api.openalex.org/publishers?filter=parent_publisher:P4310319965&sort=-works_count

# Step 4: Get only top-level publishers, sorted by output
https://api.openalex.org/publishers?filter=hierarchy_level:0&sort=-works_count&per_page=20
```

## Explore citation links (Under 1¢)

Trace the citation network around a single work using its `referenced_works`, `cited_by_api_url`, and `related_works` fields.

```bash
# Step 1: Get a work and inspect its citation fields
https://api.openalex.org/works/W2741809807
# Response includes:
#   "referenced_works": ["https://openalex.org/W...", ...]   ← outgoing citations
#   "cited_by_api_url": "https://api.openalex.org/works?filter=cites:W2741809807"
#   "related_works": ["https://openalex.org/W...", ...]      ← semantically similar

# Step 2: Follow outgoing citations (referenced_works)
# Batch-fetch the works this paper cites using the OR operator
https://api.openalex.org/works?filter=openalex:W2100837269|W2134720587&per_page=100

# Step 3: Follow incoming citations (cited_by_api_url)
# Use the cites filter to find all works that cite this one
https://api.openalex.org/works?filter=cites:W2741809807&sort=-publication_date

# Step 4: Explore related works
# Fetch semantically similar works returned in the related_works field
https://api.openalex.org/works?filter=openalex:W2052533833|W1982351946&per_page=100
```

## Build a text corpus ($0.01 per file)

Assemble a collection of full-text PDFs for analysis or AI synthesis.

> **Warning:**
> Content downloads require an API key and cost **$0.01 per file**. See [authentication](/api/authentication/) for details.

```bash
# Step 1: Find works with downloadable PDFs using the has_content filter
https://api.openalex.org/works?search=CRISPR&filter=has_content.pdf:true,publication_year:2023-2024

# Step 2: Download a single PDF
curl -L "https://content.openalex.org/works/W3038568908.pdf?api_key=YOUR_KEY" -o W3038568908.pdf

# Step 3: For bulk downloads, use the CLI tool
pip install openalex-official

openalex download \
  --api-key YOUR_KEY \
  --output ./results \
  --filter "fulltext.search:CRISPR,has_content.pdf:true,publication_year:2023-2024"
```

Download programmatically in Python:

```python
import requests

# List of work IDs from Step 1
work_ids = ["W4388482763", "W4386073691", ...]

for work_id in work_ids:
    r = requests.get(
        f"https://content.openalex.org/works/{work_id}.pdf",
        params={"api_key": "YOUR_KEY"},
        allow_redirects=True
    )

    with open(f"{work_id}.pdf", "wb") as f:
        f.write(r.content)
```

> **Info:**
> **Downloading more than a few thousand files?** Use the [CLI tool](/docs/content-archive/#option-2-command-line-tool-up-to-a-few-million-files) for parallel downloads and automatic retries.
