I’m cleaning up test accounts using the Users API, but deleting a user doesn’t seem to handle their historical interactions gracefully. The docs say interactions are preserved, but the userId on those records points to a null or deleted object, breaking our reporting queries.
I’m using the JS SDK:
const usersApi = new UsersApi(config);
await usersApi.deleteUser(userId, { hardDelete: true });
The request returns 204 No Content, which is expected. However, when I query the interactions API later:
const interactions = await interactionsApi.getInteractions({ userId: userId });
It throws a 404 because the user no longer exists to be referenced. I need the interactions to remain queryable by the original user ID, even if the user is deleted. Is there a specific header or query param I’m missing to archive the user instead of deleting the reference? Or should I be archiving the user first via a PATCH call to /api/v2/users/{userId} with { "archived": true } before deletion? The SDK doesn’t expose a clear “archive” method in the generated types.