# OpenAlex Paper Search (relevance-ranked, abstracts) (`jmspwr/openalex-paper-search`) Actor

- **URL**: https://apify.com/jmspwr/openalex-paper-search.md
- **Developed by:** [James Power](https://apify.com/jmspwr) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 papers

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OpenAlex Paper Search

Search about 250 million scholarly works in the OpenAlex index by topic and get one clean row per paper:
title, DOI, year, venue, authors (names only), citation count, open-access status and a free PDF link where
OpenAlex knows one, and the abstract rebuilt as readable text.

**Ranking:** matches are ranked by relevance to your query by default. Quote a phrase to require it
(`"urban heat island"`). You can instead sort by citations or publication date.

### Input

| Field | Default | Notes |
|---|---|---|
| `query` | required | 2 to 200 characters. Quote a phrase for an exact match. |
| `fromYear`, `toYear` | none | Publication year range, optional. |
| `openAccessOnly` | `false` | Keep only works OpenAlex marks open access. |
| `workType` | `""` | One of article, review, book-chapter, book, dataset, preprint, dissertation, report. |
| `sortBy` | `relevance` | Or `cited_by_count`, `publication_date`. |
| `includeAbstract` | `true` | Abstract is missing for works OpenAlex has no abstract for. |
| `maxResults` | `25` | 1 to 1000. |

### Price

**$0.001 per paper returned** (event `paper-found`). There is no start fee. A search that returns nothing,
or a run that fails, is not charged. Each paper is charged once, as it is stored.

### Output

One dataset row per paper: `openAlexId`, `doi`, `title`, `year`, `publicationDate`, `type`, `venue`,
`authors`, `authorCount`, `institutions` (unique institution names, up to 100), `citedByCount`, `isOpenAccess`, `openAccessPdfUrl`, `landingPageUrl`,
`abstract` (if requested), `query`, `source` (always `openalex.org`).

Run status is written to the key-value store under `OUTPUT`: `ok`, `no_results`, `charge_limit`.

### Data and limits

- Source: OpenAlex (https://openalex.org), whose metadata is released under CC0. This Actor is not affiliated
  with OpenAlex. It calls the public works API. An optional OpenAlex API key (secret input; leave empty to run without one) is sent only to OpenAlex and is never stored or emitted.
- Metadata and abstracts only. No full text is retrieved.
- Author fields are display names as published; institution fields are display names only. Author ORCIDs, emails,
  raw affiliation strings and institution identifiers are not requested or returned.
- Abstracts come from OpenAlex's own index and are missing for some works.
- Relevance ranking is OpenAlex's text ranking. It is not a guarantee that every result is on-topic. Check
  titles before relying on a list.

### Test status

Unit tests run offline on captured live responses (`python3 -m unittest discover -s tests`). The daily
health check (`health/health_check.py`) calls the live API and runs no model.

# Actor input Schema

## `query` (type: `string`):

Topic or phrase to search (2-200 characters). Put an exact phrase in double quotes to require it. Matching is by relevance.

## `fromYear` (type: `integer`):

Earliest publication year to include (optional).

## `toYear` (type: `integer`):

Latest publication year to include (optional).

## `openAccessOnly` (type: `boolean`):

Keep only works OpenAlex marks as open access.

## `workType` (type: `string`):

Restrict to one OpenAlex work type. Empty means all types.

## `sortBy` (type: `string`):

relevance (default) ranks by how well each work matches the query. cited_by_count and publication_date are alternatives.

## `includeAbstract` (type: `boolean`):

Rebuild the abstract text from OpenAlex's index (where OpenAlex has one).

## `maxResults` (type: `integer`):

How many papers to return (1-1000). You pay per paper returned.

## `apiKey` (type: `string`):

Optional. Your own free OpenAlex key (openalex.org/settings/api) raises the daily limit. Leave empty to run without a key. Never stored or emitted.

## Actor input object example

```json
{
  "query": "CRISPR base editing",
  "openAccessOnly": false,
  "workType": "",
  "sortBy": "relevance",
  "includeAbstract": true,
  "maxResults": 25
}
```

# Actor output Schema

## `papers` (type: `string`):

Every paper stored by the run (one dataset item per paper).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "CRISPR base editing"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jmspwr/openalex-paper-search").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "CRISPR base editing" }

# Run the Actor and wait for it to finish
run = client.actor("jmspwr/openalex-paper-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "CRISPR base editing"
}' |
apify call jmspwr/openalex-paper-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jmspwr/openalex-paper-search"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/YQTPtKymhxdIWSgjv/builds/gYeNyJpHycfW1nz5Q/openapi.json
