> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opal.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Buddy

> Learn how to connect Opal to Buddy to review who can reach your Buddy workspace, projects, and groups.

With the Buddy integration, you can see who has access to your Buddy CI/CD workspace from Opal:

* Review who owns and administers your Buddy workspace
* Review who can reach each Buddy project, and with which permission set
* Review Buddy groups, their members, and the projects each group can reach
* Include Buddy access in access reviews

Opal connects to one Buddy workspace through a personal access token. To manage several workspaces, add a Buddy app in Opal for each one. Self-hosted Buddy isn't supported.

## Supported resources

| Resource | Read | Grant and revoke access | Notes |
| - | - | - | - |
| Buddy Workspace | ✔️ | | Lists workspace owners and administrators, with **Owner** and **Administrator** as access levels. Other members' access shows on the projects they can reach. |
| Buddy Projects | ✔️ | | Each permission set in your workspace, built-in or custom, is an access level. |
| Buddy Groups | ✔️ | | Optional. Members hold **Member** or **Manager**. Shows the projects each group can reach. |

Opal also syncs your workspace members as Buddy accounts and links them to Opal users by email.

## Requirements

Before you begin, you must:

* Be an Opal Admin
* Have a Buddy account in the workspace that can create a personal access token with the scopes below
* Be on version `X` or later, if you self-host Opal

## Configuration steps

### 1. Create a Buddy personal access token

1. In Buddy, open your avatar menu and go to **Security** > **Personal Access Tokens**.
2. Create a token with the scopes below, then copy it.

| Scope | Needed to |
| - | - |
| `WORKSPACE_READ` | Read the workspace |
| `MEMBER_READ` | Sync workspace members, owners, and administrators |
| `PROJECT_READ` | Sync projects and who can reach them |
| `PERMISSION_READ` | Read the permission sets your projects grant |
| `GROUP_READ` | Sync groups. Not needed if you set **Groups** to **Don't sync** |

The token also needs read access to your own email address and to members' email addresses. Without it, Buddy leaves every email out and no one links to an Opal user.

The token creation form groups scopes under broader headings rather than naming them. The **Workspace** heading carries members, groups, projects, and permission sets. The token doesn't need any write access.

### 2. Find your workspace domain and region

Your workspace domain is the workspace's ID in your Buddy URL. For example, if you sign in at `app.buddy.works/my-company`, the domain is `my-company`.

Your region follows the address you sign in at:

| You sign in at | Region |
| - | - |
| `app.buddy.works` | `api.buddy.works` |
| `eu.buddy.works` | `api.eu.buddy.works` |
| `asia.buddy.works` | `api.asia.buddy.works` |

A token only works in the region that issued it.

### 3. Create the Buddy app in Opal

In Opal, go to **Inventory** > **+ App** and select **Buddy**. Fill in the following fields:

| Field | Value |
| - | - |
| App name | A name for the Buddy app in Opal, for example `Buddy`. |
| App admin | The owner who administers the app in Opal. |
| Description | A short description that helps requesters understand what this app is. |
| Region | **api.buddy.works** (default), **api.eu.buddy.works**, or **api.asia.buddy.works**, from step 2. |
| Groups | **Sync** (default) or **Don't sync**. **Don't sync** leaves Buddy groups, and the project access they carry, out of Opal. |
| Workspace domain | The workspace domain from step 2. |
| Personal access token | The token from step 1. |

Opal checks the credentials and the workspace domain when you save the app. The app's **Setup** tab shows whether the token can read members, member emails, projects, permission sets, and groups. With **Groups** set to **Don't sync**, the groups check is skipped.

### 4. Import assets

After you save the app, import the items you want to review: on the app's **Assets** tab, select **Import assets** and choose the workspace, projects, and groups. Opal pulls access only for imported items, so members appear after the next sync.

## Troubleshooting

| Error or symptom | Fix |
| - | - |
| Saving the app fails | Check that the workspace domain matches your Buddy URL and the region matches where you sign in. Buddy also refuses inactive workspaces ("Workspace must be active"). |
| A **Read** check fails on the **Setup** tab | Add the matching scope: `MEMBER_READ`, `PROJECT_READ`, `PERMISSION_READ`, or member email access. |
| **Read groups** fails | Add `GROUP_READ`, or set **Groups** to **Don't sync**. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.