Skip to content

Latest commit

 

History

History
3662 lines (2424 loc) · 59.9 KB

File metadata and controls

3662 lines (2424 loc) · 59.9 KB

Reference

Calls

client.calls.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.list()

⚙️ Parameters

assistant_id: typing.Optional[str] — This will return calls with the specified assistantId.

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.calls.create(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.create()

⚙️ Parameters

name: typing.Optional[str] — This is the name of the call. This is just for your own reference.

assistant_id: typing.Optional[str] — This is the assistant that will be used for the call. To use a transient assistant, use assistant instead.

assistant: typing.Optional[CreateAssistantDto] — This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead.

assistant_overrides: typing.Optional[AssistantOverrides] — These are the overrides for the assistant or assistantId's settings and template variables.

squad_id: typing.Optional[str] — This is the squad that will be used for the call. To use a transient squad, use squad instead.

squad: typing.Optional[CreateSquadDto] — This is a squad that will be used for the call. To use an existing squad, use squadId instead.

phone_number_id: typing.Optional[str]

This is the phone number that will be used for the call. To use a transient number, use phoneNumber instead.

Only relevant for outboundPhoneCall and inboundPhoneCall type.

phone_number: typing.Optional[ImportTwilioPhoneNumberDto]

This is the phone number that will be used for the call. To use an existing number, use phoneNumberId instead.

Only relevant for outboundPhoneCall and inboundPhoneCall type.

customer_id: typing.Optional[str]

This is the customer that will be called. To call a transient customer , use customer instead.

Only relevant for outboundPhoneCall and inboundPhoneCall type.

customer: typing.Optional[CreateCustomerDto]

This is the customer that will be called. To call an existing customer, use customerId instead.

Only relevant for outboundPhoneCall and inboundPhoneCall type.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.calls.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.calls.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.calls.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.calls.update(
    id="id",
)

⚙️ Parameters

id: str

name: typing.Optional[str] — This is the name of the call. This is just for your own reference.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Assistants

client.assistants.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.assistants.list()

⚙️ Parameters

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.assistants.create(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.assistants.create()

⚙️ Parameters

transcriber: typing.Optional[CreateAssistantDtoTranscriber] — These are the options for the assistant's transcriber.

model: typing.Optional[CreateAssistantDtoModel] — These are the options for the assistant's LLM.

voice: typing.Optional[CreateAssistantDtoVoice] — These are the options for the assistant's voice.

first_message_mode: typing.Optional[CreateAssistantDtoFirstMessageMode]

This is the mode for the first message. Default is 'assistant-speaks-first'.

Use:

  • 'assistant-speaks-first' to have the assistant speak first.
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).

@default 'assistant-speaks-first'

hipaa_enabled: typing.Optional[bool] — When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.

client_messages: typing.Optional[typing.Sequence[CreateAssistantDtoClientMessagesItem]] — These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.

server_messages: typing.Optional[typing.Sequence[CreateAssistantDtoServerMessagesItem]] — These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.

silence_timeout_seconds: typing.Optional[float]

How many seconds of silence to wait before ending the call. Defaults to 30.

@default 30

max_duration_seconds: typing.Optional[float]

This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.

@default 600 (10 minutes)

background_sound: typing.Optional[CreateAssistantDtoBackgroundSound] — This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.

backchanneling_enabled: typing.Optional[bool]

This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.

Default false while in beta.

@default false

background_denoising_enabled: typing.Optional[bool]

This enables filtering of noise and background speech while the user is talking.

Default false while in beta.

@default false

model_output_in_messages_enabled: typing.Optional[bool]

This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.

Default false while in beta.

@default false

transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] — These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.

name: typing.Optional[str]

This is the name of the assistant.

This is required when you want to transfer between assistants in a call.

first_message: typing.Optional[str]

This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

voicemail_detection: typing.Optional[TwilioVoicemailDetection]

These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.

voicemail_message: typing.Optional[str]

This is the message that the assistant will say if the call is forwarded to voicemail.

If unspecified, it will hang up.

end_call_message: typing.Optional[str]

This is the message that the assistant will say if it ends the call.

If unspecified, it will hang up without saying anything.

end_call_phrases: typing.Optional[typing.Sequence[str]] — This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] — This is for metadata you want to store on the assistant.

server_url: typing.Optional[str]

