Whitelabel Callfluent AI for your agency’s services with full flexibility Explore Whitelabel

Agent Services

Share this guide

The Agent Services API allows you to create, configure, and manage AI-powered voice agents within your CallFluent workspace. Agents can handle inbound/outbound calls, execute actions (email, SMS, webhooks), and integrate with third-party services.

Base URL

All requests must be sent to:
https://api.callfluent.ai/api

Authentication

Include your API key in the Authorization header:

Authorization: Bearer {api_key}  

Agent Endpoints

1. Get Twilio Number List

GET: /agent/number-list/{id}/{agentType}

Retrieves the Twilio number list.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
idnumbertrueWorkspace ID1
agentTypestringtrueoutbound or inboundoutbound

Example Request

curl -X GET https://api.callfluent.ai/api/agent/number-list/1/outbound \
  -H "Authorization: Bearer {api_key}"

Response

  • Example Success

status code: 200: workspace list

{ status: true, data: number_list, agentNumMap: {used_number: used_avatar_url, …}}

number_list: [
{number: twlio_number, sid: twilio_sid, type: “twilio/verified”}
]

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

2. Create a New Agent

POST: /agent/create

Creates a new voice agent with customizable settings.

Header

Authorization: Bearer {api_key}  

Request Body (agentPayload)

FieldTypeRequiredDescriptionExample
workspaceIdnumbertrueWorkspace ID1
formatstringtrueoutbound/inboundoutbound
timezonestringtrueAgent timezoneUTC+00:00
namestringtrueAgent nameSales assistant
avatarstringXXPublic image URL/image’s base64https://...
langstringtrueValue of language listen
voicestringtrueValue of workspace voicealloy
phone_numberstringtrue (outbound)
false (inbound)
Agent phone number+123456789
welcome_msg_flagbooleanfalseTurn on/off welcome messagetrue
welcome_msgstringfalseTurn on/off the welcome messageHow are you today?
welcome_msg_delaynumberfalseWait time (in seconds) before playing the welcome message3
call_recordingbooleanfalseEnable call recordingtrue
blocked_phone_typesstringfalseBlock phone type list1,2,3
enable_voice_mailbooleanfalseEnable machine detectiontrue
voice_mail_modenumberfalse1. Leave a voice message. 2. hang up the call1
voice_mail_textstringfalse1. Leave a voice message. 2. Hang up the callPlease try again.
machine_detection_timeoutnumberfalseTwilio machine detection timeout10
openai_modelstringfalseOpenAI model name (only available when openAI key is valid)gpt-4o
answer_creativitynumberfalseOpenAI temperature (0–10)3
context_max_tokensnumberfalseOpenAI prompt max token count350
speech_stop_sensitivitynumberfalseWord count that stops the agent’s speech (0-10)5
answer_lengthnumberfalseLimit the maximum no. of words (approximatively) per answer25
silence_message_delaynumberfalseTrigger the “are you there?” message after X seconds10
silence_end_callnumberfalseEnd the call if there is no sound for XX seconds20
utterance_detectionnumberfalseHow long to wait before an utterance ends (min 500ms)1000
transcribe_filler_wordsbooleanfalseTranscribe words like “hmm” or “uhm”true
agent_typestringtrueAgent typesales
backgroundstringtrueAgent’s backgroundYou are a support agent.
goalstringtrueAgent’s goalSupport clients
tonestringtrueAgent’s toneProfessional
instructionsstringtrueAgent’s instructions
script_optionbooleanfalseEnable agent’s scripttrue
scripttextfalseAgent’s scriptEnable the agent’s script
background_soundstringfalseBackground noise (only for browser call)office-ambience.wav

Example Request

curl -X POST https://api.callfluent.ai/api/agent/create \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "workspaceId": 1,
    "format": "outbound",
    "name": "Sales Bot",
    "voice": "alloy",
    "phone_number": "+123456789",
    "agent_type": "sales",
    "background": "You are a sales agent.",
    "goal": "Close deals."
  }'

Response

  • Example Success

status code: 200: workspace list

{status: true, data: new_agent }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 400 (Bad Request) – Agent limit reached.
{ 
        status: false,
        msg: "You have reached limit.",
}

3. Get All Agents in Workspace

GET: /agent/get-all/{workspaceId}

Retrieves the agents’ list in a workspace.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
workspaceIdnumbertrueWorkspace ID1

Response

  • Example Success

status code: 200: workspace list

{"status": true, "data": "agent_list" }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

4. Get Agent Details

