> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unleashx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Voice Agent

The Update Voice Agent API uses the same request/response shape as Create Voice Agent, but you must include `agent_id` to identify which agent to update. Only `agent_id` is required — include any other fields you want to change, including `status` to draft, publish, or delete the agent.

## API Endpoint

**POST** `/api/v1/global/create-agent`

**Content-Type:** `application/json`

**Authentication:** Required (Token header: `token`)

## Request Body

```json theme={null}
{
  "agent_id": 123,
  "agent_name": "Updated Support Agent",
  "description": "Updated description",
  "prompt": "Updated prompt/instructions",
  "timezone": "Asia/Kolkata",
  "greeting": "Hello and welcome",
  "session_data_webhook": "https://www.tryunleashx.com/webhooks/session-data",
  "voice": {
    "provider": "elevenlabs",
    "voice_id": "RXe6OFmxoC0nlSWpuCDy",
    "model": "eleven_turbo_v2_5",
    "settings": {
      "stability": 0.5,
      "voice_style": 1,
      "speed": 1.0
    }
  },
  "speech_to_text": {
    "provider": "deepgram",
    "model": "nova-2",
    "language": "english"
  },
  "llm": {
    "llm": "gpt-4o",
    "model": "gpt-4o"
  },
  "configurations": {
    "confidence_threshold": 0.8,
    "do_not_call_detection": true
  }
}
```

## Required Fields

| Field | Type | Description |
| - | - | - |
| `agent_id` | integer | ID of the agent to update (required) |

## Optional Fields

All other fields follow the same definitions as the Create Voice Agent API — include only the fields you want to update.

