# Get Agents

### Voice Agents API Documentation

#### Endpoint: Get Voice Agents

Retrieve all voice agents associated with an organization based on the provided API key.

**URL:**\
`POST https://www.tabbly.io/api/get-agents`

**Method:**\
POST

#### Request Headers

| Header       | Value            | Required |
| ------------ | ---------------- | -------- |
| Content-Type | application/json | Yes      |

#### Request Body

| Parameter | Type   | Description                            | Required |
| --------- | ------ | -------------------------------------- | -------- |
| api\_key  | string | Your unique API key for authentication | Yes      |

**Request Body Example:**

```json
{
    "api_key": "your_api_key_here"
}
```

#### Success Response

* **Status Code:** 200 OK
* **Content Type:** application/json

**Response Body:**

| Field  | Type    | Description                              |
| ------ | ------- | ---------------------------------------- |
| status | string  | Indicates the request status ("success") |
| data   | array   | Array of voice agent objects             |
| count  | integer | Number of voice agents returned          |

**Voice Agent Object Fields:**

| Field               | Type    | Description                                       |
| ------------------- | ------- | ------------------------------------------------- |
| id                  | integer | Unique identifier of the voice agent              |
| agent\_name         | string  | Name of the voice agent (max 100 characters)      |
| custom\_first\_line | string  | Custom greeting text                              |
| prompt\_text        | string  | null                                              |
| phone\_number       | string  | null                                              |
| created\_time       | string  | Timestamp of agent creation (YYYY-MM-DD HH:MM:SS) |

**Success Response Example:**

```json
{
    "status": "success",
    "data": [
        {
            "id": 1,
            "agent_name": "Agent Smith",
            "custom_first_line": "Hello, how can I assist you?",
            "prompt_text": null,
            "phone_number": "+1234567890",
            "created_time": "2025-04-09 10:00:00"
        }
    ],
    "count": 1
}
```

#### Error Responses

**Missing API Key:**

* **Status Code:** 400 Bad Request
* **Response Body:**
*   ```json
    {
        "error": "API key is required"
    }
    ```



**Invalid API Key:**

**Status Code:** 401 Unauthorized

**Response Body:**

```
{
    "error": "Invalid API key"
}
```



**Server Error:**

**Status Code:** 500 Internal Server Error

**Response Body:**

```json
{
    "error": "Database error: [error message]"
}
```

#### Sample cURL Request

```bash
curl --location --request POST 'https://www.tabbly.io/api/get-agents' \
--header 'Content-Type: application/json' \
--data-raw '{
    "api_key": "your_api_key_here"
}'
```



#### Notes

* The API key must be obtained from your Tabbly account dashboard.
* Each organization has a unique API key.
* The response includes all voice agents associated with the organization linked to the provided API key.
* The `prompt_text` and `phone_number` fields may be null if not set.
* All timestamps are in UTC.



#### Authentication

* This endpoint requires API key authentication.
* The API key should be kept confidential and not shared publicly.
