# Access control

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

Access control decides who can open artifact version URLs outside Buddy: Buddy login, HTTP Basic Auth or public access. Set it in the UI, with bdy flags or API.

**Access control** determines who can access artifact version files through their URL from outside Buddy, for example, using a web browser or `curl`. The **HTTP BA** (HTTP Basic Authentication) option is available only for Bucket artifacts.

Access control does not determine which pipelines and sandboxes can access the artifact. Configure their access on the Permissions tab, as described in [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md).

| UI | API | Authentication requirements |
| :--- | :--- | :--- |
| **Buddy Auth** | `BUDDY` | Requires authentication with a Buddy account |
| **HTTP BA** | `BASIC` | Requires the username and password configured for the artifact |
| **Public** | `NONE` | No authentication required |

## Artifact version URLs

Each version of a Bucket artifact has the address `https://<version>-<artifact>-<workspace>.bucket-2.registry.sh`, e.g.:

```
https://1-0-0-my-app-build-my-workspace.bucket-2.registry.sh
```

The `latest` version has no prefix in the address. In a pipeline, the version address is in the `BUDDY_ARTIFACT_VERSION_RAW_URL` variable ([Artifacts in pipelines](https://buddy.works/docs/artifacts/pipelines.md)).

A public artifact with an `index.html` file works as a static website ([Bucket](https://buddy.works/docs/artifacts/bucket.md)).

## Setting access control when creating an artifact



### Set access control in the UI

In the **New artifact** form, the **Access control** field has the options **Buddy Auth**, **HTTP BA** and **Public**. **Buddy Auth** is selected by default.

![New Bucket artifact form](https://buddy.works/docs/artifacts/artifacts-new-bucket-form.png)

### Set access control using the CLI

Use the `-b` flag with `bdy artifact create` to enable Buddy Auth, or `-a user:pass` to enable HTTP Basic Authentication.

```bash
bdy artifact create my-app-build -b -p my-project
bdy artifact create my-app-reports -a mike:secret-password -p my-project
```

> **Warning**
>
> **Without the `-b` or `-a` flag, an artifact created from the CLI is public**, even when `bdy artifact publish -c` creates it.

For a complete list of available flags, see [`bdy artifact create`](https://buddy.works/docs/cli/artifact/create.md).

## ## Change access control for an existing artifact

To change access control, open the artifact's Settings tab and modify the **Access control** field. Access to the Settings tab requires the **Manage** permission level.

![Access control in artifact settings](https://buddy.works/docs/artifacts/artifacts-settings-access-control.png)

`bdy artifact update` changes only the artifact notes, so from the terminal you change Access control through the REST API, with the `authorization` field:

```json
{
  "authorization": {
    "type": "BASIC",
    "user": "mike",
    "password": "secret-password"
  }
}
```

The other `type` values are `BUDDY` and `NONE`. The endpoint is described in the [API reference](https://buddy.works/docs/api/artifacts/update.md).

## Download files from outside Buddy

`bdy artifact download` authenticates with the CLI token, so it works the same way with Buddy Auth, HTTP BA and Public:

```bash
bdy artifact download my-app-build:1.0.0 ./dist -p my-project
```

With HTTP BA, any client that supports Basic Auth works, e.g. `curl` with the `-u` flag:

```bash
curl -u mike:secret-password \
  https://1-0-0-my-app-build-my-workspace.bucket-2.registry.sh/index.html
```

Without the login and password, or with wrong credentials, a version address with HTTP BA responds with code 401.

With Buddy Auth, the version address responds with code 302 and redirects to `app.buddy.works/artifact/auth`, the Buddy login. In scripts and on servers without a browser session, use `bdy artifact download` or HTTP BA.

## Container and npm registries

Container Image and NPM Package have no version address. You log in to the registry separately:

- **Container Image** - `bdy artifact docker login`, then regular `docker push` and `docker pull`. See [Container registry](https://buddy.works/docs/artifacts/container-registry.md).
- **NPM Package** - a token in `.npmrc`. See [npm registry](https://buddy.works/docs/artifacts/npm-registry.md).

See also:

- [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) - access for pipelines, sandboxes and project roles
- [Scopes](https://buddy.works/docs/artifacts/scopes.md) - Workspace, Project and Environment scope
- [Bucket](https://buddy.works/docs/artifacts/bucket.md) - file upload and version addresses
- [`bdy artifact download`](https://buddy.works/docs/cli/artifact/download.md) - `--merge` and `--replace` flags for downloading to a non-empty directory


---
Original source: https://buddy.works/docs/artifacts/access-control