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

# Update Agent

> Update an existing agent's configuration

<Endpoint method="PUT" path="/v1/agents/{agentId}" description="Update an existing agent's configuration">
  <RequestBody description="Update agent configuration" required contentType="application/json" schemaRef="#/components/schemas/UpdateAgent" />

  <ResponseFields>
    <ResponseField status="200" description="Agent updated successfully" contentType="application/json" schemaRef="#/components/schemas/AgentResponse" />

    <ResponseField status="400" description="Unexpected error" contentType="application/json" schemaRef="#/components/schemas/Error" />
  </ResponseFields>
</Endpoint>


## OpenAPI

````yaml PUT /v1/agents/{agentId}
openapi: 3.0.1
info:
  title: OpenAPI Example
  description: A sample API to demonstrate features in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.contactship.ai
security: []
paths:
  /v1/agents/{agentId}:
    put:
      description: Update an existing agent's configuration
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: API key for authentication
        - name: agentId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the agent to update
      requestBody:
        description: Update agent configuration
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgent'
      responses:
        '200':
          description: Agent updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
              example:
                statusCode: 200
                data:
                  id: 337a9eeb-3e16-4cc5-94ec-25fa159eb57a
                  name: Technical Support Specialist
                  person_name: Emily Parker
                  language: en-US
                  webhook_url: https://webhook.example.com/support-notifications
                  conversation_purpose: >-
                    Provide technical support and troubleshooting assistance to
                    customers
                  prompt: >-
                    You are Emily Parker, an experienced technical support
                    specialist. Your role is to help customers resolve technical
                    issues efficiently and professionally.


                    Guidelines:

                    - Start by understanding the customer's issue clearly

                    - Provide step-by-step solutions in a clear, natural way

                    - Use simple language, avoiding technical jargon unless
                    necessary

                    - Create support tickets for complex issues

                    - Follow up to ensure the solution worked


                    Maintain a patient and helpful tone throughout the
                    conversation.
                  volume: 1.1
                  voice_id: custom_voice_emily_tech
                  interruption_sensitivity: 0.7
                  ambient_sound: call-center
                  voice_speed: 1
                  voice_temperature: 0.8
                  post_call_analysis_data:
                    - name: issue_resolved
                      type: boolean
                      description: Whether the technical issue was resolved
                    - name: resolution_time
                      type: number
                      description: Time taken to resolve the issue (minutes)
                    - name: ticket_created
                      type: boolean
                      description: Whether a support ticket was created
                    - name: customer_satisfaction
                      type: number
                      description: Customer satisfaction score (1-10)
                  tools:
                    - name: create_ticket
                      type: function
                      description: Create a support ticket for unresolved issues
                    - name: search_knowledge_base
                      type: function
                      description: Search technical documentation for solutions
                      parameters:
                        type: object
                        required:
                          - query
                        properties:
                          query:
                            type: string
                            description: Search query for technical documentation
                    - name: schedule_followup
                      type: function
                      description: Schedule a follow-up call for complex issues
                  created_at: '2024-01-15T10:30:00.000Z'
                  updated_at: '2024-03-20T15:45:00.000Z'
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UpdateAgent:
      type: object
      properties:
        name:
          type: string
          description: >-
            The name of the agent in our system. Only used for your own
            reference.
        person_name:
          type: string
          description: The name of the agent in the call.
        voice_id:
          type: string
          description: The ID of the voice to use `[Still working on this]`
        language:
          type: string
          description: >-
            Specifies what language (and dialect) the speech recognition will
            operate in. For instance, selecting `en-GB` optimizes speech
            recognition for British English. If unset, will use default value
            `en-US`. Select `multi` for multilingual support, currently this
            supports Spanish and English.

             Available options: `en-US`, `en-IN`, `en-GB`, `de-DE`, `es-ES`, `es-419`, `hi-IN`, `ja-JP`, `pt-PT`, `pt-BR`, `fr-FR`, `zh-CN`, `ru-RU`, `it-IT`, `ko-KR`, `nl-NL`, `pl-PL`, `tr-TR`, `vi-VN`, `multi`
        ambient_sound:
          type: string
          description: >-
            If set, will add ambient environment sound to the call to make
            experience more realistic. Currently supports the following options:


            - `coffee-shop`: Coffee shop ambience with people chatting in
            background. [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbYbOxwpTTmk6RGMQWPxJlZeoXwymSYTDLB9qfA)


            - `convention-hall`: Convention hall ambience, with some echo and
            people chatting in background. [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbY50taIawGGN1VRlWetZd205m9uED4x63UHJiI)


            - `summer-outdoor`: Summer outdoor ambience with cicada chirping.
            [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbY50URDWTGGN1VRlWetZd205m9uED4x63UHJiI)


            - `mountain-outdoor`: Mountain outdoor ambience with birds singing.
            [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbY18Wj5vPoRw9qLuYsGjAUyWQzdrNlZ1cp640h)


            - `static-noise`: Constant static noise. [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbYehXy6HiLMvRztpy4fneJQrq5gXkBCH8oxl2N)


            - `call-center`: Call center work noise. [Listen to
            Ambience](https://utfs.io/f/lq9uThRNnWbYNyG8A23IUXjuxqE9skNeTvFgdtbWhG26nV5c)


            Set to null to remove ambient sound from this agent.


            Available options: coffee-shop, convention-hall, summer-outdoor,
            mountain-outdoor, static-noise, call-center
          enum:
            - coffee-shop
            - convention-hall
            - summer-outdoor
            - mountain-outdoor
            - static-noise
            - call-center
            - null
          nullable: true
        interruption_sensitivity:
          type: number
          description: >-
            Controls how sensitive the agent is to user interruptions. Value
            ranging from `[0.1,1]`. Lower value means it will take longer / more
            words for user to interrupt agent, while higher value means it's
            easier for user to interrupt agent. 


            If unset, default value 1 will apply. When this is set to `0.1`,
            agent would never be interrupted.
        webhook_url:
          type: string
          description: >-
            URL for webhook notifications. They will be sent when the agent
            finishes a call, from API calls, Inbound calls, Campaigns calls or
            Widgets calls.
        conversation_purpose:
          type: string
          description: The purpose of conversations for this agent
        prompt:
          type: string
          description: The prompt template for the agent
        voice_speed:
          type: number
          description: >-
            Controls speed of voice. Value ranging from `[0.5,2]`. Lower value
            means slower speech, while higher value means faster speech rate. If
            unset, default value 1 will apply.
        voice_temperature:
          type: number
          description: >-
            Controls how stable the voice is. Value ranging from `[0,2]`. Lower
            value means more stable, and higher value means more variant speech
            generation. If unset, default value 1 will apply.
        volume:
          type: number
          description: >-
            If set, will control the volume of the agent. Value ranging from
            `[0,2]`. Lower value means quieter agent speech, while higher value
            means louder agent speech. If unset, default value 1 will apply.
        post_call_analysis_data:
          type: array
          description: Configuration for post-call analysis
          items:
            type: object
            nullable: true
        tools:
          type: array
          description: List of tools available to the agent
          items:
            type: object
            nullable: true
    AgentResponse:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP status code
        data:
          $ref: '#/components/schemas/Agent'
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    Agent:
      type: object
      required:
        - id
        - name
        - created_at
        - language
      properties:
        id:
          type: string
          description: The ID of the agent
        name:
          type: string
          description: The name of the agent in our system
        person_name:
          type: string
          description: The name of the agent in the call
        language:
          type: string
          description: The language of the agent
        webhook_url:
          type: string
          nullable: true
          description: The webhook URL for call status updates
        conversation_purpose:
          type: string
          nullable: true
          description: The purpose of the conversation
        prompt:
          type: string
          nullable: true
          description: The prompt for the agent
        volume:
          type: number
          description: Volume level for the voice
        voice_id:
          type: string
          description: The ID of the voice to use
        interruption_sensitivity:
          type: number
          description: Sensitivity level for interruptions (0-1)
        ambient_sound:
          type: string
          nullable: true
          description: Background sound configuration
        voice_speed:
          type: number
          description: Speed of the voice
        voice_temperature:
          type: number
          description: Temperature parameter for voice generation
        post_call_analysis_data:
          type: array
          nullable: true
          description: Configuration for post-call analysis
          items:
            type: object
        tools:
          type: array
          nullable: true
          description: List of tools available to the agent
          items:
            type: object
        created_at:
          type: string
          format: date-time
          description: The creation time of the agent
        updated_at:
          type: string
          format: date-time
          description: The last update time of the agent

````