Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ navigation:
path: server-url/events.mdx
- page: Developing Locally
path: server-url/developing-locally.mdx
- page: Server Authentication
path: server-url/server-authentication.mdx

- section: Community
collapsed: true
Expand Down
84 changes: 84 additions & 0 deletions fern/server-url/server-authentication.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Server Authentication

When configuring webhooks for your assistant, you can authenticate your server endpoints using either a secret token, custom headers, or OAuth2. This ensures that only authorized requests from Vapi are processed by your server.

## Credential Configuration

Credentials can be configured at multiple levels:

1. **Tool Call Level**: Create individual credentials for each tool call
2. **Assistant Level**: Set credentials directly in the assistant configuration
3. **Phone Number Level**: Configure credentials for specific phone numbers
4. **Organization Level**: Manage credentials in the [API Keys page](https://dashboard.vapi.ai/keys)

The order of precedence is:
1. Tool call-level credentials
2. Assistant-level credentials
3. Phone number-level credentials
4. Organization-level credentials from the API Keys page

## Authentication Methods
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a JWT Authentication as well https://docs.vapi.ai/customization/jwt-authentication

We can migrate it into one documentation.


### Secret Token Authentication

The simplest way to authenticate webhook requests is using a secret token. Vapi will include this token in the `X-Vapi-Signature` header of each request.

#### Configuration

```json
{
"server": {
"url": "https://your-server.com/webhook",
"secret": "your-secret-token"
}
}
```

### Custom Headers Authentication

For more complex authentication scenarios, you can configure custom headers that Vapi will include with each webhook request.

#### Configuration

```json
{
"server": {
"url": "https://your-server.com/webhook",
"headers": {
"Authorization": "Bearer your-api-key",
"Custom-Header": "custom-value"
}
}
}
```

### OAuth2 Authentication

For OAuth2-protected webhook endpoints, you can configure OAuth2 credentials that Vapi will use to obtain and refresh access tokens.

#### Configuration

```json
{
"server": {
"url": "https://your-server.com/webhook"
},
"credentials": {
"webhook": {
"type": "oauth2",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"tokenUrl": "https://your-server.com/oauth/token",
"scope": "optional, only needed to specify which scopes to request access for"
}
}
}
```

#### OAuth2 Flow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add examples around the response format as well.


1. Vapi makes a request to your token endpoint with client credentials
2. Your server validates the credentials and returns an access token
3. Vapi includes the access token in the Authorization header for webhook requests
4. Your server validates the access token before processing the webhook
5. When the token expires, Vapi automatically requests a new one