Grokipedia API
Livev0.3.0 · PHPUnofficial REST wrapper for grokipedia.com. Returns structured JSON — title, clean plain text, word count, and references — for any Grokipedia page. Responses cached for 48 hours. Not affiliated with xAI.
GET /page/{slug}
Fetches and parses a Grokipedia page. Returns structured JSON.
GET
/page/{slug}
Path parameter
| Parameter | Description |
|---|---|
| slug | Page name. Case-insensitive; spaces or underscores both work.
e.g. Brisbane, Ada_Lovelace, quantum computing |
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| extract_refs | bool | true | Include numbered reference list |
| truncate | int | — | Truncate content_text to N characters |
| citations | bool | false | Preserve inline <sup> citation markers in text |
# Path style (requires mod_rewrite)
https://spaceless.com/grokipedia/page/Brisbane
https://spaceless.com/grokipedia/page/Ada_Lovelace?truncate=500
https://spaceless.com/grokipedia/page/Physics?extract_refs=false&citations=true
GET /health
Returns cache statistics and server status. Requires the HEALTH_SECRET configured in config.php.
GET
/health?key={HEALTH_SECRET}
{
"status": "Live",
"cached_items": 12,
"cache_size_bytes": 614400,
"cache_size_mb": 0.59,
"cached_slugs": ["Brisbane", "Physics", "Taiwan"],
"timestamp": "2025-04-19T14:32:00+00:00"
}
Response schema
| Field | Type | Description |
|---|---|---|
| title | string | Page heading from <h1> |
| slug | string | Normalised slug used for the request |
| url | string | Canonical URL on grokipedia.com |
| content_text | string | Clean plain-text body; block elements separated by double newlines |
| char_count | int | Character count of content_text |
| word_count | int | Word count of content_text |
| references_count | int | Number of references found |
| references | array | List of {number, url} objects |
Errors & rate limits
| Status | Meaning |
|---|---|
| 400 | Missing or empty slug |
| 404 | Page not found on Grokipedia |
| 429 | Rate limit exceeded |
| 500 | Server misconfiguration |
Rate limit: 100 requests per 60-second window per IP address. Counters reset automatically.
URL styles
Both path-style and query-param URLs are supported — the latter works without mod_rewrite.
# Path style (preferred, requires mod_rewrite) https://spaceless.com/grokipedia/page/Brisbane # Query param style (always works) https://spaceless.com/grokipedia/?route=page&slug=Brisbane
Slug normalisation: the first character is uppercased automatically and spaces become underscores,
so
ada lovelace, Ada_Lovelace and ada_lovelace all resolve to the same page.