> For the complete documentation index, see [llms.txt](https://docs.go-atlassian.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.go-atlassian.io/confluence-cloud/content/restrictions/operations/group.md). Agents can also search and read this documentation through its [MCP server](https://docs.go-atlassian.io/~gitbook/mcp).

# Group

## Get content restriction status for group

`GET /wiki/rest/api/content/{id}/restriction/byOperation/{operation}/group/{group}`

Returns whether the specified content restriction applies to a group.&#x20;

* This endpoint combines the get content restriction status by group name and group id.
* If you provide the group id (UUID), the method will create the endpoint with the verb /**byGroupId**/{groupNameOrID}
* If you provide the group name, the endpoint uses the verb **/group/**{groupNameOrID}.

```go
var endpoint strings.Builder
endpoint.WriteString(fmt.Sprintf("wiki/rest/api/content/%v/restriction/byOperation/%v/", contentID, operationKey))

// check if the group id is an uuid type
// if so, it's the group id
groupID, err := uuid.Parse(groupNameOrID)

if err == nil {
	endpoint.WriteString(fmt.Sprintf("byGroupId/%v", groupID.String()))
} else {
	endpoint.WriteString(fmt.Sprintf("group/%v", groupNameOrID))
}
```

{% code fullWidth="true" %}

```go
package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/confluence"
	"log"
	"os"
)

func main()  {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	instance, err := confluence.New(nil, host)
	if err != nil {
		log.Fatal(err)
	}

	instance.Auth.SetBasicAuth(mail, token)
	instance.Auth.SetUserAgent("curl/7.54.0")

	contentID := "80412692"
	ctx := context.Background()
	operationKey := "update"
	groupNameOrID := "confluence-users"

	response, err := instance.Content.Restriction.Operation.Group.Get(ctx, contentID, operationKey, groupNameOrID)
	if err != nil {
		if response != nil {
			log.Println(response.Bytes.String())
			log.Println("Endpoint:", response.Endpoint)
		}
		log.Fatal(err)
	}

	log.Println("Endpoint:", response.Endpoint)
	log.Println("Status Code:", response.Code)
}
```

{% endcode %}

## Add group to content restriction

`PUT /wiki/rest/api/content/{id}/restriction/byOperation/{operation}/group/{grou[}`

Adds a group to a content restriction. That is, grant read or update permission to the group for a piece of content.

{% code fullWidth="true" %}

```go
package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/confluence"
	"log"
	"os"
)

func main()  {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	instance, err := confluence.New(nil, host)
	if err != nil {
		log.Fatal(err)
	}

	instance.Auth.SetBasicAuth(mail, token)
	instance.Auth.SetUserAgent("curl/7.54.0")

	contentID := "80412692"
	ctx := context.Background()
	operationKey := "read"
	groupNameOrID := "jira-users-22"

	response, err := instance.Content.Restriction.Operation.Group.Add(ctx, contentID, operationKey, groupNameOrID)
	if err != nil {
		if response != nil {
			log.Println(response.Bytes.String())
			log.Println("Endpoint:", response.Endpoint)
		}
		log.Fatal(err)
	}

	log.Println("Endpoint:", response.Endpoint)
	log.Println("Status Code:", response.Code)
}
```

{% endcode %}

## Remove group from content restriction

`DELETE /wiki/rest/api/content/{id}/restriction/byOperation/{operationKey}/group/{groupName}`

Removes a group from a content restriction. That is, remove read or update permission for the group for a piece of content.

{% code fullWidth="true" %}

```go
package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/confluence"
	"log"
	"os"
)

func main()  {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	instance, err := confluence.New(nil, host)
	if err != nil {
		log.Fatal(err)
	}

	instance.Auth.SetBasicAuth(mail, token)
	instance.Auth.SetUserAgent("curl/7.54.0")

	contentID := "80412692"
	ctx := context.Background()
	operationKey := "read"
	groupNameOrID := "jira-users-22"

	response, err := instance.Content.Restriction.Operation.Group.Remove(ctx, contentID, operationKey, groupNameOrID)
	if err != nil {
		if response != nil {
			log.Println(response.Bytes.String())
			log.Println("Endpoint:", response.Endpoint)
		}
		log.Fatal(err)
	}

	log.Println("Endpoint:", response.Endpoint)
	log.Println("Status Code:", response.Code)

}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.go-atlassian.io/confluence-cloud/content/restrictions/operations/group.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
