# IRPCSubstituteUsers.SetSubstituteUsers

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Substitute users](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/

Badges: `Vault API / standard` `write` `session` `idempotent` `returns metadata structure version`

Replaces the substitutes of the calling user.

- **Service:** [Substitute users](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/index.md) `MFiles.IRPCSubstituteUsers`
- **gRPC method:** `/MFiles.IRPCSubstituteUsers/SetSubstituteUsers`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/set-substitute-users`
- **Request:** [`SetSubstituteUsersRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/index.md#request)
- **Response:** [`SetSubstituteUsersResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSubstituteUsers/SetSubstituteUsers/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** write
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires a vault session. Any user can set their own substitutes; there is no way to set
  another user's substitutes with this service.
- The list replaces the old one completely: send all substitutes, and an empty list to remove
  them all. Duplicates are stored once.
- Take the IDs from the Users (6) and User groups (16) value lists.
- The change takes effect at once, also for the existing sessions of the new and removed
  substitutes; they do not need to log in again.
- Fails with "Access denied." when substitution is turned off on the server.

<a id="request"></a>

## Request: SetSubstituteUsersRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `substitutes[]` | repeated [`UserOrUserGroupID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.UserOrUserGroupID/index.md) | The complete new list of substitutes: users (`USER_TYPE_USER`) and user groups (`USER_TYPE_USER_GROUP`). |
| `substitutes[].type` | [`UserType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.UserType/index.md) | User type. Values: `USER_TYPE_UNKNOWN` (0), `USER_TYPE_USER` (1), `USER_TYPE_USER_GROUP` (2), `USER_TYPE_WORKFLOW_STATE_PSEUDO_USER` (3), `USER_TYPE_PROPERTY_BASED_PSEUDO_USER` (4). |
| `substitutes[].id` | `int32` | User or user group. |

<a id="response"></a>

## Response: SetSubstituteUsersResponse

No fields.
