Configure the artifacts binding in your Wrangler config:
[[artifacts]]
binding = "ARTIFACTS"
namespace = "default"
This exposes Artifacts on env.ARTIFACTS inside your Worker.
If you authenticate with wrangler login, current docs say Wrangler requests artifacts:write by default.
Regenerate Worker types after adding the binding:
npx wrangler types
Use the generated binding type in your environment definition:
interface Env {
ARTIFACTS: Artifacts;
}
Wrangler generates the Artifacts type from the binding. Treat the generated worker-configuration.d.ts file as the source of truth for your environment.
Artifacts works best when autonomous work is isolated:
For external systems, configure the namespace-scoped base URL and gateway JWT:
export ARTIFACTS_NAMESPACE="default"
export ARTIFACTS_JWT="<YOUR_GATEWAY_JWT>"
export ARTIFACTS_BASE_URL="https://artifacts.cloudflare.net/v1/api/namespaces/$ARTIFACTS_NAMESPACE"
Some environments also expose an /edge/v1/api/... base path. Verify the correct host and base path in the live docs for your Artifacts environment.
Use environment variables or your secret manager. Do not hardcode gateway JWTs or repo tokens.
Artifacts workflows usually involve repo-scoped tokens returned by create() or minted later through the binding or REST API.
Keep the control plane and data plane separate:
remote.Recommended handling:
read or writeVerify the current token behavior and auth guidance in https://developers.cloudflare.com/artifacts/ before building long-lived automation.
Artifacts is designed to work with standard git-over-HTTPS clients once you have a repo remote and an access token.
Prefer header-based auth for local tooling so the full token stays out of the remote URL:
git -c http.extraHeader="Authorization: Bearer $ARTIFACTS_TOKEN" clone "$ARTIFACTS_REMOTE" artifacts-clone
Use a Basic-auth remote only for short-lived commands that need a self-contained URL.
Check the live docs before relying on:
/edge/v1 base path for your environment