> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getraya.app/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getraya.app/_mcp/server.

# API reference

This section provides detailed API reference documentation for **Raya Voice AI Agents API**.

> **Note**
>
> All endpoints use HTTPS. HTTP is not supported. API keys that call the API over HTTP may be subject to automatic rotation.

## **API Overview**

### **Raya Voice AI Agents API**

The Raya Voice AI Agents API enables you to create, manage, and interact with AI voice agents that can make phone calls, conduct conversations, and handle batch operations.

**Base URL:** `https://v1.getraya.app/api`

**Authentication:** API key via `X-API-Key` header

**Agent guides (create/update):**

* [LLM function tools](/voice-agents/llm-tools)
* [Language Options](/voice-agents/language-options)
* [Voice Options](/voice-agents/voice-options)

**Available Endpoints:**

* **Calls**: Initiate calls, get call details, list agent calls
* **Agents**: Create (`POST /api/agent`), list, get, update, delete, and manage agents. Create and response bodies use `output_fields` (**array of key–description pairs**: each item has `key` and `description`) and `output_instructions` (**string**). `PATCH /api/agent/{id}` accepts the same fields as create.
* **Job Agents**: Create (`POST /api/job-agent`), list, get, update. Use template fields (`agent_role`, introduction, questions, etc.; `agent_role` is how the voice agent behaves, distinct from job/position). `output_fields` (array of key–description pairs), `output_instructions` (string). Optional `generate_from_jd_text`: paste JD text to generate template content. `PATCH /api/job-agent/{id}` accepts the same fields as create **except** `generate_from_jd_text`. Types: `hr_pre_screening`, `hr_mock_interview`, `hr_interview`.
* **Batches**: Create and manage batch calling campaigns
* **User Interaction**: Nudge users during active sessions

## **Authentication**

All APIs require authentication using an API key. Include the API key in the request headers:

### Raya Voice AI Agents API

```bash
-H "X-API-Key: <YOUR_API_KEY>"
```

## **Obtaining API Keys**

To obtain your API key, please contact your administrator.

## **Request and Response Formats**

### Content Types

* **Request**: `application/json` for most endpoints
* **Response**: `application/json` for data endpoints

### Error Responses

The API returns errors in a consistent format:

```json
{
  "error": "Error type",
  "message": "Detailed error message"
}
```

Common HTTP status codes:

* `200` - Success
* `400` - Bad Request (validation error)
* `401` - Unauthorized (invalid or missing API key)
* `402` - Calls not allowed right now. Returned when placing a call, creating a batch, adding contacts to a batch or starting one. `code` is `INSUFFICIENT_CREDITS` when the balance is at or below its limit (credits are over), or `TEAM_SUSPENDED` while calls are restricted on the account. Either way, reach out to [support@litwizlabs.ai](mailto:support@litwizlabs.ai)
* `404` - Not Found
* `429` - Rate Limit Exceeded
* `500` - Internal Server Error

## **Rate Limiting**

### Raya Voice AI Agents API

* **Call initiation**: Per-key limit (default 1 per 20 seconds); configurable in key settings
* **Other endpoints**: 1 request per second per API key

When rate limited, you'll receive a `429` status code with details about when to retry.

## **Best Practices**

1. **Store API keys securely** - Never commit API keys to version control
2. **Handle errors gracefully** - Always check response status codes
3. **Respect rate limits** - Implement exponential backoff for retries
4. **Validate input** - Check required fields and formats before making requests
5. **Monitor call status** - For Agents API, poll call status endpoints to track call progress

## **Code Examples**

### Raya Voice AI - Initiate a Call

```bash
curl -X POST https://v1.getraya.app/api/call \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "123e4567-e89b-12d3-a456-426614174000",
    "to_number": "1234567890",
    "country_code": "91",
    "timezone": "Asia/Kolkata"
  }'
```

### Raya Voice AI - Get Call Details

```bash
curl -X GET "https://v1.getraya.app/api/call/123e4567e89b12d3a456426614174000" \
  -H "X-API-Key: <YOUR_API_KEY>"
```

## **SDKs and Libraries**

While we don't provide official SDKs yet, our REST APIs are straightforward to use with any HTTP client library. Popular options include:

* **Python**: `requests` library
* **JavaScript/Node.js**: `axios` or `fetch`
* **cURL**: Command-line tool
* **Postman**: For testing and exploration

## **Support and Resources**

* **Documentation**: This site
* **Support Email**: [support@litwizlabs.ai](mailto:support@litwizlabs.ai)
* **Dashboard**: [https://console.getraya.app](https://console.getraya.app)

## **Next Steps**

1. Explore the **Agents API** endpoints for voice agent management
2. Review the request/response schemas for each endpoint
3. Try the examples in your preferred programming language