> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superintern.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Keys and Web SDK

> Create API keys for your team, connect your own code to SuperIntern, and put SuperIntern's chat on your website with the Web SDK.

An API key lets something outside SuperIntern work with your team's agents. With one you can:

* **put SuperIntern's chat on your website**, so visitors get answers and leave their details,
* **chat with SuperIntern from your own app** or server,
* **show your property listings** or the CRM items you've made public on your website,
* **read and update your CRM**, or **run email campaigns**, from your own code.

> [!TIP]
>
> Only want a chat window on your website? You don't need to read further than [Add the chat to your website](#add-the-chat-to-your-website). The **Web Chat** page in SuperIntern creates the key and gives you the code to paste.

## Create a Key

API keys belong to your team. A team admin creates them from **Team → API keys** in the SuperIntern web app. A team can have up to **20 keys** at a time.

**1. Open your team's API keys**

Go to **Team → API keys** and click **Create Key**.

**2. Say what it is for**

**What is this key for?** fills in the permissions for you, and you can still change them below:

* **Claude Code or another AI tool, for one business**: that business's CRM (items, tables and what is public) and its websites. Enough to build a website with a shop or customer sign-in.
* **The chat on a website**: a key that is safe to put in your website's code. It can only chat, with the skills you choose.
* **Something else**: choose every permission yourself.

**3. Name it**

Pick a name that tells you where the key is used, such as "Website chat" or "Order sync". You'll see it in the list of keys later.

**4. Choose where you'll use it**

* **On your website**: safe to put in your website's code. It does one thing, which you choose.
* **In your own code**: keep it on your server and never put it in a web page. It can do several things at once.

**5. Choose what it can do**