This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

server_url_secret: typing.Optional[str]

This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.

Same precedence logic as serverUrl.

analysis_plan: typing.Optional[AnalysisPlan] — This is the plan for analysis of assistant's calls. Stored in call.analysis.

artifact_plan: typing.Optional[ArtifactPlan]

This is the plan for artifacts generated during assistant's calls. Stored in call.artifact.

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

message_plan: typing.Optional[MessagePlan]

This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages.

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

start_speaking_plan: typing.Optional[StartSpeakingPlan]

This is the plan for when the assistant should start talking.

You should configure this if you're running into these issues:

  • The assistant is too slow to start talking after the customer is done speaking.
  • The assistant is too fast to start talking after the customer is done speaking.
  • The assistant is so fast that it's actually interrupting the customer.

stop_speaking_plan: typing.Optional[StopSpeakingPlan]

This is the plan for when assistant should stop talking on customer interruption.

You should configure this if you're running into these issues:

  • The assistant is too slow to recognize customer's interruption.
  • The assistant is too fast to recognize customer's interruption.
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • The assistant is getting interrupted by background noises.
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.

monitor_plan: typing.Optional[MonitorPlan]

This is the plan for real-time monitoring of the assistant's calls.

Usage:

  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

credential_ids: typing.Optional[typing.Sequence[str]] — These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.assistants.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.assistants.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.assistants.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.assistants.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.assistants.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.assistants.update(
    id="id",
)

⚙️ Parameters

id: str

transcriber: typing.Optional[UpdateAssistantDtoTranscriber] — These are the options for the assistant's transcriber.

model: typing.Optional[UpdateAssistantDtoModel] — These are the options for the assistant's LLM.

voice: typing.Optional[UpdateAssistantDtoVoice] — These are the options for the assistant's voice.

first_message_mode: typing.Optional[UpdateAssistantDtoFirstMessageMode]

This is the mode for the first message. Default is 'assistant-speaks-first'.

Use:

  • 'assistant-speaks-first' to have the assistant speak first.
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).

@default 'assistant-speaks-first'

hipaa_enabled: typing.Optional[bool] — When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.

client_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoClientMessagesItem]] — These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.

server_messages: typing.Optional[typing.Sequence[UpdateAssistantDtoServerMessagesItem]] — These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.

silence_timeout_seconds: typing.Optional[float]

How many seconds of silence to wait before ending the call. Defaults to 30.

@default 30

max_duration_seconds: typing.Optional[float]

This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.

@default 600 (10 minutes)

background_sound: typing.Optional[UpdateAssistantDtoBackgroundSound] — This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.

backchanneling_enabled: typing.Optional[bool]

This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.

Default false while in beta.

@default false

background_denoising_enabled: typing.Optional[bool]

This enables filtering of noise and background speech while the user is talking.

Default false while in beta.

@default false

model_output_in_messages_enabled: typing.Optional[bool]

This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.

Default false while in beta.

@default false

transport_configurations: typing.Optional[typing.Sequence[TransportConfigurationTwilio]] — These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.

name: typing.Optional[str]

This is the name of the assistant.

This is required when you want to transfer between assistants in a call.

first_message: typing.Optional[str]

This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

voicemail_detection: typing.Optional[TwilioVoicemailDetection]

These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.

voicemail_message: typing.Optional[str]

This is the message that the assistant will say if the call is forwarded to voicemail.

If unspecified, it will hang up.

end_call_message: typing.Optional[str]

This is the message that the assistant will say if it ends the call.

If unspecified, it will hang up without saying anything.

end_call_phrases: typing.Optional[typing.Sequence[str]] — This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] — This is for metadata you want to store on the assistant.

server_url: typing.Optional[str]

This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

server_url_secret: typing.Optional[str]

This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.

Same precedence logic as serverUrl.

analysis_plan: typing.Optional[AnalysisPlan] — This is the plan for analysis of assistant's calls. Stored in call.analysis.

artifact_plan: typing.Optional[ArtifactPlan]

This is the plan for artifacts generated during assistant's calls. Stored in call.artifact.

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

message_plan: typing.Optional[MessagePlan]

This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages.

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

start_speaking_plan: typing.Optional[StartSpeakingPlan]

This is the plan for when the assistant should start talking.

