POST
/
v1
/
agents
/
{agent_id}
curl --request POST \
  --url https://api.bland.ai/v1/agents/{agent_id} \
  --header 'Content-Type: application/json' \
  --header 'authorization: <authorization>' \
  --data '{
  "prompt": "<string>",
  "voice": "<string>",
  "analysis_schema": {},
  "metadata": {},
  "pathway_id": "<string>",
  "language": "<string>",
  "webhook": "<string>",
  "model": "<string>",
  "first_sentence": "<string>",
  "tools": [
    {}
  ],
  "dynamic_data": {},
  "interruption_threshold": 123,
  "max_duration": {}
}'
{
    "status": "success",
    "message": "Successfully updated agent 46f37229-7d12-44be-b343-6e68274cfbea.",
    "updates": {
        "model": "enhanced"
    }
}

Headers

authorization
string
required

Your API key for authentication.

Path Parameters

agent_id
string

The web agent you’ll be updating.

Body

prompt
string
required

Provide instructions, relevant information, and examples of the ideal conversation flow.

voice
string

Set your agent’s voice - all available voices can be found with the List Voices endpoint.

analysis_schema
object

Define a JSON schema for how you want to get information about the call - information like email addresses, names, appointment times or any other type of custom data.

In the webhook response or whenever you retrieve call data later, you’ll get the data you defined back under analysis.

For example, if you wanted to retrieve this information from the call:

"analysis_schema": {
  "email_address": "email",
  "first_name": "string",
  "last_name": "string",
  "wants_to_book_appointment": "boolean",
  "appointment_time": "YYYY-MM-DD HH:MM:SS"
}

You would get it filled out like this in your webhook once the call completes:

"analysis": {
  "email_address": "johndoe@gmail.com",
  "first_name": "John",
  "last_name": "Doe",
  "wants_to_book_appointment": true,
  "appointment_time": "2024-01-01 12:00:00"
}
metadata
object

Add any additional information you want to associate with the call. This can be useful for tracking or categorizing calls.

pathway_id
string

Set the pathway that your agent will follow. This will override the prompt field, so there is no need to pass the ‘prompt’ field if you are setting a pathway.

Warning: Setting a pathway will set the following fields to null / their default value - prompt, first_sentence, model, dynamic_data, tools

Set to null or an empty string to clear the pathway.

language
string
default: "ENG"

Select a supported language of your choice. Optimizes every part of our API for that language - transcription, speech, and other inner workings.

Supported Languages and their codes:

  • English: ENG
  • Spanish: ESP
  • French: FRE
  • Polish: POL
  • German: GER
  • Italian: ITA
  • Brazilian Portuguese: PBR
  • Portuguese: POR
webhook
string

The webhook should be a http / https callback url. We will send the call_id and transcript to this URL after the call completes. This can be useful if you want to have real time notifications when calls finish.

Set to null or an empty string to clear the webhook.

model
string
default: "enhanced"

Select a model to use for your call.

Options: base, turbo and enhanced.

In nearly all cases, enhanced is the best choice for now.

first_sentence
string

A phrase that your call will start with instead of a generating one on the fly. This works both with and without wait_for_greeting. Can be more than one sentence, but must be less than 200 characters.

To remove, set to null or an empty string.

tools
array

Interact with the real world through API calls.

Detailed tutorial here: Custom Tools

dynamic_data
object

Integrate data from external APIs into your agent’s knowledge.

Set to null or an empty string to clear dynamic data settings.

Detailed usage in the Send Call endpoint.

interruption_threshold
number
default: 100

Adjusts how patient the AI is when waiting for the user to finish speaking.

Lower values mean the AI will respond more quickly, while higher values mean the AI will wait longer before responding.

Recommended range: 50-200

  • 50: Extremely quick, back and forth conversation
  • 100: Balanced to respond at a natural pace
  • 200: Very patient, allows for long pauses and interruptions. Ideal for collecting detailed information.

Try to start with 100 and make small adjustments in increments of ~10 as needed for your use case.

max_duration
integer (minutes)
default: 30

The maximum duration that calls to your agent can last before being automatically terminated.

Set to null to reset to default.

Response

status
string

Whether the update was successful or not - will be success or error.

message
string

A message describing the status of the update.

updates
object

An object containing the updated settings for the agent.

failed_updates
object

If the update was unsuccessful, this will contain the settings that failed to update. Useful to determine how your request is being interpreted on our end.