Docs

Two read endpoints. Together they make a docs project fully retrievable — structure from one call, content from the other. Both are public; a key scopes and rate-limits the request.

GET /api/v1/docs/tree

Returns the project's docs.json: the ordered sidebar groups and the pages in each.

curl "https://api.inkform.dev/api/v1/docs/tree?projectId=YOUR_PROJECT_ID"
{
  "data": {
    "name": "Documentation",
    "version": "1.0",
    "navigation": [
      {
        "group": "Getting Started",
        "pages": [
          { "title": "Introduction", "slug": "introduction", "file": "introduction.mdx" },
          { "title": "Quickstart", "slug": "quickstart", "file": "quickstart.mdx" }
        ]
      }
    ]
  }
}

Page entries may nest via a children array, so walk the tree recursively rather than assuming two levels. Returns 404 if the project isn't a docs project or has no docs.json.

A single page

GET /api/v1/docs/{slug}

Resolved by nav slug, not file path — the same slug that appears in the tree. Nested slugs contain slashes and must be URL-encoded, or simply written as a path:

curl "https://api.inkform.dev/api/v1/docs/guides/newsletter?projectId=YOUR_PROJECT_ID"
{
  "data": {
    "slug": "guides/newsletter",
    "title": "Add newsletter signup to a site",
    "description": "Wire the Inkform newsletter into any Next.js site.",
    "body": "Any site can collect newsletter subscribers..."
  }
}

body is MDX with frontmatter stripped. Returns 404 for an unknown slug or an unpublished page.

Mirroring a docs site

Fetch the tree, then each page:

const BASE = 'https://api.inkform.dev/api/v1';
const projectId = process.env.INKFORM_PROJECT_ID!;
 
const { data: tree } = await fetch(`${BASE}/docs/tree?projectId=${projectId}`).then((r) => r.json());
 
function slugs(pages: any[]): string[] {
  return pages.flatMap((p) => [p.slug, ...(p.children ? slugs(p.children) : [])]);
}
const all = tree.navigation.flatMap((g: any) => slugs(g.pages));
 
// Sequential on purpose — a tight parallel loop is the fastest way to a 429.
const pages = [];
for (const slug of all) {
  const res = await fetch(`${BASE}/docs/${slug}?projectId=${projectId}`);
  if (res.ok) pages.push((await res.json()).data);
}

For a large site, fetch at build time and cache — not per visitor request.

Feeding docs to an AI agent

These two endpoints are what you'd point a retrieval pipeline at: the tree gives you titles and hierarchy for chunk metadata, the page endpoint gives you clean MDX with no navigation chrome to strip.

If you're running the framework yourself, it also ships /llms.txt, /llms-full.txt, and a self-hostable MCP server — usually a better fit than re-implementing retrieval on top of these endpoints.