---
title: "Create an API key"
description: "Create a pkgplane API key for a script, a CI job or your own terminal, and store it safely."
---

> Documentation Index
> Fetch the complete documentation index at: https://pkgplane-docs.richaisolutions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an API key

An API key lets a script, CI job or terminal call the pkgplane API as you, without your password.
Create one key per place that uses it, so you can revoke one without breaking the others.

You need to be signed in to pkgplane. A key can't create other keys, so this has to be done on the
website or with a signed-in session.

## Create the key

1. Open [API keys](https://pkgplane.richaisolutions.com/api-keys) and select **Create key**.
2. Give it a **Name** that says where it will live, such as `GitHub Actions: deploy`. Add a
   **Description** if the name isn't enough.
3. Choose when it **Expires**: 30, 90 or 365 days, or **Never**. You can't change this later.
   Prefer an expiry for keys that leave your machine.
4. Select **Create key**.
5. Copy the key. It starts with `pkp_`, and pkgplane shows it only this once: it stores a hash of
   the key, not the key itself. If you lose it, create a new one.

## Store it

Keep the key out of source code and shell history. Put it in the secret store of the place that uses
it, such as a GitHub Actions secret or your password manager, and read it from an environment
variable:

```yaml title=".github/workflows/deploy.yml"
env:
  PKGPLANE_API_KEY: ${{ secrets.PKGPLANE_API_KEY }}
```

## Check it works

```sh
curl -H "Authorization: Bearer $PKGPLANE_API_KEY" https://pkgplane.richaisolutions.com/api/me
```

A working key returns your account as JSON. A `401` means the key was mistyped, has expired or has
been disabled. See [Authentication](https://pkgplane-docs.richaisolutions.com/reference/authentication/) for every status code.

You can have up to 25 keys. The **Last used** column on the API keys page shows which ones are
still in use, updated at most once a minute.

Source: https://pkgplane-docs.richaisolutions.com/guides/create-an-api-key/index.mdx