You should configure this if you're running into these issues:

  • The assistant is too slow to start talking after the customer is done speaking.
  • The assistant is too fast to start talking after the customer is done speaking.
  • The assistant is so fast that it's actually interrupting the customer.

stop_speaking_plan: typing.Optional[StopSpeakingPlan]

This is the plan for when assistant should stop talking on customer interruption.

You should configure this if you're running into these issues:

  • The assistant is too slow to recognize customer's interruption.
  • The assistant is too fast to recognize customer's interruption.
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • The assistant is getting interrupted by background noises.
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.

monitor_plan: typing.Optional[MonitorPlan]

This is the plan for real-time monitoring of the assistant's calls.

Usage:

  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

credential_ids: typing.Optional[typing.Sequence[str]] — These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

PhoneNumbers

client.phone_numbers.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.phone_numbers.list()

⚙️ Parameters

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.phone_numbers.create(...)

🔌 Usage

from vapi import CreateByoPhoneNumberDto, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.phone_numbers.create(
    request=CreateByoPhoneNumberDto(
        credential_id="credentialId",
    ),
)

⚙️ Parameters

request: PhoneNumbersCreateRequest

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.phone_numbers.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.phone_numbers.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.phone_numbers.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.phone_numbers.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.phone_numbers.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.phone_numbers.update(
    id="id",
)

⚙️ Parameters

id: str

fallback_destination: typing.Optional[UpdatePhoneNumberDtoFallbackDestination]

This is the fallback destination an inbound call will be transferred to if:

  1. assistantId is not set
  2. squadId is not set
  3. and, assistant-request message to the serverUrl fails

If this is not set and above conditions are met, the inbound call is hung up with an error message.

name: typing.Optional[str] — This is the name of the phone number. This is just for your own reference.

assistant_id: typing.Optional[str]

This is the assistant that will be used for incoming calls to this phone number.

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

squad_id: typing.Optional[str]

This is the squad that will be used for incoming calls to this phone number.

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

server_url: typing.Optional[str]

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

You can see the shape of the messages sent in ServerMessage.

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

server_url_secret: typing.Optional[str]

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

Same precedence logic as serverUrl.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Squads

client.squads.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.squads.list()

⚙️ Parameters

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.squads.create(...)

🔌 Usage

from vapi import SquadMemberDto, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.squads.create(
    members=[SquadMemberDto()],
)

⚙️ Parameters

members: typing.Sequence[SquadMemberDto]

This is the list of assistants that make up the squad.

The call will start with the first assistant in the list.

name: typing.Optional[str] — This is the name of the squad.

members_overrides: typing.Optional[AssistantOverrides]

This can be used to override all the assistants' settings and provide values for their template variables.

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.squads.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.squads.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.squads.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.squads.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.squads.update(...)

🔌 Usage

from vapi import SquadMemberDto, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.squads.update(
    id="id",
    members=[SquadMemberDto()],
)

⚙️ Parameters

id: str

members: typing.Sequence[SquadMemberDto]

This is the list of assistants that make up the squad.

The call will start with the first assistant in the list.

name: typing.Optional[str] — This is the name of the squad.

members_overrides: typing.Optional[AssistantOverrides]

This can be used to override all the assistants' settings and provide values for their template variables.

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Blocks

client.blocks.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.blocks.list()

⚙️ Parameters

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.blocks.create(...)

🔌 Usage

from vapi import CreateConversationBlockDto, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.blocks.create(
    request=CreateConversationBlockDto(
        instruction="instruction",
    ),
)

⚙️ Parameters

request: BlocksCreateRequest

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.blocks.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.blocks.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.blocks.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.blocks.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.blocks.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.blocks.update(
    id="id",
)

⚙️ Parameters

id: str

messages: typing.Optional[typing.Sequence[UpdateBlockDtoMessagesItem]] — These are the pre-configured messages that will be spoken to the user while the block is running.

input_schema: typing.Optional[JsonSchema]

This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input

These are accessible as variables:

  • ({{input.propertyName}}) in context of the block execution (step)
  • ({{stepName.input.propertyName}}) in context of the workflow

output_schema: typing.Optional[JsonSchema]

This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}).

These are accessible as variables:

  • ({{output.propertyName}}) in context of the block execution (step)
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)

Caveats:

  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

