Public APIs
Authorization
All of Swiftsell's APIs use a Bearer token based authentication.
Your account token can be found at Settings > Account Settings.
Create a knowledge base
POST /v1/ai/knowledge-base
Using this API, you can create a knowledge base in the account.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Copy
{
"name": "KNOWLEDGE_BASE_NAME"
}Response
{
"ok": true,
"id": KNOWLEDGE_BASE_ID,
"message": "Knowledge base has been created.",
"code": "CREATE_KNOWLEDGE_BASE_SUCCESS_MESSAGE"
}{
"ok": false,
"message": "You have reached the maximum number of knowledge bases. Upgrade your plan to create more knowledge bases.",
"error": "MAX_KNOWLEDGE_BASE_COUNT_EXCEEDED",
"code": "MAX_KNOWLEDGE_BASE_COUNT_EXCEEDED"
}
{
"ok": false,
"message": "Please reach out to support to use this feature",
"error": "UNAUTHORIZED_FEATURE",
"code": "UNAUTHORIZED_FEATURE"
}Adding text/file data sources to a knowledge base
POST /api/v1/ai/knowledge-base/<knowledge_base_id>/upload/sources
Using this API, you can add a data source to an existing knowledge base.
Headers
Content-Type
multipart/form-data
Authorization
Bearer <token>
Body
The API accepts files and text as multipart form data for upload. Each form field should be a unique key and contain either a file or text content.
file_data_source_name
form-data
File location
text_data_source_name
form-data
Text content
Response
Adding individual URLs data sources to a knowledge base
POST /v1/ai/knowledge-base/<knowledge_base_id>/data-sources/webpages
Using this API, you can add individual URLs as data sources to an existing knowledge base.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Adding domain data source to a knowledge base
POST /v1/ai/knowledge-base/<knowledge_base_id>/data-sources/domain
Using this API, you can add domain as data source to an existing knowledge base.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Get training status of a data source
GET /api/v1/ai/status/sources
Using this API, you can fetch the status of one or more data sources in a knowledge base to know it its training is - in progress / completed / failed.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
source_ids
query params
Comma-separated list of data source IDs to be passed as query params.
Response
Fetch knowledge base details
GET /v1/ai/knowledge-base/<knowledge_base_id>
Using this API, you can fetch knowledge base and it's relevant data sources details.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Creating a conversation
POST /v1/conversations
Using this endpoint, you can start/create a new conversation.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Contains the message payload. Payload differs based on channel.
Response
Send agent response to a conversation
POST /api/v1/conversation/<conversation_id>/messages
For every response sent by the agent on the third-party system, this API is to be invoked so it can relay this response to the user.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Closing a conversation
POST /api/v1/conversation/<conversation_id>/events
Use this endpoint to close an open conversation.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Changing assignee in a conversation
POST /api/v1/conversation/<conversation_id>/events
Use this endpoint to change the assignee in an open conversation.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Update variable of a conversation
POST /v1/accounts/<account_id>/conversations/<conversation_id>/variables
Use this endpoint to update the variables in the conversation.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Set webhook URL for Events feature
POST /v1/accounts/<account_id>/webhook
Use this endpoint to set webhook for receiving conversation related events from the account.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
200401Copy
Create a bot
POST /v1/bot
Using this API, you can create a bot in account.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Fetch bot flow
GET /v1/bots/<bot_id>/flow
Using this API, you can fetch bot's flow data.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Deploy bot flow
POST /v1/bots/<bot_id>/deploy
Using this API, you can deploy the bot flow after modifying it's JSON data.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
Response
Fetch Bots List
GET /v1/accounts/<account_id>/bots
Use this endpoint to fetch list of bots available in the account.
Headers
Content-Type
application/json
Authorization
Bearer <token>
Response
Last updated