Open API
Integrate Ai4Scholar academic search into your own applications through RESTful APIs
Overview
Ai4Scholar's Open API provides RESTful endpoints for developers to integrate paper, author, and citation-network queries into their applications. The Open Platform provides separate documentation for Semantic Scholar, PubMed, Google Scholar, and Google Patents. See the interactive API documentation for currently available endpoints, parameters, and response structures. This page covers the most common requests.
Authentication
Every API request must include an API key in the header:
Authorization: Bearer YOUR_API_KEYAll public endpoints use this authentication method. The x-api-key header is not supported. If you are referring to Semantic Scholar's official documentation, remember that its authentication instructions apply to its own API. Always use Authorization: Bearer when calling through Ai4Scholar.
Get an API key
- After signing in, open the Open Platform, or open API key management through the developer settings in research mode.
- Create a key and set a spending limit as needed.
- Copy the key and store it securely. Use placeholders in public examples and frontend code, never real keys.
Common endpoints
These are common entry points, not the complete list. See the interactive API documentation for batch, autocomplete, snippet search, and other endpoints.
| Endpoint | Method | Description |
|---|---|---|
/graph/v1/paper/search | GET | Search papers |
/graph/v1/paper/{id} | GET | Paper details |
/graph/v1/paper/{id}/citations | GET | Get citing papers |
/graph/v1/paper/{id}/references | GET | Get references |
/graph/v1/paper/batch | POST | Get papers in bulk |
/graph/v1/author/search | GET | Search authors |
/graph/v1/author/{id} | GET | Author details |
/graph/v1/author/{id}/papers | GET | List an author's papers |
/graph/v1/author/batch | POST | Get authors in bulk |
/api/credits | GET | Check credit balance (free, no charge) |
Request examples
Python
import requests
API_KEY = "sk-user-your-key-here"
BASE_URL = "https://ai4scholar.net/graph/v1"
response = requests.get(
f"{BASE_URL}/paper/search",
params={
"query": "transformer attention mechanism",
"limit": 10,
"fields": "paperId,title,abstract,authors,year,citationCount"
},
headers={"Authorization": f"Bearer {API_KEY}"}
)
data = response.json()
for paper in data["data"]:
print(f"{paper['title']} ({paper['year']}) - Citations: {paper['citationCount']}")JavaScript
const API_KEY = 'sk-user-your-key-here';
const BASE_URL = 'https://ai4scholar.net/graph/v1';
const response = await fetch(
`${BASE_URL}/paper/search?query=transformer&limit=5`,
{
headers: { Authorization: `Bearer ${API_KEY}` },
},
);
const data = await response.json();
console.log(data);cURL
curl "https://ai4scholar.net/graph/v1/paper/search?query=LLM&limit=5&fields=title,year,citationCount" \
-H "Authorization: Bearer sk-user-your-key-here"Billing
Billable endpoints consume credits. Prices depend on the current Open Platform configuration and request size. Batch endpoint billing may also change with the service. Check the price displayed in the Open Platform before submitting, and use the response headers to confirm the actual charge afterward.
For multiple papers, consider batch endpoints to reduce the number of requests. See the interactive API documentation for item limits and pricing.
Failures and retries
Refunds for failed tool requests follow the rules of the relevant endpoint. Other successful calls in a combined workflow may still incur charges. If the network disconnects, a missing response does not mean the service did not execute. Check usage records before retrying.
Read actual costs from the response
Billable endpoints provide the following response headers for reconciliation and budget control. The fields actually returned depend on the endpoint documentation:
| Response header | Meaning |
|---|---|
x-credits-charged | Actual charge for this request |
x-credits-remaining | Credits remaining after the request |
Check your balance for free
GET /api/credits is free and can be used to check your budget before starting a task:
curl "https://ai4scholar.net/api/credits" \
-H "Authorization: Bearer sk-user-your-key-here"{
"credit_contract_version": 2,
"unit": "credits",
"credits": {
"permanent": 1000,
"member_monthly_remaining": 0,
"total_available": 980,
"held": 20
},
"api_key": {
"credit_limit": null,
"credits_used": 21,
"held_credits": 20,
"credits_remaining": null
},
"membership": null
}This is a shortened example of the unified credits API. The exact detail object is omitted, and the values are illustrative:
permanentis the permanent credit balance;member_monthly_remainingretains compatibility information for legacy monthly membership benefits.total_availableis the amount currently available after reservations;heldis the number of credits temporarily reserved by running requests. Do not replace the available amount by simply adding the two balance fields.- An
api_key.credit_limitofnullmeans that key has no spending cap. When a cap is set, also check the key's owncredits_remaining. - A
membershipvalue ofnulldoes not prevent you from using permanent credit packs. See Credits and plans for current purchase and billing rules.
Rate limits
Request limits are enforced according to the account, API key, and service configuration. If you receive 429, reduce concurrency, increase the retry interval, and check the current limits in the Open Platform. This guide does not hardcode plan limits.
Error codes
| Status code | Description |
|---|---|
| 200 | Request succeeded |
| 400 | Invalid parameters |
| 401 | Authentication failed; check your API key |
| 402 | Insufficient credits or available allowance for this API key |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
| 503 | The service or credit lookup is temporarily unavailable; retry later as instructed by the endpoint |