GET /v1/page/{page_id}
Retrieve a Wikipedia page by its page ID, including metadata and all text chunks.
GET https://api.wikirest.com/v1/page/{page_id} Path Parameters
| Parameter | Type | Description |
|---|---|---|
page_id | integer | Wikipedia page ID (e.g., 736 for Albert Einstein) |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | Optional | chunks (default) or concat |
max_chunks | integer | Optional | Maximum chunks to return (1-200,000, default: 10,000) |
offset | integer | Optional | Chunk offset for pagination (default: 0) |
Format Options
format=chunks (default)
Returns an array of chunk objects, each with its own text, section, and metadata.
format=concat
Adds a text field with all chunks concatenated into a single string.
Response
{
"page": {
"id": "736",
"page_id": 736,
"rev_id": 1234567890,
"title": "Albert Einstein",
"url": "https://en.wikipedia.org/wiki/Albert_Einstein",
"timestamp": "2024-01-15T10:30:00Z",
"ts_unix": 1705315800,
"source": {...},
"license": {...}
},
"chunks": {
"results": [
{
"id": "736_0",
"page_id": 736,
"title": "Albert Einstein",
"section": "",
"text": "Albert Einstein was a German-born theoretical physicist...",
"chunk_id": 0
},
{
"id": "736_1",
"page_id": 736,
"title": "Albert Einstein",
"section": "Early life and education",
"text": "Einstein was born in Ulm...",
"chunk_id": 1
}
],
"offset": 0,
"limit": 10000,
"total": 45
},
"attribution": {...}
} Response Fields
| Field | Type | Description |
|---|---|---|
page | object | Page metadata with attribution |
page.page_id | integer | Wikipedia page ID |
page.title | string | Article title |
page.timestamp | string | Last modification (ISO 8601) |
chunks.results | array | Array of chunk objects |
chunks.total | integer | Total chunks in this page |
text | string | Concatenated text (only with format=concat) |
Finding Page IDs
Wikipedia page IDs can be found through:
- Search results: The
page_idfield in search hits - Wikipedia API:
https://en.wikipedia.org/w/api.php?action=query&titles=Albert_Einstein&format=json - Page info: "Page information" link in Wikipedia's Tools menu
Examples
Get a page with all chunks
curl -H "X-API-Key: YOUR_KEY" \
"https://api.wikirest.com/v1/page/736" Get page as concatenated text for LLM
curl -H "X-API-Key: YOUR_KEY" \
"https://api.wikirest.com/v1/page/736?format=concat" Paginate through large article
# Get first 100 chunks
curl -H "X-API-Key: YOUR_KEY" \
"https://api.wikirest.com/v1/page/736?max_chunks=100"
# Get next 100 chunks
curl -H "X-API-Key: YOUR_KEY" \
"https://api.wikirest.com/v1/page/736?max_chunks=100&offset=100" Error Responses
| Status | Error | Description |
|---|---|---|
400 | page_id must be an integer | Invalid page_id format |
404 | not found | Page ID does not exist |
401 | unauthorized | API key not provided |
429 | rate_limit_exceeded | Too many requests |
Related
- /v1/lucky - Get page by search query
- /v1/chunk - Get individual chunks
- /v1/changes - Track page changes