SDK and API reference
Three ways to build on Sophia Stack X, each with a machine-readable reference so your editor, your code generator or your AI agent gets exact names instead of guesses.
The content API, as OpenAPI
Every install serves an OpenAPI 3.1 description of its content API at /api/v1/openapi.json. It needs no token, and it holds no site data. Feed it to any OpenAPI generator to get a typed client in TypeScript, Python, Go, Swift or anything else, or hand it to an AI agent.
- Download: openapi.json
- What it covers: the site and its collections with their fields, listing and reading live entries, creating drafts, menus as trees, and MCP over HTTP.
- Auth:
Authorization: Bearer sxt_..., a site token with the read, write or mcp scope. See Content API.
npx @openapitools/openapi-generator-cli generate -i https://your-site.com/api/v1/openapi.json -g typescript-fetch -o ./sophia-client
Types for extension code
sophia new app <name> puts sophia.d.ts into the new extension, and server.js points at it. Editors that understand TypeScript, such as VS Code, then autocomplete and check every sx call: routes and the request object, the extension's data models, content, accounts, mail, outbound HTTP, rate limits and escaping.
- Download: sophia.d.ts
- To check a file from a terminal:
npx tsc --noEmit --checkJs --allowJs server.js sophia.d.ts
/// <reference path="./sophia.d.ts" />
sx.route("POST", "/tickets", (req) => {
if (!sx.rateLimit(req.ip, 5, 600)) return { status: 429, text: "Slow down" };
const t = sx.data.create("ticket", { subject: req.form.subject });
return { redirect: "/x/tickets/tickets/" + t.id };
});
MCP tools
The 55 MCP tools describe themselves: an MCP client lists them with tools/list, each with a JSON Schema for its arguments. Run them locally with sophia mcp, or over HTTP at /api/v1/mcp with a token that has the mcp scope. See AI agents.
Everything in one file for AI agents
/llms-full.txt is this whole site as Markdown, and sophia docs prints the full reference for building on the stack. Point an agent at either before it writes an extension.