> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/sfp/publishing-and-fetching-artifacts/fetching-artifacts.md).

# Fetching Artifacts

`sfp artifacts fetch` retrieves published artifacts from a registry onto your local file system, where they can be installed or inspected.

Artifacts are written to the directory given by `-d/--artifactdir`, which defaults to `artifacts`.

## Choosing what to fetch

The command takes **either** a release definition **or** an explicit list of artifacts. Passing both, or neither, is an error.

### From a release definition

Given a release definition file such as `Sprint2-13-11.yaml`:

```yaml
release: Sprint-2-13-11-6844956242
skipIfAlreadyInstalled: true
skipArtifactUpdate: false
artifacts:
  feature-management: 1.0.19-6844956242
promotePackagesBeforeDeploymentToOrg: prod
changelog:
  workItemFilters:
    - (FGK|FFK)-[0-9]{3,4}
  workItemUrl: https://flxbl.atlassian.net/browse
  limit: 30
```

fetch every artifact it names:

```bash
sfp artifacts fetch -p Sprint2-13-11.yaml --npm --scope flxbl
```

### By name

`-a/--artifacts` takes a comma-separated list, and each entry may pin a version with `name:version`:

```bash
# Latest of each
sfp artifacts fetch -a feature-management,core-crm --npm --scope flxbl

# A specific version
sfp artifacts fetch -a feature-management:1.0.19-6844956242 --npm --scope flxbl
```

## Where artifacts are fetched from

When `--sfp-server-url` is set, artifacts are fetched from the sfp server's internal registry. If `--npm` is also passed with a `--repository` and no `--npmrcpath`, sfp retrieves the registry `.npmrc` from the server and falls back to that external registry.

Without a server, fetching is external only, and needs `--npm` with a `--scope`, or a `--scriptpath`.

```bash
# Internal registry
sfp artifacts fetch -p release.yaml --sfp-server-url https://sfp.example.com

# External npm registry
sfp artifacts fetch -p release.yaml --npm --scope flxbl --npmrcpath .npmrc
```

The `--scope` must match the scope the artifacts were published under.

## Fetching from somewhere that is not npm

Where artifacts live in storage that is not an npm registry, pass `--scriptpath` instead of `--npm` — the two are mutually exclusive. sfp calls the script once per artifact.

```bash
sfp artifacts fetch -p release.yaml -f scripts/fetch-artifact.sh
```

## Continuing past failures

By default a failed artifact fails the command. `--continue-on-error` processes the remaining artifacts and reports which ones failed, which is useful when auditing what a registry actually holds.

```bash
sfp artifacts fetch -p release.yaml --npm --scope flxbl --continue-on-error
```

## Flags

| Flag                        | Description                                                    | Required           |
| --------------------------- | -------------------------------------------------------------- | ------------------ |
| `-p`, `--releasedefinition` | Release definition naming the artifacts to fetch               | One of `-p` / `-a` |
| `-a`, `--artifacts`         | Comma-separated artifact names, optionally `name:version`      | One of `-p` / `-a` |
| `-d`, `--artifactdir`       | Directory to write artifacts to (default `artifacts`)          | Yes                |
| `--npm`                     | Fetch from an npm-compatible registry. Excludes `--scriptpath` | No                 |
| `--scope`                   | Scope the artifacts were published under                       | With `--npm`       |
| `--npmrcpath`               | Path to the `.npmrc` used to authenticate. Requires `--npm`    | No                 |
| `-f`, `--scriptpath`        | Script that fetches each artifact. Excludes `--npm`            | No                 |
| `--continue-on-error`       | Keep going when an artifact fails to fetch                     | No                 |

## Related

* [Publish Artifact](/flxbl/sfp/publishing-and-fetching-artifacts/publish-artifact.md) — publishing the artifacts this command retrieves
* [Installing an artifact](/flxbl/sfp/installing-an-artifact/overview.md) — installing what you fetched


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/publishing-and-fetching-artifacts/fetching-artifacts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
