/v1/apps/{app_id}/end-users/bulk-update-roleAuthBulk-assign a role across a selection.
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.
role_name*stringRole name to assign to all selected users
Example: "member"
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-update-role
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"selection": {
"mode": "ids",
"ids": [
"string"
],
"status": "active",
"search": "string",
"signal": "unverified",
"provider": "string"
},
"role_name": "member"
}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.bulkUpdateRole({ role_name: "member", selection: { mode: "ids" } });auth.admin.app(…).endUsers.bulkUpdateRole(params, options?): Auth.BulkAffectedUsers
Response
{
"affected_users": 0
}