> ## 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.

## 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.

## 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"
}
```

#### 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."
  }'
```

## 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.


## 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
                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
      responses:
        '201':
          description: Created
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````