Introduction

Authentication

Learn how to authenticate requests to the Companion API

API keys

The Companion API uses API keys to authenticate requests. Every API key is scoped to an organization and a project. All resources — companions, tools, knowledge collections, and FAQ collections — live under a specific project.

All API requests must include the key in the X-Api-Key header:

X-Api-Key: <your-api-key>

If the key is missing, expired, or invalid, the server responds with 401 Unauthorized.

Your API key is a secret. Keep it private and only use it on the server side — never expose it in client-side code.

Getting an API key

To generate an API key, go to the API Keys page in the dashboard and click Generate API key.

When generating a key, you configure:

  1. Project — select which project to scope the key to.
  2. Provider — choose Azure OpenAI as the LLM provider.
  3. Deployment type — choose Custom or Napster:
    • Custom — you provide your own deployment credentials (Azure endpoint and key). AI inference runs in your cloud environment.
    • Napster — Napster manages the model infrastructure. No credentials needed.

Using your API key

Include your key in the X-Api-Key header on every request:

curl -X POST https://companion-api.napster.com/public/connections \
  -H "X-Api-Key: $NAPSTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "companionId": "comp_abc123",
    "providerConfig": {
      "voiceId": "alloy",
      "settings": {}
    }
  }'

The same key works for all Companion API endpoints — managing companions, uploading knowledge, configuring tools, and everything else.

On this page