# Scholarly Works Search (`openalex.works`)

Search 250M+ scholarly works (papers, books, datasets) with citations, authors and open-access links.

- **Route:** `POST /v1/run/openalex.works`
- **Price:** $0.0008 per request ($0.80 per 1,000) · `cost_usd` on every response
- **Source:** OpenAlex (`openalex`) · failover: no
- **Measured latency:** not enough calls measured yet
- **Heavy response:** no

## Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `query` | string | yes |  |  |
| `from_year` | integer, null | no | null |  |
| `open_access_only` | boolean | no | false |  |
| `sort` | string | no | "relevance" |  |
| `limit` | integer | no | 25 |  |

## Output (`output` in the run envelope)

| Field | Meaning |
|---|---|
| `results` | Title, DOI, year, citations, authors, venue, OA link. |

## Example

```bash
curl -s -X POST https://getallapis.com/v1/run/openalex.works \
  -H "Authorization: Bearer $GETALLAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"retrieval augmented generation","limit":5}'
```

```python
from getallapis_client import Client
client = Client()  # reads GETALLAPIS_API_KEY
result = client.run('openalex.works', {'query': 'retrieval augmented generation', 'limit': 5})
print(result['cost_usd'], result['output'])
```

```bash
getallapis run openalex.works '{"query":"retrieval augmented generation","limit":5}'
```

Quote first (free, validates input): `POST /v1/quote/openalex.works` with the same body.
