Skip to main content

User Unsubscribing in the REST API

How to log out users via the REST API

Written by Petr Pech

Once a user successfully logs in to ABRA Flexi, an authentication session is created. After selecting a company, the system also creates context information for each user regarding the connection to that company — the base currency, company settings, or user permissions. Any subsequent change to this data only affects a new login, so a user who has been logged in for a long time would not be aware of it. The solution is to force the termination of their session.


Calling the Service

POST https://demo.flexibee.eu/status/user/{přihlašovací jméno}/logout

⚠️ The same method is also used for the web interface. For API calls, therefore, request the format JSON or XML — this will prevent the final redirect.

You can terminate sessions of users logged in via the web interface as well as API sessions created via JSON authentication. No session is created for API requests that use HTTP authentication.


Two Ways to Use It

What You Want

How to Call It

Result

Log the user out of all companies

Without any additional parameters.

All of the user's authentication sessions are terminated.

Log the user out of a specific company

Add the parameter company={databázové jméno firmy}.

Authentication sessions remain valid; only the context information is discarded.

The context is automatically restored and re-cached with the user's next request.


Examples

Logging out user novak from all companies and ending their authentication:

POST https://demo.flexibee.eu/status/user/novak/logout

Logging out user franta from company nejlepsi_firma_a_s_ without ending their authentication:

POST https://demo.flexibee.eu/status/user/franta/logout?company=nejlepsi_firma_a_s_


Return Statuses

Status

When It Occurs

200

Successful call via the API. The response body is empty.

303

Successful call from the web interface — redirect to /status/user.

404

The user is not logged in; the body contains the message User '…' is not logged in. The same status occurs even if the context information was discarded but no authentication session existed — typically for API calls using HTTP authentication.

💡 If you don't want to receive the 404 error for a user who is not logged in, add the parameter ?ignore-not-found=true. The call will then return 200 even when there was nothing to log out — this is more convenient for batch logouts.

POST https://demo.flexibee.eu/status/user/novak/logout?ignore-not-found=true


Who Can Use This Service

  • A user with access rights to all companies and, at the same time, with license management rights.

  • Calls made under server authorization.

  • A user acting on themselves.


Related

Did this answer your question?