See [What a key can do](#what-a-key-can-do) below. A website chat key also needs at least one skill: visitors can only talk to the skills you pick.

**6. Copy the key**

The key is shown **only once**, straight after you create it. Copy it and keep it somewhere safe. If you lose it, delete it and create a new one.

> [!NOTE]
>
> On a personal account (not in a team), API keys are off unless SuperIntern support switches them on for you. Email [support@superintern.ai](mailto:support@superintern.ai) to ask.

## What a Key Can Do

### On your website

A website key does exactly one of these:

| Choice | What it's for |
| - | - |
| **Chat with visitors** | Runs the chat window on your website. It only works with the skills you picked. |
| **Show your property listings** | Lists the properties you're advertising, with their photos, on your own site. |
| **Show what you've made public in a CRM** | Reads only the tables, columns and items you've marked public in your [CRM](https://docs.superintern.ai/intern/crm.md). |

Anyone who opens your website can see a website key, so these keys are built to give away nothing private.

### In your own code

A key for your own code can hold several of these:

| Permission | What it lets your code do |
| - | - |
| **Chat with SuperIntern** | Send messages to your agent and get its replies. |
| **Read your property listings** | Read the listings you've published, to show them somewhere else. |
| **Connect to your team's MCP server** | Let an AI tool use the MCP server your team set up in SuperIntern. |
| **Read your Telegram groups and messages** | For a partner app that needs your group conversations. Only a team admin can give this, and only give it to partners you trust. |

A key can also work with **one business's CRM**, **its email campaigns** or **its websites**. Choose the business at the top of the CRM part of the list (with only one, it is chosen for you): some permissions depend on it and stay greyed out until it is chosen. That key can't do anything else, so create a second key for the rest.

| CRM permission | What it lets your code do |
| - | - |
| See tables, items and contacts | Read everything in that CRM |
| Add, change and delete items | Also edit items |
| Create and change tables and columns | Also change the CRM's tables (agent owner or team admin only) |
| See saved views and automations | Read them as well |
| Set up and change saved views and automations | Also change them (agent owner or team admin only) |

| Website permission | What it lets your code do |
| - | - |
| See websites and copy their files | Read the business's websites (agent owner or team admin only) |
| Create websites, change them and put them online | Also build and publish them, and switch customer accounts on or off (agent owner or team admin only) |

| Campaign permission | What it lets your code do |
| - | - |
| See campaigns and how they're going | Read campaigns and their results |
| Create and edit draft campaigns | Also write drafts |
| Schedule, pause and cancel campaigns | Also send them. Scheduling a campaign emails its recipients. |

Campaign permissions can only be given by the agent's owner or a team admin. A CRM or campaign key works as the person who created it: if they lose access to that agent, the key does too.

### Limit a chat key to some skills

When a key can chat, you can limit it to one or more [skills](https://docs.superintern.ai/skills/what-is-a-skill.md). It then can't reach any other skill, which keeps it away from tools you don't want it near, such as your CRM or memory. Leave the list empty to allow every skill.

## Manage Your Keys

The **Team → API keys** list shows each key's name, what it can do, when it was created and when it was last used.

* **Change a key.** Click the edit button to change its skills, or to turn on spam protection for a website chat key. You can take permissions away from a key, but never add them: to give a key more, create a new one.
* **Delete a key.** Deleting stops the key working straight away, everywhere it is used, and can't be undone. Put the new key in place before you delete the old one.
* **Out of room?** When your team has 20 keys, delete one you no longer use to create another.

> [!WARNING]
>
> Anyone with a key for your own code can act as your team with it. Keep it on your server, out of version control and out of web pages. Only website keys are made to be published.

## Use a Key

Send the key in the `Authorization` header of every request:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

All requests go to `https://api.superintern.ai`.

### What a key opens

| You want to | Request | Key needs |
| - | - | - |
| Chat with your agent | `POST /agent/async/chat` | Chat |
| Read a past chat, or pick up new replies | `GET /agent/history` | Chat |
| Show your listings | `GET /public/crm/properties?agent_id=…` and `GET /public/crm/properties/{id}?agent_id=…` | Property listings |
| Read and update your CRM | `/crm/v1/…` | A CRM permission. See [API](https://docs.superintern.ai/integrations/api.md) |
| Run email campaigns | `/campaigns/v1/…` | A campaign permission |
| Use your CRM from Claude, ChatGPT or Cursor | `https://api.superintern.ai/crm/mcp` | A CRM permission. See [MCP](https://docs.superintern.ai/integrations/mcp.md) |

A key used somewhere it isn't allowed gets `401`.

### Chat with your agent

```bash theme={null}
curl -X POST https://api.superintern.ai/agent/async/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "YOUR_AGENT_ID",
    "query": "What are your opening hours?",
    "session_id": "customer-123",
    "stream": false
  }'
```

| Field | Required | Meaning |
| - | - | - |
| `agent_id` | Yes | Your agent's id. It is in the snippet the **Web Chat** page gives you. |
| `query` | Yes | The message. |
| `session_id` | No | Send the same value to carry on the same conversation. |
| `mode_short_id` | No | The skill that answers. A key limited to some skills uses the first of them when you leave this out. |
| `stream` | No | `true` sends the reply piece by piece as server-sent events (`content`, `thinking`, `tool_call_start`, `tool_call_end`, `error`, `done`). |

When something is refused, check `error_code` rather than the message, which may change:

| HTTP | `error_code` | What happened |
| - | - | - |
| 401 | | The key is wrong, deleted, or can't be used for chat |
| 403 | | The key isn't allowed to use that skill |
| 403 | `session_not_yours` | That conversation belongs to someone else. Start a new `session_id`. |
| 429 | `too_many_conversations` | Too many new conversations at once from one visitor. Wait a minute. |

A message uses credits the same way as a message in the web app. See [Billing](https://docs.superintern.ai/billing.md).

## Add the Chat to Your Website

The Web SDK puts a SuperIntern chat window on any website, with one script and a few lines of settings. Visitors ask questions, SuperIntern answers from your knowledge base, and you can read every conversation in SuperIntern.

### The quick way

1. Open the **Web Chat** page in SuperIntern.
2. Choose how the chat should behave: a sales assistant that collects visitors' details, a project FAQ, or first-line customer support.
3. SuperIntern creates a website key and gives you a snippet. Paste it into your site, just before `</body>`, or into your tag manager.

You can try it first in the [playground](https://playground.superintern.ai) before it goes on your site.

### Add it yourself

Load the SDK, then open a chat button in the corner of every page:

```html theme={null}
<script src="https://cdn.superintern.ai/sdk/embed.global.js" defer></script>
<script>
  window.addEventListener("load", function () {
    window.SuperIntern.ChatButton({
      baseSettings: {
        apiKey: "YOUR_WEBSITE_KEY",
        agentId: "YOUR_AGENT_ID",
        environment: "production",
        primaryBrandColor: "#4f46e5",
      },
      aiChatSettings: {
        aiAssistantName: "Support Assistant",
        introMessage: "👋 Hi! How can I help you today?",
        quickQuestions: ["What do you offer?", "How much does it cost?"],
      },
    });
  });
</script>
```

Use a **Chat with visitors** website key here, never a key for your own code. Without both `apiKey` and `agentId` the window shows a placeholder message and never answers.

### Choose how it looks on the page

| Widget | Where it shows | Needs a place on the page |
| - | - | - |
| `ChatButton` | A floating button that opens the chat | No |
| `EmbeddedChat` | A chat built into the page, for a help or contact page | Yes |
| `SidebarChat` | A panel docked to the side of the page | Yes |
| `ModalChat` | A chat that opens in a dialog when you call it | No |
| `SearchBar` | A search box that answers from your knowledge base | Yes |

Widgets that need a place take a CSS selector first, for example `SuperIntern.EmbeddedChat("#chat", { ... })` with `<div id="chat" style="height: 600px"></div>` on the page. You can see each one in the [playground](https://playground.superintern.ai).

### Settings

All widgets take the same settings. Only `apiKey` and `agentId` are required.

**`baseSettings`**

| Setting | What it does |
| - | - |
| `apiKey` | Your website chat key |
| `agentId` | Your agent's id |
| `environment` | `"production"` (the default) |
| `primaryBrandColor`, `secondaryBrandColor` | Your brand colours |
| `theme` | `{ colorMode: { type: "light" \| "dark" \| "auto" } }` |
| `skillId` | Which skill answers. Leave it out to follow the key's default, which you can change in SuperIntern without touching your site. |
| `persistSessionOnReload` | `true` keeps the conversation when the visitor reloads the page |
| `user` | `{ id, email, name }` of a visitor who is signed in on your site, so their chats are grouped under one person |
| `getCustomerGrant` | For sites where customers sign in: lets the chat answer about their own orders and bookings |
| `turnstileSiteKey` | Turns on a quiet check that the visitor is human, which stops automated spam. SuperIntern gives you the key. |

**`aiChatSettings`**

| Setting | What it does |
| - | - |
| `aiAssistantName`, `aiAssistantDescription` | The name and line shown at the top of the chat |
| `introMessage` | The first message visitors see |
| `quickQuestions` | Buttons with questions visitors can ask in one click |
| `placeholder` | The text in the empty message box |
| `botAvatarSrcUrl` | The assistant's picture |
| `language` | The language of the chat's own buttons and forms, such as `"en"`, `"es"`, `"ja"` or `"zh-CN"`. By default it follows the visitor's browser. |
| `disclaimer` | `{ text, link }` shown under the message box |
| `showPoweredBy` | `false` hides "Powered by SuperIntern" |
| `showEscalateButton` | `false` hides the "Talk to a human" button. SuperIntern can still hand a chat to your team. |
| `contactForm` | The wording and fields of the form visitors use to leave their details |
| `privacy` | `{ text, link }` to your privacy policy, shown where visitors leave their email |
| `productCards` | Shows cards for the products SuperIntern mentions, from a CRM table you've made public |
| `feedback` | Thumbs up and down on answers, and the questions asked after them |
| `enableSearchMode` | Adds a search mode next to chat |

> [!NOTE]
>
> If your site has a Content-Security-Policy, allow `https://cdn.superintern.ai` in `script-src`, `https://api.superintern.ai` in `connect-src` and `img-src`, and, when the human check is on, `https://playground.superintern.ai` in `frame-src`.

### Keep spam out

On the key's edit screen in **Team → API keys**, turn on **Spam protection for your website chat**. Start with **Check visitors, don't block**, then switch to **Block chats that fail the check** once you're happy. Visitors only see a check when Cloudflare isn't sure they're human.

***

Questions about API keys or the Web SDK? Email [support@superintern.ai](mailto:support@superintern.ai).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.