AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Extract Citation Networks and Automate Paper Metadata Retrieval with the Semantic Scholar Academic Graph API

차재현 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

For academic developers, data scientists, and bibliometrics researchers tracking emerging literature, scraping publisher sites or Google Scholar is an engineering dead end. Between aggressive IP blocks, erratic bot traps, and brittle DOM structures, web scrapers cannot sustain production workloads. The official Semantic Scholar Academic Graph (S2AG) REST API, maintained by the Allen Institute for Artificial Intelligence (Ai2), is the superior programmatic bridge into scientific literature, indexing over 214 million publications, 79 million authors, and 2.4 billion citation relationships.

Programmatic access, however, comes with strict operational guardrails. At 365Finds, our research evaluation shows that naive implementations—such as sequential GET requests or unfiltered graph traversals—routinely fail due to the default 1 request per second (RPS) rate limit or payload overflows. To build reliable academic knowledge graphs and automated literature pipelines, developers must adopt three foundational strategies:

  1. Always batch queries via POST: Never iterate through papers using individual GET /paper/{paper_id} endpoints. Batching up to 500 identifiers via POST /paper/batch delivers a 500x operational throughput gain within the exact same 1 RPS allowance.
  2. Prune graph noise with isInfluential and intents: Raw citation counts are vanity metrics cluttered with perfunctory mentions. Semantic Scholar’s machine-learned citation flags—specifically isInfluential and intent classifications (methodology, background, result)—allow you to filter out 80% of citation noise and isolate substantive scientific dependencies.
  3. Respect the REST vs. Datasets boundary: If your ingestion pipeline demands more than 50,000 papers or full-corpus analyses, stop querying the REST API. The REST endpoints are engineered for interactive queries, real-time DOI lookups, and focused graph traversals; bulk ingestion should always use the Semantic Scholar Datasets API (/datasets/v1) with incremental release diffs.

1. Authentication, Base URLs, and Rate Limit Dynamics

Semantic Scholar organizes its programmatic access into three specialized APIs:

The API Key Architecture

While unauthenticated access to the Academic Graph API is theoretically permitted, it operates on a shared global pool capped at 1,000 requests per second across all anonymous users worldwide. During peak global traffic, unauthenticated scripts suffer immediate 429 Too Many Requests throttling.

To establish a production-grade pipeline, you must register for an API key through the official Semantic Scholar API portal. The key must be transmitted in every HTTP request header:

x-api-key: YOUR_API_KEY

Note on Case Sensitivity: The header name x-api-key is strictly lowercase. Using improper capitalization like X-API-KEY or X-Api-Key may cause authentication rejections on specific gateway routes.

Rate Limits and Backoff Discipline

An authenticated API key begins with an introductory rate limit of 1 request per second (1 RPS) across all graph endpoints. Partners and institutional research teams with verified high-throughput requirements can request rate upgrades through Ai2's support desk. However, regardless of your limit tier, production clients must implement automated retries with exponential backoff and jitter to absorb transient network hiccups (500, 502, 503, 504) and rate cap alerts (429).


2. Universal Identifier Mapping: DOI, ArXiv, and CorpusId

A recurring problem in bibliometric automation is reconciling mismatched external identifiers. The Semantic Scholar API resolves this by treating external publication IDs as first-class path parameters across paper endpoints.

Instead of executing fuzzy keyword searches, developers can resolve papers directly by prefixing external IDs:

Identifier TypeFormat PrefixExample Endpoint Target
Native S2 SHANone (40-char hex)/paper/649def34f8be52c8b66281af98ae884c09aef38b
CorpusIdCorpusId:<int>/paper/CorpusId:215416146
DOIDOI:<doi>/paper/DOI:10.18653/v1/N18-3011
arXivARXIV:<id>/paper/ARXIV:2106.15928
PubMed / MedlinePMID:<id>/paper/PMID:19872477
PubMed CentralPMCID:<id>/paper/PMCID:2323736
ACL AnthologyACL:<id>/paper/ACL:W12-3903
Microsoft Academic GraphMAG:<id>/paper/MAG:112218234
Supported URLsURL:<url>/paper/URL:https://arxiv.org/abs/2106.15928v1

Recognized URL domains include semanticscholar.org, arxiv.org, aclweb.org, acm.org, and biorxiv.org.


3. Mastering Field Projections and Batch Ingestion

The fields Parameter Rule

By default, Semantic Scholar endpoints return only bare-minimum properties—such as paperId and title for papers, or authorId and name for authors. If your application needs abstracts, publication dates, open-access PDF links, or vector embeddings, you must explicitly declare them in the fields query parameter.

Subfields and nested objects are addressed using standard dot notation:

Caution: Individual HTTP responses are hard-capped at 10 MB. Requesting deep subfields on papers with thousands of citations will trigger a 400 Bad Request warning that the response exceeds maximum allowed size. Keep field masks disciplined to the exact data attributes required downstream.

High-Throughput Batch Retrieval

Querying 1,000 papers sequentially at 1 RPS consumes over 16 minutes. Using the batch endpoint, the exact same task takes 2 HTTP requests and less than 3 seconds.

import os
import requests

API_KEY = os.getenv("S2_API_KEY", "your_api_key_here")
URL = "https://api.semanticscholar.org/graph/v1/paper/batch"

# Mixed external identifiers supported simultaneously
paper_identifiers = [
    "DOI:10.18653/v1/N18-3011",
    "ARXIV:2106.15928",
    "CorpusId:215416146",
    "649def34f8be52c8b66281af98ae884c09aef38b"
]

params = {
    "fields": "title,year,abstract,authors.name,citationCount,influentialCitationCount,openAccessPdf"
}
headers = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json"
}

