POST
/
conversations
/
create_phone_call
curl --request POST \
  --url https://api.voiceos.io/conversations/create_phone_call \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "from_number": "<string>",
  "to_number": "<string>",
  "agent_id": "<string>",
  "agent_config": {
    "initial_message": "<string>",
    "prompt": "<string>",
    "voice": {
      "provider": "playht",
      "credential_id": "<string>",
      "model": "susan",
      "speed": 1,
      "temperature": 1,
      "text_guidance": 1.5,
      "style_guidance": 15.5
    },
    "language_model": {
      "provider": "openai",
      "credential_id": "<string>",
      "model": "gpt-3.5-turbo",
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "<string>",
            "description": "<string>",
            "parameters": {
              "type": "object",
              "properties": {},
              "required": [
                "<string>"
              ]
            }
          }
        }
      ],
      "temperature": 0,
      "max_tokens": 300
    },
    "transcriber": {
      "provider": "deepgram",
      "credential_id": "<string>",
      "model": "nova-2",
      "language": "en",
      "keywords": []
    },
    "max_duration_seconds": 600,
    "webhooks": [
      {
        "events": [
          "phone_call:connection_requested"
        ],
        "filter": "<string>",
        "url": "<string>",
        "method": "GET",
        "headers": {}
      }
    ],
    "hooks": [
      {
        "events": [
          "phone_call:connection_requested"
        ],
        "filter": "<string>",
        "instructions": [
          {
            "instruction": "hang_up"
          }
        ]
      }
    ],
    "metadata": {}
  }
}'
{
  "uri": "<string>",
  "type": "inbound_phone_call",
  "account_id": "<string>",
  "status": "started",
  "started_at": "2023-11-07T05:31:56Z",
  "ended_at": "2023-11-07T05:31:56Z",
  "agent_config": {
    "initial_message": "<string>",
    "prompt": "<string>",
    "voice": {
      "provider": "playht",
      "credential_id": "<string>",
      "model": "susan",
      "speed": 1,
      "temperature": 1,
      "text_guidance": 1.5,
      "style_guidance": 15.5
    },
    "language_model": {
      "provider": "openai",
      "credential_id": "<string>",
      "model": "gpt-3.5-turbo",
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "<string>",
            "description": "<string>",
            "parameters": {
              "type": "object",
              "properties": {},
              "required": [
                "<string>"
              ]
            }
          }
        }
      ],
      "temperature": 0,
      "max_tokens": 300
    },
    "transcriber": {
      "provider": "deepgram",
      "credential_id": "<string>",
      "model": "nova-2",
      "language": "en",
      "keywords": []
    },
    "max_duration_seconds": 600,
    "webhooks": [
      {
        "events": [
          "phone_call:connection_requested"
        ],
        "filter": "<string>",
        "url": "<string>",
        "method": "GET",
        "headers": {}
      }
    ],
    "hooks": [
      {
        "events": [
          "phone_call:connection_requested"
        ],
        "filter": "<string>",
        "instructions": [
          {
            "instruction": "hang_up"
          }
        ]
      }
    ],
    "metadata": {}
  },
  "agent_id": "<string>",
  "messages": [],
  "phone_call": {
    "provider": "twilio",
    "to_number": "<string>",
    "from_number": "<string>"
  },
  "ended_reason": "agent_ended",
  "cost_breakdown": {
    "total": 123,
    "voice": {
      "provider": "azure",
      "cost": 123,
      "characters": 123
    },
    "transcriber": {
      "provider": "deepgram",
      "cost": 123,
      "seconds": 123
    },
    "language_model": {
      "provider": "openai",
      "cost": 123,
      "input_tokens": 123,
      "output_tokens": 123
    },
    "telephony": {
      "provider": "twilio",
      "cost": 123,
      "seconds": 123
    },
    "agent": {
      "provider": "voiceos",
      "cost": 123,
      "seconds": 123
    }
  },
  "id": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
from_number
string
required

The phone number associated with the account from which the call will be made.

to_number
string
required

The phone number to call including the country code.

agent_id
string

The agent id to use for the conversation. If null, the agent configuration will be used.

agent_config
object

The agent configuration to use for the conversation. If null, the agent id will be used.

Response

200
application/json
Successful Response
uri
string
required

The uri of the conversation.

type
enum<string>
required

The type of conversation.

Available options:
inbound_phone_call,
outbound_phone_call,
web_call
account_id
string
required

The account id associated with of the conversation.

status
enum<string>
required

The status of the conversation.

Available options:
started,
ended,
queued
agent_config
object
required

The agent configuration used for the conversation.

id
string
required

The id of the conversation.

started_at
string

The start time of the conversation.

ended_at
string

The end time of the conversation. Returns null if the conversation is has not ended.

agent_id
string

The id of the agent used in the conversation. Returns null if the conversation did not use an existing agent.

messages
object[]

The messages of the conversation.

phone_call
object

The phone call details of the conversation. Returns null if the conversation was over web.

ended_reason
enum<string>

The reasons the conversation ended.

Available options:
agent_ended,
user_ended,
unknown
cost_breakdown
object

The cost breakdown of the conversation.