Skip to main content

Get Chat Session Messages

This API allows you to get a chat session's last 20 messages by your user's unique identifier.

info

A successful response will not use up any requests from your monthly limit.

Below is the full reference for the GET request.

Endpoint

GET 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 can be sent as JSON in the request body, or can be urlencoded.

KeyTypeRequiredDescription
identifierstringYesThe unique identifier of your user. Must be a valid string.

Response

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

{
"success": true,
"message": "SUCCESS",
"data": [
{
"sender": "who sent the message, USER or ASSISTANT",
"content": "contents of the message",
"new": "flag indicating if the message is the beginning of a new session",
"createdAt": "timestamp for when the message was created",
"action": "action recommended by the assistant | null"
}
// more messages...
]
}
KeyTypeDescription
successbooleanIndicates if the request was successful.
messagestringThe status message.
data[index].sender"USER" | "ASSISTANT"The sender of the message.
data[index].contentstringThe content of the message.
data[index].newbooleanA flag indicating if the message is the beginning of a new session.
data[index].createdAtstringThe timestamp for when the message was created.
data[index].actionstring | nullThe action recommended by the assistant.

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
identifierProperty "identifier" must be a valid string.

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

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 GET "https://www.navigable.ai/api/v1/chat?identifier=12345" \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json"