# OpenCitations Citation Scraper (`muhammadafzal/open-citations-scraper`) Actor

Retrieve open citation links, references, counts, and bibliographic metadata by DOI, PMID, or OMID for research and knowledge graphs.

- **URL**: https://apify.com/muhammadafzal/open-citations-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.60 / 1,000 opencitations results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## OpenCitations Scraper

Retrieve open scholarly citation links, outgoing references, citation counts, and bibliographic metadata from OpenCitations by DOI, PMID, or OpenCitations Meta ID (OMID).

The Actor uses the official OpenCitations Index v2 and Meta v1 REST services. It is useful for literature reviews, citation-network analysis, research intelligence, bibliometrics, academic knowledge graphs, and RAG pipelines that need structured citation data without scraping publisher pages.

### What it extracts

The dataset always has one stable shape. Fields that do not apply to the selected operation are returned as `null` or an empty array, which makes exports and agent workflows predictable.

| Field | Description |
| --- | --- |
| `recordType` | `citation`, `metadata`, or `counts` discriminator |
| `queryIdentifier` | Normalized DOI, PMID, or OMID used for the request |
| `oci` | Open Citation Identifier for a citation relationship |
| `citingIdentifiers` / `citedIdentifiers` | All persistent IDs OpenCitations attaches to each work |
| `citingDoi` / `citedDoi` | Convenient DOI values when available |
| `creationDate` / `timespan` | Citing-work date and XSD duration between publications |
| `journalSelfCitation` / `authorSelfCitation` | Self-citation flags when known |
| `title`, `authors`, `publicationDate` | Core bibliographic metadata |
| `venue`, `volume`, `issue`, `pages` | Publication context |
| `workType`, `publisher`, `editors` | Additional bibliographic details |
| `citationCount` / `referenceCount` | Incoming and outgoing totals in count mode |
| `sourceUrl`, `scrapedAt` | Exact REST endpoint and retrieval timestamp |

### When to use it

Use this Actor when you already know one or more persistent scholarly identifiers and want citation relationships or bibliographic data. Common workflows include:

- build an incoming-citation list for a paper;
- extract a paper's bibliography as outgoing citation edges;
- compare citation and reference counts across a DOI portfolio;
- resolve OpenCitations metadata for known works;
- generate nodes and edges for a scholarly knowledge graph;
- feed structured, source-linked records to an AI research agent.

This Actor is not a full-text academic search engine and does not search papers by arbitrary keywords, scrape Google Scholar, download articles, or bypass publisher access controls. OpenCitations covers open citation data contributed by its source indexes, so results may differ from proprietary citation databases.

### Input

| Input | Type | Default | Description |
| --- | --- | --- | --- |
| `operation` | string | `citations` | `citations`, `references`, `both`, `metadata`, or `counts` |
| `identifiers` | string\[] | example DOI | Up to 50 DOIs, PMIDs, or bibliographic OMIDs |
| `maxResults` | integer | `1000` | Global cap after normalization and deduplication; Free-plan users receive at most 5 records |
| `requestTimeoutSeconds` | integer | `30` | Per-request timeout from 5 to 60 seconds |

DOIs can be supplied as bare values, with a `doi:` prefix, or as `https://doi.org/...` URLs. A numeric identifier is interpreted as a PMID. Explicit examples include:

```json
{
  "operation": "both",
  "identifiers": [
    "10.7717/peerj-cs.421",
    "pmid:33817056",
    "omid:br/06101801781"
  ],
  "maxResults": 250,
  "requestTimeoutSeconds": 30
}
```

#### Operation behavior

- `citations` returns incoming citation edges: works that cite each requested work.
- `references` returns outgoing citation edges: works cited by each requested work.
- `both` runs both directions and labels every row with its concrete operation.
- `metadata` returns one bibliographic metadata record when OpenCitations Meta resolves the identifier.
- `counts` returns one record containing both incoming citation and outgoing reference totals.

The `maxResults` cap applies to the entire run, not separately to every input. Apify Free-plan users are limited to 5 delivered records per run; paid-plan users can use the requested cap up to 10,000. When the free-tier cap is reached, the Actor exits gracefully with a clear status message and records the applied limit in `SUMMARY`. Duplicate identifiers are normalized and removed before requests start. Citation records are also deduplicated by operation, query identifier, and OCI.

### Output example

Citation mode returns records like this:

```json
{
  "recordType": "citation",
  "operation": "citations",
  "queryIdentifier": "doi:10.7717/peerj-cs.421",
  "oci": "06404435594-06101801781",
  "citingIdentifiers": [
    "omid:br/06404435594",
    "doi:10.1063/5.0110347",
    "openalex:W4322579315"
  ],
  "citedIdentifiers": [
    "omid:br/06101801781",
    "doi:10.7717/peerj-cs.421",
    "openalex:W3134956838",
    "pmid:33817056"
  ],
  "citingDoi": "10.1063/5.0110347",
  "citedDoi": "10.7717/peerj-cs.421",
  "creationDate": "2023",
  "timespan": "P1Y",
  "journalSelfCitation": false,
  "authorSelfCitation": false,
  "workIdentifiers": [],
  "title": null,
  "authors": [],
  "publicationDate": null,
  "venue": null,
  "volume": null,
  "issue": null,
  "pages": null,
  "workType": null,
  "publisher": null,
  "editors": [],
  "citationCount": null,
  "referenceCount": null,
  "sourceUrl": "https://api.opencitations.net/index/v2/citations/doi:10.7717/peerj-cs.421",
  "scrapedAt": "2026-08-28T12:00:00.000Z"
}
```

