Skip to content

Create a Chatbot

Create a Chatbot

This endpoint allows you to programmatically create a new chatbot within your Nexvio.ai account.

Endpoint

POST https://api.nexvio.ai/v1/chatbots

Headers

NameRequiredDescription
AuthorizationYesYour API key in the format: Bearer YOUR_API_KEY
Content-TypeYesMust be application/json

Request Body

ParameterTypeRequiredDescription
namestringYesThe name of your chatbot
welcome_messagestringNoInitial message displayed when a user opens the chatbot
modelstringNoAI model to use. Options: gpt-3.5-turbo, gpt-4. Default: gpt-3.5-turbo
instructionsstringNoSystem instructions that define your chatbot’s personality and knowledge
team_idstringNoThe team ID if you want to assign this chatbot to a specific team
appearanceobjectNoConfiguration for the chatbot’s visual appearance (see below)

Appearance Object

ParameterTypeRequiredDescription
primary_colorstringNoPrimary color for the chatbot UI (hex code)
chat_bubble_button_stylestringNoStyle of the chat button. Options: round, square
positionstringNoPosition of the chat widget. Options: bottom-right, bottom-left, top-right, top-left
chatbox_header_textstringNoText to display in the chatbox header
hide_brandingbooleanNoWhether to hide Nexvio.ai branding. Requires enterprise plan. Default: false

Example Request

{
"name": "Sales Assistant",
"welcome_message": "Hello! I'm your sales assistant. How can I help you today?",
"model": "gpt-4",
"instructions": "You are a sales assistant for Acme Corp, a software company that specializes in CRM solutions. Be friendly, helpful, and knowledgeable about our products. Our main product is AcmeCRM, which starts at $29/month. Refer technical support questions to support@acmecorp.com.",
"team_id": "team_123abc",
"appearance": {
"primary_color": "#4A90E2",
"chat_bubble_button_style": "round",
"position": "bottom-right",
"chatbox_header_text": "Sales Support",
"hide_branding": false
}
}

Response

{
"status": "success",
"data": {
"chatbot": {
"id": "chatbot_456def",
"team_id": "team_123abc",
"name": "Sales Assistant",
"welcome_message": "Hello! I'm your sales assistant. How can I help you today?",
"model": "gpt-4",
"instructions": "You are a sales assistant for Acme Corp...",
"appearance": {
"primary_color": "#4A90E2",
"chat_bubble_button_style": "round",
"position": "bottom-right",
"chatbox_header_text": "Sales Support",
"hide_branding": false
},
"created_at": "2023-07-15T12:30:45Z",
"updated_at": "2023-07-15T12:30:45Z"
}
}
}

Error Responses

Authentication Error

{
"status": "error",
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}

Validation Error

{
"status": "error",
"error": {
"code": "validation_error",
"message": "Invalid request data",
"details": {
"name": "Name is required"
}
}
}

Plan Limit Error

{
"status": "error",
"error": {
"code": "plan_limit_exceeded",
"message": "Your current plan allows a maximum of 5 chatbots. Please upgrade your plan to create more."
}
}

Notes

  • Creating a chatbot does not automatically make it accessible to your users. You’ll need to configure sources, deploy it to your website, or integrate it with other platforms.
  • The model selection affects pricing. Advanced models like GPT-4 may incur additional costs based on your plan.
  • To upload a profile picture or icon for your chatbot, use the separate upload endpoints after creating the chatbot.

Code Examples

cURL

Terminal window
curl -X POST "https://api.nexvio.ai/v1/chatbots" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Sales Assistant",
"welcome_message": "Hello! How can I help you today?",
"model": "gpt-3.5-turbo",
"instructions": "You are a friendly sales assistant..."
}'

JavaScript

const response = await fetch('https://api.nexvio.ai/v1/chatbots', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Sales Assistant',
welcome_message: 'Hello! How can I help you today?',
model: 'gpt-3.5-turbo',
instructions: 'You are a friendly sales assistant...'
})
});
const data = await response.json();
console.log(data);

Python

import requests
url = "https://api.nexvio.ai/v1/chatbots"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"name": "Sales Assistant",
"welcome_message": "Hello! How can I help you today?",
"model": "gpt-3.5-turbo",
"instructions": "You are a friendly sales assistant..."
}
response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data)