Grokipedia API

Livev0.3.0 · PHP

Unofficial 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

ParameterDescription
slugPage name. Case-insensitive; spaces or underscores both work. e.g. Brisbane, Ada_Lovelace, quantum computing

Query parameters

ParameterTypeDefaultDescription
extract_refsbooltrueInclude numbered reference list
truncateintTruncate content_text to N characters
citationsboolfalsePreserve 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

FieldTypeDescription
titlestringPage heading from <h1>
slugstringNormalised slug used for the request
urlstringCanonical URL on grokipedia.com
content_textstringClean plain-text body; block elements separated by double newlines
char_countintCharacter count of content_text
word_countintWord count of content_text
references_countintNumber of references found
referencesarrayList of {number, url} objects

Errors & rate limits

StatusMeaning
400Missing or empty slug
404Page not found on Grokipedia
429Rate limit exceeded
500Server 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.