All useful Litmind endpoints require you to create a session and pass along the X-SessionId and X-UserId headers with your requests.
You create a session by making a login request to the API with your Litmind username and password, the same credentials you use to login manually on the Litmind website.
To obtain your X-SessionId and X-UserId, call the /session/login endpoint, which accepts your Litmind's account credentials, and answers back with the values you need, like this:
Now you're logged in and ready to request all endpoints that require a logged account. Remember to store your X-SessionId and X-UserId programmatically and send the proper headers from now on. Here's an example:
Sessions are reusable
You don't need to login each time you want to make a request. Login just once, automatically store your X-SessionId and X-UserIdand re-use them for all consecutive requests.
Logging in with multiple users
If you have more than one user at Litmind, you can login with all of them to perform actions from each of your accounts.
To do so, call the /session/login endpoint again with the new user and password credentials, but this time pass along the X-SessionIdyou obtainer earlier. You'll get the corresponding X-UserId that you can now use to call the api acting as that Litmind account.
If you're a model agency, depending on your API credentials, you will be even able to log in into the accounts of the models in your agency to manage their profiles.
When logging with multiple users, call the /session/list endpoint to obtain a list of all the accounts currently logged into your session.
Sessions can expire
For security reasons, sessions can expire over time. When your session expires, you'll obtain a 40x HTTP error.
When this happens, your system should create a new session by logging in again and storing the new X-SessionId and X-UserId values.