---
title: "CircleCI"
description: "Use Ennote secrets in CircleCI: store an Ennote token in a context or project environment variable, install the Ennote CLI in the job, and inject secrets into steps with ennote secret get."
canonical_url: "https://docs.ennote.io/guides/ci-cd/circleci"
---
# CircleCI

> Use Ennote secrets in CircleCI: store an Ennote token in a context or project environment variable, install the Ennote CLI in the job, and inject secrets into steps with ennote secret get.

## How it works

CircleCI stores one Ennote token in a context or project environment variable. The job installs the Ennote CLI, and `ennote secret get <secret> -- <command>` runs the command with the keys of the secret as environment variables. See the [CI/CD overview](https://docs.ennote.io/guides/ci-cd/overview) for the common setup.

## 1. Create a token

Create a [Personal Access Token](https://docs.ennote.io/docs/auth/user-tokens) with an expiration, and copy it.

## 2. Store it in CircleCI

Use a **context** so you can share the token between projects and restrict who can use it: open **Organization Settings → Contexts → Create Context**, name it `ennote`, and add the environment variable `ENNOTE_TOKEN` with the token.

For a single project, you can instead add `ENNOTE_TOKEN` under **Project Settings → Environment Variables**.

## 3. Add the config

```yaml [.circleci/config.yml]
version: 2.1

jobs:
  deploy:
    docker:
      - image: cimg/node:lts
    environment:
      ENNOTE_ORGANIZATION_ID: org_123
      ENNOTE_WORKSPACE_ID: wrk_prod
      ENNOTE_DO_NOT_TRACK: "1"
    steps:
      - checkout
      - run:
          name: Install the Ennote CLI
          command: curl -sSfL https://get.ennote.io/get-cli.sh | sh
      - run:
          name: Run database migrations
          command: ennote secret get db-credentials -- npm run migrate
      - run:
          name: Deploy
          command: ennote secret get aws -- ./deploy.sh

workflows:
  deploy:
    jobs:
      - deploy:
          context: ennote
          filters:
            branches:
              only: main
```

Replace `org_123`, `wrk_prod`, `db-credentials` and `aws` with your organization ID, workspace ID and secret names. CircleCI convenience images (`cimg/*`) include `curl` and allow `sudo`, so the install script works as is.

## FAQ

### How do I limit who can deploy with the token?

Add a security group or expression restriction to the `ennote` context, so only allowed users or branches can run jobs that use it.

### Do I need `ennote auth login`?

No. With `ENNOTE_TOKEN` set, the CLI authenticates headlessly ([ennote auth](https://docs.ennote.io/cli/commands/auth)).

<need-help>



</need-help>


## Sitemap

See the full [sitemap](https://docs.ennote.io/sitemap.md) for all pages.
