API

Examples

Search for Papers

curl "https://sciencestack.ai/api/v1/search?q=transformer+attention&limit=5" \
  -H "x-api-key: $API_KEY"
{
  "data": [
    {
      "id": "0dc1dcb2-991d-5ff2-b67c-af0a863ad32f",
      "arxivId": "1706.03762",
      "title": "Attention Is All You Need",
      "authors": ["Ashish Vaswani", "Noam Shazeer", "Niki Parmar", "..."],
      "abstract": "The dominant sequence transduction models...",
      "tldr": "Introduces the Transformer architecture based purely on attention mechanisms.",
      "published": "2017-06-12T17:57:34Z",
      "citationCount": 159306,
      "primaryCategory": "cs.CL"
    }
  ],
  "pagination": { "offset": 0, "limit": 5, "hasMore": true },
  "_version": "1.0.0"
}

Filter by field or date

# Recent ML papers
curl "https://sciencestack.ai/api/v1/search?q=diffusion&field=machine-learning&from=2024-01-01&sort=recent" \
  -H "x-api-key: $API_KEY"

# Papers in specific arXiv categories
curl "https://sciencestack.ai/api/v1/search?q=attention&category=cs.LG,cs.CL&sort=citations" \
  -H "x-api-key: $API_KEY"

Get Paper Overview (Free)

The /overview endpoint is free and returns everything an agent needs to understand a paper:

curl "https://sciencestack.ai/api/v1/papers/1706.03762/overview" \
  -H "x-api-key: $API_KEY"
{
  "data": {
    "id": "0dc1dcb2-991d-5ff2-b67c-af0a863ad32f",
    "arxivId": "1706.03762v7",
    "title": "Attention Is All You Need",
    "authors": ["Ashish Vaswani", "Noam Shazeer", "..."],
    "abstract": "The dominant sequence transduction models...",
    "published": "2017-06-12T17:57:34Z",
    "aiSummary": "The Transformer paper addresses the inefficiency of recurrent models...",
    "toc": [
      { "nodeId": "sec:1", "section": "1", "title": "Introduction", "depth": 1 },
      { "nodeId": "sec:3", "section": "3", "title": "Model Architecture", "depth": 1 },
      { "nodeId": "sec:3.2", "section": "3.2", "title": "Attention", "depth": 2 },
      { "nodeId": "sec:3.2.1", "section": "3.2.1", "title": "Scaled Dot-Product Attention", "depth": 3 }
    ],
    "figures": [
      {
        "nodeId": "fig:1",
        "number": "1",
        "caption": "The Transformer - model architecture.",
        "imageUrls": ["https://cdn.sciencestack.ai/papers/1706.03762/fig1.png"]
      },
      {
        "nodeId": "fig:2",
        "number": "2",
        "caption": "(left) Scaled Dot-Product Attention. (right) Multi-Head Attention.",
        "imageUrls": ["https://cdn.sciencestack.ai/papers/1706.03762/fig2.png"]
      }
    ],
    "tables": [
      { "nodeId": "tab:1", "number": "1", "caption": "Maximum path lengths, per-layer complexity..." }
    ],
    "equations": [
      { "nodeId": "eq:1", "number": "1" },
      { "nodeId": "eq:2", "number": "2" }
    ],
    "mathEnvs": [
      { "nodeId": "thm:1", "type": "theorem", "number": "1", "title": null }
    ]
  },
  "_version": "1.0.0"
}

Get Full Paper Content

# Markdown format (default) - ideal for LLM context
curl "https://sciencestack.ai/api/v1/papers/1706.03762/content?format=markdown" \
  -H "x-api-key: $API_KEY"

# LaTeX format
curl "https://sciencestack.ai/api/v1/papers/1706.03762/content?format=latex" \
  -H "x-api-key: $API_KEY"

# Raw JSON AST (Pro+)
curl "https://sciencestack.ai/api/v1/papers/1706.03762/content?format=raw" \
  -H "x-api-key: $API_KEY"

Fetch Specific Nodes

Use node IDs from the overview to fetch specific content:

# Get specific equations and figures
curl "https://sciencestack.ai/api/v1/papers/1706.03762/nodes?nodeIds=eq:1,eq:2,fig:1&format=markdown" \
  -H "x-api-key: $API_KEY"

# Get a section with all its content
curl "https://sciencestack.ai/api/v1/papers/1706.03762/nodes?nodeIds=sec:3.2.1&format=markdown" \
  -H "x-api-key: $API_KEY"

Fetch by Type

# Get all equations
curl "https://sciencestack.ai/api/v1/papers/1706.03762/nodes?types=equation&format=markdown" \
  -H "x-api-key: $API_KEY"

# Get all figures and tables
curl "https://sciencestack.ai/api/v1/papers/1706.03762/nodes?types=figure,table&format=markdown" \
  -H "x-api-key: $API_KEY"

# Get all theorems, lemmas, proofs
curl "https://sciencestack.ai/api/v1/papers/1706.03762/nodes?types=math_env&format=markdown" \
  -H "x-api-key: $API_KEY"

Get References

curl "https://sciencestack.ai/api/v1/papers/1706.03762/references" \
  -H "x-api-key: $API_KEY"
{
  "data": [
    {
      "citeKey": "bahdanau2014neural",
      "arxivId": "1409.0473",
      "doi": "10.48550/arXiv.1409.0473",
      "enrichment": {
        "status": "enriched",
        "semanticScholar": {
          "paperId": "fa72afa9b2cbc8f0d7b05d52548906610ffbb9c5",
          "title": "Neural Machine Translation by Jointly Learning to Align and Translate",
          "authors": [{ "name": "Dzmitry Bahdanau" }, { "name": "Kyunghyun Cho" }, { "name": "Yoshua Bengio" }],
          "publicationDate": "2014-09-01"
        }
      }
    }
  ],
  "pagination": { "offset": 0, "limit": 100, "hasMore": false },
  "_version": "1.0.0"
}

