# Paper summaries

> Summaries of scientific papers from PubMed Central: instant or queued.

Two endpoints summarise scientific papers from PubMed Central (NCBI).

## Summary from a search

```text
POST https://api.prosecaptain.com/api/generate/summary-from-ncbi?token=YOUR_TOKEN
```

Searches NCBI and immediately returns a summary of the first result that has full text. Nothing is saved.

```json
{
  "query": "mediterranean diet cardiovascular risk",
  "language": "english"
}
```

Response:

```json
{
  "success": true,
  "summary": "…",
  "source_article": { "title": "…", "authors": "…", "journal": "…", "pub_date": "2025", "pmcid": "PMC1234567", "url": "https://pmc.ncbi.nlm.nih.gov/articles/PMC1234567/" },
  "search_info": { "query": "…", "total_found": 128, "articles_returned": 10 },
  "processing_time_ms": 23110
}
```

## Queued summary

```text
POST https://api.prosecaptain.com/api/generate/article-summary?token=YOUR_TOKEN
```

Queues a summary of a specific paper and immediately returns an `article_id`. Check the result with the [article status](/en/docs/articles/).

```json
{
  "url": "https://pmc.ncbi.nlm.nih.gov/articles/PMC1234567/",
  "language": "english"
}
```

| Field | Required | Description |
|---|---|---|
| `url` | yes | Paper URL with a PMC id. |
| `language` | yes | Summary language. |
| `article` | no | Paper data (`title`, `authors`, `journal`, `pub_date`, `pmcid`, `fullText`, `abstract`) if you want to provide it instead of fetching from NCBI. |

Response:

```json
{
  "success": true,
  "article_id": "6f1c…",
  "status": "queued",
  "message": "Task queued. Worker will create article and generate the summary."
}
```

The summary is usually ready within a few minutes. Poll the status every 10–15 seconds until `queue_status` becomes `completed` or `failed`.

## Errors

| Status | `code` | Description |
|---|---|---|
| 400 | `VALIDATION_FAILED`, `INVALID_URL` | Missing fields or a URL without a PMC id. |
| 404 | `NOT_FOUND`, `no_articles_found` | No full text for the paper, or no search results. |
| 503 | `WORKER_UNAVAILABLE` | The queue is temporarily unavailable. Retry. |