> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create role bindings in a batch

> Assign several roles in one request and inspect each result.

API referenceApplies to: Workspaces with access management

`POST /api/v1/rolebindings/batch`

Assign several roles in one request and inspect each result.

## Access

Use an identity allowed to administer workspace access.

[Choose the right workspace credential](https://docs.e6data.com/api-reference/authentication.md). Ask your workspace administrator whether this API is available in your workspace.

For this example, set `ACCESS_TOKEN` to a user's [personal access token (PAT)](https://docs.e6data.com/platform/tokens/create-rotate-revoke.md#personal-access-tokens) with the required permission. A machine-client OAuth token also needs active permission enforcement and a role binding that grants this action to the client. Ask your administrator to confirm both.

## Request

JSON body requires a non-empty `roleBindings` array. Each entry has the same fields as one role binding. Check `failed` and every item in `results` before treating the batch as complete.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --proto '=https' --silent --show-error --fail-with-body \
  --request POST \
  --header @- \
  --header 'Content-Type: application/json' \
  --data '{"roleBindings":[{"name":"analysts-viewer","subject":{"kind":"Group","name":"analysts"},"roleRef":"viewer"},{"name":"lee-viewer","subject":{"kind":"User","name":"lee@example.com"},"roleRef":"viewer"}]}' \
  "$WORKSPACE_URL/api/v1/rolebindings/batch" <<< "Authorization: Bearer $ACCESS_TOKEN"
```

## Response

HTTP `200`. Example response with sample values:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "total": 2,
  "succeeded": 2,
  "failed": 0,
  "results": [
    {
      "name": "analysts-viewer",
      "success": true
    },
    {
      "name": "lee-viewer",
      "success": true
    }
  ]
}
```

## If the request fails

For `401`, check the workspace URL and token. For `403`, ask your administrator to check your access. For `400`, check the array and each entry. A `200` can include failed items, so read `results`.

[Return to the API endpoint directory](https://docs.e6data.com/api-reference/endpoints.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.