---
ai:
  exclude: true
search:
  tags:
    - Content Restrictions
    - PUT
seo:
  description: >-
    Sets all the restrictions specified to a piece of… Reference for the PUT
    /rest/api/content/{id}/restriction endpoint in the Confluence Data Center
    API.
sidebar:
  label: Update restrictions
  badge: PUT
title: Update restrictions
type: openapi-operation
---
Sets all the restrictions specified to a piece of content identified by `contentId`. Setting per-content restrictions is currently allowed for Pages or BlogPosts only. 

Example request URI: 

`http://example.com/confluence/rest/content/1234567/restriction?expand=`

The payload uses the same schema as returned by the GET requests from `/rest/api/content/{id}/restriction/byOperation*` which can be used as a template but is not necessary. 

Example request for a single content restriction: 

```json
[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } } ]
```

Example request for updating two ContentRestrictions: 

```json
[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } }, { "operation": "read", "restrictions": { "user": [ { "type": "known", "username": "fred" } ] } } ]
```

Rules for using this method: 

- The provided ContentRestrictions will overwrite any existing restrictions on the Content for the corresponding operations. 
- If the provided `ContentRestriction` lacks any supported operations, the restrictions for the operations will not be altered. 
- Setting `users` and/or `groups` map entries as empty arrays will remove the corresponding content restrictions. 
- Missing `users` and/or `groups` map entries means the corresponding operation's user/group content restrictions won't be changed. 
- Modifying restrictions to revoke the requesting user's access is prohibited.

`PUT /rest/api/content/{id}/restriction`

**Request body** (`application/json`)

Request body example:

```json
[
  {
    "content": {
      "expanded": true,
      "idProperties": {}
    },
    "operation": "string",
    "restrictions": {}
  }
]
```

**Responses**

- `200` — Returns a full JSON representation of the restrictions present directly on piece of content after the update operation.
- `400` — Returned if any of the above validation rules are violated.
- `401` — Returned if the calling user is not authenticated.
- `403` — Returned if the calling user does not have permission to edit the restrictions.
- `404` — Returned if there is no content with the given id, or if the calling user does not have permission to view the content.

Response example, 200:

```json
{
  "results": [
    {
      "operation": "read",
      "restrictions": {
        "user": {
          "results": [],
          "start": 0,
          "limit": 200,
          "size": 0
        },
        "group": {
          "results": [],
          "start": 0,
          "limit": 200,
          "size": 0
        }
      },
      "get_links": {
        "self": "https://instenv-320828-cq6e.instenv.internal.atlassian.com/rest/api/content/2326529/restriction/byOperation/read",
        "base": "https://instenv-320828-cq6e.instenv.internal.atlassian.com",
        "context": "string"
      },
      "get_expandable": {
        "content": "/rest/api/content/2326529"
      }
    }
  ],
  "start": 25,
  "limit": 25,
  "size": 25,
  "_links": {
    "base": "http://localhost:8085/rest/api",
    "self": "http://localhost:8085/rest/api",
    "context": "http://localhost:8085/rest/api",
    "next": "http://localhost:8085/rest/api/latest/../paginate?limit=25&start=50",
    "prev": "http://localhost:8085/rest/api/latest/../paginate?limit=25&start=0"
  }
}
```
