Skip to main content
B2B only. Customer scope exists only on a B2B instance, that is one whose user_context_isolation is strict. A B2C instance (user_context_isolation: "equals_customer") does not accept customer_id on any call and rejects customer.context.fetch with HTTP 400, so it has no customer-scoped entries to clear. On B2C, use cache.clear_user instead. Call GET /api/v1/auth/whoami to see which mode your instance is in.
clear_customer() removes every cache entry whose customer scope matches customer_id, including any nested user-scoped entries that belong to that customer. Use it when offboarding a B2B tenant, when test fixtures need a clean slate, or when a customer’s data has drifted and you want to force a refresh from the platform. This is a synchronous method, no await.

Parameters

string
required
The external customer identifier whose cached data should be dropped. Must match the customer_id you originally passed when populating the cache. Customer scoping is a B2B concern only. See B2C vs B2B.

Returns

Returns None.

Example

Raises

This method does not raise SDK errors. See Error Codes for the full SDK exception hierarchy.

See also