Every run also writes a `SUMMARY` key-value record with the outcome class (`DATA`, `EMPTY`, `BLOCKED`, `FAILED`, or `REJECTED`), successful and failed request counts, delivered record count, cap state, and warnings. Diagnostics are kept out of the business-entity dataset.

### Pricing

The Actor uses transparent pay-per-event pricing. Apify charges synthetic events automatically; the code does not manually charge them.

| Event | Price | When charged |
| --- | ---: | --- |
| Actor start | $0.00005 | Once when a run starts |
| OpenCitations result | $0.00060 | Once per schema-valid default-dataset record |

For example, a paid-plan run returning 100 records costs `$0.06005` in event charges. A valid no-results run costs only the `$0.00005` start event. A count request normally returns one record, for `$0.00065` total. A Free-plan run returns at most 5 records, for a maximum event charge of `$0.00305`. Platform usage is included in these event prices rather than charged separately; your configured maximum total charge still applies.

### Reliability, limits, and data provenance

OpenCitations documents a fair-use rate limit of 180 API requests per minute per IP. This Actor stays below that threshold with a minimum interval between requests, retries transient connection errors and server failures, honors `Retry-After` on rate limits, and stops after three attempts. Count mode uses two API requests per identifier; other modes normally use one.

The Actor uses OpenCitations' first-party public REST APIs rather than parsing the human-facing website. An optional operator-side `OPENCITATIONS_ACCESS_TOKEN` environment secret is sent as an authorization header when configured; it is never exposed as a public input or logged. OpenCitations recommends its free access token for application use, but the public endpoints currently accept bounded anonymous requests.

Unknown but well-formed identifiers can truthfully return no rows. Invalid identifiers are rejected before network work with a correction example. Upstream outages and exhausted rate limits produce warnings and a `SUMMARY` diagnostic; partial valid results are preserved. The Actor never creates placeholder citation records to make an empty run appear successful.

For bulk harvesting beyond the Actor's 10,000-record run cap, use the official OpenCitations data dumps instead of issuing many API calls. Coverage and counts reflect the OpenCitations indexes at retrieval time and can change as their open datasets are updated.

### API use

Call the Actor through the Apify API with the same JSON input used in Console. The default dataset can be exported as JSON, CSV, Excel, XML, or RSS through Apify storage endpoints. AI agents can use the output schema to distinguish citation edges, metadata nodes, and count records without inferring fields from logs.

### Legal and responsible use

OpenCitations states that its datasets are released under the CC0 public-domain dedication. The Actor records the exact source endpoint for provenance. Cite OpenCitations when appropriate in research outputs, respect its fair-use limits, and review the source project's current terms and attribution guidance for your use case. This tool does not access paywalled full text, authentication-protected publisher pages, or personal accounts.

For support, include the Apify run ID, selected operation, a non-sensitive example identifier, and the `SUMMARY` record. Do not include account tokens or other secrets.

# Actor input Schema

## `operation` (type: `string`):

Use this to choose one output mode. 'citations' returns works citing each input, 'references' returns works cited by each input, 'both' returns both directions, 'metadata' returns work details, and 'counts' returns incoming and outgoing totals. Default is citations.

## `identifiers` (type: `array`):

Use this to identify scholarly works. Enter one DOI, PMID, or OpenCitations Meta ID per line, for example '10.7717/peerj-cs.421', 'pmid:33817056', or 'omid:br/06101801781'. DOI URLs and a leading 'doi:' are accepted. Maximum 50 unique identifiers.

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

Use this to cap records across the whole run after deduplication. Enter 1 to 10000; default is 1000. Apify Free-plan users receive at most 5 records per run, even when a higher value is requested.

## `requestTimeoutSeconds` (type: `integer`):

Use this to bound each OpenCitations API request. Enter 5 to 60 seconds. Default is 30; transient failures receive bounded retries within this limit.

## Actor input object example

```json
{
  "operation": "citations",
  "identifiers": [
    "10.7717/peerj-cs.421"
  ],
  "maxResults": 1000,
  "requestTimeoutSeconds": 30
}
```

# Actor output Schema

## `results` (type: `string`):

Citation, metadata, or count records in the default dataset.

## `summary` (type: `string`):

Outcome, request counts, warnings, and record totals.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/open-citations-scraper").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/open-citations-scraper").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 '{}' |
apify call muhammadafzal/open-citations-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/open-citations-scraper"
        }
    }
}
```

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/M8AYT6YE86MK7au2J/builds/SMpz6owF4ssMQwRrY/openapi.json
