---
question: How do I get a key that lets a script call Nexus as me?
kind: task
via_web: beta
via_cli: na
via_python: na
via_api: na
via_config: na
ref_web: /account/api-keys
prereq: You are signed in to Nexus. See [Sign in to Nexus](/capabilities/get-started/sign-in).
next:
  - /capabilities/platform/authenticate-engine-api
  - /capabilities/platform/account
---

# Create a personal API key

A personal API key (`abi_pk_...`) is a credential of yours for scripts, the `abi org`, `abi user` and `abi workspace` commands, and other programs that call Nexus's API. It acts as you, and never does more than you can. You can make it do less: read only, or a list of statements of your own.

You can have five active keys. Each expires, a year after it is made at most, and you can revoke it at any time.

## Web UI

The page works at this version, but Account Settings does not list it yet: open it by its address.

### Open API Keys

Go to `/account/api-keys` on Nexus web, such as `http://localhost:3042/account/api-keys` on the Docker stack.

### Create the key

Select **Create Key**. In **Create New API Key**:

1. Give the key a name, such as `Nightly export`.
2. Pick when it expires: **Expires in 30 days**, **90 days** or **1 year** (the default).
3. Pick its access:
   - **Full access (as you)**: everything you may do.
   - **Read only (reads and lists)**: only the actions the engine classes as reads or lists.
   - **Custom (your own statements)**: a JSON array of Allow statements, such as `[{"effect": "Allow", "actions": ["triple_store:Query"], "resources": ["*"]}]`.

Select **Create**. With five active keys, **Create Key** is off: revoke one first.

### Copy it

The page shows the key once, with **Copy key** and two examples of its use. Nexus stores only a hash of it: if you lose it, revoke it and create another. Select **I have copied it** when it is safe.

### Use it

Send it as the bearer on Nexus's API, or put it in `NEXUS_ACCESS_TOKEN` for the CLI:

```bash
export NEXUS_API_URL=http://localhost:9879
export NEXUS_ACCESS_TOKEN=abi_pk_...
curl -H "Authorization: Bearer $NEXUS_ACCESS_TOKEN" "$NEXUS_API_URL/api/workspaces"
abi org list
```

To hold a short-lived credential instead, exchange the key for a token of ten minutes at `POST /api/iam/token`. That endpoint takes the key as `client_secret` in the form body, not as the bearer: it is the one `/api/iam/` route a key reaches. See [A personal API key](/capabilities/platform/authenticate-engine-api#a-personal-api-key).

### Revoke a key

In the list, select the bin icon on the key's row, then **Revoke** at "Revoke this key?". The key is refused from its next use; a token already exchanged for it expires within ten minutes. The list keeps revoked and expired keys, with when each was made, last used and expires.

## CLI

Not applicable. No `abi` command makes a personal key: `abi iam key create` makes keys of service accounts, which call the message bus, not Nexus's API. Make the key in the Web UI, then pass it to the CLI as `--token` or `NEXUS_ACCESS_TOKEN`.

## Python

Not applicable. Make the key in the Web UI, then send it from Python as the `Authorization: Bearer` header.

## REST API

Not applicable for a script. The page calls `GET` and `POST /api/iam/api-keys` and `DELETE /api/iam/api-keys/{id}`, which take a browser session only: as the bearer, a key is refused on `/api/iam/`, so a key can never make another key or widen itself.

## Config

Not applicable. Keys are kept by the engine's IAM, not in `config.yaml`.

## What a key reaches

- **Nexus `/api/*`**, as the bearer, except your account (`/api/auth/`) and identity and access administration (`/api/iam/`), which take a session only. Not the WebSocket. The exception is `POST /api/iam/token`, which reads the key from the form body (`client_secret`) to issue a 10-minute token.
- **Not the engine's own routes** (`/agents`, `/workflows`, `/pipelines`, `/tools`): they take `ABI_API_KEY`. See [Authenticate engine API requests](/capabilities/platform/authenticate-engine-api).
- **No groups from your identity provider.** A key is not a session: a role you hold only through a group claim does not reach it.
- **Your permissions as they are now.** When your access changes, so does the key's. When you are suspended, it stops working.