| Field | Type | Description |
| - | - | - |
| `status` | number | `1` = Active/Published, `2` = Deleted, `3` = Draft/Unpublished. See [Status](#status) below. |

## Status

Pass `status` on its own (just `agent_id` + `status`) to draft, publish, or delete the agent without touching anything else:

```json theme={null}
{
  "agent_id": 123,
  "status": 1
}
```

| Code | Meaning |
| - | - |
| `1` | **Publish** — the agent can place and receive calls |
| `2` | **Delete** (soft delete) — also releases every phone number assigned to the agent |
| `3` | **Unpublish** — moves the agent back to Draft |

> [!NOTE]
>
> New agents are created in Draft (`status: 3`) by default — see [Create Voice Agent](https://docs.unleashx.ai/api-reference/voice-ai/create-voice-agent.md). Publishing (`status: 1`) a **voice** agent (`AGENT_TYPE = 3`) requires it to already have at least one **active, workspace-owned** phone number attached — see [Attach Phone Number](https://docs.unleashx.ai/api-reference/voice-ai/attach-phone-number.md). Numbers from a shared/global provider don't count.

## Response

### Success Response

**Status Code:** `200 OK`

```json theme={null}
{
  "success": true,
  "message": "Voice agent updated successfully",
  "data": {
    "agent_id": 123,
    "agent_name": "Updated Support Agent"
  }
}
```

### Error Responses

#### 400 Bad Request

```json theme={null}
{
  "error": true,
  "message": "Agent ID is required"
}
```

Also returned for status changes:

| Message | Cause |
| - | - |
| `Invalid status value` | `status` isn't `1`, `2`, or `3` |
| `Add at least 1 phone number to your agent` | `status: 1` on a voice agent with no active phone number attached |
| `Cannot publish agent with global provider phone numbers. Please use workspace-owned phone numbers.` | `status: 1` but the agent's only attached number(s) belong to a shared/global provider |

#### 401 Unauthorized

```json theme={null}
{
  "error": true,
  "message": "Invalid Auth Key or Session Expired"
}
```

#### 404 Not Found

```json theme={null}
{
  "error": true,
  "message": "Agent not found"
}
```

#### 422 Unprocessable Entity

```json theme={null}
{
  "error": true,
  "message": "Validation error message"
}
```

## Example Requests

```bash theme={null}
# Update agent using agent_id in request body
curl -X POST https://www.tryunleashx.com/api/v1/global/create-agent \
  -H "Content-Type: application/json" \
  -H "token: your_api_token_here" \
  -d '{
    "agent_id": 123,
    "agent_name": "Updated Support Agent",
    "prompt": "You are an updated helpful support agent.",
    "voice": {
      "provider": "elevenlabs",
      "voice_id": "RXe6OFmxoC0nlSWpuCDy"
    }
  }'
```

```bash theme={null}
# Or using agent_id as query parameter
curl -X POST "https://www.tryunleashx.com/api/v1/global/create-agent?agent_id=123" \
  -H "Content-Type: application/json" \
  -H "token: your_api_token_here" \
  -d '{
    "agent_name": "Updated Support Agent",
    "prompt": "You are an updated helpful support agent."
  }'
```

```bash theme={null}
# Publish the agent (status only, no other fields changed)
curl -X POST https://www.tryunleashx.com/api/v1/global/create-agent \
  -H "Content-Type: application/json" \
  -H "token: your_api_token_here" \
  -d '{
    "agent_id": 123,
    "status": 1
  }'
```

## Notes

* Only include fields you want to update; omitted fields will remain unchanged.
* The agent must exist and belong to your workspace.
* For available options for `voice.provider`, `speech_to_text.provider`, `speech_to_text.language`, `llm` models, and `tts_model`, refer to the Create Voice Agent API documentation.
* The `agent_id` can be provided either in the request body or as a query parameter.
* `status` can be sent alone or alongside other field changes — see [Status](#status) above.


## OpenAPI

````yaml api-reference/openapi.json POST /create-agent
openapi: 3.1.0
info:
  title: >-
    UnleashX - Build human like conversations | Voice Agents | Automations | AI
    Workforce
  version: 1.0.0
  description: UnleashX - Your home for human like conversations
servers:
  - url: https://www.tryunleashx.com/api/v1/global/
security:
  - bearerAuth: []
paths:
  /create-agent:
    post:
      tags:
        - Voice AI
      summary: Create voice agent
      parameters:
        - name: token
          in: header
          required: true
          description: API token for authentication
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_id:
                  type: integer
                  description: >-
                    ID of an existing agent to update. Omit to create a new
                    agent.
                agent_name:
                  type: string
                description:
                  type: string
                prompt:
                  type: string
                timezone:
                  type: string
                greeting:
                  type: string
                session_data_webhook:
                  type: string
                voice:
                  type: object
                  properties:
                    provider:
                      type: string
                      enum:
                        - elevenlabs
                        - openai
                        - deepgram
                        - sarvam
                    voice_id:
                      type: string
                    model:
                      type: string
                    settings:
                      type: object
                speech_to_text:
                  type: object
                  properties:
                    provider:
                      type: string
                    model:
                      type: string
                    language:
                      type: string
                      enum:
                        - english
                        - hindi
                        - multi
                        - albanian
                        - arabic
                        - armenian
                        - azerbaijani
                        - belarusian
                        - bengali
                        - bosnian
                        - bulgarian
                        - catalan
                        - chinese
                        - croatian
                        - czech
                        - danish
                        - dutch
                        - english_australia
                        - english_india
                        - english_new_zealand
                        - english_uk
                        - english_us
                        - english_spanish
                        - estonian
                        - finnish
                        - french
                        - galician
                        - georgian
                        - german
                        - german_switzerland
                        - greek
                        - gujarati
                        - haitian_creole
                        - hausa
                        - hebrew
                        - afrikaans
                        - hungarian
                        - icelandic
                        - indonesian
                        - italian
                        - japanese
                        - javanese
                        - kannada
                        - kazakh
                        - khmer
                        - korean
                        - latvian
                        - lithuanian
                        - macedonian
                        - malay
                        - malayalam
                        - maori
                        - marathi
                        - nepali
                        - norwegian
                        - persian
                        - polish
                        - portuguese
                        - portuguese_brazil
                        - punjabi
                        - romanian
                        - russian
                        - serbian
                        - shona
                        - slovak
                        - slovenian
                        - somali
                        - spanish
                        - spanish_latin_america
                        - sundanese
                        - swahili
                        - swedish
                        - tagalog
                        - tamil
                        - tajik
                        - telugu
                        - thai
                        - tswana
                        - turkish
                        - ukrainian
                        - urdu
                        - vietnamese
                        - welsh
                llm:
                  type: object
                  properties:
                    llm:
                      type: string
                    model:
                      type: string
                configurations:
                  type: object
                status:
                  type: integer
                  enum:
                    - 1
                    - 2
                    - 3
                  description: >-
                    1 = Active/Published, 2 = Deleted, 3 = Draft/Unpublished.
                    New agents default to 3 (Draft) when omitted. Publishing (1)
                    a voice agent (AGENT_TYPE 3) requires at least one active,
                    workspace-owned phone number already attached.
      responses:
        '201':
          description: Created
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.