Get Citations (Forward References)

Find papers that cite a specific paper:

curl "https://sciencestack.ai/api/v1/papers/1706.03762/citations?limit=10" \
  -H "x-api-key: $API_KEY"
{
  "paperId": "0dc1dcb2-991d-5ff2-b67c-af0a863ad32f",
  "arxivId": "1706.03762",
  "data": [
    {
      "arxivId": "1810.04805",
      "title": "BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding",
      "authors": "Jacob Devlin, Ming-Wei Chang, Kenton Lee, et al.",
      "published": "2018-10-11T00:00:00Z",
      "citationCount": 95421
    }
  ],
  "pagination": { "offset": 0, "limit": 10, "hasMore": true },
  "_version": "1.0.0"
}

Check Your Usage

curl "https://sciencestack.ai/api/v1/me/usage" \
  -H "x-api-key: $API_KEY"
{
  "data": {
    "tier": "pro",
    "papersUsed": 42,
    "papersLimit": 200,
    "requestsPerMinute": 60,
    "resetsAt": "2025-02-01T00:00:00Z"
  },
  "_version": "1.0.0"
}

Python Example

import requests

API_KEY = "sk_live_your_key_here"
BASE_URL = "https://sciencestack.ai/api/v1"

headers = {"x-api-key": API_KEY}

# Search for papers (free)
response = requests.get(
    f"{BASE_URL}/search",
    params={"q": "transformer attention", "limit": 5},
    headers=headers
)
papers = response.json()["data"]

# Get paper overview (free)
overview = requests.get(
    f"{BASE_URL}/papers/1706.03762/overview",
    headers=headers
).json()["data"]

print(f"Title: {overview['title']}")
print(f"Sections: {len(overview['toc'])}")
print(f"Figures: {len(overview['figures'])}")

# Get full content as markdown (uses quota)
content = requests.get(
    f"{BASE_URL}/papers/1706.03762/content",
    params={"format": "markdown"},
    headers=headers
).json()["data"]

# Fetch specific equations
nodes = requests.get(
    f"{BASE_URL}/papers/1706.03762/nodes",
    params={"nodeIds": "eq:1,eq:2", "format": "markdown"},
    headers=headers
).json()["data"]

TypeScript Example

const API_KEY = "sk_live_your_key_here";
const BASE_URL = "https://sciencestack.ai/api/v1";

const headers = { "x-api-key": API_KEY };

// Search for papers (free)
async function searchPapers(query: string, limit = 10) {
  const params = new URLSearchParams({ q: query, limit: String(limit) });
  const response = await fetch(`${BASE_URL}/search?${params}`, { headers });
  const json = await response.json();
  return json.data;
}

// Get paper overview (free)
async function getPaperOverview(arxivId: string) {
  const response = await fetch(`${BASE_URL}/papers/${arxivId}/overview`, { headers });
  const json = await response.json();
  return json.data;
}

// Get full content (uses quota)
async function getPaperContent(arxivId: string, format: "markdown" | "latex" | "raw" = "markdown") {
  const params = new URLSearchParams({ format });
  const response = await fetch(`${BASE_URL}/papers/${arxivId}/content?${params}`, { headers });
  const json = await response.json();
  return json.data;
}

// Fetch specific nodes (uses quota)
async function getNodes(arxivId: string, nodeIds: string[]) {
  const params = new URLSearchParams({ nodeIds: nodeIds.join(","), format: "markdown" });
  const response = await fetch(`${BASE_URL}/papers/${arxivId}/nodes?${params}`, { headers });
  const json = await response.json();
  return json.data;
}

// Example usage
const papers = await searchPapers("attention mechanisms");
const overview = await getPaperOverview("1706.03762");
const equations = await getNodes("1706.03762", ["eq:1", "eq:2", "fig:1"]);

Agent Workflow Example

A typical workflow for an AI agent:

import requests

API_KEY = "sk_live_your_key_here"
BASE_URL = "https://sciencestack.ai/api/v1"
headers = {"x-api-key": API_KEY}

def research_topic(query: str):
    # 1. Search for relevant papers (free)
    papers = requests.get(
        f"{BASE_URL}/search",
        params={"q": query, "limit": 10, "sort": "citations"},
        headers=headers
    ).json()["data"]

    results = []
    for paper in papers[:3]:  # Top 3 papers
        arxiv_id = paper["arxivId"]

        # 2. Get overview to understand structure (free)
        overview = requests.get(
            f"{BASE_URL}/papers/{arxiv_id}/overview",
            headers=headers
        ).json()["data"]

        # 3. Identify key sections from TOC
        methods_section = next(
            (s for s in overview["toc"] if "method" in s["title"].lower()),
            None
        )

        # 4. Fetch specific content (uses quota)
        if methods_section:
            content = requests.get(
                f"{BASE_URL}/papers/{arxiv_id}/nodes",
                params={"nodeIds": methods_section["nodeId"], "format": "markdown"},
                headers=headers
            ).json()["data"]

            results.append({
                "title": overview["title"],
                "arxivId": arxiv_id,
                "summary": overview.get("aiSummary"),
                "methods": content
            })

    return results

# Research a topic
findings = research_topic("attention mechanisms in transformers")
    Examples