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

# Update Agent

> Partially update an agent. Only fields present in the request body are modified.

<Note>
  Every endpoint on this page requires either a Clerk-issued JWT (`Authorization: Bearer <token>`) or
  an organization API key (`x-api-key: pk_…`). Anonymous calls return `401 Unauthorized`. See
  [Authentication](/authentication) for the full setup.
</Note>

<Note>
  Tool attachments are **replaced** on update, not merged. To add a tool, send the full list of desired `tools` including existing ones. Pass `"tools": []` to detach all tools.
</Note>

## Code examples

<CodeGroup>
  ```bash curl theme={null}
  curl -X PATCH https://api.agntix.ai/v2/chat/agents/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
    -H "x-api-key: pk_live_••••" \
    -H "Content-Type: application/json" \
    -d '{
      "fullName": "Tier-1 Support — Updated",
      "systemPrompt": "You specialize in billing, returns, and account access. Be brief and friendly.",
      "isActive": true
    }'
  ```

  ```javascript Node.js theme={null}
  const agentId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';

  const res = await fetch(`https://api.agntix.ai/v2/chat/agents/${agentId}`, {
    method: 'PATCH',
    headers: {
      'x-api-key': 'pk_live_••••',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      systemPrompt: 'You specialize in billing, returns, and account access. Be brief.',
      tools: [
        { toolId: '550e8400-e29b-41d4-a716-446655440000' },
        { toolId: '660e8400-e29b-41d4-a716-446655441111' },
      ],
    }),
  });
  const updated = await res.json();
  ```

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

  agent_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

  updated = httpx.patch(
      f"https://api.agntix.ai/v2/chat/agents/{agent_id}",
      headers={"x-api-key": "pk_live_••••"},
      json={
          "fullName": "Tier-1 Support — Updated",
          "isActive": True,
      },
  ).json()
  ```
</CodeGroup>

## Updating tools

To attach a new tool without removing existing ones, first fetch the agent, then send the merged list:

```javascript Node.js theme={null}
const agent = await fetch(`https://api.agntix.ai/v2/chat/agents/${id}`, {
  headers: { 'x-api-key': 'pk_live_••••' },
}).then(r => r.json());

const existingToolIds = agent.agentTools.map(({ tool }) => ({ toolId: tool.id }));

await fetch(`https://api.agntix.ai/v2/chat/agents/${id}`, {
  method: 'PATCH',
  headers: { 'x-api-key': 'pk_live_••••', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    tools: [...existingToolIds, { toolId: 'new-tool-uuid' }],
  }),
});
```

## Sample response

```json theme={null}
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "fullName": "Tier-1 Support — Updated",
  "systemPrompt": "You specialize in billing, returns, and account access. Be brief and friendly.",
  "isActive": true,
  "updatedAt": "2026-04-29T09:30:00Z"
}
```


## OpenAPI

````yaml PATCH /v2/chat/agents/{id}
openapi: 3.0.3
info:
  title: Agntix API
  version: 1.0.0
  description: >-
    The Agntix API lets you build, deploy, and operate AI chat and voice agents.
    All requests are sent to `https://api.agntix.ai`. Authenticate with an API
    key (`x-api-key`) or a Clerk-issued JWT (`Authorization: Bearer <token>`).


    Base URL: `https://api.agntix.ai`
servers:
  - url: https://api.agntix.ai
    description: Production
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Agents
    description: >-
      Create and manage AI agents — the core building block of Agntix. An agent
      encapsulates a system prompt, LLM, tools, knowledge store, and voice
      configuration.
  - name: Chat
    description: >-
      Open chat sessions with an agent and exchange messages. Supports streaming
      responses over SSE.
  - name: Voice
    description: >-
      List available voices and TTS/STT models, and create real-time voice
      sessions.
  - name: Tools
    description: >-
      Extend agent capabilities with API tools (webhook calls) or function tools
      (server-side logic).
  - name: Phone Numbers
    description: >-
      Provision and manage telephony numbers for inbound and outbound voice
      calls.
  - name: Models
    description: Browse available LLM, STT, and TTS models supported by Agntix.
  - name: Analytics
    description: Query call and agent-level performance metrics.
  - name: API Keys
    description: Create and manage organization-scoped API keys.
  - name: Contacts
    description: Manage customer contacts that can be linked to chat sessions.
  - name: Call Campaigns
    description: Launch and manage outbound call campaigns against a list of contacts.
  - name: Subscriptions
    description: View billing plans, usage quotas, and manage Stripe subscriptions.