tool: typing.Optional[UpdateBlockDtoTool] — This is the tool that the block will call. To use an existing tool, use toolId.

steps: typing.Optional[typing.Sequence[UpdateBlockDtoStepsItem]] — These are the steps in the workflow.

name: typing.Optional[str] — This is the name of the block. This is just for your reference.

instruction: typing.Optional[str]

This is the instruction to the model.

You can reference any variable in the context of the current block execution (step):

  • "{{input.your-property-name}}" for the current step's input
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • "{{global.your-property-name}}" for the global context

This can be as simple or as complex as you want it to be.

  • "say hello and ask the user about their day!"
  • "collect the user's first and last name"
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"

Caveats:

  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.

tool_id: typing.Optional[str] — This is the id of the tool that the block will call. To use a transient tool, use tool.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Tools

client.tools.list(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.tools.list()

⚙️ Parameters

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.tools.create(...)

🔌 Usage

from vapi import CreateDtmfToolDto, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.tools.create(
    request=CreateDtmfToolDto(),
)

⚙️ Parameters

request: ToolsCreateRequest

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.tools.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.tools.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.tools.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.tools.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.tools.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.tools.update(
    id="id",
)

⚙️ Parameters

id: str

async_: typing.Optional[bool]

This determines if the tool is async.

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

Defaults to synchronous (false).

messages: typing.Optional[typing.Sequence[UpdateToolDtoMessagesItem]]

These are the messages that will be spoken to the user as the tool is running.

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

function: typing.Optional[OpenAiFunction]

This is the function definition of the tool.

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

server: typing.Optional[Server]

This is the server that will be hit when this tool is requested by the model.

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Files

client.files.list()

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.files.list()

⚙️ Parameters

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.files.create(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.files.create()

⚙️ Parameters

file: `from future import annotations

core.File` — See core.File for more documentation

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.files.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.files.get(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.files.delete(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.files.delete(
    id="id",
)

⚙️ Parameters

id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.files.update(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.files.update(
    id="id",
)

⚙️ Parameters

id: str

name: typing.Optional[str] — This is the name of the file. This is just for your own reference.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Analytics

client.analytics.get(...)

🔌 Usage

from vapi import AnalyticsOperation, AnalyticsQuery, Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
client.analytics.get(
    queries=[
        AnalyticsQuery(
            name="name",
            operations=[
                AnalyticsOperation(
                    operation="sum",
                    column="id",
                )
            ],
        )
    ],
)

⚙️ Parameters

queries: typing.Sequence[AnalyticsQuery] — This is the list of metric queries you want to perform.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Logs

client.logs.get(...)

🔌 Usage

from vapi import Vapi

client = Vapi(
    token="YOUR_TOKEN",
)
response = client.logs.get()
for item in response:
    yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
    yield page

⚙️ Parameters

org_id: typing.Optional[str] — This is the unique identifier for the org that this log belongs to.

type: typing.Optional[LogsGetRequestType] — This is the type of the log.

assistant_id: typing.Optional[str] — This is the ID of the assistant.

phone_number_id: typing.Optional[str] — This is the ID of the phone number.

customer_id: typing.Optional[str] — This is the ID of the customer.

squad_id: typing.Optional[str] — This is the ID of the squad.

call_id: typing.Optional[str] — This is the ID of the call.

page: typing.Optional[int] — This is the page number to return. Defaults to 1.

sort_order: typing.Optional[LogsGetRequestSortOrder] — This is the sort order for pagination. Defaults to 'ASC'.

limit: typing.Optional[float] — This is the maximum number of items to return. Defaults to 100.

created_at_gt: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than the specified value.

created_at_lt: typing.Optional[dt.datetime] — This will return items where the createdAt is less than the specified value.

created_at_ge: typing.Optional[dt.datetime] — This will return items where the createdAt is greater than or equal to the specified value.

created_at_le: typing.Optional[dt.datetime] — This will return items where the createdAt is less than or equal to the specified value.

updated_at_gt: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than the specified value.

updated_at_lt: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than the specified value.

updated_at_ge: typing.Optional[dt.datetime] — This will return items where the updatedAt is greater than or equal to the specified value.

updated_at_le: typing.Optional[dt.datetime] — This will return items where the updatedAt is less than or equal to the specified value.

request_options: typing.Optional[RequestOptions] — Request-specific configuration.