< class="prominent-subhead ">

Intermittent 401 error response when making a call through K2-REST API to UiPath

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.


You may be getting an intermittent 401 error response when making a call through K2 - REST API to UiPath.


The issue could be caused by the  UiPath OAuth tokens expiring after 30 minutes. K2 refreshes the token after 60 minutes by default.

Troubleshooting Steps

Increasing the UIPath token lifetime to above 60 minutes will resolve the issue.

Update the UiPath web.config, add the following setting in the AppSettings section and set “Auth.Cookie.Expire" to 70 as follows:

<add key="Auth.Cookie.Expire" value="70" />
<add key="Auth.Bearer.Basic.Expire" value="70" />