# CircleCI Orbs

Agents: `circleci.com/developer/orbs` renders client-side and returns no content to a fetch. Use this file, the CLI, or the REST API below instead.

## Quick reference

| Task | Command |
|---|---|
| List all orbs | `circleci orb list` |
| List orbs in a namespace | `circleci orb list <namespace>` |
| Inspect an orb | `circleci orb get <namespace>/<orb>` |
| View orb source | `circleci orb source <namespace>/<orb>@<version>` |
| List all versions of an orb | REST API — see [Step 3](#how-to-discover-orbs-programmatically) below (no CLI equivalent) |
| Use in config | `orbs: { <alias>: <namespace>/<orb>@<version> }` |

See [How to discover orbs programmatically](#how-to-discover-orbs-programmatically) for MCP and REST API equivalents, and [How to use a registry orb in config](#how-to-use-a-registry-orb-in-config) for the full config example.

## What are orbs?

Orbs are reusable, versioned packages of CircleCI configuration. They bundle jobs, commands, and executors that you import into `.circleci/config.yml` to avoid writing boilerplate. For example, the `circleci/node` orb provides a pre-built test job, a caching-aware `install-packages` command, and a Node Docker executor — replacing ~30 lines of config with 3.

Three types exist:

- **Registry orbs** — published to the CircleCI registry, semantically versioned, immutable. Format: `namespace/orb-name@x.y.z`. Publicly searchable. Most orbs you'll use are registry orbs.
- **URL orbs** — a YAML file hosted at a public HTTPS URL (e.g. a GitHub raw URL). Mutable. Requires org admin to add the URL prefix to the org's allow-list.
- **Inline orbs** — defined directly inside `config.yml`. Project-scoped, never published.

---

## How to use a registry orb in config

```yaml
version: 2.1

orbs:
  node: circleci/node@5.0.3   # import the orb, alias it as "node"

jobs:
  test:
    executor: node/default     # use the orb's executor
    steps:
      - checkout
      - node/install-packages  # use the orb's command

workflows:
  main:
    jobs:
      - node/test              # use the orb's pre-built job
```

**Slug format:** `<namespace>/<orb-name>@<version>`
- Pin to exact version: `circleci/node@5.0.3` (recommended for stability)
- Pin to minor: `circleci/node@5.0` (gets patch updates)
- Pin to major: `circleci/node@5` (gets minor + patch updates)
- `volatile` — always latest, not recommended for production

---

## How to discover orbs programmatically

### Option 1 — CircleCI CLI (recommended for agents)

The CLI is the most reliable way to discover and inspect orbs without hitting the UI.

```bash
# Install CLI
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | bash

# List all public orbs (paginated)
circleci orb list

# List orbs in a specific namespace
circleci orb list circleci

# Search by keyword (no built-in search flag; filter client-side)
circleci orb list circleci --json | jq '.[] | select(.name | contains("node"))'

# Get info on a specific orb (description, latest version, private/listed status)
circleci orb get circleci/node

# View the full YAML source of a specific version
circleci orb source circleci/node@5.0.3
```

The CLI has no command to list all published versions of an orb — use the REST API (Option 3, Step 3) for that.

Most CircleCI-authored orbs are also open source, so the raw source is fetchable directly:
```bash
# Pattern: https://github.com/CircleCI-Public/<orb-name>-orb (no namespace prefix)
# Check the repo's default branch first — it varies (main, master).
curl https://raw.githubusercontent.com/CircleCI-Public/node-orb/master/src/%40orb.yml
```

### Option 2 — CircleCI MCP server

If the CircleCI MCP server is connected, use the `list_orbs` tool — it returns the real orb catalog directly from orb-service and is the preferred approach for agents in an IDE or agentic coding context.

### Option 3 — REST API (v3)

The v3 REST API is public and requires no authentication for public orbs. All resources are UUID-addressed, so discovery is a multi-step process.

**Step 1 — Resolve a namespace name to its UUID:**
```bash
curl https://circleci.com/api/v2/namespaces/circleci
# → { "id": "e33a89eb-7649-4258-bb40-a8efc1e655cd", "name": "circleci", ... }
```

**Step 2 — List orbs in the namespace:**
```bash
curl -g "https://circleci.com/api/v3/orb/packages?filter[namespace_id]=e33a89eb-7649-4258-bb40-a8efc1e655cd"
# → {
#     "data": [{
#       "id": "<orb-uuid>",
#       "attributes": { "name": "circleci/node", "is_private": false, ... },
#       "references": {
#         "namespace": { "id": "<namespace-uuid>" },
#         "orb_versions": [{ "id": "<version-uuid>", "attributes": { "version": "5.2.1", "created_at": "..." } }]
#       }
#     }],
#     "page": { "next": "<cursor>" }
#   }
```

The `orb_versions` array in each package entry contains the latest version. Paginate with `?page[after]=<cursor>` using the `page.next` value from each response.

To find a specific orb directly, `filter[name]=<namespace>/<orb-name>` also works, but only on an exact full-name match — it does not do partial/substring search.

**Step 3 — List all versions of an orb:**
```bash
curl -g "https://circleci.com/api/v3/orb/versions?filter[orb_id]=<orb-uuid>"
# → {
#     "data": [{ "id": "<version-uuid>", "attributes": { "version": "5.0.3", "created_at": "..." } }],
#     "page": { "next": "<cursor>" }
#   }
```

**Step 4 — Fetch the YAML source for a version:**
```bash
curl "https://circleci.com/api/v3/orb/versions/<version-uuid>/source"
# → raw YAML text
```

**Validate orb YAML before publishing:**
```bash
curl -X POST https://circleci.com/api/v3/orb/packages/validate \
  -H "Content-Type: application/json" \
  -d '{"yaml": "<orb yaml string>"}'
```

---

## Commonly used CircleCI orbs

These are high-usage certified orbs maintained by the CircleCI team. Use these slugs directly in config:

| Slug | Purpose |
|------|---------|
| `circleci/node@7` | Node.js install, caching, test job |
| `circleci/python@4` | Python install, pip caching, test job |
| `circleci/ruby@3` | Ruby/Bundler setup, rspec |
| `circleci/go@4` | Go module caching, build, test |
| `circleci/rust@2` | Cargo caching, build, test |
| `circleci/docker@4` | Docker build, push, publish |
| `circleci/aws-ecr@10` | Build and push to Amazon ECR |
| `circleci/aws-ecs@8` | Deploy to Amazon ECS |
| `circleci/aws-s3@5` | S3 upload/download/sync |
| `circleci/aws-cli@5` | AWS CLI setup and auth |
| `circleci/aws-eks@4` | Deploy to Amazon EKS |
| `circleci/gcp-gke@2` | Deploy to Google Kubernetes Engine |
| `circleci/gcp-gcr@0` | Push images to Google Container Registry |
| `circleci/gcp-cli@4` | Google Cloud CLI setup and auth |
| `circleci/kubernetes@2` | kubectl, helm, kustomize |
| `circleci/helm@3` | Helm chart deployments |
| `circleci/terraform@3` | Terraform plan and apply |
| `circleci/slack@6` | Post Slack notifications on pass/fail |
| `circleci/jira@2` | Update Jira tickets from pipelines |
| `circleci/browser-tools@2` | Install Chrome, Firefox for browser tests |
| `circleci/android@3` | Android SDK setup, build, test |

---

## How to use a URL orb

```yaml
version: 2.1

orbs:
  platform: https://raw.githubusercontent.com/my-org/orbs/refs/heads/main/platform-team.yaml

jobs:
  build:
    steps:
      - platform/some-command
```

The URL prefix must be on the org's allow-list. Org admins manage this at **Org Settings > Orbs**.

---

## Authoring an orb

To publish a registry orb:

```bash
# Set up a new orb project using the orb dev kit
circleci orb init my-orb

# Pack local orb source into a single YAML
circleci orb pack src/ > orb.yml

# Validate the packed orb
circleci orb validate orb.yml

# Publish a dev version for testing
circleci orb publish orb.yml my-namespace/my-orb@dev:my-feature

# Publish a production version
circleci orb publish orb.yml my-namespace/my-orb@1.0.0
```

Full authoring guide: `https://circleci.com/docs/orbs/author/create-test-and-publish-a-registry-orb/`

---

## Further reading

- Orb concepts (types, versioning, namespaces): `https://circleci.com/docs/orbs/use/orb-concepts/index.md`
- Orb introduction and usage examples: `https://circleci.com/docs/orbs/use/orb-intro/index.md`
- Reusable config reference (commands, jobs, executors): `https://circleci.com/docs/reference/reusing-config/index.md`
- Orb authoring introduction: `https://circleci.com/docs/orbs/author/orb-author/index.md`
