# SDK and API reference | Sophia Stack X

Source: https://sophiastack.sophiaxt.com/docs/sdk

Docs

*   [Overview](https://sophiastack.sophiaxt.com/docs)
*   [Quick start](https://sophiastack.sophiaxt.com/docs/quick-start)
*   [Concepts](https://sophiastack.sophiaxt.com/docs/concepts)
*   [Publishing and SEO](https://sophiastack.sophiaxt.com/docs/publishing)
*   [Importing](https://sophiastack.sophiaxt.com/docs/import)
*   [Shop](https://sophiastack.sophiaxt.com/docs/shop)
*   [Migrate from WordPress](https://sophiastack.sophiaxt.com/docs/migrate-from-wordpress)
*   [Forms, events and comments](https://sophiastack.sophiaxt.com/docs/forms-events-comments)
*   [Site accounts and email](https://sophiastack.sophiaxt.com/docs/accounts-email)
*   [Security](https://sophiastack.sophiaxt.com/docs/security)
*   [Extensions](https://sophiastack.sophiaxt.com/docs/extensions)
*   [AI agents](https://sophiastack.sophiaxt.com/docs/ai-agents)
*   [Content API](https://sophiastack.sophiaxt.com/docs/content-api)
*   [Deploying](https://sophiastack.sophiaxt.com/docs/deploy)
*   [Commands](https://sophiastack.sophiaxt.com/docs/commands)
*   [SDK](https://sophiastack.sophiaxt.com/docs/sdk)
*   [Business apps](https://sophiastack.sophiaxt.com/docs/business)

# 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](https://sophiastack.sophiaxt.com/sdk/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](https://sophiastack.sophiaxt.com/docs/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](https://sophiastack.sophiaxt.com/sdk/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](https://sophiastack.sophiaxt.com/docs/ai-agents).

## Everything in one file for AI agents

[/llms-full.txt](https://sophiastack.sophiaxt.com/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.
