> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/api-reference/platform-apis/access-control.md).

# Access Control

Manage roles, role assignments, resource groups, and permissions, and check access, with the Harness Access Control API.

The Access Control API manages role-based access control (RBAC) in Harness. Use it to decide who can do what, and to check whether a user or service account has a permission.

## Request basics

* **API key token**: Send it in the `x-api-key` header on every request. Go to [Manage API keys](https://developer.harness.io/harness-platform/use-harness-platform/automation/api/add-and-manage-api-keys) to create a key and token.
* **Account, organization, and project IDs**: Send `accountIdentifier` as a query parameter on every request. Add `orgIdentifier` and `projectIdentifier` to work with roles and assignments in an organization or project. Go to [Organizations and projects](https://developer.harness.io/harness-platform/use-harness-platform/organizations-and-projects) to find these identifiers.
* **Base URL**: Send requests to `https://app.harness.io/gateway/authz/api`, followed by the endpoint path.

## Example request

List the roles in your account:

```bash
curl "https://app.harness.io/gateway/authz/api/roles?accountIdentifier=ACCOUNT_ID" \
  -H "x-api-key: $HARNESS_API_KEY"
```

Replace `ACCOUNT_ID` with your own values, and set `HARNESS_API_KEY` to your API key token.

## Find an endpoint

Endpoint paths are relative to the base URL.

* **Roles**: Named sets of permissions, such as Pipeline Executor, that you give to users, user groups, and service accounts. List roles with `GET /roles`. Go to [Manage roles](https://developer.harness.io/harness-platform/use-harness-platform/platform-access-control/add-manage-roles) to create and edit roles.
* **Role assignments**: The link between a principal, a role, and a resource group. An assignment is what actually grants access. List assignments with `GET /roleassignments` and grant access with `POST /roleassignments`.
* **Resource groups**: The set of resources, such as specific pipelines or all secrets, that a role assignment applies to. Their endpoints are in the [Core Platform](https://developer.harness.io/api-reference/platform-apis/core-platform.md) API, starting with `GET /v2/resourcegroup`. Go to [Manage resource groups](https://developer.harness.io/harness-platform/use-harness-platform/platform-access-control/manage-resource-groups) to define a resource group.
* **Permissions**: The individual actions a role can allow, such as View, Create, Edit, or Execute on a resource type. List permissions with `GET /permissions`. Go to [Permissions reference](https://developer.harness.io/harness-platform/use-harness-platform/platform-access-control/permissions-reference) to look up each permission.
* **Access checks**: Requests that ask whether a principal can perform an action on a resource, without performing it. Check a permission with `POST /acl`. Go to [API permissions reference](https://developer.harness.io/harness-platform/use-harness-platform/automation/api/api-permissions-reference) to see which permissions each API call needs.
