> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJiMTA4NGY0Zi04YmJiLTQwMzQtYmUzOC1iNzQ4MGI2OTZjNGQiLCJleHAiOjE3ODExNzY0NDgsImlhdCI6MTc4MTE3NjE0OH0.6pffF-GsMNFK2AzurqKs23HG8kmJX81A9zv_Lo9qXus
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# API keys

> Create and manage API keys for CLI authentication in CI/CD environments.

[Admins](/learn/dashboard/configuration/permissions) can create and manage API keys from the [Fern Dashboard](https://dashboard.buildwithfern.com/fern/tokens). API keys authenticate the Fern CLI in CI/CD pipelines, for example when publishing SDKs or documentation from GitHub Actions.

API keys don't expire. Rotate them periodically and delete any that are no longer in use.

## Create an API key

Navigate to the [Fern Dashboard](https://dashboard.buildwithfern.com/) and select **API Keys** from the sidebar.

Select **Create key**, enter a name (e.g. `CI/CD pipeline`), then select **Generate**.

The API key is displayed once. Copy it immediately; you won't be able to view it again.

Add the API key as a repository secret named `FERN_TOKEN` in your CI/CD provider (e.g. GitHub Actions, GitLab CI). The Fern CLI reads this value from the environment to authenticate, so any workflow that runs a `fern` command can reference it:

```yaml title="GitHub Actions example"
env:
  FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
```

The rest of the workflow depends on what you publish: the same token authenticates [publishing your docs](/learn/docs/preview-publish/publishing-your-docs) and [publishing an SDK to a package registry](/learn/sdks/generators/typescript/publishing).

## Manage API keys

From the **API Tokens** page, you can:

* **Delete an API key** — select the options menu next to an API key and choose **Delete**. Deleted API keys are immediately revoked and can't be restored.

All [members](/learn/dashboard/configuration/permissions) can view API key names and creation dates. Only Admins can create or delete API keys.