BLOG — DEVELOPERS

A first integration with the 9xAI API

Getting a copilot session running from your own code takes one API call. Here's what that actually looks like.

Building on 9xAI starts with creating a copilot session — the same underlying primitive whether you're integrating the Engineering copilot into an internal tool, or building a customer-facing product on top of the Finance copilot. The API is designed so this first step is genuinely simple, even though a lot of platform capability sits behind it.

Creating a session

A session is created with a single authenticated POST request to the relevant copilot's sessions endpoint:

const res = await fetch("https://api.9xai.in/copilot/engineering/sessions", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_API_KEY" },
  body: JSON.stringify({ title: "New session" })
});

The copilot in the URL path — engineering here — determines which of the 14 industry copilots handles the session, or you can use the general-purpose 9xChat endpoint if the work doesn't need a specific domain lens.

What happens behind that one call

A single session creation call sets up everything a conversation with that copilot needs: the domain-specific system context for the chosen copilot, access to the Model Router for that session's requests, and a persistent session ID you can use for follow-up messages, file attachments, and — where relevant — 9xAgents-style multi-step task execution.

Where to go from a first session

From here, the natural next steps are sending messages into the session, attaching documents for the copilot to work with, and, for more advanced integrations, using the Agent APIs for multi-step workflows or the Knowledge APIs to connect your own organization's data as context. The full endpoint reference for all of this lives in the API Reference.

The design goal throughout is the same one that shapes the rest of the platform: the same infrastructure and Model Router power every copilot, so switching which copilot your integration targets is a change to a URL path, not a different integration to build from scratch.

Ready to put 9xAI to work?