Skip to main content

Send a Chat Message

This API allows you to send a chat message and get a response from the assistant.

info

A successful response will use up 1 request from your monthly limit.

Below is the full reference for the POST request.

Endpoint

POST https://www.navigable.ai/api/v1/chat

Headers

KeyValue
X-Api-Key<YOUR_API_KEY>
Content-Typeapplication/jsonIf using JSON in the request body

Request Parameters

Request parameters can be sent as JSON in the request body, or can be urlencoded.

KeyTypeRequiredDescription
messagestringYesThe chat message sent by your user. Must be a valid string.
identifierstringNoA unique identifier for your user. Must be a valid string.
newbooleanNoIndicates if this is a new chat session. Must be true or omitted.
markdownbooleanNoEnables markdown support. Must be true or omitted.
currentPagestringNoSpecifies the current page. Must be a valid string.
configuredActionsstring[]NoAn array of configured actions. The LLM will recommend only one of these actions. Must be an array of strings.
configuredFunctionsstring[]NoAn array of configured functions. The LLM will automate only one of these actions. Must be an array of strings.
functionCallIdstringNoThe ID of the function call. Required if the LLM recommends a function call.
info

Actions are named as follows:

  • Pages: Go to <page name>
  • Actions: <action name>

You can copy the actions map from the API keys page.

info

In case of a function call result, pass the functionCallId in the request body. The function response must be passed in the message field.

Response

On a successful request, the API will return a 200 status code along with the following JSON response:

{
"success": true,
"message": "SUCCESS",
"data": {
"assistantMessage": "response from LLM",
"action": "action recommended by the LLM | null",
"identifier": "unique id of the chat session, new id if not provided in the request",
"toolCalls": [] // Array of function calls
}
}
KeyTypeDescription
successbooleanIndicates if the request was successful.
messagestringThe status message.
data.assistantMessagestringThe response from the LLM.
data.actionstring | nullThe action recommended by the LLM.
data.identifierstringThe unique identifier of the chat session. A new one will be provided if not specified in the request.
data.toolCallstoolCall[]An array of function calls. Maximum of 1 function call will be returned.
interface toolCall {
id: string;
type: "function";
function: {
name: string;
arguments: JSON; // JSON of arguments to be provided to the function call. key: argument name, value: argument value
};
}

Error Response - Unauthorized

On an unauthorized request, the API will return a 401 status code along with the following JSON response:

{
"success": false,
"message": "UNAUTHORIZED"
}

In case of this error, check your API key and ensure your request header has the correct X-Api-Key value.

Error Response - Bad Request

On a bad request, the API will return a 400 status code along with the following JSON response:

{
"success": false,
"message": "BAD_REQUEST",
"errors": {
"<field>": "<error message>"
// ... other error fields
}
}
ParameterError Message
messageProperty "message" must be a valid string.
identifierProperty "identifier" must be a valid string.
newProperty "new" must be true or omitted.
markdownProperty "markdown" must be true or omitted.
currentPageProperty "currentPage" must be a valid string.
configuredActionsPlease choose at least one valid action. Should be a list of actions configured in your website or app.
configuredFunctionsPlease choose at least one valid function slug. Should be a list of function slugs configured in your website or app.
functionCallIdInvalid function call id.

In case of this error, check your request parameters for any invalid values.

Error Response - Chat Limit Reached

On a chat limit reached, the API will return a 403 status code along with the following JSON response:

{
"success": false,
"message": "CHAT_LIMIT_REACHED"
}

In case of this error, top up your chat quota and try again.

Error Response - Internal Server Error

On an internal server error, the API will return a 500 status code along with the following JSON response:

{
"success": false,
"message": "UNEXPECTED_ERROR",

// In case the error is known
"error": "<error message>"
}

In case of this error, try again.

Example Requests

curl -X POST https://www.navigable.ai/api/v1/chat \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"message": "Hello, World!",
"identifier": "12345",
"markdown": true
}'