/api/logout2

End the current session (logout), optionally unregister the customer.

Change Note: new API

Parameters

(bool) if true, log out even when an unsaved cart exists
(bool) if true, also clear the cookie ('remember me') authentication
(bool) if true, block/unregister the customer on logout
(string) optional message sent to the shop owner when unregistering
(string) goodbye reasons the customer picked when unregistering: ids of /api/system/goodbye_reasons, comma separated; unknown ids are ignored
(String) optionally define the response-format for this call. One of: compact (default) | compacts | full | fulls | json | md | html | js | openapi | yaml
(int) optionally force the API to check against the role (instead of silently not returning data). For guests or public access, the default is -1. 0 (regular customer) and above define the role for which the current session is expected to be authorized.

Error Responses

HTTP StatusError CodeDescription
403not_authUser is not authenticated
409hascartLogout denied: an unsaved cart exists. Resend with confirmed=true to discard it.

Response Types

LogoutResult

LogoutResult (v1) docs

Result of a logout/unregister action

Fields (2)
#FieldTypeDescription
0actionstringthe action that was performed
1resultstringlogout_ok = session ended; unregistered = customer unregistered and session ended. (A denied logout due to an unsaved cart returns HTTP 409 hascart instead.)

Data (1 record)

actionresult
Logoutlogout_ok