# With an API key (https://webmetic.de/docs/en/ai-assistant/setup/api-key)

The API key replaces the sign-in, for example in these cases:

- **No sign-in in a browser**: You connect scripts, CI pipelines, or clients that don't start a sign-in.
- **Single sign-on**: You sign in to Webmetic with single sign-on and have no password.

The **AI Assistant (MCP)** window shows the key, and only admins see the menu item for it. If you aren't an admin, ask an admin for the API key.

What you need beforehand is listed under [Before you start](https://webmetic.de/docs/en/ai-assistant/setup#before-you-start).

1. Open [**Menu** > **Integrations** > **MCP**](https://app.webmetic.de/?menu=mcp). The window shows the fields **Server URL** and **Your API key**.
2. Click the copy icon in the **Your API key** field. Webmetic copies the full key, even while it's hidden.

   ![The AI Assistant (MCP) window with the server URL and the hidden API key](https://webmetic.de/docs/media/en/light/mcp-drawer.webp)

3. Enter the key in your client in the `Authorization` header, without "Bearer" in front of it. In Claude Code, it looks like this:

   ```bash
   claude mcp add --transport http --scope user webmetic https://mcp.webmetic.de/mcp --header "Authorization: wmtc_YOUR_API_KEY"
   ```

   In Cursor, add `headers`:

   ```json
   {
     "mcpServers": {
       "webmetic": {
         "url": "https://mcp.webmetic.de/mcp",
         "headers": {
           "Authorization": "wmtc_YOUR_API_KEY"
         }
       }
     }
   }
   ```

Don't put your API key in public code. Anyone with the key can fetch your account's data.

The connection ends when you remove the key from the client, or when an admin creates a new one under [**Menu** > **Integrations** > **API**](https://app.webmetic.de/?menu=api_details). The old key then stops working in other applications too.

## Next steps [#next-steps]

- [Check the connection](https://webmetic.de/docs/en/ai-assistant/setup#check-the-connection): Ask a first question to test that the assistant fetches your data.
- [Example questions](https://webmetic.de/docs/en/ai-assistant/example-questions): Questions for sales and marketing that the assistant answers from your data.
