POST
/
v1
/
agents
curl --request POST \
  --url https://api.callrounded.com/v1/agents \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '{
  "name": "My booking agent",
  "language": "en",
  "initial_message": "Hello, how can I help you today?",
  "initial_message_delay": 0,
  "max_call_duration": 1800,
  "presence_check_phrases": [
    "Are you there?",
    "Can you repeat please?"
  ],
  "presence_check_idle_threshold": 15,
  "presence_check_max_times": 10,
  "base_prompt": "You are a helpful assistant",
  "voice": {
    "provider": "openai",
    "name": "Ash",
    "instructions": "warm and professional",
    "speed": 1.2
  },
  "states": [
    {
      "name": "ask_booking_reason",
      "prompt": "Ask the user for the reason for booking",
      "llm": {
        "model": "gpt-4.1",
        "temperature": 0.5
      },
      "variables": [
        {
          "description": "Reason for booking",
          "extraction_instructions": "Extract the reason for booking from the user'\''s input",
          "name": "booking_reason",
          "type": "string"
        }
      ],
      "transitions": [
        {
          "condition": "User provides valid booking reason",
          "destination_state_name": "ask_booking_schedule",
          "filler_sentence": "Thanks for your answer"
        }
      ]
    },
    {
      "name": "ask_booking_schedule",
      "prompt": "Ask the user for the date of the booking using the {{search_availability}} tool, then let them select the booking date and save it into {{selected_booking_date}}.",
      "llm": {
        "model": "gpt-4.1",
        "temperature": 0.5
      },
      "variables": [
        {
          "description": "Date of the booking",
          "extraction_instructions": "Extract the date of the booking from the user'\''s input",
          "name": "selected_booking_date",
          "type": "datetime"
        }
      ],
      "tools": [
        {
          "name": "search_availability",
          "type": "custom_function",
          "description": "Search availability for a specific date",
          "filler_sentence": "Searching for availabilities in the specified data, one moment please...",
          "url": "https://api.example.com/search_availability",
          "method": "GET",
          "content_type": "url_params",
          "parameters": [
            {
              "name": "reason",
              "value": {
                "source": "variable",
                "variable": "booking_reason"
              }
            },
            {
              "name": "date",
              "value": {
                "source": "llm_parameter",
                "llm_parameter": {
                  "name": "booking_date",
                  "type": "string",
                  "description": "Ask the user for the date of the booking, convert it to datetime format YYYY-MM-DD"
                }
              }
            }
          ],
          "response_mapping": [
            {
              "json_path_to_data": "$.json.availabilities",
              "destination_variable": "availabilities"
            }
          ]
        }
      ],
      "transitions": [
        {
          "condition": "User provides valid input",
          "destination_state_name": "confirm_booking",
          "filler_sentence": "Thanks for your answer"
        }
      ]
    },
    {
      "name": "confirm_booking",
      "prompt": "Ask the user to confirm the booking",
      "llm": {
        "model": "gpt-4.1",
        "temperature": 0.5
      },
      "variables": [
        {
          "description": "Confirmation of the booking",
          "extraction_instructions": "Extract the confirmation of the booking from the user'\''s input",
          "name": "booking_confirmation",
          "type": "boolean"
        }
      ],
      "transitions": [
        {
          "condition": "User provides valid input",
          "destination_state_name": "end_booking",
          "filler_sentence": "Thanks for your answer"
        }
      ]
    },
    {
      "name": "end_booking",
      "prompt": "Thank the user for the booking and finish the call with {{hang_up}} tool.",
      "llm": {
        "model": "gpt-4.1",
        "temperature": 0.5
      },
      "tools": [
        {
          "type": "hang_up"
        }
      ]
    }
  ],
  "initial_state_name": "ask_booking_reason"
}'
{
"message": "Agent created successfully",
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "My booking agent"
},
"error": null,
"status": 201
}

Authorizations

X-Api-Key
string
header
required

The API Key created in Rounded Studio.

Body

application/json

Response

201
application/json

Successfully created agent

The response is of type object.