Knowledgelib icon

Knowledgelib

Query pre-verified, cited knowledge units from knowledgelib.io

Get Unit

AI-generated

Summary

Retrieve a knowledge unit by ID path, with optional format selection for markdown or JSON response.

Inputs

  • unitId (required) — Unit ID path (e.g., 'consumer-electronics/audio/wireless-earbuds-under-150/2026')
  • format — Response format: raw markdown or structured JSON with parsed frontmatter; defaults to 'md' if omitted

Output shape

json

Each returned item contains a json property. When format is 'json', the value is the parsed unit data fetched from the API endpoint /api/v1/units/{unitId}.json. When format is 'md' (default), the value is { id: string, format: 'markdown', content: string } where content is the raw markdown text fetched from /api/v1/units/{unitId}.md. Authentication is handled via optional knowledgelibApi credentials; if absent, public access to https://knowledgelib.io is used.

Examples

Example 1: Fetch a unit as raw markdown

unitId: 'consumer-electronics/audio/wireless-earbuds-under-150/2026', format: 'md' (default)

Example 2: Fetch a unit as structured JSON

unitId: 'consumer-electronics/audio/wireless-earbuds-under-150/2026', format: 'json'

Links

Discussion