Skip to content

Add Fake Voice Agent API documentation and enhance OpenAPI docs #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
253 changes: 253 additions & 0 deletions fern/api-reference/fake-voice-agent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
---
title: Fake Voice Agent API Endpoints
description: Detailed documentation for the Fake Voice Agent API endpoints.
---

# Fake Voice Agent API Endpoints

## Introduction

The Fake Voice Agent API provides endpoints for simulating voice agent interactions. This documentation outlines the available endpoints, their usage, and example requests.

## Endpoints

### GET /fake-route

**Summary:** Fake voice root endpoint

**Description:** This endpoint simulates a basic voice interaction.

**Response:**
- **200:** Returns a simple JSON object with a message.

**Example:**

```javascript
fetch('/fake-route', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### POST /fake-route

**Summary:** Fake POST endpoint

**Description:** This endpoint simulates a voice interaction with a provided data string.

**Request Body:**
- **data** (string): The data string to be processed.

**Response:**
- **201:** Returns a JSON object with a status.

**Example:**

```javascript
fetch('/fake-route', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ data: 'example data' })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### POST /fake-voice-agent/start

**Summary:** Start a fake voice agent

**Description:** This endpoint initiates a fake voice agent interaction.

**Request Body:**
- **agentName** (string): The name of the agent to start.

**Response:**
- **200:** Returns a JSON object with the agent's ID and status.

**Example:**

```javascript
fetch('/fake-voice-agent/start', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ agentName: 'testAgent' })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### POST /fake-voice-agent/stop

**Summary:** Stop a fake voice agent

**Description:** This endpoint stops a fake voice agent interaction.

**Request Body:**
- **id** (string): The ID of the agent to stop.

**Response:**
- **200:** Returns a JSON object with the status.

**Example:**

```javascript
fetch('/fake-voice-agent/stop', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ id: 'agent123' })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### GET /fake-voice-agent/{id}/status

**Summary:** Get fake voice agent status

**Description:** This endpoint retrieves the status of a fake voice agent.

**Parameters:**
- **id** (string, required): The ID of the agent.

**Response:**
- **200:** Returns a JSON object with the agent's ID and status.

**Example:**

```javascript
fetch('/fake-voice-agent/agent123/status', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### GET /fake-list

**Summary:** List fake voice agents

**Description:** This endpoint lists all fake voice agents.

**Response:**
- **200:** Returns an array of agent names.

**Example:**

```javascript
fetch('/fake-list', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

### GET /fake-status

**Summary:** Fake health check

**Description:** This endpoint performs a health check on the fake voice agent service.

**Response:**
- **200:** Returns a JSON object with the status.

**Example:**

```javascript
fetch('/fake-status', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

## Usage Examples

### Starting a Fake Voice Agent

```javascript
fetch('/fake-voice-agent/start', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ agentName: 'exampleAgent' })
})
.then(response => response.json())
.then(data => {
console.log('Agent started:', data);
// Store the agent ID for future requests
const agentId = data.id;
})
.catch(error => console.error('Error:', error));
```

### Stopping a Fake Voice Agent

```javascript
fetch('/fake-voice-agent/stop', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({ id: 'exampleAgentId' })
})
.then(response => response.json())
.then(data => console.log('Agent stopped:', data))
.catch(error => console.error('Error:', error));
```

### Checking Fake Voice Agent Status

```javascript
fetch('/fake-voice-agent/exampleAgentId/status', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log('Agent status:', data))
.catch(error => console.error('Error:', error));
```

## Security

All endpoints require authentication via a bearer token. Ensure your API key is included in the `Authorization` header for all requests.

## Conclusion

The Fake Voice Agent API provides a set of endpoints to simulate voice agent interactions. Use these endpoints for testing and development purposes.

For more information on integrating voice agents into your applications, refer to the [Vapi Web SDK documentation](/quickstart/web) and [Vapi Server SDK documentation](/quickstart/server).
54 changes: 53 additions & 1 deletion fern/api-reference/openapi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,60 @@ title: OpenAPI
slug: api-reference/openapi
---

# OpenAPI

Vapi provides a comprehensive OpenAPI specification that describes our REST API endpoints, request/response schemas, and authentication requirements. This specification allows developers to easily integrate Vapi's voice AI capabilities into their applications.

## Accessing the OpenAPI Specification

<Check>
Our OpenAPI is hosted at
Our OpenAPI specification is hosted at:
[https://api.vapi.ai/api-json](https://api.vapi.ai/api-json)
</Check>

You can use this URL to:

- View the full API documentation
- Generate client libraries in various programming languages
- Test API endpoints directly from OpenAPI-compatible tools

## Key Sections

The OpenAPI specification includes details on:

- Available endpoints and HTTP methods
- Request parameters and body schemas
- Response formats and status codes
- Authentication requirements
- Available resources (Assistants, Calls, Phone Numbers, etc.)

## Using with API Tools

Many popular API development and testing tools support importing OpenAPI specifications. Some examples include:

- Postman
- Insomnia
- Swagger UI
- Stoplight Studio

Importing the Vapi OpenAPI spec into these tools allows you to quickly start exploring and testing our API endpoints.

## Code Generation

OpenAPI specifications can be used to auto-generate client libraries and server stubs. Tools like OpenAPI Generator support generating code for:

- TypeScript/JavaScript
- Python
- Java
- C#
- Many other languages

This can significantly speed up API integration in your preferred programming language.

## Versioning

The OpenAPI specification is versioned along with the API. Be sure to check for updates periodically to stay current with any API changes or new features.

## Need Help?

If you have any questions about using our OpenAPI specification or integrating with the Vapi API, please don't hesitate to reach out to our developer support team.
Loading