WikiRest Docs

GET /v1/chunk/{id}

Retrieve a single text chunk by its ID. Chunks are passages from Wikipedia articles, typically a paragraph or small section.

GET https://api.wikirest.com/v1/chunk/{id}

Try it in Playground

Chunk ID Format

Chunk IDs follow the format {page_id}_{chunk_index}:

  • 736_0 - First chunk (index 0) of page 736 (Albert Einstein)
  • 736_5 - Sixth chunk (index 5) of page 736
  • 12345_12 - Thirteenth chunk of page 12345

Path Parameters

Parameter Type Description
id string Chunk ID in format {page_id}_{chunk_index}

Response

{
  "id": "736_0",
  "page_id": 736,
  "rev_id": 1234567890,
  "title": "Albert Einstein",
  "section": "",
  "text": "Albert Einstein (14 March 1879 - 18 April 1955) was a German-born theoretical physicist who is widely held to be one of the greatest and most influential scientists of all time.",
  "chunk_id": 0,
  "url": "https://en.wikipedia.org/wiki/Albert_Einstein",
  "timestamp": "2024-01-15T10:30:00Z",
  "source": {
    "project": "en.wikipedia.org",
    "page_id": 736,
    "revision_id": 1234567890,
    "source_url": "https://en.wikipedia.org/wiki/Albert_Einstein",
    "permalink": "https://en.wikipedia.org/w/index.php?curid=736&oldid=1234567890"
  },
  "license": {
    "name": "CC BY-SA 4.0",
    "full_name": "Creative Commons Attribution-ShareAlike 4.0 International",
    "url": "https://creativecommons.org/licenses/by-sa/4.0/"
  },
  "modified": true,
  "modifications": [
    "Converted from Wikitext markup to plain text",
    "HTML tags and references removed",
    "Chunked into passages for semantic search"
  ]
}

Response Fields

Field Type Description
id string Unique chunk ID
page_id integer Wikipedia page ID
title string Wikipedia article title
section string Section heading (empty for article intro)
text string The chunk text content
chunk_id integer Position within the page (0-indexed)
source object Source attribution with Wikipedia links
license object Content license information

Examples

Get a specific chunk

curl -H "X-API-Key: YOUR_KEY" \
  "https://api.wikirest.com/v1/chunk/736_0"

Get chunk from search results

# Search returns chunk IDs in hits[].id
# Use that ID to fetch the full chunk:
curl -H "X-API-Key: YOUR_KEY" \
  "https://api.wikirest.com/v1/chunk/736_5"

Use Cases

  • Building LLM context: Fetch specific chunks identified by search
  • Citations: Each chunk includes full source attribution
  • Navigation: Use chunk IDs to iterate through an article

Error Responses

Status Error Description
404 not found Chunk ID does not exist
401 unauthorized API key not provided
429 rate_limit_exceeded Too many requests

Was this page helpful?

Help us improve our documentation