GET: /agent/get-one/{agentId}

Retrieves details for a specific agent.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1

Response

  • Example Success

status code: 200: workspace list

{
    status: true,
    data: {
        agent,
        files,
        totalCalls,
        averageDuration
    }
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

5. Delete an Agent

DELETE: /agent/delete/{agentId}

Deletes a specific agent.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID11

Response

  • Example Success

status code: 200: workspace list

{ status: true, data: agent_list }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

6. Get an Agent’s Call History

GET: /agent/{agentId}/calls

Gets an agent’s call history.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1

Query Parameters

FieldTypeRequiredDescriptionExample
pagenumberfalsePage number1

Response

  • Example Success

status code: 200: workspace list

{
    status: true,
    data: calls
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

7. Update an Agent

PUT: /agent/update/{id}

Updates an agent.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
Idnumbertrueagent ID14

Request Body

{
	Payload: agentPayload
}

agentPayload

FieldTypeRequiredDescriptionExample
workspaceIdnumbertrueWorkspace ID1
formatstringtrueoutbound/inboundoutbound
timezonestringtrueAgent timezoneUTC+00:00
namestringtrueAgent nameSales assistant
avatarstringXXPublic image URL/image’s base64https://...
langstringtrueValue of language listen
voicestringtrueValue of workspace voicealloy
phone_numberstringtrue (outbound)
false (inbound)
Agent phone number+123456789
welcome_msg_flagbooleanfalseTurn on/off welcome messagetrue
welcome_msgstringfalseTurn on/off the welcome messageHow are you today?
welcome_msg_delaynumberfalseWait time (in seconds) before playing the welcome message3
call_recordingbooleanfalseEnable call recordingtrue
blocked_phone_typesstringfalseBlock phone type list1,2,3
enable_voice_mailbooleanfalseEnable machine detectiontrue
voice_mail_modenumberfalse1. Leave a voice message. 2. hang up the call1
voice_mail_textstringfalse1. Leave a voice message. 2. Hang up the callPlease try again.
machine_detection_timeoutnumberfalseTwilio machine detection timeout10
openai_modelstringfalseOpenAI model name (only available when openAI key is valid)gpt-4o
answer_creativitynumberfalseOpenAI temperature (0–10)3
context_max_tokensnumberfalseOpenAI prompt max token count350
speech_stop_sensitivitynumberfalseWord count that stops the agent’s speech (0-10)5
answer_lengthnumberfalseLimit the maximum no. of words (approximatively) per answer25
silence_message_delaynumberfalseTrigger the “are you there?” message after X seconds10
silence_end_callnumberfalseEnd the call if there is no sound for XX seconds20
utterance_detectionnumberfalseHow long to wait before an utterance ends (min 500ms)1000
transcribe_filler_wordsbooleanfalseTranscribe words like “hmm” or “uhm”true
agent_typestringtrueAgent typesales
backgroundstringtrueAgent’s backgroundYou are a support agent.
goalstringtrueAgent’s goalSupport clients
tonestringtrueAgent’s toneProfessional
instructionsstringtrueAgent’s instructions
script_optionbooleanfalseEnable agent’s scripttrue
scripttextfalseAgent’s scriptEnable the agent’s script
background_soundstringfalseBackground noise (only for browser call)office-ambience.wav

Response

  • Example Success

status code: 200: updated agent

{ status: true, data: updated_agent }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

8. Upload an Agent’s Knowledge Base File

PUT: /agent/knowledge/{id}

Upload an agent’s knowledge base file.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1

Request Body

FieldTypeRequiredDescription
filesbinarytrueThe file to be uploaded (Content-Type: multipart/form-data)

Response

  • Example Success

status code: 200: updated agent

{ status: true, data: agent_list }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

9. Delete an Agent’s Knowledge Base File

DELETE: /agent/knowledge/{id}

Deletes an agent’s knowledge base file.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
idnumbertrueKnowledge file ID11

Response

  • Example Success

status code: 200: workspace list

{ status: true, data: agent_list }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

10. Delete an Agent’s Call

DELETE: /agent/delete-call/{call_id}

Deletes an agent’s call.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
call_idnumbertrueCall ID11

Response

  • Example Success

status code: 200: workspace list

{ status: true, data: agent_list }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

11. Hang Up an In-Progress Twilio Call

POST: /agent/hangup-call

Hangs up an in-progress Twilio call.

Header

Authorization: Bearer {api_key}  

Request Body

FieldTypeRequiredDescriptionExample
callidnumbertrueCall ID1

Response

  • Example Success

status code: 200: updated agent

{ status: true, data: agent_list }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

12. Create an Agent’s Custom Fields

PUT: /agent/custom-field/{id}

Creates an agent’s custom fields.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
idnumbertrueAgent ID1

Body

{
	data: custom_field
}

custom_field

FieldTypeRequiredDescriptionExample
idstringcreate: false
update: true
Field IDd7d6946a-d90a-438e-954f-08cb5950d680
namestringtrueField namename
labelstringtrueField descriptionCall’s name

Response

  • Example Success

status code: 200: workspace list

{ status: true, data: updated_custom_field }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

13. Delete an Agent’s Custom Fields

DELETE: /agent/remove-custom-fields/{agent_id}/{field_id}

Deletes an agent’s custom fields.

Header

Authorization: Bearer {api_key}  

Path Parameters

FieldTypeRequiredDescriptionExample
agent_idnumbertrueAgent ID1
field_idnumbertrueField IDd7d6946a-d90a-438e-954f-08cb5950d680

Response

  • Example Success

status code: 200: updated custom field

{ status: true, data: updated_custom_field }

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{status: false, error: error_message}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
        status: false,
        msg: "Your account doesn't have the permission to access that page."
}

14. Create a New Agent Action

POST: /agent/create-action

Creates a new action for a specified agent.

Header

Authorization: Bearer {api_key}

Request Body

{
	payload: actionPayload
}

actionPayload Types

1. Send Email

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typesendEmail
namestringtrueAction nameSend email action
instructionstringtrueInstruction to trigger actionThis is a test email
contentstringtrueEmail contentThis is test email
subjectstringtrueEmail subjectIntroduction email

2. Call Forwarding

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typecallForwarding
namestringtrueAction nameCall forwarding action
instructionstringtrueInstruction to trigger actionForward to the phone number
forwardNumberstringtrueForward to phone number+1XXXXXXXX

3. Send Text Message

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typesms
namestringtrueAction nameSms action
instructionstringtrueInstruction to trigger actionTrigger when user wants sms
contentstringtrueSMS contentIt is test sms

4. Webhook / Zapier

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typewebhook
namestringtrueAction namewebhook action
webhook_urlstringtrueWebhook URLhttps://webhook-test/XXX
fieldsstringtrueJSON string of custom fields[{"value":"dev1","label":"dev1"},{"value":"email","label":"email"}]

5. Data Collection

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typedataCollection
namestringtrueAction nameData collection action
instructionstringtrueInstruction to trigger actionTrigger when user shares his name
collectFieldstringtrueField value of custom fieldemail

6. Email Data Push

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typeemail_push
namestringtrueAction nameEmail push action
target_emailstringtrueEmail address to push data[email protected]
subjectstringtrueEmail subjectCall summary
fieldsstringtrueJSON string of custom fields[{"value":"dev1","label":"dev1"},{"value":"email","label":"email"}]

7. GHL Calendar

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typeghl_calendar
namestringtrueAction nameGHL meeting action
ghlCalendarIdstringtrueGHL calendar IDB6blCXXXXX
calendarPeriodstringtrueDate range for scheduling1week
instructionstringtrueInstruction to trigger actionTrigger when user want to schedule call

8. Google Calendar

FieldTypeRequiredDescriptionExample
agentIdnumbertrueAgent ID1
actionTypestringtrueAction typegoogle_calendar
namestringtrueAction nameGHL meeting action
google_titlestringtrueGoogle meeting titleIntroduction meeting
google_descriptionstringfalseGoogle meeting description
instructionstringtrueInstruction to trigger actionTrigger when user want to schedule call
calendarPeriodstringtrueDate range for scheduling1week
google_durationstringtrueMeeting duration30 mins

Response

Example Success

status code: 200: created action

{ 
  status: true, 
  data: created_action 
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{ 
  status: false, 
  error: error_message 
}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
  status: false, 
  msg: "Your account doesn't have the permission to access that page." 
}

15. Update an Agent Action

POST: /agent/update-action/{actionId}

Updates an existing action for a specified agent.

Header

Authorization: Bearer {api_key}

Path Parameter

FieldTypeRequiredDescriptionExample
actionIdnumbertrueAction ID1

Request Body

actionPayload:

actionPayload Types

1. Send Email

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typesendEmail
namestringtrueAction nameSend email action
instructionstringtrueInstruction to trigger actionTrigger when user asks to send email
contentstringtrueEmail contentThis is test email
subjectstringtrueEmail subjectIntroduction email

2. Call Forwarding

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typecallForwarding
namestringtrueAction nameCall forwarding action
instructionstringtrueInstruction to trigger actionTrigger when user want to connect with a manager
forwardNumberstringtrueForward to phone number+1XXXXXXXX

3. Send Text Message

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typesms
namestringtrueAction nameSms action
instructionstringtrueInstruction to trigger actionTrigger when user wants sms
contentstringtrueSMS contentIt is a test SMS

4. Webhook / Zapier

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typewebhook
namestringtrueAction namewebhook action
webhook_urlstringtrueWebhook URLhttps://webhook-test/XXX
fieldsstringtrueJSON string of custom fields[{"value":"dev1","label":"dev1"},{"value":"email","label":"email"}]

5. Data Collection

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typedataCollection
namestringtrueAction nameData collection action
instructionstringtrueInstruction to trigger actionTrigger when user shares his name
collectFieldstringtrueField value of custom fieldemail

6. Email Data Push

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typeemail_push
namestringtrueAction nameEmail push action
target_emailstringtrueEmail address to push data[email protected]
subjectstringtrueEmail subjectCall summary
fieldsstringtrueJSON string of custom fields[{"value":"dev1","label":"dev1"},{"value":"email","label":"email"}]

7. GHL Calendar

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typeghl_calendar
namestringtrueAction nameGHL meeting action
ghlCalendarIdstringtrueGHL calendar IDB6blCXXXXX
calendarPeriodstringtrueDate range for scheduling1week
instructionstringtrueInstruction to trigger actionTrigger when user want to schedule call

8. Google Calendar

FieldTypeRequiredDescriptionExample
actionTypestringtrueAction typegoogle_calendar
namestringtrueAction nameGHL meeting action
google_titlestringtrueGoogle meeting titleIntroduction meeting
google_descriptionstringfalseGoogle meeting description
instructionstringtrueInstruction to trigger actionTrigger when user want to schedule call
calendarPeriodstringtrueDate range for scheduling1week
google_durationstringtrueMeeting duration30 mins

Response

Example Success

Status code: 200: created action

{ 
  status: true, 
  data: created_action 
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{ 
  status: false, 
  error: error_message 
}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
  status: false, 
  msg: "Your account doesn't have the permission to access that page." 
}

16. Delete an Agent Action

DELETE: /agent/delete-action/{actionId}

Deletes an existing action for a specified agent.

Header

Authorization: Bearer {api_key}

Path Parameter

FieldTypeRequiredDescriptionExample
actionIdnumbertrueAction ID1

Response

Example Success

Status code: 200: deleted action

{ 
  status: true, 
  data: deleted_action 
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{ 
  status: false, 
  error: error_message 
}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
  status: false, 
  msg: "Your account doesn't have the permission to access that page." 
}

17. Set Agent’s CORS Origin

PUT: /agent/webhook-cors-origin/{agent_id}

Sets the agent’s CORS origin.

Header

Authorization: Bearer {api_key}

Path Parameter

FieldTypeRequiredDescriptionExample
agent_idnumbertrueAgent ID1

Request Body

{
	data: webhookPayload
}

webhookPayload

FieldTypeRequiredDescriptionExample
has_webhook_cors_originbooleantrueEnable CORS origintrue
webhook_cors_originarraytrueDomains[“https://google.com“, “https://yahoo.com“]

Response

Example Success

Status code: 200: updated webhook

{ 
  status: true, 
  data: updated_webhook 
}

Errors

  • 500 (Server Error) – Server error.

server error: status code: 500

{ 
  status: false, 
  error: error_message 
}
  • 403 (Permission Error) – Permission error.

permission error: status code: 403

{ 
  status: false, 
  msg: "Your account doesn't have the permission to access that page." 
}

Conclusion

This covers all Agent Services API endpoints. For workspace management, refer to the Call Services Documentation.

Leave a reply

Your email address will not be published. Required fields are marked *

Automate your phone calls with AI

Create artificial inteligence powered, human-like voice agents ready to handle inbound and outbound calls 24/7

Discover Callfluent

Frequently asked questions

Get answers to commonly asked questions about our cutting-edge AI voice call technology & learn how our platform revolutionizes customer engagement line never before.

No, you don’t need to download or install anything. Callfluent is a cloud based app, that means that it is hosted in the cloud and you can access it from any device anytime.

Have more questions ? Check out our Knowledge base