API keys

Find and securely use your Vapi public and private API keys.

Never expose a private API key in browser or mobile app code, logs, screenshots, a source-code repository, or paste it in an agent chat. Store private keys in a server-side secret manager or environment variable.

A Vapi API key is a credential that authorizes an application to access your Vapi organization. Use a public API key for supported client-side integrations and a private API key for server-side requests.

This guide covers API keys issued by Vapi. To connect accounts from model, voice, transcriber, and telephony providers, see Provider keys.

How it works

Every API key belongs to one Vapi organization. Choose the key type based on where your application runs, then limit the key to the origins and assistants that need access.

Key typeUse it forWhere to store it
Public API keyClient-side Vapi SDKs and web integrationsClient-side application configuration
Private API keyVapi REST API, server SDKs, and server-side integrationsServer-side secret manager or environment variable

Prerequisites

  • A Vapi account
  • Access to API Keys for your Vapi organization

Create an API key

1

Open API Keys

Open the Dashboard, then select API Keys.

Complete Dashboard API Keys page with the expanded sidebar and private and public API key sections
Open API Keys to view and create private or public keys.
2

Choose a key type

Choose Private API Keys for server-side access or Public API Keys for client-side SDK access.

3

Start creating the key

In the section for your chosen key type, select Add Key.

4

Name the key

Enter a descriptive name in Name.

5

Restrict access

For a public key, enter the URLs that may use the key in Allowed Origins. In Allowed Assistants, select the assistants the key may access. Enable Transient Assistant only when the application needs to create calls with transient assistants.

For example, add https://app.example.com for a production web application.

Complete New Public API Key form with the expanded Dashboard sidebar, name, allowed origins, allowed assistants, and transient assistant settings
Configure the public key name and access restrictions.
6

Create and store the key

Select Create Private Token or Create Public Token. Select Copy ID next to the new key, then store the copied value in the appropriate location for that key type.

Use separate keys for development, staging, and production. Give each key only the access its application needs.

View or copy a key

Open the Dashboard, then select API Keys. Find the key under Private API Keys or Public API Keys.

  • Select the eye icon next to the masked key value to view the key.
  • Select the copy icon next to the masked key value to copy the key.

Use a public API key

Pass a public API key to the Vapi Web SDK to start a browser-based voice call with an assistant:

1import Vapi from "@vapi-ai/web";
2
3const vapi = new Vapi("YOUR_PUBLIC_API_KEY");
4vapi.start("YOUR_ASSISTANT_ID");

Replace YOUR_PUBLIC_API_KEY and YOUR_ASSISTANT_ID with values from your Vapi organization.

Public API keys are visible in client-side code. Restrict them to the required origins and assistants. For short-lived or user-specific access, use JWT authentication.

Test a private API key

Send a private API key in the Authorization header as a bearer token. This request only lists the assistants in your organization and does not modify them:

$export VAPI_PRIVATE_API_KEY="YOUR_PRIVATE_API_KEY"
$
$curl https://api.vapi.ai/assistant \
> -H "Authorization: Bearer $VAPI_PRIVATE_API_KEY"

Replace YOUR_PRIVATE_API_KEY with your private API key. Do not add the real value to a script or commit it to version control.

Find your organization ID

Some integrations require your organization ID in addition to an API key.

1

Open General Settings

Open the Dashboard. Select your organization name in the upper-left corner, then select Settings.

Under Organization Settings, select General Settings.

Complete Dashboard General Settings page with the main and Settings sidebars expanded and organization values blurred
Select General Settings under Organization Settings.
2

Copy the organization ID

Locate Organization ID, then select Copy to clipboard.

Verify it works

Run the list-assistants request with a private API key. A successful request returns a JSON list containing the assistant you created. A 401 response means the key is missing, invalid, or unavailable to the organization making the request.

Confirm that the new key also appears under Private API Keys or Public API Keys in the Dashboard.