response = requests.post(URL, params=params, json={"ids": paper_identifiers}, headers=headers)

if response.status_code == 200:
    papers = response.json()
    for paper in papers:
        if paper:  # ID resolution can return None if not found in graph
            print(f"[{paper.get('year')}] {paper.get('title')} (Citations: {paper.get('citationCount')})")

4. Extracting Citation Networks: Citations, References, and Influence

A comprehensive knowledge graph requires traversing edges in both directions:

  1. References (/paper/{paper_id}/references): Backward edges—the works cited by your target paper.
  2. Citations (/paper/{paper_id}/citations): Forward edges—subsequent literature citing your target paper.

Why isInfluential Changes Bibliometrics

In academic publishing, many citations are perfunctory: authors cite survey papers for broad context or add citations during peer review. Ai2 addresses this by deploying a machine learning classification model trained on citation contexts, reference counts, and surrounding textual features to classify citations.

The /citations and /references endpoints expose three critical semantic properties:

Paginating Citation Edges

Both /citations and /references endpoints support pagination via offset and limit query parameters:


5. End-to-End Pipeline: Building an Influential Citation Graph in Python

Here is a resilient, production-ready Python script that resolves a seed paper, extracts its 1-hop citation network, filters for influential citations, and records citation contexts:

import time
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

class SemanticScholarClient:
    BASE_URL = "https://api.semanticscholar.org/graph/v1"

    def __init__(self, api_key: str = None):
        self.session = requests.Session()
        self.headers = {"Content-Type": "application/json"}
        if api_key:
            self.headers["x-api-key"] = api_key
            
        # Configure automatic retries with exponential backoff
        retries = Retry(
            total=5,
            backoff_factor=1.5,
            status_forcelist=[429, 500, 502, 503, 504],
            allowed_methods=["GET", "POST"]
        )
        self.session.mount("https://", HTTPAdapter(max_retries=retries))

    def get_influential_citation_network(self, seed_paper_id: str, max_citations: int = 500):
        """
        Retrieves papers citing the seed paper, filtered strictly by influential impact.
        """
        url = f"{self.BASE_URL}/paper/{seed_paper_id}/citations"
        fields = (
            "isInfluential,intents,contexts,"
            "citingPaper.paperId,citingPaper.title,citingPaper.year,"
            "citingPaper.citationCount,citingPaper.authors"
        )
        
        offset = 0
        limit = min(100, max_citations)
        influential_network = []

        while offset < max_citations:
            params = {
                "fields": fields,
                "offset": offset,
                "limit": limit
            }
            
            response = self.session.get(url, params=params, headers=self.headers)
            
            if response.status_code != 200:
                print(f"Error fetching citations: {response.status_code} - {response.text}")
                break
                
            payload = response.json()
            data = payload.get("data", [])
            if not data:
                break  # Reached the end of citations
                
            for edge in data:
                # Isolate high-impact citation dependencies
                if edge.get("isInfluential"):
                    citing = edge.get("citingPaper", {})
                    influential_network.append({
                        "source_seed": seed_paper_id,
                        "citing_id": citing.get("paperId"),
                        "title": citing.get("title"),
                        "year": citing.get("year"),
                        "intents": edge.get("intents", []),
                        "contexts": edge.get("contexts", [])
                    })

            if "next" not in payload:
                break
                
            offset = payload["next"]
            time.sleep(1.0)  # Maintain 1 RPS safety threshold

        return influential_network


if __name__ == "__main__":
    # Example: 'Attention Is All You Need' via ArXiv ID
    client = SemanticScholarClient(api_key="YOUR_API_KEY_HERE")
    network = client.get_influential_citation_network("ARXIV:1706.03762", max_citations=200)
    
    print(f"Extracted {len(network)} influential citing papers.")
    for item in network[:3]:
        print(f"\nTitle: {item['title']} ({item['year']})")
        print(f"Intents: {', '.join(item['intents'])}")
        if item["contexts"]:
            print(f"Context: \"{item['contexts'][0]}\"")

6. Strategic Architecture: When to Use REST vs. Datasets API

In our enterprise evaluations at 365Finds, the single most common design error is attempting to crawl the REST API for macro-level bibliometrics. The table below delineates the proper technical boundary:

Feature / RequirementAcademic Graph REST API (/graph/v1)Datasets API (/datasets/v1)
Primary Use CaseReal-time paper lookup; targeted citation crawling; search autocomplete; ad-hoc graph queries.Full academic knowledge graph construction; corpus-wide text mining; offline bibliometrics.
Data ScopeSingle papers, batches of 500 IDs, or filtered searches up to 1,000 relevance results.Complete corpus snapshots (214M+ papers, billions of edges) partitioned in JSONL archives.
Throughput Boundary1 RPS default (100–500 papers/sec with batching).Unlimited local processing speed after multi-file S3 downloads.
Update MechanismLive updates reflecting index modifications.Dated weekly releases with incremental diff endpoints (/diffs/...).
Optimal InfrastructureMicroservices, web apps, interactive researcher dashboards, on-demand reference resolvers.Data warehouses (Snowflake, BigQuery), Neo4j graph databases, Vector search indexes (Milvus, Qdrant).

365Finds Recommendation

If your project focuses on real-time paper lookups, citation alerts, or interactive visualizers (similar to Connected Papers or Litmaps), the REST API with batching and backoff is your optimal tool. If you are building a proprietary citation graph database or training language models on scientific corpora, use the Datasets API to hydrate your offline warehouse first, then query the REST API solely for fresh deltas and targeted real-time lookups.

References