---
title: "Set space role assignments"
method: POST
path: "/spaces/{id}/role-assignments"
tags: ["Space Roles"]
---

# Set space role assignments

`POST /spaces/{id}/role-assignments`

Sets space role assignments as specified in the payload. For each entry, if `roleId` is provided
the principal is assigned to that role. If `roleId` is omitted, the role assignment for that principal is removed, if it exists.

Available on tenants with [Role-Based Access Control](https://support.atlassian.com/confluence-cloud/docs/manage-user-roles/). 

**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:
Permission to manage roles in the space.

## Path parameters

- `id` integer, required

## Request body

- object[]
  - `principal` Principal, required — The principal of the role assignment.
    - `principalType` 'USER' | 'GROUP' | 'ACCESS_CLASS' — The principal type.
    - `principalId` string — The principal ID.
  - `roleId` string — The role to which the principal is assigned.

## Response `200`

Returned if the requested update to space role assignments succeeds in its entirety.

- object
  - `results` SpaceRoleAssignment[]
    - `principal` Principal — The principal of the role assignment.
      - `principalType` 'USER' | 'GROUP' | 'ACCESS_CLASS' — The principal type.
      - `principalId` string — The principal ID.
    - `roleId` string — The role to which the principal is assigned.
  - `_links` MultiEntityLinks
    - `next` string — Used for pagination. Contains the relative URL for the next set of results, using a cursor query parameter. This property will not be present if there is no additional data available.
    - `base` string — Base url of the Confluence site.

## Other responses

- `400` — Returned if an invalid request is provided.
- `401` — Returned if the authentication credentials are incorrect or missing from the request.
- `404` — Returned if the calling user does not have permission to set roles in the space, or the space was not found.
- `413` — Returned if the request is too large in size (over 5 MB).

---

[API](https://skmtc.net/atlassian/apis/the-confluence-cloud-rest-api-v2.md) · [All operations](https://skmtc.net/atlassian/apis/the-confluence-cloud-rest-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/atlassian/the-confluence-cloud-rest-api-v2/revisions/c4bd1ed570f2/schema)
