# Game Sessions

Casino game sessions related endpoints

## Get the latest game sessions of a user

> Returns the latest played game sessions for the given \`user\`\
> \
> The results are sorted by the \`started\` date of the session \`descending\`.\
> This means that the most recent game session will be at the top of the response.\
> \
> If the user does not exist or has no sessions played then an empty list is returned.\
> \
> {% hint style="info" %}\
> \
> \## Example\
> \
> \
> In this example we get the latest \`5\` sessions of the user with id \`123\`.\
> \
> \`\`\`bash\
> $ curl --request GET \\\
> &#x20; \--url '<https://api.vaix.ai/api/casino/game\\_sessions/latest?user=123\\&count=5'\\>
> \`\`\`\
> \
> {% endhint %}\ <br>

````json
{"openapi":"3.0.1","info":{"title":"","version":"0.1.0"},"tags":[{"description":"Casino game sessions related endpoints","name":"Game Sessions"}],"servers":[{"description":"Production API","url":"https://api.vaix.ai"},{"description":"Staging (integration) API","url":"https://staging-api.vaix.ai"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"GameSession":{"description":"A game session object","type":"object","properties":{"category":{"description":"The category of the game, e.g. `Gaming: Dice`.","type":"string","nullable":true},"channels":{"description":"The available channels of the game.","type":"array","items":{"type":"string"},"nullable":true},"enabled":{"description":"Is game enabled indicator.","type":"number","nullable":true},"first_transaction":{"description":"Time of first transaction.","type":"string","format":"date-time","nullable":true},"game_id":{"description":"The unique game id","type":"string"},"game_image_url":{"description":"Game image from client's website.","type":"string","nullable":true},"game_link":{"description":"The url to the game (used in email campaigns).","type":"string","nullable":true},"game_name":{"description":"The name of the game.","type":"string"},"game_studio":{"description":"The studio providing the game.","type":"string","nullable":true},"has_avalanche":{"description":"Avalanche cascading reels feature indicator.","type":"boolean","nullable":true},"has_bonus":{"description":"bonus feature indicator.","type":"boolean","nullable":true},"has_buy":{"description":"buy feature indicator.","type":"boolean","nullable":true},"has_jackpot":{"description":"jackpot feature indicator.","type":"boolean","nullable":true},"has_megaways":{"description":"Megaways feature indicator.","type":"boolean","nullable":true},"has_sticky":{"description":"Wild sticky feature indicator.","type":"boolean","nullable":true},"images":{"description":"The list of images of the game.","type":"array","items":{"$ref":"#/components/schemas/GameImage"},"nullable":true},"internal_game_id":{"description":"The operator's internal game id of the game.","type":"string","nullable":true},"is_live":{"description":"live feature indicator.","type":"boolean","nullable":true},"max_bet":{"description":"The game's maximum bet allowed.","type":"number","nullable":true},"min_bet":{"description":"The game's minimum bet.","type":"number","nullable":true},"release_date":{"description":"Release date of the game, given by the operator.","type":"string","format":"date-time","nullable":true},"started":{"description":"Started time of game session.","type":"string","format":"date-time"},"total_duration_in_seconds":{"description":"Total duration of game session in seconds.","type":"number","nullable":true},"vaix_category":{"description":"Category provided by Vaix.","type":"string","nullable":true},"vaix_game_studio":{"description":"Game studio provided by Vaix.","type":"string","nullable":true},"vaix_tags":{"description":"Themes tagged by Vaix.","type":"array","items":{"type":"string"},"nullable":true}}},"GameImage":{"description":"A game image object","type":"object","properties":{"type":{"description":"Type of the image","type":"string"},"url":{"description":"Url of the image","type":"string"}},"additionalProperties":false},"Error":{"description":"The generic API's error response","type":"object","properties":{"error":{"description":"Description of the error","type":"string"},"status":{"description":"response status","type":"string"}},"additionalProperties":false},"Errors":{"description":"The generic API's errors response","type":"object","properties":{"errors":{"description":"An object with the request errors","type":"object"}},"additionalProperties":false},"UnprocessableEntityError":{"oneOf":[{"additionalProperties":false,"description":"The generic API's error response","properties":{"error":{"description":"Description of the error","type":"string"},"status":{"description":"response status","type":"string"}},"type":"object"},{"additionalProperties":false,"description":"The generic API's errors response","properties":{"errors":{"description":"An object with the request errors","type":"object"}},"type":"object"}]}}},"paths":{"/api/casino/game_sessions/latest":{"get":{"operationId":"get_latest_game_sessions","summary":"Get the latest game sessions of a user","description":"Returns the latest played game sessions for the given `user`\n\nThe results are sorted by the `started` date of the session `descending`.\nThis means that the most recent game session will be at the top of the response.\n\nIf the user does not exist or has no sessions played then an empty list is returned.\n\n{% hint style=\"info\" %}\n\n## Example\n\n\nIn this example we get the latest `5` sessions of the user with id `123`.\n\n```bash\n$ curl --request GET \\\n  --url 'https://api.vaix.ai/api/casino/game_sessions/latest?user=123&count=5'\n```\n\n{% endhint %}\n\n","parameters":[{"name":"x-vaix-client-id","in":"header","description":"Custom client header, the value should be the name of the group the user belongs to","required":true,"schema":{"type":"string"}},{"name":"x-vaix-authentication-method","in":"header","description":"Authentication method to be used, supported values [`vaix`, `iam`]. Defaults to `vaix`","required":false,"schema":{"type":"string"}},{"name":"user","in":"query","description":"The user to get game sessions for.","required":true,"schema":{"type":"string","default":"0"}},{"name":"count","in":"query","description":"Number of game sessions to return.","required":false,"schema":{"type":"integer","default":10,"maximum":100,"minimum":1}},{"name":"distinction_level","in":"query","description":"  Select whether the game sessions returned should be distinct based on game id.\n  The allowed methods are:\n  daily: If a game has more than one sessions per day,\n  then for each specific day, only one session of this game is returned.\n  none: Returns all game sessions for all games as they are.\n  unique: Returns only one session per game.\n","required":false,"schema":{"type":"string","default":"daily","enum":["daily","none","unique"]}},{"name":"minimum_duration","in":"query","description":"Include game sessions that lasted more than the given value (in seconds).\nIf not set no such filtering will be applied\n","required":false,"schema":{"type":"integer","default":60,"minimum":0}},{"name":"before_date","in":"query","description":"Sessions up to this timestamp will be taken into account","required":false,"schema":{"type":"string","format":"date-time","default":"now"}},{"name":"after_date","in":"query","description":"Sessions after this timestamp will be taken into account","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"filters","in":"query","description":"Optional filtering of the games to retrieve. It expects a string\nadhering to the filtering format, as described in the filtering\nsection, e.g. `enabled:eq:1`.\n","required":false,"schema":{"type":"string","enum":["game_id","game_name","game_studio","category","vaix_tags","vaix_category","tags","channels","has_megaways","is_live","has_bonus","has_buy","has_jackpot","has_sticky","has_avalanche","has_fixed","has_free_spin","has_wilds","has_gamble","has_respin","has_scatter","has_symbols_collection","has_symbols_mega","has_symbols_expanding","has_symbols_mystery","has_multiplier","has_wilds_random","has_wilds_walking","enabled","has_megaways","game_country","is_live","has_bonus","has_buy","has_jackpot","min_bet","max_bet","has_sticky","has_avalanche","has_fixed","has_free_spin","has_wilds","has_gamble","has_respin","has_scatter","has_symbols_collection","has_symbols_mega","has_symbols_expanding","has_symbols_mystery","has_multiplier","has_wilds_random","has_wilds_walking","game_image","has_game_link","live","game_brand","properties_channels"]}},{"name":"fields","in":"query","description":"Optional selection of the object fields to retrieve. It expects a comma\nseparated list of strings, as described in the field selection section,\ne.g. `game_id,game_name`.\n","required":false,"schema":{"type":"string","default":"game_id","enum":["game_id","game_name","game_studio","category","vaix_tags","vaix_category","tags","channels","has_megaways","is_live","has_bonus","has_buy","has_jackpot","has_sticky","has_avalanche","has_fixed","has_free_spin","has_wilds","has_gamble","has_respin","has_scatter","has_symbols_collection","has_symbols_mega","has_symbols_expanding","has_symbols_mystery","has_multiplier","has_wilds_random","has_wilds_walking"]}},{"name":"operator","in":"query","description":"The operator to use for querying data. Notice that this is applied only\nif your account has access to multiple operators. In a different case\nthe assigned operator to your account is used and the value of this\nfield is ignored.\n","required":false,"schema":{"type":"string"}},{"name":"bookmaker_id","in":"query","description":"The bookmaker id to use for querying data. Notice that this is applied only\nif your account has access to multiple operators. In a different case\nthe assigned operator to your account is used and the value of this\nfield is ignored. Note that this parameter is used together with the\n`sub_bookmaker_id` parameter.\n","required":false,"schema":{"type":"integer"}},{"name":"sub_bookmaker_id","in":"query","description":"The sub-bookmaker id to use for querying data. Notice that this is applied only\nif your account has access to multiple operators. In a different case\nthe assigned operator to your account is used and the value of this\nfield is ignored. Note that this parameter is used together with the\n`bookmaker_id` parameter.\n","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"description":"API response","type":"object","properties":{"data":{"description":"Array of objects","type":"array","items":{"$ref":"#/components/schemas/GameSession"}},"status":{"description":"The status of the request","type":"string","enum":["success","error"]}},"additionalProperties":false}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"406":{"description":"Not Acceptable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Errors"}}}},"413":{"description":"Request Entity Too Large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Errors"}}}},"422":{"description":"Unprocessable Entity","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnprocessableEntityError"}}}},"425":{"description":"Too Early","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Errors"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"tags":["Game Sessions"]}}}}
````
