Knowledge Bases
Create knowledge bases from texts, files, and URLs, manage their sources, and reference them from a Retell LLM or conversation flow for retrieval-augmented answers during calls.
Create knowledge bases from texts, files, and URLs, manage their sources, and reference them from a Retell LLM or conversation flow for retrieval-augmented answers during calls.
openapi: 3.0.1
info:
title: Retell AI API
description: >-
REST API for building, testing, and deploying AI voice agents that make and
receive phone and web calls. Configure a response engine (Retell LLM, a
custom LLM, or a Conversation Flow), attach a voice, provision phone numbers,
place outbound and web calls, run batch campaigns, ground agents with
knowledge bases, and read back transcripts, recordings, and call analysis.
All endpoints are authenticated with a Bearer API key.
termsOfService: https://www.retellai.com/terms-of-service
contact:
name: Retell AI Support
url: https://docs.retellai.com
version: '2.0'
servers:
- url: https://api.retellai.com
security:
- api_key: []
tags:
- name: Agent
- name: Retell LLM
- name: Conversation Flow
- name: Phone Call
- name: Web Call
- name: Call
- name: Phone Number
- name: Voice
- name: Knowledge Base
- name: Batch Call
- name: Concurrency
paths:
/create-agent:
post:
operationId: createAgent
tags:
- Agent
summary: Create a new voice agent.
description: >-
Creates an agent that pairs a response engine (retell-llm, custom-llm, or
conversation-flow) with a voice and call-behavior settings.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRequest'
responses:
'201':
description: Agent created.
content:
application/json:
schema:
$ref: '#/components/schemas/AgentResponse'
/get-agent/{agent_id}:
get:
operationId: getAgent
tags:
- Agent
summary: Retrieve an agent.
parameters:
- $ref: '#/components/parameters/AgentId'
- $ref: '#/components/parameters/Version'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AgentResponse'
/list-agents:
get:
operationId: listAgents
tags:
- Agent
summary: List all agents.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AgentResponse'
/update-agent/{agent_id}:
patch:
operationId: updateAgent
tags:
- Agent
summary: Update an agent.
parameters:
- $ref: '#/components/parameters/AgentId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AgentRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AgentResponse'
/delete-agent/{agent_id}:
delete:
operationId: deleteAgent
tags:
- Agent
summary: Delete an agent.
parameters:
- $ref: '#/components/parameters/AgentId'
responses:
'204':
description: Agent deleted.
/create-retell-llm:
post:
operationId: createRetellLLM
tags:
- Retell LLM
summary: Create a Retell LLM response engine.
description: >-
Creates a Retell-managed LLM response engine (prompt, model, tools,
states, and knowledge base references) that an agent can use to drive the
conversation.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RetellLLMRequest'
responses:
'201':
description: Retell LLM created.
content:
application/json:
schema:
$ref: '#/components/schemas/RetellLLMResponse'
/get-retell-llm/{llm_id}:
get:
operationId: getRetellLLM
tags:
- Retell LLM
summary: Retrieve a Retell LLM.
parameters:
- $ref: '#/components/parameters/LlmId'
- $ref: '#/components/parameters/Version'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RetellLLMResponse'
/list-retell-llms:
get:
operationId: listRetellLLMs
tags:
- Retell LLM
summary: List all Retell LLMs.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/RetellLLMResponse'
/update-retell-llm/{llm_id}:
patch:
operationId: updateRetellLLM
tags:
- Retell LLM
summary: Update a Retell LLM.
parameters:
- $ref: '#/components/parameters/LlmId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RetellLLMRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RetellLLMResponse'
/delete-retell-llm/{llm_id}:
delete:
operationId: deleteRetellLLM
tags:
- Retell LLM
summary: Delete a Retell LLM.
parameters:
- $ref: '#/components/parameters/LlmId'
responses:
'204':
description: Retell LLM deleted.
/create-conversation-flow:
post:
operationId: createConversationFlow
tags:
- Conversation Flow
summary: Create a conversation flow.
description: >-
Creates a node/edge conversation flow response engine for visually
structured, deterministic agent conversations.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationFlowRequest'
responses:
'201':
description: Conversation flow created.
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationFlowResponse'
/get-conversation-flow/{conversation_flow_id}:
get:
operationId: getConversationFlow
tags:
- Conversation Flow
summary: Retrieve a conversation flow.
parameters:
- $ref: '#/components/parameters/ConversationFlowId'
- $ref: '#/components/parameters/Version'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationFlowResponse'
/list-conversation-flows:
get:
operationId: listConversationFlows
tags:
- Conversation Flow
summary: List all conversation flows.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ConversationFlowResponse'
/update-conversation-flow/{conversation_flow_id}:
patch:
operationId: updateConversationFlow
tags:
- Conversation Flow
summary: Update a conversation flow.
parameters:
- $ref: '#/components/parameters/ConversationFlowId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationFlowRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationFlowResponse'
/delete-conversation-flow/{conversation_flow_id}:
delete:
operationId: deleteConversationFlow
tags:
- Conversation Flow
summary: Delete a conversation flow.
parameters:
- $ref: '#/components/parameters/ConversationFlowId'
responses:
'204':
description: Conversation flow deleted.
/v2/create-phone-call:
post:
operationId: createPhoneCall
tags:
- Phone Call
summary: Create an outbound phone call.
description: >-
Places an outbound PSTN call from a number you own to a destination
number, handled by the agent bound to the from_number (or an override
agent).
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreatePhoneCallRequest'
responses:
'201':
description: Phone call registered.
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneCallResponse'
/v2/create-web-call:
post:
operationId: createWebCall
tags:
- Web Call
summary: Create a web call.
description: >-
Registers a browser-based (WebRTC) call and returns an access_token to
hand to the Retell Web Client SDK in your frontend.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateWebCallRequest'
responses:
'201':
description: Web call registered.
content:
application/json:
schema:
$ref: '#/components/schemas/WebCallResponse'
/get-call/{call_id}:
get:
operationId: getCall
tags:
- Call
summary: Retrieve a call.
description: >-
Returns the full call object including status, transcript, recording URL,
call analysis, and cost breakdown.
parameters:
- name: call_id
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Call'
/list-calls:
post:
operationId: listCalls
tags:
- Call
summary: List calls.
description: >-
Lists calls with optional filter criteria (agent, status, direction,
timestamp ranges), sort order, and pagination.
requestBody:
required: false
content:
application/json:
schema:
$ref: '#/components/schemas/ListCallsRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Call'
/create-batch-call:
post:
operationId: createBatchCall
tags:
- Batch Call
summary: Create a batch call.
description: >-
Queues an outbound calling campaign to many recipients from a single
from_number, subject to available concurrency.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateBatchCallRequest'
responses:
'201':
description: Batch call created.
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCallResponse'
/create-phone-number:
post:
operationId: createPhoneNumber
tags:
- Phone Number
summary: Buy a phone number.
description: >-
Provisions (purchases) a new phone number and optionally binds inbound
and outbound agents to it.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreatePhoneNumberRequest'
responses:
'201':
description: Phone number provisioned.
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneNumberResponse'
/import-phone-number:
post:
operationId: importPhoneNumber
tags:
- Phone Number
summary: Import an existing phone number.
description: >-
Connects a number you already own via your own SIP trunk / elastic SIP
trunking for use with Retell agents.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ImportPhoneNumberRequest'
responses:
'201':
description: Phone number imported.
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneNumberResponse'
/get-phone-number/{phone_number}:
get:
operationId: getPhoneNumber
tags:
- Phone Number
summary: Retrieve a phone number.
parameters:
- $ref: '#/components/parameters/PhoneNumber'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneNumberResponse'
/list-phone-numbers:
get:
operationId: listPhoneNumbers
tags:
- Phone Number
summary: List phone numbers.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/PhoneNumberResponse'
/update-phone-number/{phone_number}:
patch:
operationId: updatePhoneNumber
tags:
- Phone Number
summary: Update a phone number.
parameters:
- $ref: '#/components/parameters/PhoneNumber'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePhoneNumberRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PhoneNumberResponse'
/delete-phone-number/{phone_number}:
delete:
operationId: deletePhoneNumber
tags:
- Phone Number
summary: Delete (release) a phone number.
parameters:
- $ref: '#/components/parameters/PhoneNumber'
responses:
'204':
description: Phone number released.
/list-voices:
get:
operationId: listVoices
tags:
- Voice
summary: List all available voices.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Voice'
/get-voice/{voice_id}:
get:
operationId: getVoice
tags:
- Voice
summary: Retrieve a voice.
parameters:
- name: voice_id
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Voice'
/create-knowledge-base:
post:
operationId: createKnowledgeBase
tags:
- Knowledge Base
summary: Create a knowledge base.
description: >-
Creates a knowledge base from texts, files, and/or URLs that agents can
retrieve from (RAG) during calls.
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateKnowledgeBaseRequest'
responses:
'201':
description: Knowledge base created.
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeBaseResponse'
/get-knowledge-base/{knowledge_base_id}:
get:
operationId: getKnowledgeBase
tags:
- Knowledge Base
summary: Retrieve a knowledge base.
parameters:
- $ref: '#/components/parameters/KnowledgeBaseId'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeBaseResponse'
/list-knowledge-bases:
get:
operationId: listKnowledgeBases
tags:
- Knowledge Base
summary: List all knowledge bases.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/KnowledgeBaseResponse'
/delete-knowledge-base/{knowledge_base_id}:
delete:
operationId: deleteKnowledgeBase
tags:
- Knowledge Base
summary: Delete a knowledge base.
parameters:
- $ref: '#/components/parameters/KnowledgeBaseId'
responses:
'204':
description: Knowledge base deleted.
/add-knowledge-base-sources/{knowledge_base_id}:
post:
operationId: addKnowledgeBaseSources
tags:
- Knowledge Base
summary: Add sources to a knowledge base.
parameters:
- $ref: '#/components/parameters/KnowledgeBaseId'
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/AddKnowledgeBaseSourcesRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeBaseResponse'
/delete-knowledge-base-source/{knowledge_base_id}/source/{source_id}:
delete:
operationId: deleteKnowledgeBaseSource
tags:
- Knowledge Base
summary: Delete a knowledge base source.
parameters:
- $ref: '#/components/parameters/KnowledgeBaseId'
- name: source_id
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/KnowledgeBaseResponse'
/get-concurrency:
get:
operationId: getConcurrency
tags:
- Concurrency
summary: Get current and maximum call concurrency.
description: >-
Returns the organization's current number of ongoing calls, base and
purchased concurrency limits, burst settings, and reserved inbound
concurrency.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ConcurrencyResponse'
components:
securitySchemes:
api_key:
type: http
scheme: bearer
bearerFormat: apiKey
description: 'Retell API key, sent as: Authorization: Bearer <RETELL_API_KEY>'
parameters:
AgentId:
name: agent_id
in: path
required: true
schema:
type: string
LlmId:
name: llm_id
in: path
required: true
schema:
type: string
ConversationFlowId:
name: conversation_flow_id
in: path
required: true
schema:
type: string
KnowledgeBaseId:
name: knowledge_base_id
in: path
required: true
schema:
type: string
PhoneNumber:
name: phone_number
in: path
required: true
description: Phone number in E.164 format.
schema:
type: string
Version:
name: version
in: query
required: false
description: Specific version (integer) or version tag to retrieve.
schema:
type: string
schemas:
ResponseEngine:
type: object
description: The engine that produces agent responses during a call.
required:
- type
properties:
type:
type: string
enum:
- retell-llm
- custom-llm
- conversation-flow
llm_id:
type: string
description: Retell LLM id when type is retell-llm.
llm_websocket_url:
type: string
description: >-
Your WebSocket URL when type is custom-llm. Retell connects to
`{this-url}/{call_id}` at call start.
conversation_flow_id:
type: string
description: Conversation flow id when type is conversation-flow.
version:
type: integer
AgentRequest:
type: object
required:
- response_engine
- voice_id
properties:
response_engine:
$ref: '#/components/schemas/ResponseEngine'
voice_id:
type: string
example: 11labs-Adrian
agent_name:
type: string
voice_model:
type: string
voice_speed:
type: number
minimum: 0.5
maximum: 2
voice_temperature:
type: number
minimum: 0
maximum: 2
language:
type: string
default: en-US
webhook_url:
type: string
responsiveness:
type: number
minimum: 0
maximum: 1
interruption_sensitivity:
type: number
minimum: 0
maximum: 1
ambient_sound:
type: string
end_call_after_silence_ms:
type: integer
stt_mode:
type: string
enum:
- fast
- accurate
AgentResponse:
allOf:
- $ref: '#/components/schemas/AgentRequest'
- type: object
properties:
agent_id:
type: string
version:
type: integer
is_published:
type: boolean
last_modification_timestamp:
type: integer
RetellLLMRequest:
type: object
properties:
general_prompt:
type: string
description: General prompt appended to the system prompt in every state.
model:
type: string
default: gpt-4.1
model_temperature:
type: number
minimum: 0
maximum: 1
s2s_model:
type: string
begin_message:
type: string
description: First utterance said by the agent.
start_speaker:
type: string
enum:
- agent
- user
general_tools:
type: array
items:
$ref: '#/components/schemas/Tool'
states:
type: array
items:
type: object
starting_state:
type: string
knowledge_base_ids:
type: array
items:
type: string
default_dynamic_variables:
type: object
additionalProperties:
type: string
RetellLLMResponse:
allOf:
- $ref: '#/components/schemas/RetellLLMRequest'
- type: object
properties:
llm_id:
type: string
version:
type: integer
is_published:
type: boolean
last_modification_timestamp:
type: integer
Tool:
type: object
properties:
type:
type: string
enum:
- end_call
- transfer_call
- check_availability_cal
- book_appointment_cal
- press_digit
- custom
name:
type: string
description:
type: string
url:
type: string
description: Webhook URL for a custom tool.
ConversationFlowRequest:
type: object
properties:
global_prompt:
type: string
nodes:
type: array
description: Flow nodes (conversation, function, transfer, end, etc.).
items:
type: object
start_node_id:
type: string
model:
type: string
knowledge_base_ids:
type: array
items:
type: string
ConversationFlowResponse:
allOf:
- $ref: '#/components/schemas/ConversationFlowRequest'
- type: object
properties:
conversation_flow_id:
type: string
version:
type: integer
is_published:
type: boolean
CreatePhoneCallRequest:
type: object
required:
- from_number
- to_number
properties:
from_number:
type: string
description: E.164 number you own.
example: '+14157774444'
to_number:
type: string
description: E.164 destination number.
example: '+12137774445'
override_agent_id:
type: string
override_agent_version:
type: integer
metadata:
type: object
retell_llm_dynamic_variables:
type: object
additionalProperties:
type: string
custom_sip_headers:
type: object
additionalProperties:
type: string
PhoneCallResponse:
type: object
properties:
call_id:
type: string
call_type:
type: string
enum:
- phone_call
agent_id:
type: string
agent_version:
type: integer
call_status:
$ref: '#/components/schemas/CallStatus'
from_number:
type: string
to_number:
type: string
direction:
type: string
enum:
- inbound
- outbound
telephony_identifier:
type: object
CreateWebCallRequest:
type: object
required:
- agent_id
properties:
agent_id:
type: string
agent_version:
type: integer
metadata:
type: object
retell_llm_dynamic_variables:
type: object
additionalProperties:
type: string
WebCallResponse:
type: object
properties:
call_id:
type: string
call_type:
type: string
enum:
- web_call
access_token:
type: string
description: Token to pass to the Retell Web Client SDK in your frontend.
agent_id:
type: string
agent_version:
type: integer
call_status:
$ref: '#/components/schemas/CallStatus'
ListCallsRequest:
type: object
properties:
filter_criteria:
type: object
properties:
agent_id:
type: array
items:
type: string
call_status:
type: array
items:
$ref: '#/components/schemas/CallStatus'
direction:
type: array
items:
type: string
sort_order:
type: string
enum:
- ascending
- descending
limit:
type: integer
pagination_key:
type: string
CallStatus:
type: string
enum:
- registered
- ongoing
- ended
- error
Call:
type: object
properties:
call_id:
type: string
call_type:
type: string
enum:
- phone_call
- web_call
agent_id:
type: string
call_status:
$ref: '#/components/schemas/CallStatus'
from_number:
type: string
to_number:
type: string
direction:
type: string
start_timestamp:
type: integer
end_timestamp:
type: integer
duration_ms:
type: integer
transcript:
type: string
transcript_object:
type: array
items:
type: object
recording_url:
type: string
public_log_url:
type: string
disconnection_reason:
type: string
call_analysis:
$ref: '#/components/schemas/CallAnalysis'
call_cost:
$ref: '#/components/schemas/CallCost'
metadata:
type: object
CallAnalysis:
type: object
properties:
call_summary:
type: string
user_sentiment:
type: string
enum:
- Negative
- Positive
- Neutral
- Unknown
call_successful:
type: boolean
in_voicemail:
type: boolean
custom_analysis_data:
type: object
CallCost:
type: object
properties:
combined_cost:
type: number
description: Total cost of the call in cents.
total_duration_seconds:
type: integer
product_costs:
type: array
items:
type: object
properties:
product:
type: string
description: e.g. retell_platform, tts, llm, telephony.
unit_price:
type: number
cost:
type: number
CreateBatchCallRequest:
type: object
required:
- from_number
- tasks
properties:
from_number:
type: string
name:
type: string
trigger_timestamp:
type: integer
description: Unix ms at which to start the campaign; omit to start immediately.
tasks:
type: array
items:
type: object
required:
- to_number
properties:
to_number:
type: string
retell_llm_dynamic_variables:
type: object
additionalProperties:
type: string
BatchCallResponse:
type: object
properties:
batch_call_id:
type: string
name:
type: string
from_number:
type: string
scheduled_timestamp:
type: integer
total_task_count:
type: integer
CreatePhoneNumberRequest:
type: object
properties:
area_code:
type: integer
nickname:
type: string
inbound_agent_id:
type: string
outbound_agent_id:
type: string
number_provider:
type: string
enum:
- twilio
- telnyx
ImportPhoneNumberRequest:
type: object
required:
- phone_number
properties:
phone_number:
type: string
termination_uri:
type: string
description: SIP termination URI for outbound.
sip_trunk_auth_username:
type: string
sip_trunk_auth_password:
type: string
inbound_agent_id:
type: string
outbound_agent_id:
type: string
nickname:
type: string
UpdatePhoneNumberRequest:
type: object
properties:
inbound_agent_id:
type: string
outbound_agent_id:
type: string
nickname:
type: string
PhoneNumberResponse:
type: object
properties:
phone_number:
type: string
phone_number_pretty:
type: string
nickname:
type: string
inbound_agent_id:
type: string
outbound_agent_id:
type: string
area_code:
type: integer
last_modification_timestamp:
type: integer
Voice:
type: object
properties:
voice_id:
type: string
example: 11labs-Adrian
voice_name:
type: string
provider:
type: string
enum:
- elevenlabs
- openai
- deepgram
- play_ht
- cartesia
accent:
type: string
gender:
type: string
enum:
- male
- female
age:
type: string
preview_audio_url:
typ
# --- truncated at 32 KB (34 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/retell/refs/heads/main/openapi/retell-openapi.yml