/v1/apps/{app_id}/end-users/bulk-deleteAuthBulk-delete accounts across a selection.
Deletes every matched account in one transaction. Each deleted account gets an `auth.account.deleted` audit row (`via: platform_bulk`) whose metadata carries the `selection` (`{ mode: "ids" }`, or `{ mode: "filter", filter }`), so a filter sweep reads as one. The workspace audit log gets one `auth.end_users.deleted` row with the count. `user.deleted` (`via: "platform_bulk"`) fires per account only when 100 or fewer were deleted.
Path parameters
app_id*stringId of the app.
Request body
selection*objectmode*enum (2)Selection strategy. `ids` operates on an explicit list of account ids (capped at 5,000). `filter` operates on every account matching the same status / search filter the list endpoint exposes — uncapped.
idsarrayRequired when mode=ids. Account ids to operate on.
statusenum (3)mode=filter only. Same status filter as GET /end-users.
searchstringmode=filter only. Same search filter as GET /end-users.
signalenum (5)mode=filter only. Same risk-signal filter as GET /end-users. Present so a bulk operation acts on exactly the rows the operator was looking at — omitting it would silently widen the selection to every account in the app.
providerstringmode=filter only. Same provider filter as GET /end-users. Carried for the same reason as `signal`: the server re-resolves the set at send time, so omitting it widens the operation past what the operator was looking at.
confirm_all_in_appbooleanDefence-in-depth confirmation for the destructive case where selection is `mode: 'filter'` with no `status` and no `search` (i.e. matches every account in the app). The server rejects that combination with 400 unless this flag is `true`. Set explicitly when you really mean "delete every end-user in this app".
Response · 200
affected_users*numberNumber of accounts (distinct ids) affected by the bulk write.
Example
Request
POST https://api.auth.productcraft.co/v1/apps/{app_id}/end-users/bulk-delete
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"selection": {
"mode": "ids",
"ids": [
"string"
],
"status": "active",
"search": "string",
"signal": "unverified",
"provider": "string"
},
"confirm_all_in_app": false
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const bulkAffectedUsers = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").endUsers.bulkDelete({ selection: { mode: "ids" } });auth.admin.app(…).endUsers.bulkDelete(params, options?): Auth.BulkAffectedUsers
Response
{
"affected_users": 0
}