Endpoints API Reference
Interact programmatically with the Distill paper extraction tools. All endpoints use standard HTTP methods and return standard JSON responses. Make sure to authenticate via the HTTP Authorization header unless otherwise noted.
POST
/api/summarizeReq: BASIC
Extracts metadata and generates a structured summary for a given PubMed ID or PDF extract.
Example Request
client.js
fetch('https://distill-ai-one.vercel.app/api/summarize', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ pmid: '38291047' }) // OR { pdfText: '...' }
});JSON Response
200 OK
{
"keyFindings": "The study demonstrated a 43% reduction...",
"methodology": "Double-blind, placebo-controlled trial...",
"conclusions": "Strong viability for in vivo therapeutics.",
"limitations": "Limited to murine models.",
"paperTitle": "CRISPR-Cas9 Efficacy...",
"year": "2024"
}Try it out internally ✦
GET
/api/summary/:idReq: BASIC
Retrieve a previously generated summary by its ID.
Example Request
client.js
GET https://distill-ai-one.vercel.app/api/summary/sum_12345abc Authorization: Bearer YOUR_API_KEY
JSON Response
200 OK
{
"id": "sum_12345abc",
"pmid": "38291047",
"summary": { ... }
}GET
/api/summariesReq: BASIC
List all accessible summaries, with optional pagination and filtering.
Example Request
client.js
GET https://distill-ai-one.vercel.app/api/summaries?limit=10&page=1 Authorization: Bearer YOUR_API_KEY
JSON Response
200 OK
{
"data": [
{ "id": "sum_12345abc", "paperTitle": "...", "dateAdded": "..." },
...
],
"meta": { "total": 42, "page": 1, "lastPage": 5 }
}POST
/api/feedback/:idReq: BASIC
Submit a rating or text feedback for an extraction.
Example Request
client.js
POST https://distill-ai-one.vercel.app/api/feedback/sum_12345abc
Content-Type: application/json
{ "rating": 5, "text": "Perfect extraction" }JSON Response
200 OK
{ "status": "success", "recorded": true }POST
/api/auth/registerReq: NONE
Create a new Distill account programmatically.
Example Request
client.js
POST https://distill-ai-one.vercel.app/api/auth/register
Content-Type: application/json
{ "email": "dev@example.com", "password": "...", "name": "..." }JSON Response
200 OK
{ "token": "jwt_...", "user": { "id": "usr_x", "role": "STUDENT" } }POST
/api/auth/loginReq: NONE
Authenticate and receive a JWT session token.
Example Request
client.js
POST https://distill-ai-one.vercel.app/api/auth/login
Content-Type: application/json
{ "email": "dev@example.com", "password": "..." }JSON Response
200 OK
{ "token": "jwt_...", "user": { "id": "usr_x", "role": "STUDENT" } }GET
/api/admin/usersReq: ADMIN
List all registered users (Admin only).
Example Request
client.js
GET https://distill-ai-one.vercel.app/api/admin/users Authorization: Bearer YOUR_ADMIN_KEY
JSON Response
200 OK
{
"users": [ ... ],
"count": 142
}GET
/api/admin/analyticsReq: ADMIN
Retrieve global API usage analytics.
Example Request
client.js
GET https://distill-ai-one.vercel.app/api/admin/analytics?period=7d Authorization: Bearer YOUR_ADMIN_KEY
JSON Response
200 OK
{
"period": "7d",
"totalCalls": 8402,
"uniqueTokens": 45
}