# API users

> Create API users and their tokens in Helix, so CI pipelines and scripts can deploy without a person's login. Rotate and revoke tokens and set roles.

An API user is a non-human member of one workspace, with tokens that let a CI pipeline or a script run `helix` commands as that user instead of as a person. Organization owners and admins manage them in the dashboard under Organization settings, in the **Tokens** section, on **API users**: create an API user with its first token, add or revoke tokens, change its organization role, and delete it.

## When you need one

A `helix login` session belongs to the person who signed in and expires with their session, so it can't keep a pipeline running. An API user token is the credential for anything that deploys without a person at the keyboard, most often the `TRAY_CLI_TOKEN` secret that [Deploy from CI](/documentation/guides/continuous-deployment/) sets up. A deployment made with it is attributed to the API user, not to whoever created the token.

:::note{title="Two different tokens"}
The tokens on this page let a pipeline act as an API user, for example to deploy. A project's [API tokens](/documentation/guides/api-tokens/), on its Access Control tab, let another system call a deployed app. A project API token still acts as an API user, so you create the API user here first.
:::

## Who can manage API users

Only organization owners and admins see the **Tokens** section in Organization settings. Anyone else who opens its address is sent back to **Members**. If you need an API user and don't have the section, ask an organization owner or admin.

## Create an API user

1. Open the user menu in the [dashboard](https://app.helix.tray.ai), choose **Organization settings**, then **API users** under **Tokens**.
2. Choose **Create API user**.
3. Enter a **Name**, such as "GitHub Actions deploy", and pick the **Workspace** it belongs to.
4. Choose a **Workspace role**: Contributor (the default) or Viewer. CI needs Contributor or higher to deploy.
5. Choose **Next**, then name the first token (up to 30 characters) and choose when it **Expires in**: 30 days, 90 days (the default), or one year.
6. Choose **Create API user**, then copy the token. It's shown once and you can't see it again.

The dialog also shows a command to check the token works:

```bash
TRAY_CLI_TOKEN=<token> helix whoami
```

A new API user starts with the Viewer organization role. An API user belongs to exactly one workspace, so a pipeline that deploys to two workspaces needs one API user in each.

If your organization [limits who can deploy](/documentation/governance/deploy-access/), the API user also has to be on the list on **Deploy access** before its token can deploy.

:::warning{title="An API user token reaches the whole workspace"}
The token isn't limited to Helix. It acts as its API user across everything in that workspace, including shared Tray iPaaS assets such as workflows and authentications. Give the API user the lowest workspace role that does the job, keep the token in a secret store and never in source code or an AI prompt, and revoke it straight away if it's ever exposed.
:::

## Manage tokens

The API users list shows each API user's name, workspace, workspace role, organization role, and how many tokens it has. Search narrows it by name.

Open an API user's actions menu and choose **Manage tokens** to see its tokens:

| Column | What it shows |
|---|---|
| Created | When the token was created |
| Expires | The expiry date, or **Expired** once it has passed |
| Last seen | When the token was last used, or **Never** |
| Created by | Who created the token |

From there you can **Create token**, with the same name and expiry choices as the first one, or revoke a token. A revoked token stops working at once, and revoking can't be undone.

Every API user token expires. To rotate one without downtime, create a new token, update the secret that holds it, then revoke the old one.

## Change an API user's organization role

Open the API user's actions menu and choose **Admin**, **Contributor**, or **Viewer** under **Organization role**. Making an API user an Admin asks you to confirm first, because an Admin API user's token can manage the whole organization, including creating more API users and tokens. An API user with the Owner role can't be changed here.

## Delete an API user

Choose **Delete API user** from its actions menu and confirm. This deletes the API user and every token that acts as it. Anything using those tokens, including a project's [API tokens](/documentation/guides/api-tokens/) that act as it, stops working immediately, and it can't be undone.

## Limits

Your organization can have a limited number of API users. When it reaches the limit, the page says so and **Create API user** is unavailable until you delete one.

---

Canonical: https://helix.tray.ai/documentation/governance/api-users/
Any link on this page is available as markdown by appending .md to its URL.
Full corpus: https://helix.tray.ai/documentation/llms-full.txt