Create Session

Creating a session

at the beginning of each conversation with each user or group a session must be established, this session must not change throughout the conversation unless it has expired or is no longer available due to an AI Error.

If a new session ID gets established for each incoming message, this will result in weird conversations that will not make sense since the AI will not be able to recall the last few messages of the conversation with the user or group

This method will return a Session Object upon a successful request

Session Creation Limit

Depending on your subscription, there are a limited amount of sessions that you can create. Each session lasts around for 3 hours but the usage for each session contains no limit.

For example, your subscription may only support "100 Monthly Lydia Sessions" which means that you can only create 100 sessions per month and that limitation only resets after a billing cycle (Both paid and free)
Parameter NameDefault ValueRequiredDescription
languageenFalseThe default language that the AI will try to base the conversation in, can be ISO-639-1 or a language name (Eg; English, EspaƱol)

Example Success Response

  "success": true,
  "response_code": 200,
  "results": {
    "session_id": "46db504f80a9eadd0fbec43ff4f75690962242b5c57fb23f6e4f2a23423bcab8",
    "language": "en",
    "available": true,
    "expires": 1581899765

Session Object Structure

session_idstringThe ID of the session that must be used for requests like "Think Thought"
languagestringThe ISO 639-1 Language code that this session is based in
availablebooleanIndicates if this session is available or not. A session can be unavailable if it has expired or a session error raises
expiresintegerThe Unix Timestamp for when this session will expire

Invalid Language Code Response

This response is given when the parameter target_language contains an invalid value.
  "success": false,
  "response_code": 400,
  "error": {
    "error_code": 7,
    "type": "CLIENT",
    "message": "The given language code is not a valid ISO 639-1 Language Code"