paths:
  /v2/chat/agents/{id}:
    patch:
      tags:
        - Agents
      summary: Update agent
      description: >-
        Partially updates an agent. Only fields present in the request body are
        modified. Pass `subAgents: []` to remove all sub-agents.
      operationId: updateAgent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentRequest'
            example:
              fullName: Tier-1 Support — Updated
              systemPrompt: >-
                You specialize in billing, returns, and account access. Be
                brief.
              isActive: true
      responses:
        '200':
          description: Updated agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    UpdateAgentRequest:
      type: object
      description: All fields are optional — only provided fields are updated.
      properties:
        fullName:
          type: string
        description:
          type: string
        role:
          type: string
        language:
          type: string
        systemPrompt:
          type: string
        specialInstructions:
          type: string
        modelId:
          type: string
          format: uuid
        voiceEnabled:
          type: boolean
        voicePipelineMode:
          type: string
          enum:
            - pipeline
            - sts
            - hybrid
        isActive:
          type: boolean
        isPublic:
          type: boolean
        tools:
          type: array
          items:
            $ref: '#/components/schemas/AgentTool'
        subAgents:
          type: array
          description: Pass `[]` to remove all sub-agents.
          items:
            type: object
    Agent:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        fullName:
          type: string
          example: Customer Support Bot
        description:
          type: string
          example: Handles tier-1 customer queries
        role:
          type: string
          example: You are a helpful support agent for Acme Inc.
        language:
          type: string
          example: en
        systemPrompt:
          type: string
        voiceEnabled:
          type: boolean
          example: false
        voicePipelineMode:
          type: string
          nullable: true
        isActive:
          type: boolean
          example: true
        isPublic:
          type: boolean
          example: false
        orgId:
          type: string
          example: org_2abc123
        modelId:
          type: string
          format: uuid
        createdAt:
          type: string
          format: date-time
          example: '2026-04-28T11:42:11Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-04-28T11:42:11Z'
    AgentTool:
      type: object
      properties:
        toolId:
          type: string
          format: uuid
          description: UUID of an existing tool to attach.
          example: 550e8400-e29b-41d4-a716-446655440000
        toolDescription:
          type: string
          description: Optional context-specific description override for this agent.
      required:
        - toolId
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: NOT_FOUND
            message:
              type: string
              example: Resource not found.
            status:
              type: integer
              example: 404
        meta:
          type: object
          properties:
            requestId:
              type: string
            timestamp:
              type: string
              format: date-time
  responses:
    BadRequest:
      description: Invalid request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: VALIDATION_ERROR
              message: fullName should not be empty
              status: 400
            meta:
              requestId: req_01j3m...
              timestamp: '2026-04-29T10:00:00Z'
    Unauthorized:
      description: Missing or invalid authentication credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: UNAUTHORIZED
              message: Authentication required.
              status: 401
            meta:
              requestId: req_01j3m...
              timestamp: '2026-04-29T10:00:00Z'
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: NOT_FOUND
              message: Agent not found.
              status: 404
            meta:
              requestId: req_01j3m...
              timestamp: '2026-04-29T10:00:00Z'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Organization API key. Obtain from the
        [dashboard](https://app.agntix.ai/settings/api-keys). Format:
        `pk_live_…`
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Clerk-issued JWT. Use `Authorization: Bearer <token>`.'

````