Experiencing something similar: When only requesting endpoints status/ or relay/control/, all is good. When requesting endpoint status/ and (directly afterwards) relay/control/, the second request gets answered with 401.
This is due to the Api being limited to 1 request per second (a bit longer in my tests, currently I go with 1.7 seconds).
Hopefully the limit is raised soon, as this timespan makes up more or less 90% of the latency in my automation...