# gt: General Translation CLI tool: gt api-key create
URL: https://generaltranslation.com/en-US/docs/cli/reference/commands/api-key-create.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Create a project or Organization API key with explicit permissions and print its secret once. API reference for the gt api-key create command.

Create runtime or automation credentials without changing local environment or config files. For a project key, authenticate with a saved login or an authorized explicit key as described in [Configuring the CLI](/docs/cli/guides/configuring#credentials). An Organization key requires signing in with [`gt login`](/docs/cli/reference/commands/login).

## Overview [#overview]

```bash
npx gt api-key create --name <name> --permission <permissions...> [options]
```

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`--name <name>`](#name) | Nonempty key name. | `string` | No | — |
| [`--permission <permissions...>`](#permission) | Explicit canonical grants. | `string[]` | No | — |
| [`--org-id <orgId>`](#organization-id) | Create an Organization key for this Organization instead of a project key. | `string` | Yes | — |
| [`-c, --config <path>`](#config) | Config file path. | `string` | Yes | Auto-resolved |
| [`--api-key <key>`](#api-key) | Explicit authentication override for a project key. | `string` | Yes | `GT_API_KEY`, otherwise login |
| [`--project-id <id>`](#project-id) | Target project for a project key. | `string` | Yes | Config or environment |

## How it works [#how-it-works]

Without `--org-id`, the command creates a project key. It needs a project ID, and the caller needs `project:api_keys:write` authorization and permission to delegate every requested grant. Project keys cannot hold `project:api_keys:write` and cannot create other keys.

With [`--org-id`](#organization-id), the command creates an Organization key. API keys cannot create Organization keys, so sign in with [`gt login`](/docs/cli/reference/commands/login) first; `--api-key` and `GT_API_KEY` are not used. Your account needs **Create & delete Organization API keys** in that Organization and must be able to grant every requested permission. (See [Roles and permissions](/docs/platform/dashboard/reference/roles-and-permissions)). If you are not signed in, the command stops and tells you to run [`gt login`](/docs/cli/reference/commands/login).

Unavailable grants fail all-or-nothing; the CLI does not silently narrow the selection. An Organization-only permission without `--org-id` fails before any request.

`--org-id` requires `gt` 2.27.0 or later. Earlier releases create only project keys.

On success, only the new secret plus a newline is written to stdout. Diagnostics go to stderr. The secret bypasses the logger and log file, including under `--quiet` and when `GT_LOG_FORMAT` is `json` or `agent`; it is not JSON metadata. The command does not write env or config files.

## Flags [#flags]

The [global options](/docs/cli/reference/global-options) also apply.

### Name

**Type** `string` · **Required** · **Default** —

The key's display name. Leading and trailing whitespace is trimmed; an empty result is rejected before any request.

### Permission

**Type** `string[]` · **Required** · **Default** —

Pass one or more canonical permission names, separated by spaces or repeated occurrences of the flag:

- `project:write`
- `project:context:read`
- `project:context:write`
- `project:files:read`
- `project:files:write`
- `project:translations:generate`
- `project:translations:enqueue`

These permissions require [`--org-id`](#organization-id). An Organization key can include them together with the project permissions above:

- `org:projects:create`
- `project:api_keys:read`
- `project:api_keys:write`
- `org:context:read`
- `org:context:write`
- `org:assets:write`

Wildcards, preset names, and key-type flags are not supported. Omitting permissions is an error, not a full-access shortcut. Include each required grant explicitly; do not assume a write grant also adds read access.

### Organization ID

**Type** `string` · **Optional** · **Default** —

Create an Organization key for this Organization instead of a project key. The value is the Organization ID. Sign in with [`gt login`](/docs/cli/reference/commands/login) first; `--api-key` and `GT_API_KEY` are not used for this key.

### Config

**Type** `string` · **Optional** · **Default** Auto-resolved

Read project settings from this JSON config file; the `.json` suffix may be omitted. Without it, normal `gt.config.json` discovery applies.

### API key

**Type** `string` · **Optional** · **Default** `GT_API_KEY`, otherwise saved login

Override authentication for a project key with an explicit authorized key. Invalid or insufficient keys do not fall back to login. Not used with [`--org-id`](#organization-id). Prefer environment-based secrets over literal secrets in shell history. (See [credential precedence](/docs/cli/guides/configuring#credentials)).

### Project ID

**Type** `string` · **Optional** · **Default** Config or environment

Select the target project for a project key. A config ID that disagrees with the flag or resolved environment ID fails validation. Without a config ID, the flag wins over the environment. Supported framework-prefixed project variables also participate in resolution. An Organization key is not bound to a project.

## Example [#example]

After signing in with [`gt login`](/docs/cli/reference/commands/login), create a generate-only development runtime key:

```bash
npx gt api-key create \
  --project-id your-project-id \
  --name "Runtime translations" \
  --permission project:translations:generate
```

Store the returned secret securely. This generate-only key cannot run the full [`gt translate`](/docs/cli/reference/commands/translate) pipeline. For CI, grant permissions for the [whole workflow](/docs/cli/guides/configuring#credentials) and save the key in your CI provider's secret store, not in committed files.

After signing in, create an Organization key that can read Context Groups:

```bash
npx gt api-key create \
  --org-id your-organization-id \
  --name "Context read" \
  --permission org:context:read
```

<Callout type="warn">
  Treat stdout as secret material. Do not merge stderr into it, send it to shared logs, or expose even a generate-only key in deployed browser or mobile bundles. Repeating the command can create another key; there is no remote rollback or idempotent retry guarantee.
</Callout>

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
