> For the complete documentation index, see [llms.txt](https://docs.khotan.com/llms.txt). A markdown version of any page is available at its `index.md` URL.

# Pipelines

Use the `khotan` CLI to operate Khotan pipelines. Add `--json` for machine-readable output; results go to stdout, diagnostics to stderr.

## Commands

### khotan pipelines create

Usage: `khotan pipelines create --name <string> [--region-preference <string>] [--env KEY=VALUE]... [--database <json>] [--redis <json>] [--idempotency-key <string>]`

Provision a new pipeline.

Arguments & options:
- `--name` — The pipeline name. (required, body)
- `--region-preference` — Optional region id; omit for the default region. (optional, body)
- `--environment-variables` — Optional initial env vars: array of { key, value }. They are not stored, so a dashboard Retry after a failed setup does not re-apply them; set them again if setup failed. (optional, body)
- `--database` — Optional managed Postgres selection: { mode: existing, databaseId } or { mode: create, displayName, regionId }. (optional, body)
- `--redis` — Optional managed Redis selection: { mode: existing, databaseId } or { mode: create, displayName, primaryRegion }. (optional, body)
- `--idempotency-key` — Optional retry token; repeating returns the existing resource. (optional, body)

### khotan pipelines delete

Usage: `khotan pipelines delete <pipelineId>`

Permanently delete a pipeline and tear down its provider resources.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan pipelines email-subscriptions create

Usage: `khotan pipelines email-subscriptions create <pipelineId> --email-integration-id <string> --delivery-url <string>`

Watch a connected Gmail mailbox for this pipeline; Google pushes notifications directly to the delivery URL.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--email-integration-id` — The connected Gmail integration id. (required, body)
- `--delivery-url` — https URL on the target's primary hostname. (required, body)

### khotan pipelines email-subscriptions delete

Usage: `khotan pipelines email-subscriptions delete <pipelineId> <subscriptionId>`

Remove an email subscription (deletes the Pub/Sub push subscription).

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `<subscriptionId>` — The email subscription id. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan pipelines email-subscriptions get

Usage: `khotan pipelines email-subscriptions get <pipelineId> <subscriptionId>`

Get one email subscription by id.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `<subscriptionId>` — The email subscription id. (required, path)

### khotan pipelines email-subscriptions list

Usage: `khotan pipelines email-subscriptions list <pipelineId>`

List the connected mailboxes this pipeline watches.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines env bulk-set

Usage: `khotan pipelines env bulk-set <pipelineId> [--var KEY=VALUE]... [--target <a,b>]`

Create or update many env vars in one request. Writes every environment unless you pass target.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--variables` — Array of { key, value } to upsert. (required, body)
- `--target` — Environments to write, any of: production, preview, development (comma-separated or repeatable). Omit to write all environments. (optional, body)

### khotan pipelines env list

Usage: `khotan pipelines env list <pipelineId>`

List env var metadata (never values) for a pipeline.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines env reveal

Usage: `khotan pipelines env reveal <pipelineId> <key> [--target <string>]`

Reveal a single decrypted env var value for one environment. Secret-bearing; explicit-only.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `<key>` — The env var key to reveal. (required, path)
- `--target` — Environment to read: production, preview, or development. Omit to default to production. (optional, query)

Safety: secret — returns credential-bearing values; never shown in list/table output.

### khotan pipelines env set

Usage: `khotan pipelines env set <pipelineId> <key> --value <string> [--target <a,b>]`

Create or update one env var. Writes every environment unless you pass target.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `<key>` — The env var key. (required, path)
- `--value` — The env var value. (required, body, secret)
- `--target` — Environments to write, any of: production, preview, development (comma-separated or repeatable). Omit to write all environments. (optional, body)

### khotan pipelines env unset

Usage: `khotan pipelines env unset <pipelineId> <key> [--target <string>]`

Delete one env var. Removes it from every environment unless you pass target.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `<key>` — The env var key to delete. (required, path)
- `--target` — Environment to remove from: production, preview, or development. Omit to remove from all environments. (optional, query)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan pipelines get

Usage: `khotan pipelines get <pipelineId>`

Get one pipeline by id, including its current deployment.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines list

Usage: `khotan pipelines list`

List the organization's pipelines.

### khotan pipelines oauth disconnect

Usage: `khotan pipelines oauth disconnect <pipelineId>`

Revoke the OAuth client and remove its injected environment variables.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

Safety: destructive — prompts for confirmation in a terminal and refuses in non-interactive sessions unless you pass `--yes`.

### khotan pipelines oauth export

Usage: `khotan pipelines oauth export <pipelineId>`

Export secret-bearing .env.local content for local development.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

Safety: secret — returns credential-bearing values; never shown in list/table output.

### khotan pipelines oauth rotate

Usage: `khotan pipelines oauth rotate <pipelineId> [--redeploy]`

Invalidate the current secret, inject a new one, and optionally redeploy.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--redeploy` — Start a fresh deployment after rotation. (optional, body)

Safety: secret — returns credential-bearing values; never shown in list/table output.

### khotan pipelines oauth set-redirects

Usage: `khotan pipelines oauth set-redirects <pipelineId> --redirect-uris <a,b>`

Replace additional redirect URIs while preserving the managed production callback.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--redirect-uris` — Additional http(s) redirect URIs. Repeat the flag or pass a comma-separated list. (required, body)

### khotan pipelines oauth setup

Usage: `khotan pipelines oauth setup <pipelineId>`

Create OAuth credentials once and return the plaintext secret.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

Safety: secret — returns credential-bearing values; never shown in list/table output.

### khotan pipelines oauth status

Usage: `khotan pipelines oauth status <pipelineId>`

Show non-secret OAuth client state and redirect URIs.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines oauth sync

Usage: `khotan pipelines oauth sync <pipelineId>`

Repair OAuth redirects and environment values without rotating the secret.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines redeploy

Usage: `khotan pipelines redeploy <pipelineId>`

Trigger a new deployment of a pipeline.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines setup

Usage: `khotan pipelines setup <pipelineId> --name <string> --website <string> [--logo <string>] [--idempotency-key <string>]`

Start a cloud setup run for a pipeline: a cloud agent provisions its database, Redis, and env, brands it from the website, and Khotan merges the setup PR when its checks pass. The pipeline must be ready: after creating one, wait until pipelines get shows status ready, because setup refuses a pipeline that is still being created. Returns the run in status running; follow it with pipelines setup status.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--name` — What the app does, 20 characters or fewer, such as Order Desk. (required, body)
- `--website` — The customer's website, for the theme colours and the logo. (required, body)
- `--logo` — Optional https URL of a logo; omit to take the logo from the website. (optional, body)
- `--idempotency-key` — Optional retry token; repeating returns the same run. (optional, body)

### khotan pipelines setup status

Usage: `khotan pipelines setup status <pipelineId>`

Show the newest cloud setup run for a pipeline: its status, the reason when it is not ready, the setup PR, and the live URL.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines source

Usage: `khotan pipelines source <pipelineId>`

Download the pipeline's source files (its subdirectory in the org mono-root repo) as a JSON listing with paths rooted at the pipeline. Text files come back utf-8, binary files base64.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)

### khotan pipelines tags set

Usage: `khotan pipelines tags set <pipelineId> --tags <a,b>`

Replace the tags on a pipeline and return the stored list.

Arguments & options:
- `<pipelineId>` — The pipeline id. (required, path)
- `--tags` — Full tag list, comma-separated or repeatable; it replaces the stored list, and an empty value clears it. The server lowercases each tag and turns spaces into hyphens. Up to 10 tags of 1-32 lowercase letters, digits, or single hyphens. (required, body)

Examples:
- `khotan pipelines tags set <pipelineId> --tags live,eu`

<!-- generated from khotan catalog v2026-10-30 (adapter 0.10.0); do not edit by hand -->
