List all the sessions for the Character. The API accepts a limit parameter which can be used to limit the number of sessions to fetch. If the value is set to "-1", then all sessions are returned.
Headers
Name
Type
Description
CONVAI-API-KEY*
String
The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.
Here are some sample codes to demonstrate the request format for the endpoint -->
import requestsimport jsonurl ="https://api.convai.com/character/chatHistory/list"headers ={'CONVAI-API-KEY':'<Your-API-Key>','Content-Type':'application/json'}# Create a dictionary for the JSON payloadpayload ={"charID":"<Your-Character-Id>","limit":"-1"}# Convert the payload to JSONjson_payload = json.dumps(payload)response = requests.post(url, headers=headers, data=json_payload)print(response.text)
List all interactions for a given session-id. The output also contain a bool parameter which tell if the user input is a trigger or not. This will be set to true, if you have ever send a trigger while interacting with your character.
Headers
Name
Type
Description
CONVAI-API-KEY*
String
The unique api-key provided for every user. Found under the Key icon when logged into your Convai account.
Request Body
Name
Type
Description
charID
String
Id of your character.
sessionID
String
SessionId of the character for which you want to fetch the interactions.
[ {"timestamp":"2024-09-25 19:54:59.124733","interaction": [ {"speaker":"User","message":"Hi there" }, {"speaker":"Character","message":"Hi there, Welcome to the History Museum. We have the most ancient fossil ever discovered. Would be interesting in taking a tour?" } ],"is_trigger_input":false }]
{"ERROR":"Invalid API key provided."}
Here are some sample codes to demonstrate the request format for the endpoint -->
import requestsimport jsonurl ="https://api.convai.com/character/chatHistory/details"headers ={'CONVAI-API-KEY':'<Your-API-Key>','Content-Type':'application/json'}# Create a dictionary for the JSON payloadpayload ={"charID":"<Your-Character-Id>","sessionID":"<Your-Session-ID>"}# Convert the payload to JSONjson_payload = json.dumps(payload)response = requests.post(url, headers=headers, data=json_payload)print(response.text)