---
title: "Bulk Replace Users"
method: PUT
path: "/v2/facts/{proj_id}/{env_id}/bulk/users"
tags: ["Bulk Operations"]
---

# Bulk Replace Users

`PUT /v2/facts/{proj_id}/{env_id}/bulk/users`

## Path parameters

- `proj_id` string, required — Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").
- `env_id` string, required — Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

## Request body

- UserReplaceBulkOperation
  - `operations` UserCreate[], required
    - `key` string, required — A unique id by which Permit will identify the user for permission checks.
    - `email` string, email — The email of the user. If synced, will be unique inside the environment.
    - `first_name` string — First name of the user.
    - `last_name` string — Last name of the user.
    - `attributes` object — Arbitrary user attributes that will be used to enforce attribute-based access control policies.
    - `role_assignments` UserRoleCreate[] — List of roles to assign to the user in the environment.
      - `role` string, required — the role that will be assigned (accepts either the role id or the role key)
      - `tenant` string — the tenant the role is associated with (accepts either the tenant id or the tenant key)
      - `resource_instance` string — the resource instance the role is associated with (accepts either the resource instance id or key using this format resource_type:resource_instance)The resource instance will be implicitly created if the tenant parameter is specified and the resource instance does not exist.

## Response `200`

Successful Response

- UserReplaceBulkOperationResult

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/permit/apis/permit-io-api.md) · [All operations](https://skmtc.dev/permit/apis/permit-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/permit/permit-io-api/revisions/13faa12b4692/schema)
