Build with AI
Give an AI assistant the sajn docs as Markdown, llms.txt, or an MCP server, and connect it to your workspace
AI coding assistants write better sajn integrations when they read the current docs instead of guessing from training data. sajn gives you four ways to hand them the docs, and one way to let them work in your workspace.
Choose an option
| You want the assistant to | Use |
|---|---|
| Read one page you're looking at | The Markdown version of the page, or the page buttons |
| Load the whole docs site at once | llms.txt |
| Search the docs while it works, in your editor | The docs MCP server |
| Read and change documents, contacts, and templates in your workspace | The workspace MCP server |
| Write an integration that learns about changes from webhooks instead of polling | The integration rules |
Move your code from 2026-09 to 2026-10 | The upgrade prompt |
Read a page as Markdown
Every page has a Markdown version at the same URL with .md added. For example, the Markdown version of the quickstart is the following:
https://www.sajn.se/docs/get-started/quickstart.mdPaste the URL into an assistant that can fetch web pages, or paste the Markdown itself. Markdown has no navigation or styling, so it uses fewer tokens than the HTML page.
Use the page buttons
Every page has two buttons under its title:
- Copy Markdown copies the page as Markdown.
- Open has the following options:
- View as Markdown opens the Markdown version.
- Open in ChatGPT, Open in Claude, Open in Cursor, and Open in Scira AI start a conversation that asks the assistant to read the page.
To add the docs to Cursor, VS Code, or another editor, set up the docs MCP server.
Load the docs with llms.txt
The docs site publishes an llms.txt file, an index of every page with a short description and a link to its Markdown version:
https://www.sajn.se/docs/llms.txtTo load the full text of every page in one file, use https://www.sajn.se/docs/llms-full.txt. It's large, so we recommend it only for assistants with a big context window.
Search the docs with MCP
The docs MCP server lets an assistant search these docs whenever it needs to, instead of loading them up front. It needs no login, and it can't see your account.
https://www.sajn.se/docs/mcpFor setup instructions for Claude, Cursor, VS Code, and other clients, see Documentation MCP server.
Work in your workspace with MCP
The workspace MCP server connects an assistant to your sajn account. It can find and read documents, build and send them, manage parties, contacts, and templates, and read API logs and webhook deliveries while you debug an integration. You sign in with OAuth 2.0, pick one or more workspaces, and choose what the assistant may do in each. It can never do more than your role allows.
https://app.sajn.se/api/mcpFor the tools, scopes, and setup, see sajn MCP server.
The workspace MCP server acts on real data. A document that the assistant sends reaches real people. To try it safely, connect it to a sandbox.
Give the assistant the integration rules
Assistants often wait for a signature by calling GET /api/v1/documents/{id} in a loop. A document stays PENDING until it's signed, rejected, expired, or withdrawn, which can take months, so the loop runs around the clock and spends the rate limit that every integration in your organization shares.
To prevent this, add the following rules to the instructions file that your assistant reads, such as AGENTS.md, CLAUDE.md, or a Cursor rule:
## sajn API
- Read https://www.sajn.se/docs/llms.txt before you write code against the sajn API.
- Send `Sajn-Version: 2026-10` on every request.
- Never poll a document or a list endpoint to wait for a status change. A document can stay PENDING for months.
- Learn about changes from webhooks. To track signing, subscribe to document.completed, document.rejected, document.expired, and document.withdrawn.
- Create one webhook endpoint when you set up the integration, not one per document.
- Verify the webhook-signature header, return 2xx within 30 seconds, and skip event IDs you have already processed.
- Download the signed PDF on document.completed, not on document.fully_signed.
- To catch missed deliveries, or if sajn can't reach the server, read GET /api/v1/events on a schedule with createdAfter and type.
- To sync a list, request limit=100 and filter with updatedAfter. Don't read the whole list again on a schedule.
- Fetch a party's signingUrl only when you show it. Every fetch writes an audit log entry.
- On 429 and on 409 IDEMPOTENCY_KEY_IN_USE, wait for the Retry-After header before you retry.
- Retry 500, 503, and network errors with exponential backoff and a maximum number of attempts. Don't retry other 4xx errors unchanged, such as 400, 403 LIMIT_EXCEEDED, or 404.For the full pattern, see Wait for signatures.
Upgrade an integration with AI
The Upgrading to 2026-10 guide includes a prompt for coding assistants such as Claude Code, Cursor, and Codex. Run it in your repository: it lists every change between 2026-09 and 2026-10, and points the assistant at the Markdown version of the guide for the before-and-after examples.
Generate a typed client
To generate a client in your language, give the assistant or your code generator the OpenAPI specification:
https://app.sajn.se/api/v1/openapiWas this page helpful?
Last updated on