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

# Update Agent

> Update an existing agent's configuration.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.thinnest.ai/v2/agents/{public_id} \
    -H "Authorization: Bearer $THINNESTAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Updated Agent Name",
    "model": "gpt-4o-mini",
    "instructions": "You are an updated assistant with new behavior."
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.thinnest.ai/v2/agents/{public_id}"
  headers = {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
  }

  payload = {
    "name": "Updated Agent Name",
    "model": "gpt-4o-mini",
    "instructions": "You are an updated assistant with new behavior."
  }

  response = requests.patch(url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.thinnest.ai/v2/agents/{public_id}", {
    method: "PATCH",
    headers: {
      "Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
    "name": "Updated Agent Name",
    "model": "gpt-4o-mini",
    "instructions": "You are an updated assistant with new behavior."
  }),
  });

  const data = await response.json();
  console.log(data);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      payload := []byte(`{
    "name": "Updated Agent Name",
    "model": "gpt-4o-mini",
    "instructions": "You are an updated assistant with new behavior."
  }`)
      req, _ := http.NewRequest("PATCH", "https://api.thinnest.ai/v2/agents/{public_id}", bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
      req.Header.Set("Content-Type", "application/json")

      resp, err := http.DefaultClient.Do(req)
      if err != nil { panic(err) }
      defer resp.Body.Close()
      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```
</RequestExample>

***

## Path Parameters

<ParamField path="agent_id" type="string" required>
  The agent's public ID (ag\_\*)
</ParamField>

***

## Request Body

All fields are optional. Only provided fields are updated — everything else remains unchanged.

<ParamField body="name" type="string">
  Agent display name
</ParamField>

<ParamField body="model" type="string">
  LLM model identifier (see [Supported Models](/api-reference/agents/create#available-models))
</ParamField>

<ParamField body="instructions" type="string">
  System prompt
</ParamField>

<ParamField body="description" type="string">
  Internal description
</ParamField>

***

## Response `200`

Returns the full updated agent object (same structure as [Get Agent](/api-reference/agents/get)).

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "ag_c47e7c97_b2f2",
    "name": "Updated Agent Name",
    "createdAt": "2026-03-07T10:00:00Z",
    "updatedAt": "2026-03-07T12:30:00Z",
    "model": {
      "provider": "openai",
      "model": "gpt-4o-mini",
      "temperature": null,
      "maxTokens": null,
      "instructions": "You are an updated assistant with new behavior."
    },
    "transcriber": null,
    "voice": null,
    "tools": [],
    "knowledgeBase": null,
    "voiceEnabled": false,
    "agentType": "simple"
  }
  ```
</ResponseExample>

***

## Voice configuration

The `voice` object accepts the full voice agent surface — cascaded
TTS, Speech-to-Speech (Gemini Live or OpenAI Realtime), noise
cancellation, audio ambience, and BYOK options. See the dedicated
[Voice Config Reference](/api-reference/agents/voice-config) for
every field.

## Errors

| Code  | Description                         |
| ----- | ----------------------------------- |
| `401` | Missing or invalid authentication   |
| `403` | Not authorized to update this agent |
| `404` | Agent not found                     |
| `422` | Invalid request body                |
