Log Out Multiple Shoppers
Starting with B2C Commerce version 26.9, use the batchLogout endpoint of the Shopper Login and API Access Service (SLAS) Admin API to log out up to 50 shoppers across all their sessions. Identify each shopper by their login ID and authenticate the request with a SLAS admin token or an Account Manager access token with the appropriate permissions.
For example, use this endpoint to:
- Invalidate every session for shopper accounts affected by a security incident.
- Force reauthentication for a group of shoppers as part of an account-security or support workflow.
For a shopper-initiated logout, use the logoutCustomer endpoint instead. That endpoint revokes the access token and the refresh token supplied by the shopper’s session. Batch logout is an administrative operation and affects every session associated with each successful login ID.
For each valid login ID, SLAS revokes all active refresh tokens and inactivates all active access tokens issued before the request. The shopper must then authenticate again using their configured login method. Batch logout doesn’t change the shopper’s password or other account credentials.
Authenticate the request with a SLAS admin token or Account Manager access token.
- For manual requests or testing, get a SLAS admin token from the SLAS Admin UI. Your Account Manager user must have the SLAS Organization Administrator role and the correct instance filters.
- For automated integrations, configure an Account Manager API client with the Salesforce Commerce API and Sandbox API User roles for the target instance, and use the client’s credentials to request an access token.
Gather the access token, the short code, the tenant ID, and the site ID for the B2C Commerce instance. See Base URL and Request Formation.
Send up to 50 shopper login IDs in the loginIds array. Login IDs are case-insensitive.
A syntactically valid request returns 200 OK even when SLAS can’t log out one or more shoppers. Check each entry in the results array instead of relying on the HTTP status alone. A login ID that doesn’t match a shopper returns a failure status. Duplicate login IDs return a not_processed status.