The reason that you get the 401 error is most probably because your session has timed out. As with all API:s, the session token that you get is only valid for a certain period of time.
In the Appylar REST documentation overview under section 5, it says:
The session token that was created and returned calling the POST /api/v1/session/ endpoint, will expire after a while. From there on, the API will respond with an HTTP 401 for all requests. When that happens, the SDK must make sure to automatically renew the session by calling the POST /api/v1/session/ endpoint again.
In other words, you have to refresh the session in your sdk when you get the 401 error.