---
title: CLI reference
description: >-
  Every saaslayer command: what it does, usage, flags and examples. Generated
  from the CLI's command spec.
canonical_url: 'https://saaslayer.com/docs/reference/cli/'
last_updated: '2026-11-22T23:17:35-08:00'
---
# CLI reference

`saaslayer` is the customer CLI: it manages your SaaSLayer organizations, projects and deployments, connects your
AWS account, and administers your app's users and permissions. Install it with `npm install -g saaslayer` (Node.js
18 or later), or run it with `npx saaslayer`. AWS connection and foundation commands also need the AWS CLI and
credentials for the account you connect.

* **Two logins.** `saaslayer login` signs you in to SaaSLayer (organizations, projects, deployments).
  `saaslayer login --deployment <env>` signs you in to one deployment's user service as an administrator, for the
  `users` and `permissions` commands. They are kept separately.
* **What a command acts on.** `org use` and `project use` select your active organization and project;
  deployment commands take `--env`/`--region` (resolved in the active project) or `--deployment <id>`.
  `saaslayer context` shows the current selection and where each value came from.
* **Help in the terminal.** `saaslayer --help` lists every command; `saaslayer <command> --help` prints that
  command's usage, flags and examples, as on this page.
* **Flags are checked.** A command accepts the flags listed under it plus the [global flags](#global-flags). An
  unknown flag, a repeated flag that is not repeatable, or a missing or invalid value is an error that names the
  closest accepted flag. A flag without a value (*boolean*) never takes the word after it.

To get started, follow [Prepare your AWS account](https://saaslayer.com/docs/getting-started/aws-account-setup).

## Commands

| Command | Description |
| --- | --- |
| [`account`](#account) | List the cached control-plane accounts, switch the active one, or verify its email. |
| [`aws`](#aws) | Connect your AWS account to an org, and manage its connection authorizers and trust. |
| [`bindings`](#bindings) | Manage consumer bindings: the stable pointers your apps read to find a deployment. |
| [`catalog`](#catalog) | Discover deployable modules. |
| [`cdn`](#cdn) | Publish and withdraw immutable versioned assets on a deployment's CDN. |
| [`context`](#context) | Show what the CLI acts as and on: account, deployment login, AWS profile, org and project. |
| [`deploy`](#deploy) | Create a deployment of the project's modules, hosted or in your connected AWS account. |
| [`deployment`](#deployment) | Manage deployments, services, settings, operations and releases. |
| [`destroy`](#destroy) | Tear down a deployment, deleting or retaining its data, or purge what a retain destroy kept. |
| [`login`](#login) | Log in to your SaaSLayer account, or with --deployment to a deployment's user-service. |
| [`logout`](#logout) | Clear a cached control-plane account, or with --deployment a deployment login. |
| [`org`](#org) | Create, list and select your SaaSLayer orgs, and manage their members. |
| [`permissions`](#permissions) | Manage a deployment's permissions: catalog, roles, admins, API keys and login providers. |
| [`project`](#project) | Create, select, destroy and transfer projects. |
| [`signup`](#signup) | Create a SaaSLayer account, confirm the emailed code and log in. |
| [`sso`](#sso) | Manage the enterprise SSO connections of a deployment's user-service. |
| [`status`](#status) | Show the deployments of a project in every environment, or in one. |
| [`update`](#update) | Move a deployment to another release or retry its deployed release. |
| [`users`](#users) | Administer a deployment's users, or import users from another identity system. |
| [`whoami`](#whoami) | Show the logged-in account, its account id, its control plane and the active org and project. |

## Global flags

Every command accepts these flags.

* `--help` (*boolean*) — Print the command's help: usage, flags, examples and subcommands.
* `--config-url` (*string*, env `SAASLAYER_CONFIG_URL`, default `https://api.saaslayer.com`) — Control-plane API to use.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--no-color` (*boolean*) — Disable ANSI colors and terminal cursor control.
* `--debug` (*boolean*) — Write safe CLI diagnostics to stderr.
* `--silent` (*boolean*) — Suppress optional diagnostics and prompts; primary results and errors remain.
* `--non-interactive` (*boolean*) — Never prompt; report missing required input instead.

## `account`

List the cached control-plane accounts, switch the active one, or verify its email.

List or select cached control-plane accounts, or verify the active account email. Run `saaslayer account list` to see cached logins.

| Subcommand | Description |
| --- | --- |
| [`account list`](#account-list) | List the cached control-plane accounts. |
| [`account use`](#account-use) | Switch the active control-plane account to another cached login. |
| [`account verify-email`](#account-verify-email) | Prove the logged-in account owns its email. |

### `account list`

List the cached control-plane accounts.

List all cached control-plane accounts, most recently used first; `*` marks the active one and an expired token is flagged.

**Usage**

```bash
saaslayer account list
```

**Examples**

```bash
saaslayer account list
```

### `account use`

Switch the active control-plane account to another cached login.

Switch the active control-plane account to another cached login, without logging in again.

**Usage**

```bash
saaslayer account use <email>
```

**Arguments**

* `email` — Email (or user id) of a cached account. An email shared by several accounts is refused: switch by user id.

**Examples**

```bash
saaslayer account use you@example.com
```

### `account verify-email`

Prove the logged-in account owns its email.

Prove the logged-in control-plane account owns its email: a code is emailed; type it, or pass `--code`. Org owners can add only accounts whose email is verified. Without a terminal and without `--code`, it only sends the code and prints the command that finishes it.

**Usage**

```bash
saaslayer account verify-email [flags]
```

**Flags**

* `--code` (*string*, secret) — A code already emailed to you; verifies it without sending a new one.

**Examples**

```bash
saaslayer account verify-email
saaslayer account verify-email --code 123456
```

## `aws`

Connect your AWS account to an org, and manage its connection authorizers and trust.

Deploying needs a SaaSLayer login and a connected AWS account; `aws connect` makes the connection.

The AWS side of these commands runs with YOUR AWS credentials for the account: `--profile`, else the AWS CLI's default credentials. Credentials for another account are refused before anything changes.

| Subcommand | Description |
| --- | --- |
| [`aws authorizers`](#aws-authorizers) | Change who may authorize SaaSLayer org connections to an AWS account. |
| [`aws connect`](#aws-connect) | Connect your AWS account to an org with your own AWS credentials. |
| [`aws trust-rotation`](#aws-trust-rotation) | Rotate an AWS account's trust identifier for this control plane, with overlap. |
| [`aws foundation`](#aws-foundation) | Create, inspect and upgrade the account foundation. |
| [`aws sms`](#aws-sms) | Set up, register, check and release the SMS sending number for phone login. |

### `aws authorizers`

Change who may authorize SaaSLayer org connections to an AWS account.

The account's connection authorizers (the foundation's `ConnectionAuthorizerArns`, stored as path-less role ARNs) are the IAM principals whose signed proof activates an org connection to the account. Only a current authorizer can change them, with their own AWS credentials; the change is a parameter-only update of the account foundation stack in its home region.

| Subcommand | Description |
| --- | --- |
| [`aws authorizers add`](#aws-authorizers-add) | Add a connection authorizer to an AWS account. |
| [`aws authorizers remove`](#aws-authorizers-remove) | Remove a connection authorizer from an AWS account. |

### `aws authorizers add`

Add a connection authorizer to an AWS account.

Run by a current authorizer. Refused when the account has no foundation yet: connect it first with `saaslayer aws connect`.

**Usage**

```bash
saaslayer aws authorizers add <arn> --aws-account ACCOUNT_ID [flags]
```

**Arguments**

* `arn` — IAM principal ARN; stored as its path-less role ARN.

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--region` (*string*, default `us-east-1`) — Region used to find the account foundation; the change is made in its home region.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws authorizers add arn:aws:iam::123456789012:role/Admin --aws-account 123456789012 --profile my-profile
```

### `aws authorizers remove`

Remove a connection authorizer from an AWS account.

Run by a current authorizer. The last authorizer cannot be removed.

**Usage**

```bash
saaslayer aws authorizers remove <arn> --aws-account ACCOUNT_ID [flags]
```

**Arguments**

* `arn` — IAM principal ARN; stored as its path-less role ARN.

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--region` (*string*, default `us-east-1`) — Region used to find the account foundation; the change is made in its home region.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws authorizers remove arn:aws:iam::123456789012:role/Admin --aws-account 123456789012
```

### `aws connect`

Connect your AWS account to an org with your own AWS credentials.

Connects the account to an org, with YOUR AWS credentials for that account (`--profile`, else the AWS CLI's default credentials: environment, SSO profile or AWS CloudShell). Binds it to your active project by default; `--org-wide` lets any project in the org deploy into it.

The account foundation lives in one home region, created by the first connect; connecting another region adds only that region's stack. A foundation that still trusts a single ExternalId is converted here, from its home region.

The org connection is activated by a proof signed with your AWS credentials: you must be one of the account's connection authorizers (the first connect makes you one; see `saaslayer aws authorizers`). Until then the connection stays `PENDING_PROOF`, and rerunning the command resumes it.

**Usage**

```bash
saaslayer aws connect --aws-account <id> [--region R] [--profile P] [--org ID] [--org-wide | --project ID]
  [--permission-mode scoped|broad] [--sms-toll-free] [--email-sender-domain DOMAIN] [--yes] [--dry-run] [--allow-replacement]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account to connect. Your AWS credentials must be for this account.
* `--region` (*string*, default `us-east-1`) — Region to connect. The first connect makes it the account foundation's home region.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--org` (*string*) — Org to connect the account to; defaults to the active org.
* `--org-wide` (*boolean*) — Let any project in the org deploy into the account, instead of binding it to one project.
* `--project` (*string*) — Project to bind the account to; defaults to the active project. Ignored with `--org-wide`.
* `--permission-mode` (*scoped | broad*, default `scoped`) — Permission mode of the account foundation the first connect creates (see `saaslayer aws foundation upgrade`). An installed foundation keeps its mode, and asking for a different one is refused (switch it with `saaslayer aws foundation upgrade --permission-mode`).
* `--sms-toll-free` (*boolean*) — Also install the account's US toll-free SMS sending number in this region (~$2/month while it exists; asks first unless `--yes`) and print its ARN.
* `--yes` (*boolean*) — Skip the confirmations: the `--sms-toll-free` cost, and the change set that converts a foundation still trusting a single ExternalId.
* `--dry-run` (*boolean*) — For a foundation that still trusts a single ExternalId: show the conversion change set, delete it and stop without finishing the connection.
* `--allow-replacement` (*boolean*) — Let the ExternalId conversion change set replace a resource or remove an IAM role, the permissions boundary or the artifact bucket.
* `--email-sender-domain` (*string*) — Email sender domain for this region (for example `acme.com`): prints the DKIM records to add to its DNS and the `saaslayer deployment settings set` command that sends through it once verified. An empty value removes it.

**Examples**

```bash
saaslayer aws connect --aws-account 123456789012 --region us-east-1 --profile my-profile
# Open the account to every project in the org, with a toll-free SMS number
saaslayer aws connect --aws-account 123456789012 --org-wide --sms-toll-free --yes
```

### `aws trust-rotation`

Rotate an AWS account's trust identifier for this control plane, with overlap.

The trust identifier gates this control plane's access to the account. A rotation adds a new identifier beside the current one, so running operations keep their access:

* `start` (needs `--reason`) adds the new identifier.
* `verify` checks that it assumes.
* `switch` moves new operations to it.
* `retire` removes the old one once no running operation carries it.

`rollback` (before `retire`) goes back to the current identifier. `status` shows the rotation.

Each step is signed with your AWS credentials (you must be a connection authorizer of the account), is safe to rerun and prints the next step. Identifiers are never shown.

| Subcommand | Description |
| --- | --- |
| [`aws trust-rotation retire`](#aws-trust-rotation-retire) | Remove the old trust identifier once no running operation carries it. |
| [`aws trust-rotation rollback`](#aws-trust-rotation-rollback) | Go back to the current trust identifier (before retire). |
| [`aws trust-rotation start`](#aws-trust-rotation-start) | Start a trust rotation: add a new identifier beside the current one. |
| [`aws trust-rotation status`](#aws-trust-rotation-status) | Show the account's trust rotation (the last one when idle). |
| [`aws trust-rotation switch`](#aws-trust-rotation-switch) | Move new operations to the new trust identifier. |
| [`aws trust-rotation verify`](#aws-trust-rotation-verify) | Check that the new trust identifier assumes. |

### `aws trust-rotation retire`

Remove the old trust identifier once no running operation carries it.

Lists the running operations that still carry the old identifier; rerun once they finish. Afterwards the account trusts a single identifier.

**Usage**

```bash
saaslayer aws trust-rotation retire --aws-account ACCOUNT_ID [flags]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--reason` (*string*) — Why you are taking this step; sent with it.
* `--org` (*string*) — Org whose connection to the account the step acts for (it must be active); defaults to the active org.
* `--region` (*string*, default `us-east-1`) — Region the step's connection proof is signed in, and where the account foundation is looked up from.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws trust-rotation retire --aws-account 123456789012
```

### `aws trust-rotation rollback`

Go back to the current trust identifier (before retire).

Only before `retire`. After a `switch` it waits for the operations already using the new identifier: rerun once they finish.

**Usage**

```bash
saaslayer aws trust-rotation rollback --aws-account ACCOUNT_ID [flags]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--reason` (*string*) — Why you are taking this step; sent with it.
* `--org` (*string*) — Org whose connection to the account the step acts for (it must be active); defaults to the active org.
* `--region` (*string*, default `us-east-1`) — Region the step's connection proof is signed in, and where the account foundation is looked up from.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws trust-rotation rollback --aws-account 123456789012
```

### `aws trust-rotation start`

Start a trust rotation: add a new identifier beside the current one.

Adds the new identifier to the account foundation's trust entry for this control plane. Next: `saaslayer aws trust-rotation verify`.

**Usage**

```bash
saaslayer aws trust-rotation start --aws-account ACCOUNT_ID --reason TEXT [flags]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--reason` (*string*, required) — Why you are rotating; recorded in the audit log.
* `--org` (*string*) — Org whose connection to the account the step acts for (it must be active); defaults to the active org.
* `--region` (*string*, default `us-east-1`) — Region the step's connection proof is signed in, and where the account foundation is looked up from.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws trust-rotation start --aws-account 123456789012 --reason "Scheduled rotation" --profile my-profile
```

### `aws trust-rotation status`

Show the account's trust rotation (the last one when idle).

Shows the rotation's id, its state and the running operations that still carry the outgoing identifier. Reads only; needs no AWS credentials. Identifiers are never shown.

**Usage**

```bash
saaslayer aws trust-rotation status --aws-account ACCOUNT_ID
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account.

**Examples**

```bash
saaslayer aws trust-rotation status --aws-account 123456789012
```

### `aws trust-rotation switch`

Move new operations to the new trust identifier.

Run after `verify`. Next: `saaslayer aws trust-rotation retire`, once the running operations on the old identifier finish.

**Usage**

```bash
saaslayer aws trust-rotation switch --aws-account ACCOUNT_ID [flags]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--reason` (*string*) — Why you are taking this step; sent with it.
* `--org` (*string*) — Org whose connection to the account the step acts for (it must be active); defaults to the active org.
* `--region` (*string*, default `us-east-1`) — Region the step's connection proof is signed in, and where the account foundation is looked up from.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws trust-rotation switch --aws-account 123456789012
```

### `aws trust-rotation verify`

Check that the new trust identifier assumes.

When it does not verify yet, makes sure the account foundation trusts it and checks again. IAM may still be propagating: rerun on a failure.

**Usage**

```bash
saaslayer aws trust-rotation verify --aws-account ACCOUNT_ID [flags]
```

**Flags**

* `--aws-account` (*string*, required) — 12-digit id of the AWS account. Your AWS credentials must be for this account.
* `--reason` (*string*) — Why you are taking this step; sent with it.
* `--org` (*string*) — Org whose connection to the account the step acts for (it must be active); defaults to the active org.
* `--region` (*string*, default `us-east-1`) — Region the step's connection proof is signed in, and where the account foundation is looked up from.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.

**Examples**

```bash
saaslayer aws trust-rotation verify --aws-account 123456789012
```

### `aws foundation`

Create, inspect and upgrade the account foundation.

| Subcommand | Description |
| --- | --- |
| [`aws foundation create`](#aws-foundation-create) | Create the SaaSLayer foundation stack in your AWS account, trusting one control plane. |
| [`aws foundation status`](#aws-foundation-status) | Show each installed foundation stack's status and version against this CLI's bundled version. |
| [`aws foundation upgrade`](#aws-foundation-upgrade) | Upgrade the installed foundation stacks in place to this CLI's bundled templates. |

### `aws foundation create`

Create the SaaSLayer foundation stack in your AWS account, trusting one control plane.

Creates the SaaSLayer foundation stack (3 IAM roles + permissions boundary) in the caller's AWS account, with one trust entry for the SaaSLayer control plane that manages it (its control-plane account, trust identifier and control-plane id) and the caller as the account's connection authorizer. That control plane may then assume the deploy role, gated by the trust identifier, and manage only the CloudFormation stacks whose names start with `--stack-name-prefix`.

Refuses an account that already has a foundation: upgrade it with `saaslayer aws foundation upgrade`. `saaslayer aws connect` also creates the foundation when the account has none. Uses the bundled `templates/saaslayer-foundation.yml`.

**Usage**

```bash
saaslayer aws foundation create --control-plane-account ACCOUNT_ID --external-id ID --control-plane-id ID [flags]
```

**Flags**

* `--control-plane-account` (*string*, required, env `SAASLAYER_CONTROL_PLANE_ACCOUNT`) — 12-digit AWS account id of the managing control plane.
* `--external-id` (*string*, required, env `SAASLAYER_EXTERNAL_ID`, secret) — Trust identifier (AWS ExternalId) shared during onboarding.
* `--control-plane-id` (*string*, required) — The managing SaaSLayer control plane (for example `saaslayer-control-plane`); its identity roles are the only callers trusted.
* `--stack-name` (*string*, default `saaslayer-foundation`) — CloudFormation stack name. Its named IAM resources are account-global, so an account holds one foundation stack.
* `--region` (*string*, env `AWS_REGION`, default `us-east-1`) — Region to create the stack in; it becomes the foundation's home region.
* `--stack-name-prefix` (*string*, default `sl-`) — Prefix of the CloudFormation stacks the deploy role may manage: 2-7 lowercase letters or digits, starting with a letter and ending in `-`.
* `--org-id` (*string*, env `SAASLAYER_ORG_ID`) — Connected org id, recorded on the foundation stack.
* `--template` (*string*) — Foundation template to deploy instead of the bundled one.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--dry-run` (*boolean*) — Validate the template only (`aws cloudformation validate-template`); deploy nothing. The required flags are not checked.

**Examples**

```bash
saaslayer aws foundation create --control-plane-account 123456789012 --external-id ext-123abc --control-plane-id saaslayer-control-plane
# Validate the template without deploying
saaslayer aws foundation create --control-plane-account 123456789012 --external-id ext-123abc --control-plane-id saaslayer-control-plane --dry-run
```

### `aws foundation status`

Show each installed foundation stack's status and version against this CLI's bundled version.

Shows each installed foundation stack (`saaslayer-foundation` + `saaslayer-foundation-<region>`): its status, installed version and the version bundled with this CLI. For a region stack with an email sender domain, also shows whether SES has verified it, with the DKIM records while it has not.

**Usage**

```bash
saaslayer aws foundation status [flags]
```

**Flags**

* `--region` (*string*, env `AWS_REGION`, default `us-east-1`) — Region of the region stack to show. The account stack is read in its home region.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--stack-name` (*string*, default `saaslayer-foundation`) — Name of the account stack.
* `--only` (*account | region*) — Show only the account stack or only the region stack.

**Examples**

```bash
saaslayer aws foundation status --region us-west-2 --profile my-profile
```

### `aws foundation upgrade`

Upgrade the installed foundation stacks in place to this CLI's bundled templates.

Upgrades the account stack first, in its home region, then the region stack of `--region`; the region stack is skipped when it is not installed. Runs with YOUR AWS credentials.

For each stack it builds a CloudFormation change set from the bundled template that keeps every existing parameter value: trust identifiers are never re-entered or printed, and the parameter list travels in a private file, never on the command line. New parameters take their template default. It prints the version change (`5.8.0 -> 5.9.0`) and each resource change (action, resource, type, replacement, scope), executes after you confirm, waits for `UPDATE_COMPLETE` and reads the new version back. On a rollback it prints the failing resources.

Refuses a stack that is missing, not in a stable state (`*_COMPLETE`) or that runs a newer version than this CLI. A change that replaces a resource or removes an IAM role, the permissions boundary or the artifact bucket is refused, and its change set deleted, unless `--allow-replacement`.

The account stack trusts its managing control plane through the `ControlPlaneAccountId`, `ControlPlaneId` and `ControlPlaneTrustIdentifiers` parameters. A 7.x-8.x foundation's single `TrustEntries` entry becomes those parameters; a foundation trusting more than one control plane is refused, naming them. A foundation that still trusts a single ExternalId converts through `saaslayer aws connect`, from its home region.

After the upgrade (or when nothing changed) the control plane re-reads the account's foundation through its own trust, as your saaslayer login (no AWS credentials are sent), so the console and deploys see the new version. If that fails the upgrade still stands, and the console's "check again" re-reads it.

**Usage**

```bash
saaslayer aws foundation upgrade [flags]
```

**Flags**

* `--region` (*string*, env `AWS_REGION`, default `us-east-1`) — The region stack's region. The account stack is always upgraded in its home region.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--stack-name` (*string*, default `saaslayer-foundation`) — Name of the account stack.
* `--only` (*account | region*) — Upgrade only the account stack or only the region stack. With `region`, a missing region stack is an error.
* `--dry-run` (*boolean*) — Show the change set, then delete it; apply nothing.
* `--yes` (*boolean*) — Execute the change set without asking.
* `--allow-replacement` (*boolean*) — Allow a change that replaces a resource or removes an IAM role, the permissions boundary or the artifact bucket. Review the change set first.
* `--permission-mode` (*scoped | broad*) — Switch the account stack's permission mode. `scoped` (the default) limits SaaSLayer to the resources it manages; `broad` gives account-wide resource permissions with restricted IAM management, so new SaaSLayer features need fewer foundation upgrades. Broad is for accounts you own or have dedicated to SaaSLayer: the control plane is asked first and refuses an account that hosts shared deployments. Other parameters keep their values. Unchanged when omitted.
* `--template-guard` (*off | warn*) — `warn` turns on the region's template guard: a CloudFormation Guard Hook that checks every resource of every SaaSLayer module stack and reports rule failures as stack events without stopping the deploy. `off` removes it. Unchanged when omitted.
* `--email-sender-domain` (*string*) — Email sender domain of the region stack (for example `acme.com`): prints the DKIM records to add to its DNS and the `saaslayer deployment settings set` command that sends through it once verified. An empty value removes it; unchanged when omitted.

**Examples**

```bash
saaslayer aws foundation upgrade --region us-west-2 --profile my-profile --dry-run
saaslayer aws foundation upgrade --region us-west-2 --profile my-profile
# Turn on the template guard in the region stack only
saaslayer aws foundation upgrade --only region --template-guard warn
# Give an account dedicated to SaaSLayer account-wide permissions
saaslayer aws foundation upgrade --only account --permission-mode broad
```

### `aws sms`

Set up, register, check and release the SMS sending number for phone login.

An account and region has one SMS sending number, installed on its region foundation (`saaslayer-foundation-<region>`). Each command finds the account and region from `--env`: the project's deployment there, else its connected account (`--aws-account` names it when the project has several).

These commands work on your own AWS account (Bring your own AWS Account), with YOUR AWS credentials for it; SaaSLayer-hosted accounts are not supported yet.

| Subcommand | Description |
| --- | --- |
| [`aws sms register`](#aws-sms-register) | Register the toll-free sending number with AWS so that it can send. |
| [`aws sms release`](#aws-sms-release) | Retire the account-and-region SMS number and delete its registration. |
| [`aws sms setup`](#aws-sms-setup) | Install the SMS sending number for phone login (~$2/month). |
| [`aws sms status`](#aws-sms-status) | Show the sending number, its registration and what is still missing. |

### `aws sms register`

Register the toll-free sending number with AWS so that it can send.

Asks for (or reads from `--file`) the company, website, public privacy-policy and terms URLs, contact, opt-in description + PNG screenshot and message samples (naming the brand, with HELP and STOP), checks them, then creates the registration, fills it, associates the number and submits. AWS review: up to 15 business days.

Re-running resumes the same registration; after AWS asks for updates it shows the reasons, re-asks only the flagged fields and resubmits. A submitted, reviewing or complete registration is left as it is.

**Usage**

```bash
saaslayer aws sms register --env ENV [flags]
```

**Flags**

* `--env` (*string*, required) — Environment whose account and region send the SMS (for example `dev`).
* `--region` (*string*) — Region of the environment, when it spans several.
* `--aws-account` (*string*) — Connected AWS account, when the project has several (the same flag as `saaslayer deployment create --aws-account`).
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org shown in the scope line; defaults to the active org. The project decides the account.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--file` (*string*) — JSON file with the registration answers, instead of prompts. Required when not running in a terminal.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer aws sms register --env prod
saaslayer aws sms register --env prod --file registration.json --profile my-profile
```

### `aws sms release`

Retire the account-and-region SMS number and delete its registration.

Takes the control plane's SMS lock (deploys that set the number are refused meanwhile), checks that no deployment in any project still uses it, asks, removes the number (billing stops), then deletes its registration.

Every step is recorded: re-run it from any machine to resume (`saaslayer aws sms status` also records a number removal that landed).

**Usage**

```bash
saaslayer aws sms release --env ENV [flags]
```

**Flags**

* `--env` (*string*, required) — Environment whose account and region send the SMS (for example `dev`).
* `--region` (*string*) — Region of the environment, when it spans several.
* `--aws-account` (*string*) — Connected AWS account, when the project has several (the same flag as `saaslayer deployment create --aws-account`).
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org shown in the scope line; defaults to the active org. The project decides the account.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Release without asking.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer aws sms release --env dev
```

### `aws sms setup`

Install the SMS sending number for phone login (~$2/month).

Installs the number on the region foundation of the env's account and region. Shows the cost (~$2/month) and asks unless `--yes`. Prints the number's ARN and the exact `saaslayer deployment settings` command that uses it.

The number cannot send until its registration is approved (`saaslayer aws sms register`; AWS review: up to 15 business days). An account and region holds one number: replacing one of another type needs `saaslayer aws sms release` first.

Run again with a new `--help-message` to change only the reply.

**Usage**

```bash
saaslayer aws sms setup --env ENV [flags]
```

**Flags**

* `--env` (*string*, required) — Environment whose account and region send the SMS (for example `dev`).
* `--region` (*string*) — Region of the environment, when it spans several.
* `--aws-account` (*string*) — Connected AWS account, when the project has several (the same flag as `saaslayer deployment create --aws-account`).
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org shown in the scope line; defaults to the active org. The project decides the account.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--simulator` (*boolean*) — Install an AWS simulator number instead: dev only, refused when the account has staging or prod deployments. It reaches simulator destinations only and needs no registration.
* `--help-message` (*string*) — The number's automatic reply to HELP: one SMS, at most 160 characters, naming a contact (an email, a phone number or a URL) and STOP. Carriers check it.
* `--yes` (*boolean*) — Install without asking (the number costs ~$2/month).
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer aws sms setup --env prod --help-message "Acme support: you@example.com. Reply STOP to opt out."
# A simulator number for dev testing
saaslayer aws sms setup --env dev --simulator --yes
```

### `aws sms status`

Show the sending number, its registration and what is still missing.

Shows the sending number, registration state, sandbox or production, spend limit and what is still missing (as the deploy's `sms.*` readiness codes), with the console links and values for the production-access and spend-limit requests (AWS has no API for either).

An unfinished `saaslayer aws sms release` is moved forward from the stack's actual state and shown with the command that resumes it.

**Usage**

```bash
saaslayer aws sms status --env ENV [flags]
```

**Flags**

* `--env` (*string*, required) — Environment whose account and region send the SMS (for example `dev`).
* `--region` (*string*) — Region of the environment, when it spans several.
* `--aws-account` (*string*) — Connected AWS account, when the project has several (the same flag as `saaslayer deployment create --aws-account`).
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org shown in the scope line; defaults to the active org. The project decides the account.
* `--profile` (*string*) — AWS CLI profile whose credentials to use; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer aws sms status --env prod
saaslayer aws sms status --env prod --json
```

## `bindings`

Manage consumer bindings: the stable pointers your apps read to find a deployment.

A consumer binding points at one deployment and its user-service and permissions-service instances, and keeps pointing there when instances are added. Consumers read it at its discovery URL, `<api>/api/discovery/bindings/<bindingId>`.

Management actions require an org-owner login. Export reads public configuration without a login.

| Subcommand | Description |
| --- | --- |
| [`bindings export`](#bindings-export) | Print a consumer binding's public configuration as env, to bake in at build or deploy time. |
| [`bindings create`](#bindings-create) | Create a consumer binding to one deployment and print its discovery URL. |
| [`bindings list`](#bindings-list) | List the consumer bindings of the orgs you own. |
| [`bindings get`](#bindings-get) | Show one consumer binding and its discovery URL. |
| [`bindings handoff`](#bindings-handoff) | Move a consumer binding to a replacement deployment in a maintenance window. |

### `bindings export`

Print a consumer binding's public configuration as env, to bake in at build or deploy time.

Prints the public configuration of a consumer binding, to bake into an app at build or deploy time. No login needed: no credentials are read or sent.

The variables:

* `SAASLAYER_USER_POOL_ID`
* `SAASLAYER_CLIENT_ID`
* `SAASLAYER_REGION`
* `SAASLAYER_ISSUER`
* `SAASLAYER_JWKS_URL`
* `SAASLAYER_USERS_API_BASE`
* `SAASLAYER_PERMISSIONS_API_BASE`
* `SAASLAYER_HOSTED_LOGIN_URL`

A handoff underway is a notice on stderr, so stdout stays the env block alone. Apps that discover at runtime instead set `SAASLAYER_DISCOVERY_URL` to the binding's discovery URL.

**Usage**

```bash
saaslayer bindings export --binding ID [flags]
```

**Flags**

* `--binding` (*string*, required) — Consumer binding id (`bnd_…`).
* `--format` (*dotenv | json*, default `dotenv`) — `dotenv` prints `KEY=value` lines; `json` prints one object.

**Examples**

```bash
saaslayer bindings export --binding bnd_123
saaslayer bindings export --binding bnd_123 --format json
```

### `bindings create`

Create a consumer binding to one deployment and print its discovery URL.

Binds one deployment, chosen by `--deployment` or by `--env` of the active project, and its user-service and permissions-service instances (the default ones unless named). The binding keeps pointing at those instances when instances are added.

Prints the binding id and its discovery URL, `<api>/api/discovery/bindings/<bindingId>`. Org owners only.

**Usage**

```bash
saaslayer bindings create --label NAME (--deployment <dep_id> | --env E [--project P] [--region R]) [--user-service-instance I] [--permissions-instance I] [--json]
```

**Flags**

* `--label` (*string*, required) — Name of the binding, for example the app that reads it.
* `--deployment` (*string*) — Deployment id (`dep_…`) to bind. Give this or `--env`.
* `--env` (*string*) — Environment of the project whose deployment to bind, when `--deployment` is absent.
* `--project` (*string*) — Project whose `--env` deployment to bind; defaults to the active project.
* `--region` (*string*) — Region of the `--env` deployment, when the environment has deployments in several regions.
* `--user-service-instance` (*string*) — user-service instance to bind (letter-first, lowercase alphanumeric, at most 12 characters); defaults to the default instance.
* `--permissions-instance` (*string*) — permissions-service instance to bind (letter-first, lowercase alphanumeric, at most 12 characters); defaults to the default instance.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings create --label web-app --env prod
# Bind named instances of a specific deployment
saaslayer bindings create --label staff-portal --deployment dep_123abc --user-service-instance staff --permissions-instance staff
```

### `bindings list`

List the consumer bindings of the orgs you own.

Prints each binding's id, label, deployment, user-service and permissions-service instances and discovery URL. Org owners only.

**Usage**

```bash
saaslayer bindings list [flags]
```

**Flags**

* `--org` (*string*) — Org whose bindings to list; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings list
saaslayer bindings list --org org_123 --json
```

### `bindings get`

Show one consumer binding and its discovery URL.

Prints the binding's org, deployment, user-service and permissions-service instances, any handoff underway, when it was created and its discovery URL, `<api>/api/discovery/bindings/<bindingId>`. Org owners only.

**Usage**

```bash
saaslayer bindings get <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings get bnd_123
```

### `bindings handoff`

Move a consumer binding to a replacement deployment in a maintenance window.

Org owners move a consumer binding to a replacement deployment one checked step at a time, in a maintenance window. Available only when the control plane enables it.

The steps, in order:

* `start` names the replacement deployment.
* `prepare` records the checkpoints of validating against it.
* `freeze` verifies the current deployment's write freeze.
* `sync` records the final sync.
* `cutover` switches the binding.
* `complete` closes the handoff, or `rollback` returns the binding.

`status` shows where the handoff stands. Each step prints the next one, and a refused step names what it is missing. A handoff never removes the previous deployment.

| Subcommand | Description |
| --- | --- |
| [`bindings handoff start`](#bindings-handoff-start) | Start moving a consumer binding to a replacement deployment. |
| [`bindings handoff prepare`](#bindings-handoff-prepare) | Record the checkpoints of validating a handoff's replacement deployment. |
| [`bindings handoff freeze`](#bindings-handoff-freeze) | Verify the current deployment's write freeze before the final sync. |
| [`bindings handoff sync`](#bindings-handoff-sync) | Record a handoff's final sync from its migrate-pool report. |
| [`bindings handoff cutover`](#bindings-handoff-cutover) | Switch a consumer binding to its replacement deployment. |
| [`bindings handoff rollback`](#bindings-handoff-rollback) | Return a consumer binding to the deployment its handoff started from. |
| [`bindings handoff complete`](#bindings-handoff-complete) | Close a consumer binding's handoff after the observation window. |
| [`bindings handoff status`](#bindings-handoff-status) | Show a consumer binding's handoff and its history. |

### `bindings handoff start`

Start moving a consumer binding to a replacement deployment.

Names the replacement deployment. Next, build and validate release candidates against the replacement's discovery document, then record the checkpoints with `prepare`.

**Usage**

```bash
saaslayer bindings handoff start <bindingId> --to ID [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--to` (*string*, required) — Replacement deployment id (`dep_…`).
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff start bnd_123 --to dep_123abc
```

### `bindings handoff prepare`

Record the checkpoints of validating a handoff's replacement deployment.

Records the writes made while validating against the replacement deployment, the reader role on it, the binding's consumers and that static consumers were rebuilt. Needs at least one of its flags.

**Usage**

```bash
saaslayer bindings handoff prepare <bindingId> [--validation-writes FILE] [--reader-role-confirmed] [--consumer NAME]... [--consumers-confirmed] [--json]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--validation-writes` (*string*) — JSON file listing the writes made while validating against the replacement: an array of `{ description, disposition: reverted|overwritten }` (`[]` when none).
* `--reader-role-confirmed` (*boolean*) — Confirm the reader role on the replacement deployment.
* `--consumer` (*string*, repeatable) — A consumer of the binding; repeat for each.
* `--consumers-confirmed` (*boolean*) — Confirm that the static consumers were rebuilt.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff prepare bnd_123 --validation-writes writes.json --reader-role-confirmed --consumer web-app --consumer staff-portal --consumers-confirmed
```

### `bindings handoff freeze`

Verify the current deployment's write freeze before the final sync.

Verifies the current deployment's write freeze: `WriteFreeze` and `AdminMaintenance` on, and writers drained. Next, run the final sync and record it with `sync`.

**Usage**

```bash
saaslayer bindings handoff freeze <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff freeze bnd_123
```

### `bindings handoff sync`

Record a handoff's final sync from its migrate-pool report.

Records the final sync to the replacement deployment. The report's delta compare must match. Next, release the static consumers' rebuilt candidates, then run `cutover`.

**Usage**

```bash
saaslayer bindings handoff sync <bindingId> --report FILE [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--report` (*string*, required) — The final sync's report: the output of the user-service pool migration script run with `--delta --commit` (the report as JSON, or the script's output with its `report:` line).
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff sync bnd_123 --report report.log
```

### `bindings handoff cutover`

Switch a consumer binding to its replacement deployment.

Switches the binding to the replacement deployment. Next, turn `WriteFreeze` off on the replacement (`saaslayer deployment settings set`); runtime consumers move on their next refresh. After the observation window, run `complete`.

**Usage**

```bash
saaslayer bindings handoff cutover <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff cutover bnd_123
```

### `bindings handoff rollback`

Return a consumer binding to the deployment its handoff started from.

Returns the binding to the deployment the handoff started from. Afterwards, turn `WriteFreeze` and `AdminMaintenance` off on that deployment (`saaslayer deployment settings set`) and re-point any released consumers.

**Usage**

```bash
saaslayer bindings handoff rollback <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--mode` (*reverse-migration | accept-loss*) — What happens to the writes the replacement accepted. Required once the replacement accepted writes.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff rollback bnd_123
# After the replacement accepted writes
saaslayer bindings handoff rollback bnd_123 --mode reverse-migration
```

### `bindings handoff complete`

Close a consumer binding's handoff after the observation window.

Closes the handoff. The previous deployment is not removed: it is kept until its owner retires it with a custody decision (retain or delete).

**Usage**

```bash
saaslayer bindings handoff complete <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff complete bnd_123
```

### `bindings handoff status`

Show a consumer binding's handoff and its history.

Prints the deployment the binding resolves, the handoff (from, to and state, or none) and its history: each step, when and by whom.

**Usage**

```bash
saaslayer bindings handoff status <bindingId> [flags]
```

**Arguments**

* `bindingId` — Consumer binding id (`bnd_…`).

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer bindings handoff status bnd_123
```

## `catalog`

Discover deployable modules.

| Subcommand | Description |
| --- | --- |
| [`catalog list`](#catalog-list) | List the modules a project can deploy, with their regions, dependencies and outputs. |
| [`catalog schema`](#catalog-schema) | Print a module's published settings schema. |

### `catalog list`

List the modules a project can deploy, with their regions, dependencies and outputs.

List the catalog modules a project can deploy. For each module: its id (what `saaslayer deployment create --module` and `--set` take), display name and description, supported regions (`any` when unrestricted), hosting modes (SaaSLayer-hosted or your connected AWS account), the minimum foundation version it needs (upgrade with `saaslayer aws foundation upgrade`), the modules it requires and in which phase, and the stable outputs SDK discovery relies on.

Requires `saaslayer login`.

**Usage**

```bash
saaslayer catalog list
```

**Examples**

```bash
saaslayer catalog list
```

### `catalog schema`

Print a module's published settings schema.

Print a module's published settings schema: each setting's type, update behavior (update-safe | create-only), kind (deployment | runtime), whether it is secret, its billing impact and default. Without `--revision`, the revision the selected deployment runs.

**Usage**

```bash
saaslayer catalog schema --module M [--revision SHA] [--env E] [--json]
```

**Flags**

* `--module` (*string*, required) — Module id (`saaslayer catalog list`), or `<service>@<instance>` when the deployment runs several instances of it.
* `--revision` (*string*) — Module revision (commit) whose schema to print; default the revision the selected deployment runs.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer catalog schema --module user-service
saaslayer catalog schema --module permissions-service --env dev --json
```

## `cdn`

Publish and withdraw immutable versioned assets on a deployment's CDN.

Versioned static assets on a deployment's cdn-service. A published version is immutable: its contents never change, so changed content needs a new version.

Requires a live authorized control plane and a connected BYOA AWS account whose foundation is 8.5.0 or later (`saaslayer aws foundation upgrade` when needed).

| Subcommand | Description |
| --- | --- |
| [`cdn publish`](#cdn-publish) | Publish a directory as an immutable version of a package, using your own AWS credentials. |
| [`cdn withdraw`](#cdn-withdraw) | Withdraw a whole published version, with an audited reason. |

### `cdn publish`

Publish a directory as an immutable version of a package, using your own AWS credentials.

Uploads the files of `<dir>` as `<package>@<version>` with your own AWS credentials, then prints the manifest URL and snippets to use the assets. Requires a live authorized control plane and a connected BYOA account with foundation >=8.5.0; use `saaslayer aws foundation upgrade` when needed.

Identical retries verify the original bytes; changed content needs a new version. If the manifest is committed or its outcome is unknown, rerun the exact same command to verify it, and do not change the version's contents.

**Usage**

```bash
saaslayer cdn publish <dir> --package NAME --version SEMVER [--deployment ID | --project P --env E --region R]
  [--service cdn-service@INSTANCE] [--profile P] [--dry-run] [--json]
```

**Arguments**

* `dir` — Directory holding the assets to publish.

**Flags**

* `--package` (*string*, required) — Package name: one lowercase path segment (letters, digits, `.`, `_`, `-`).
* `--version` (*string*, required) — Exact semver of the version, without a `v` prefix or build metadata (for example `1.2.3` or `2.0.0-beta.1`).
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*, default `cdn-service`) — The cdn-service instance: `cdn-service` or `cdn-service@<instance>`.
* `--profile` (*string*) — AWS CLI profile whose credentials upload the assets; defaults to the AWS CLI default credential chain.
* `--dry-run` (*boolean*) — Show where the version would be published; reserves and uploads nothing.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer cdn publish ./dist --package widgets --version 1.2.3 --deployment dep_123abc
# Check the destination first, for a named cdn-service instance of the active project's staging deployment
saaslayer cdn publish ./dist --package widgets --version 1.2.3 --env staging --service cdn-service@assets --dry-run
```

### `cdn withdraw`

Withdraw a whole published version, with an audited reason.

Audited whole-version withdrawal. Waits for the product operation; retained assets and history stay reserved.

**Usage**

```bash
saaslayer cdn withdraw --package NAME --version SEMVER --reason TEXT [--deployment ID | --project P --env E --region R]
  [--service cdn-service@INSTANCE] [--dry-run] [--json]
```

**Flags**

* `--package` (*string*, required) — Package name: one lowercase path segment (letters, digits, `.`, `_`, `-`).
* `--version` (*string*, required) — Exact semver of the version, without a `v` prefix or build metadata (for example `1.2.3` or `2.0.0-beta.1`).
* `--reason` (*string*, required) — Why the version is withdrawn; recorded in the audit trail.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*, default `cdn-service`) — The cdn-service instance: `cdn-service` or `cdn-service@<instance>`.
* `--dry-run` (*boolean*) — Show what would be withdrawn without starting the withdrawal.
* `--interval` (*number*, default `5`) — How often to poll the withdrawal operation while waiting for it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer cdn withdraw --package widgets --version 1.2.3 --reason "leaked API key in bundle" --deployment dep_123abc
```

## `context`

Show what the CLI acts as and on: account, deployment login, AWS profile, org and project.

Show the control-plane account, the control-plane URL, the deployment login, the AWS profile, the org and the project (and where each came from), and every cached identity. Tokens are never printed.

The org and project are the local selection in `~/.saaslayer/context.json` (`SAASLAYER_HOME` selects another directory). `--project`, `--org` and `--env` on a command override it for that command; `--deployment` and `--as` pick a deployment login; `--profile` picks the AWS profile. Check it before connecting an AWS account or deploying.

**Usage**

```bash
saaslayer context [flags]
```

**Flags**

* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--profile` (*string*) — AWS CLI profile to report; defaults to `$AWS_PROFILE`, else the ambient AWS credentials.
* `--config-url` (*string*, env `SAASLAYER_CONFIG_URL`, default `https://api.saaslayer.com`) — Control-plane API to report.

**Examples**

```bash
saaslayer context
saaslayer context --json --profile my-profile
```

## `deploy`

Create a deployment of the project's modules, hosted or in your connected AWS account.

Create a deployment of the active project's modules in one environment. `deploy` only creates; `saaslayer deployment update` changes an existing deployment. Requires `saaslayer login`; `--hosting byoa` also needs a connected AWS account (`saaslayer aws connect`).

`--hosting hosted` runs the modules in a SaaSLayer AWS account (no AWS account of your own); `--hosting byoa` runs them in your connected account. Without `--hosting`, a project with a connected account deploys there and one without is hosted.

`--module` and `--set` take catalog module ids (`saaslayer catalog list`, e.g. `permissions-service`); an unknown id or a missing required module is refused before anything is sent.

`--version` (`saaslayer deployment releases list`) or `--channel` names the release to start on; without either the control plane picks its default (`stable`). With neither, the settings are checked against the schema of the default release `saaslayer catalog list` reports before anything is sent, and the create-only ones are listed; when the control plane reports no default release, the CLI says so and leaves the check to the control plane. The control plane always checks the settings too (it alone checks them for a `--version`).

Asks before creating anything, then confirms any cost estimate; `--yes` answers both and is required when not running in a terminal. Then waits for the deploy operation unless `--no-wait`.

Sign-in methods (user-service settings):

* `user-service.PrimaryLoginMethod` (`email`, the default, or `phone`) is permanent.
* Only the opposite method can be added as a second sign-in pool: `EnablePhoneLogin` on an email primary, `EnableEmailLogin` on a phone primary. `EnableEmailLogin=false` means no email pool is added, not that sign-in is off. Once accepted, an added method is never turned off.
* Phone sign-in needs `user-service.PhoneSmsAllowedCountries` (e.g. `US,CA`) and passes the SMS setup check first (`saaslayer aws sms status`; a failed check saves nothing).
* The permanent primary, added pools, countries and SMS/Cognito cost categories are printed before the confirmation.

**Usage**

```bash
saaslayer deploy [--module ID ...] [--settings FILE] [--set MODULE.Setting=VALUE ...]
  [--bind CONSUMER:DEPENDENCY=PROVIDER ...] [--env E] [--region R] [--hosting hosted|byoa] [--aws-account ACCOUNT_ID]
  [--version X.Y.Z | --channel NAME | --commit-sha SHA] [--admin-email EMAIL | --admin-phone-number +E164] [--yes] [--no-wait]
```

**Flags**

* `--module` (*string*, repeatable) — A catalog module id to deploy (a comma-separated list works too). Repeat once per module.
* `--settings` (*string*) — JSON file of create settings, `{ "<module>": { "<Setting>": value } }`. `--set` overrides its values.
* `--set` (*string*, repeatable) — A create setting, e.g. `user-service.PrimaryLoginMethod=phone`. A secret takes a reference, `ssm:/<parameter name>`. Overrides `--settings`; repeated inline keys use their last value.
* `--bind` (*string*, repeatable) — Select the instance a dependency uses, e.g. `scheduling-service:user-service=user-service@team`. Repeat it for each selected provider when the deployment has several instances of that service.
* `--project` (*string*) — Project id (tnt\_…) or customer id; defaults to the active project.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--env` (*string*, default `prod`) — Environment to create (for example dev, staging or prod).
* `--region` (*string*) — AWS region to deploy into.
* `--hosting` (*hosted | byoa*) — `hosted`: a SaaSLayer AWS account. `byoa`: your connected AWS account. Default: your connected account when the project has one, else hosted.
* `--aws-account` (*string*) — Your connected AWS account to deploy into. Not allowed with `--hosting hosted`.
* `--version` (*string*) — Release version to start on (`saaslayer deployment releases list`), checked against the control plane before the create.
* `--channel` (*string*) — Start on the release a channel points at now, e.g. `stable`.
* `--commit-sha` (*string*) — Start on a commit instead of a version; the settings are checked against that commit's schemas before anything is sent.
* `--admin-email` (*string*) — Email address of the deployment's first administrator.
* `--admin-phone-number` (*string*) — Phone number (E.164) of the first administrator of a phone-primary deployment; shown masked.
* `--yes` (*boolean*) — Confirm the create and any cost estimate without asking. Required when not running in a terminal.
* `--no-wait` (*boolean*) — Return once the deploy operation starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deploy --module user-service --module permissions-service --hosting byoa --env dev --region us-east-1 --admin-email admin@example.com
# Phone sign-in as the permanent primary, without prompts
saaslayer deploy --module user-service --set user-service.PrimaryLoginMethod=phone --set user-service.PhoneSmsAllowedCountries=US,CA --admin-phone-number +15555550123 --env dev --yes
# Start on a version, with settings from a file
saaslayer deploy --module user-service --settings settings.dev.json --version 1.4.0 --env dev
```

## `deployment`

Manage deployments, services, settings, operations and releases.

| Subcommand | Description |
| --- | --- |
| [`deployment create`](#deployment-create) | Create a deployment of the project's modules, hosted or in your connected AWS account. |
| [`deployment status`](#deployment-status) | Show the deployments of a project in every environment, or in one. |
| [`deployment update`](#deployment-update) | Move a deployment to another release or retry its deployed release. |
| [`deployment destroy`](#deployment-destroy) | Tear down a deployment, deleting or retaining its data, or purge what a retain destroy kept. |
| [`deployment service`](#deployment-service) | Add or remove a single service on an existing deployment. |
| [`deployment settings`](#deployment-settings) | Read and change a deployment's module settings, and compare environments. |
| [`deployment operations`](#deployment-operations) | Show, follow or cancel a deployment operation. |
| [`deployment activity`](#deployment-activity) | Read deployment activity. |
| [`deployment migrations`](#deployment-migrations) | Approve or run data migrations. |
| [`deployment releases`](#deployment-releases) | List, capture and promote releases. |

### `deployment create`

Create a deployment of the project's modules, hosted or in your connected AWS account.

Create a deployment of the active project's modules in one environment. `deploy` only creates; `saaslayer deployment update` changes an existing deployment. Requires `saaslayer login`; `--hosting byoa` also needs a connected AWS account (`saaslayer aws connect`).

`--hosting hosted` runs the modules in a SaaSLayer AWS account (no AWS account of your own); `--hosting byoa` runs them in your connected account. Without `--hosting`, a project with a connected account deploys there and one without is hosted.

`--module` and `--set` take catalog module ids (`saaslayer catalog list`, e.g. `permissions-service`); an unknown id or a missing required module is refused before anything is sent.

`--version` (`saaslayer deployment releases list`) or `--channel` names the release to start on; without either the control plane picks its default (`stable`). With neither, the settings are checked against the schema of the default release `saaslayer catalog list` reports before anything is sent, and the create-only ones are listed; when the control plane reports no default release, the CLI says so and leaves the check to the control plane. The control plane always checks the settings too (it alone checks them for a `--version`).

Asks before creating anything, then confirms any cost estimate; `--yes` answers both and is required when not running in a terminal. Then waits for the deploy operation unless `--no-wait`.

Sign-in methods (user-service settings):

* `user-service.PrimaryLoginMethod` (`email`, the default, or `phone`) is permanent.
* Only the opposite method can be added as a second sign-in pool: `EnablePhoneLogin` on an email primary, `EnableEmailLogin` on a phone primary. `EnableEmailLogin=false` means no email pool is added, not that sign-in is off. Once accepted, an added method is never turned off.
* Phone sign-in needs `user-service.PhoneSmsAllowedCountries` (e.g. `US,CA`) and passes the SMS setup check first (`saaslayer aws sms status`; a failed check saves nothing).
* The permanent primary, added pools, countries and SMS/Cognito cost categories are printed before the confirmation.

**Usage**

```bash
saaslayer deployment create [--module ID ...] [--settings FILE] [--set MODULE.Setting=VALUE ...]
  [--bind CONSUMER:DEPENDENCY=PROVIDER ...] [--env E] [--region R] [--hosting hosted|byoa] [--aws-account ACCOUNT_ID]
  [--version X.Y.Z | --channel NAME | --commit-sha SHA] [--admin-email EMAIL | --admin-phone-number +E164] [--yes] [--no-wait]
```

**Flags**

* `--module` (*string*, repeatable) — A catalog module id to deploy (a comma-separated list works too). Repeat once per module.
* `--settings` (*string*) — JSON file of create settings, `{ "<module>": { "<Setting>": value } }`. `--set` overrides its values.
* `--set` (*string*, repeatable) — A create setting, e.g. `user-service.PrimaryLoginMethod=phone`. A secret takes a reference, `ssm:/<parameter name>`. Overrides `--settings`; repeated inline keys use their last value.
* `--bind` (*string*, repeatable) — Select the instance a dependency uses, e.g. `scheduling-service:user-service=user-service@team`. Repeat it for each selected provider when the deployment has several instances of that service.
* `--project` (*string*) — Project id (tnt\_…) or customer id; defaults to the active project.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--env` (*string*, default `prod`) — Environment to create (for example dev, staging or prod).
* `--region` (*string*) — AWS region to deploy into.
* `--hosting` (*hosted | byoa*) — `hosted`: a SaaSLayer AWS account. `byoa`: your connected AWS account. Default: your connected account when the project has one, else hosted.
* `--aws-account` (*string*) — Your connected AWS account to deploy into. Not allowed with `--hosting hosted`.
* `--version` (*string*) — Release version to start on (`saaslayer deployment releases list`), checked against the control plane before the create.
* `--channel` (*string*) — Start on the release a channel points at now, e.g. `stable`.
* `--commit-sha` (*string*) — Start on a commit instead of a version; the settings are checked against that commit's schemas before anything is sent.
* `--admin-email` (*string*) — Email address of the deployment's first administrator.
* `--admin-phone-number` (*string*) — Phone number (E.164) of the first administrator of a phone-primary deployment; shown masked.
* `--yes` (*boolean*) — Confirm the create and any cost estimate without asking. Required when not running in a terminal.
* `--no-wait` (*boolean*) — Return once the deploy operation starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment create --module user-service --module permissions-service --hosting byoa --env dev --region us-east-1 --admin-email admin@example.com
# Phone sign-in as the permanent primary, without prompts
saaslayer deployment create --module user-service --set user-service.PrimaryLoginMethod=phone --set user-service.PhoneSmsAllowedCountries=US,CA --admin-phone-number +15555550123 --env dev --yes
# Start on a version, with settings from a file
saaslayer deployment create --module user-service --settings settings.dev.json --version 1.4.0 --env dev
```

### `deployment status`

Show the deployments of a project in every environment, or in one.

Show the deployed instances of a project: each one's environment, region, status, deployment id and release (its version, or the commit it was deployed at). A fleet state other than ACTIVE (for example migrations awaiting approval) is shown, and a RETIRED deployment shows when and by whom it was retired.

An unfiltered empty collection succeeds. A supplied deployment selector with no match returns a not-found result. Requires `saaslayer login`.

**Usage**

```bash
saaslayer deployment status [flags]
```

**Flags**

* `--deployment` (*string*) — Focus on one deployment by ID or environment; conflicting or ambiguous selectors fail.
* `--project` (*string*) — Project id (tnt\_…) or customer id; defaults to the active project.
* `--env` (*string*) — Show only this environment (for example dev, staging or prod); default every environment.
* `--region` (*string*) — Show only this AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment status
saaslayer deployment status --project tnt_123 --env dev
```

### `deployment update`

Move a deployment to another release or retry its deployed release.

Change the release using --version, --channel or --commit-sha, or retry the deployed release with --retry. Waits unless --no-wait. Use deployment settings set for settings and deployment releases promote for a tested manifest. Protected-environment gates and required reasons still apply.

**Usage**

```bash
saaslayer deployment update (--version X.Y.Z | --channel NAME) [--env E] [--region R] [--reason TEXT] [--force] [--no-wait]
saaslayer deployment update --retry [--env E] [--region R] [--reason TEXT] [--no-wait]
```

**Flags**

* `--version` (*string*) — Version to move the deployment to (`saaslayer deployment releases list`); checked against the control plane before the update.
* `--channel` (*string*) — Move to the release the channel points at now, e.g. `stable`. Once, not a subscription.
* `--commit-sha` (*string*) — Move to a commit instead of a version. Still works until the control plane refuses it.
* `--retry` (*boolean*) — Redeploy the deployed release with the stored settings. Takes no `--version`, `--channel`, `--commit-sha` or `--set`.
* `--force` (*boolean*) — Update past the drift gate (audited with the reason).
* `--reason` (*string*) — Why you are making the change; recorded with it. Required on the protected environments (staging, prod), and by `--set` for a billing or security change or an added sign-in method.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment update --version 1.4.0 --env staging --reason "release 1.4.0"
# Retry a failed update
saaslayer deployment update --retry --env dev
# Change one setting, keeping the release
```

### `deployment destroy`

Tear down a deployment, deleting or retaining its data, or purge what a retain destroy kept.

Tear down the project's deployment, confirmed by typing the project name (`--yes` confirms it). `--data-custody delete` removes its data (irreversible); `retain` keeps its data and leaves the deployment RETIRED: retained resources remain your organization's responsibility and cost until purged.

`--purge-retained` deletes what a retain destroy kept (irreversible).

A delete destroy or a purge prints its purgeResult: complete, pending (residual items AWS finishes later, with when) or incomplete (failed items and items outside SaaSLayer custody). A refusal because the account foundation is too old names `saaslayer aws foundation upgrade`. Waits for the operation unless `--no-wait`. Requires `saaslayer login`.

**Usage**

```bash
saaslayer deployment destroy --data-custody delete|retain [--region R] [--reason TEXT] [--acknowledge-cdn-outage] [--yes]
saaslayer deployment destroy --purge-retained --reason TEXT [--region R] [--yes]
```

**Flags**

* `--data-custody` (*delete | retain*) — `delete` removes the deployment's data (irreversible); `retain` keeps it and leaves the deployment RETIRED. Required unless `--purge-retained`.
* `--purge-retained` (*boolean*) — Delete the resources a retain destroy kept (irreversible). Takes no `--data-custody` and needs `--reason`.
* `--reason` (*string*) — Why you are tearing it down; recorded with the change. Required on the protected environments (staging, prod) and for every purge.
* `--acknowledge-cdn-outage` (*boolean*) — Acknowledge that CDN delivery stops. Its immutable assets, policies and logs remain in your AWS account and may incur charges.
* `--yes` (*boolean*) — Confirm without typing the project name.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment destroy --data-custody delete --env dev
# Keep the data, then purge it later
saaslayer deployment destroy --data-custody retain --env prod --reason "project retired"
saaslayer deployment destroy --purge-retained --env prod --reason "retention period over"
```

### `deployment service`

Add or remove a single service on an existing deployment.

Add or remove a single service on an existing deployment. Each waits for its operation unless `--no-wait`. Requires `saaslayer login`.

| Subcommand | Description |
| --- | --- |
| [`deployment service add`](#deployment-service-add) | Add a service to an existing deployment. |
| [`deployment service remove`](#deployment-service-remove) | Remove a service from an existing deployment, deleting or retaining its data. |

### `deployment service add`

Add a service to an existing deployment.

Add one service to an existing deployment. Its create settings are checked against the service's published settings schema at the deployment's revision before anything is sent.

**Usage**

```bash
saaslayer deployment service add <service> [flags]
```

**Arguments**

* `service` — Catalog module id (`saaslayer catalog list`), or `<module>@<instance>` for another instance of it.

**Flags**

* `--set` (*string*, repeatable) — A create setting for this service, keyed by its catalog module id (`user-service.Setting=VALUE` for `user-service@team`). Overrides the same setting in `--settings`.
* `--settings` (*string*) — JSON file of create settings for this service, `{ "<module>": { "<Setting>": value } }` with its catalog module id as the only key.
* `--bind` (*string*, repeatable) — Select the instance a dependency of this service uses, e.g. `scheduling-service:user-service=user-service@team`. Only this service can be the consumer.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.

**Examples**

```bash
saaslayer deployment service add scheduling-service --env dev
saaslayer deployment service add user-service@team --set user-service.AllowedAppOrigins=https://app.example.com --env dev
```

### `deployment service remove`

Remove a service from an existing deployment, deleting or retaining its data.

Remove one service from an existing deployment. A protected env (staging, prod) removal needs `--reason` and the service name typed to confirm (`--yes` confirms it).

**Usage**

```bash
saaslayer deployment service remove <service> --data-custody delete|retain [--region R] [--reason TEXT] [--acknowledge-cdn-outage] [--yes]
```

**Arguments**

* `service` — The service to remove, as the deployment names it (e.g. `user-service@team`).

**Flags**

* `--data-custody` (*delete | retain*, required) — `delete` removes the service's data (irreversible); `retain` keeps it.
* `--reason` (*string*) — Why you are removing it; recorded with the change. Required on the protected environments (staging, prod).
* `--acknowledge-cdn-outage` (*boolean*) — Acknowledge that CDN delivery stops. Its immutable assets, policies and logs remain in your AWS account and may incur charges.
* `--yes` (*boolean*) — Confirm a protected-environment removal without typing the service name.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.

**Examples**

```bash
saaslayer deployment service remove scheduling-service --data-custody delete --env dev
saaslayer deployment service remove scheduling-service --data-custody retain --env prod --reason "replaced by cron jobs" --yes
```

### `deployment settings`

Read and change a deployment's module settings, and compare environments.

Read and change a deployment's module settings. Each module has a published schema at its deployed revision; `saaslayer catalog schema` shows it. Use `saaslayer deployment settings set --set MODULE.Setting=VALUE` for a settings patch and `saaslayer deployment update` for a release change. Requires `saaslayer login`.

| Subcommand | Description |
| --- | --- |
| [`deployment settings get`](#deployment-settings-get) | Print a deployment's settings, their sources and the settings revision. |
| [`deployment settings set`](#deployment-settings-set) | Change a deployment's settings, checked against its schema first. |
| [`deployment settings diff`](#deployment-settings-diff) | Compare the settings and module revisions of two environments. |

### `deployment settings get`

Print a deployment's settings, their sources and the settings revision.

Print a deployment's settings: each value and its source (set | default | unset), the settings revision and any pending operation. A secret shows only whether it is set.

With phone sign-in requested, also each sign-in method's stage (accepted, provisioning, failed, created, ready; only ready signs in), why it is not ready and the next command (`saaslayer aws sms setup`, `saaslayer users first-admin resend`, `saaslayer deployment update --retry`).

**Usage**

```bash
saaslayer deployment settings get [flags]
```

**Flags**

* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment settings get --env dev
saaslayer deployment settings get --env prod --region us-east-1 --json
```

### `deployment settings set`

Change a deployment's settings, checked against its schema first.

Change settings; omitted settings are untouched. The change is checked against the deployment's schema before anything is sent: create-only, runtime and unknown settings are refused, and a secret takes a reference to an SSM SecureString in your account (`ssm:/<parameter name>`, or `{ "ssmParameter": "/<name>" }` in a file), never the value. A raw secret value is refused and never printed.

It is sent with the settings revision just read, so a concurrent change is refused: re-read and retry. Then it waits for the update operation unless `--no-wait`.

The login-domain settings (`user-service.CustomCognitoDomainName`, `CustomCognitoDomainCertificateArn`, `ActiveLoginDomain`) are set by `saaslayer users login-domain` and refused here (LOGIN_DOMAIN_MANAGED_SETTING).

**Usage**

```bash
saaslayer deployment settings set --env E (--set MODULE.Setting=VALUE ... | --settings settings.<env>.json) [--reason TEXT] [--no-wait]
```

**Flags**

* `--set` (*string*, repeatable) — A setting to change, e.g. `user-service.AllowedAppOrigins=https://app.example.com`. Overrides the same setting in `--settings`.
* `--settings` (*string*) — JSON file of settings, `{ "<module>": { "<Setting>": value } }`; `null` resets a setting to its default. Input to this one command, not a second copy of your settings.
* `--reason` (*string*) — Why you are making the change; recorded with it. Required for a billing or security change, an added sign-in method, and on the protected environments (staging, prod).
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the update operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment settings set --env dev --set user-service.AllowedAppOrigins=https://app.example.com
saaslayer deployment settings set --env prod --settings settings.prod.json --reason "raise the password minimum length"
```

### `deployment settings diff`

Compare the settings and module revisions of two environments.

Compare two environments: module revisions, differing settings (create-only and secret marked; secrets as set/unset) and each settings revision, plus the gaps between them.

With `--manifest`, each environment is also checked against the release: modules outside or behind the bundle, bundle modules it lacks, the permission-doc format it writes, and its deployed values against `environments.<env>.settings`.

**Usage**

```bash
saaslayer deployment settings diff --env A --env B [--manifest release.json] [--json]
```

**Flags**

* `--env` (*string*, required, repeatable) — An environment to compare; give exactly two different ones.
* `--manifest` (*string*) — Release manifest to check each environment against (`saaslayer deployment releases capture`).
* `--project` (*string*) — Project id; defaults to the active project.
* `--region` (*string*) — AWS region of both deployments, when an environment has deployments in several.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment settings diff --env staging --env prod
saaslayer deployment settings diff --env staging --env prod --manifest release.json --json
```

### `deployment operations`

Show, follow or cancel a deployment operation.

An operation is one deploy, update, service add/remove or destroy, with each component's outcome. `deploy`, `update`, `destroy` and `deployment service add|remove` wait for their operation by default (`--no-wait` returns once it starts); after a dropped connection, resume with `deployment operations watch`. Resume the existing operation after a disconnect. Re-running a mutation starts a new request; it does not resume the previous invocation. Requires `saaslayer login`.

| Subcommand | Description |
| --- | --- |
| [`deployment operations get`](#deployment-operations-get) | Show an operation and each component's outcome. |
| [`deployment operations watch`](#deployment-operations-watch) | Wait for an operation to finish, printing its progress. |
| [`deployment operations cancel`](#deployment-operations-cancel) | Cancel an in-flight operation and release the deployment. |

### `deployment operations get`

Show an operation and each component's outcome.

Show an operation: its status and each component's outcome.

**Usage**

```bash
saaslayer deployment operations get <operationId> [flags]
```

**Arguments**

* `operationId` — Operation id, as printed by the command that started it.

**Flags**

* `--deployment` (*string*) — Deployment the operation belongs to (dep\_…); without it, the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment, when `--deployment` is not given.
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment operations get op_123 --deployment dep_123abc
saaslayer deployment operations get op_123 --env dev --json
```

### `deployment operations watch`

Wait for an operation to finish, printing its progress.

Wait for an operation to finish, printing its status as it changes, then each component's outcome. A failed or partial operation exits non-zero and names the next supported command.

**Usage**

```bash
saaslayer deployment operations watch <operationId> [flags]
```

**Arguments**

* `operationId` — Operation id, as printed by the command that started it.

**Flags**

* `--deployment` (*string*) — Deployment the operation belongs to (dep\_…); without it, the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment, when `--deployment` is not given.
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--interval` (*number*, default `5`) — Seconds between polls.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment operations watch op_123 --deployment dep_123abc
```

### `deployment operations cancel`

Cancel an in-flight operation and release the deployment.

Cancel an in-flight operation: stops its run and releases the deployment for the next command. The deployment's activity records who cancelled it and the reason. A finished operation is refused. Needs the permission `saaslayer:deployer:deployment:cancel-run`.

**Usage**

```bash
saaslayer deployment operations cancel <operationId> [flags]
```

**Arguments**

* `operationId` — Operation id, as printed by the command that started it.

**Flags**

* `--deployment` (*string*) — Deployment the operation belongs to (dep\_…); without it, the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment, when `--deployment` is not given.
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--reason` (*string*) — Why you are cancelling it; recorded in the deployment's activity.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment operations cancel op_123 --deployment dep_123abc --reason "wrong version"
```

### `deployment activity`

Read deployment activity.

| Subcommand | Description |
| --- | --- |
| [`deployment activity list`](#deployment-activity-list) | Show a deployment's activity: every change, who made it and why, newest first. |

### `deployment activity list`

Show a deployment's activity: every change, who made it and why, newest first.

A deployment's activity, newest first: every change, yours and any SaaSLayer operator's, with who made it (`customer:<id>` | `operator:<id>`), the action, what it touched, the reason and its operation id. Requires `saaslayer login`.

**Usage**

```bash
saaslayer deployment activity list [flags]
```

**Flags**

* `--deployment` (*string*) — Deployment id (dep\_…); without it, the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment, when `--deployment` is not given.
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--limit` (*number*) — Most entries to show, 1 to 500.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment activity list --env dev
saaslayer deployment activity list --deployment dep_123abc --limit 20 --json
```

### `deployment migrations`

Approve or run data migrations.

| Subcommand | Description |
| --- | --- |
| [`deployment migrations approve`](#deployment-migrations-approve) | Approve the migrations an update run left awaiting approval. |
| [`deployment migrations status`](#deployment-migrations-status) | Show each service's migration ledger. |
| [`deployment migrations plan`](#deployment-migrations-plan) | List the migrations that would run, without running them. |
| [`deployment migrations dry-run`](#deployment-migrations-dry-run) | Run the pending migrations without writing, counting what they would write. |
| [`deployment migrations run`](#deployment-migrations-run) | Apply the pending migrations and report each service's ledger to SaaSLayer. |
| [`deployment migrations report`](#deployment-migrations-report) | Re-send each service's ledger to SaaSLayer after a lost report. |

### `deployment migrations approve`

Approve the migrations an update run left awaiting approval.

Approve the migrations an update left awaiting approval and start the run that applies them. `saaslayer deployment update` prints the run id. The control plane records you and the reason. Waits for the operation unless `--no-wait`.

**Usage**

```bash
saaslayer deployment migrations approve --run RUN_ID --reason TEXT [flags]
```

**Flags**

* `--run` (*string*, required) — The update run that left migrations awaiting approval.
* `--reason` (*string*, required) — Why you approve them; recorded with the approval.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment migrations approve --env prod --run run_123 --reason "rename retire reviewed"
```

### `deployment migrations status`

Show each service's migration ledger.

Read each service's migration ledger and print its status and applied migrations. Changes nothing.

**Usage**

```bash
saaslayer deployment migrations status (--deployment ID | --stack NAME --region R) [--service REF] [--repo PATH] [--profile AWS_PROFILE] [--json]
```

**Flags**

* `--deployment` (*string*) — Deployment whose services to migrate (dep\_…); its region and each service's deployed commit come from the control plane.
* `--stack` (*string*) — Standalone mode: the CloudFormation stack of one service, with no control plane and no report. Needs `--region`, with `--repo` the service directory.
* `--region` (*string*) — Standalone mode: the stack's AWS region.
* `--repo` (*string*) — The checkout to run from (the service directory in standalone mode); default the current directory.
* `--service` (*string*) — Only this service (its ref, e.g. `user-service` or `user-service@team`); default every service with migrations.
* `--profile` (*string*) — AWS CLI profile whose credentials assume the migrate role; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment migrations status --deployment dep_123abc
saaslayer deployment migrations status --stack sl-acme-dev-users --region us-east-1 --repo ./user-service
```

### `deployment migrations plan`

List the migrations that would run, without running them.

List each service's pending migrations, marking the destructive ones. Changes nothing.

**Usage**

```bash
saaslayer deployment migrations plan (--deployment ID | --stack NAME --region R) [--service REF] [--repo PATH] [--profile AWS_PROFILE] [--json]
```

**Flags**

* `--deployment` (*string*) — Deployment whose services to migrate (dep\_…); its region and each service's deployed commit come from the control plane.
* `--stack` (*string*) — Standalone mode: the CloudFormation stack of one service, with no control plane and no report. Needs `--region`, with `--repo` the service directory.
* `--region` (*string*) — Standalone mode: the stack's AWS region.
* `--repo` (*string*) — The checkout to run from (the service directory in standalone mode); default the current directory.
* `--service` (*string*) — Only this service (its ref, e.g. `user-service` or `user-service@team`); default every service with migrations.
* `--profile` (*string*) — AWS CLI profile whose credentials assume the migrate role; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment migrations plan --deployment dep_123abc --service user-service
```

### `deployment migrations dry-run`

Run the pending migrations without writing, counting what they would write.

Run each service's pending migrations in dry-run mode, which reports how many items each would write without writing them.

**Usage**

```bash
saaslayer deployment migrations dry-run (--deployment ID | --stack NAME --region R) [--service REF] [--repo PATH] [--profile AWS_PROFILE] [--json]
```

**Flags**

* `--deployment` (*string*) — Deployment whose services to migrate (dep\_…); its region and each service's deployed commit come from the control plane.
* `--stack` (*string*) — Standalone mode: the CloudFormation stack of one service, with no control plane and no report. Needs `--region`, with `--repo` the service directory.
* `--region` (*string*) — Standalone mode: the stack's AWS region.
* `--repo` (*string*) — The checkout to run from (the service directory in standalone mode); default the current directory.
* `--service` (*string*) — Only this service (its ref, e.g. `user-service` or `user-service@team`); default every service with migrations.
* `--profile` (*string*) — AWS CLI profile whose credentials assume the migrate role; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment migrations dry-run --deployment dep_123abc
```

### `deployment migrations run`

Apply the pending migrations and report each service's ledger to SaaSLayer.

Apply each service's pending migrations, then report each service's ledger to SaaSLayer (deployment mode only). A deployment whose `migrationRunner` is not `self` is refused (MIGRATION_RUNNER_NOT_SELF). A lost report never re-applies anything: re-send it with `deployment migrations report`.

Destructive migrations wait for approval (exit code 4) unless `--approve-destructive`.

**Usage**

```bash
saaslayer deployment migrations run (--deployment ID | --stack NAME --region R) [--service REF] [--approve-destructive --reason TEXT] [--repo PATH] [--profile AWS_PROFILE] [--json]
```

**Flags**

* `--deployment` (*string*) — Deployment whose services to migrate (dep\_…); its region and each service's deployed commit come from the control plane.
* `--stack` (*string*) — Standalone mode: the CloudFormation stack of one service, with no control plane and no report. Needs `--region`, with `--repo` the service directory.
* `--region` (*string*) — Standalone mode: the stack's AWS region.
* `--repo` (*string*) — The checkout to run from (the service directory in standalone mode); default the current directory.
* `--service` (*string*) — Only this service (its ref, e.g. `user-service` or `user-service@team`); default every service with migrations.
* `--profile` (*string*) — AWS CLI profile whose credentials assume the migrate role; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--approve-destructive` (*boolean*) — Approve the destructive migrations this run applies, as your AWS principal. Needs `--reason`.
* `--reason` (*string*) — Why you approve the destructive migrations; recorded with the approval.

**Examples**

```bash
saaslayer deployment migrations run --deployment dep_123abc
saaslayer deployment migrations run --deployment dep_123abc --service user-service --approve-destructive --reason "rename retire reviewed"
```

### `deployment migrations report`

Re-send each service's ledger to SaaSLayer after a lost report.

Re-send each service's ledger to SaaSLayer, read from the ledger (read-only), after `deployment migrations run` could not report it. A deployment whose `migrationRunner` is not `self` is refused (MIGRATION_RUNNER_NOT_SELF). Not available in standalone mode.

**Usage**

```bash
saaslayer deployment migrations report --deployment ID [flags]
```

**Flags**

* `--deployment` (*string*, required) — Deployment whose services to migrate (dep\_…); its region and each service's deployed commit come from the control plane.
* `--repo` (*string*) — The checkout to run from (the service directory in standalone mode); default the current directory.
* `--service` (*string*) — Only this service (its ref, e.g. `user-service` or `user-service@team`); default every service with migrations.
* `--profile` (*string*) — AWS CLI profile whose credentials assume the migrate role; defaults to the AWS CLI default credential chain.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment migrations report --deployment dep_123abc
```

### `deployment releases`

List, capture and promote releases.

| Subcommand | Description |
| --- | --- |
| [`deployment releases list`](#deployment-releases-list) | List the versions a deployment can move to, highest first. |
| [`deployment releases capture`](#deployment-releases-capture) | Record a tested deployment's release as a manifest. |
| [`deployment releases promote`](#deployment-releases-promote) | Promote a tested release manifest after validating its release and settings. |

### `deployment releases list`

List the versions a deployment can move to, highest first.

List the versions a deployment may move to, highest first: the channels on each (for example `stable`), whether the release is breaking, when it was cut, and which of the project's deployments run it. A deployment on an unversioned commit is listed apart. Move a deployment with `saaslayer deployment update --version X.Y.Z` (or `--channel stable`).

Without a selected project only the versions are listed. Requires `saaslayer login`.

**Usage**

```bash
saaslayer deployment releases list [flags]
```

**Flags**

* `--project` (*string*) — Project id (tnt\_…) or customer id whose deployments are shown beside each version; defaults to the active project.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--env` (*string*) — Environment shown in the scope line; the listing covers every environment.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment releases list
saaslayer deployment releases list --project tnt_123 --json
```

### `deployment releases capture`

Record a tested deployment's release as a manifest.

Record a tested deployment as a release manifest: its version (`bundle.version`; a deployment on an unversioned commit is refused, and `update --manifest` moves by that version) and revision, each module's settings-contract sha256, this CLI's version, and what its permissions-service writes (with user-service `EnableSso`, also `compatibility.permissions.sso`). A deployment running more than one revision is refused.

Add `permissionsDirectMode.readers` (an empty list when no app reads the permissions table directly) and `environments.<env>.settings` yourself.

**Usage**

```bash
saaslayer deployment releases capture --env E [--region R] [--out FILE] [--name NAME]
```

**Flags**

* `--out` (*string*) — Write the manifest to this file; default print it.
* `--name` (*string*) — A name for the release, stored in the manifest.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the tested deployment (for example dev or staging).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer deployment releases capture --env dev --out release.json
saaslayer deployment releases capture --env staging --name "1.4.0 tested" --out release.json
```

### `deployment releases promote`

Promote a tested release manifest after validating its release and settings.

Validate the manifest, target contracts, settings, direct-mode readers and protected-environment reason before applying the release and settings. Wait for the operation unless --no-wait.

**Usage**

```bash
saaslayer deployment releases promote --manifest FILE [--env E] [--settings FILE] [--reason TEXT] [--dry-run] [--no-wait]
```

**Flags**

* `--manifest` (*string*, required) — Tested release manifest to promote.
* `--settings` (*string*) — Environment settings instead of the manifest settings.
* `--dry-run` (*boolean*) — Show what would change without changing anything.
* `--reason` (*string*) — Why you are making the change; recorded in the activity log.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--deployment` (*string*) — Deployment id (dep\_…), or an environment name of the active project.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*) — Environment of the project (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Owning organization; defaults to the active organization.
* `--force` (*boolean*) — Proceed past the audited drift gate; does not bypass protection or consent.
* `--no-wait` (*boolean*) — Return once the operation starts.

**Examples**

```bash
saaslayer deployment releases promote --manifest release.json --env staging --reason "promote tested release" --dry-run
```

## `destroy`

Tear down a deployment, deleting or retaining its data, or purge what a retain destroy kept.

Tear down the project's deployment, confirmed by typing the project name (`--yes` confirms it). `--data-custody delete` removes its data (irreversible); `retain` keeps its data and leaves the deployment RETIRED: retained resources remain your organization's responsibility and cost until purged.

`--purge-retained` deletes what a retain destroy kept (irreversible).

A delete destroy or a purge prints its purgeResult: complete, pending (residual items AWS finishes later, with when) or incomplete (failed items and items outside SaaSLayer custody). A refusal because the account foundation is too old names `saaslayer aws foundation upgrade`. Waits for the operation unless `--no-wait`. Requires `saaslayer login`.

**Usage**

```bash
saaslayer destroy --data-custody delete|retain [--region R] [--reason TEXT] [--acknowledge-cdn-outage] [--yes]
saaslayer destroy --purge-retained --reason TEXT [--region R] [--yes]
```

**Flags**

* `--data-custody` (*delete | retain*) — `delete` removes the deployment's data (irreversible); `retain` keeps it and leaves the deployment RETIRED. Required unless `--purge-retained`.
* `--purge-retained` (*boolean*) — Delete the resources a retain destroy kept (irreversible). Takes no `--data-custody` and needs `--reason`.
* `--reason` (*string*) — Why you are tearing it down; recorded with the change. Required on the protected environments (staging, prod) and for every purge.
* `--acknowledge-cdn-outage` (*boolean*) — Acknowledge that CDN delivery stops. Its immutable assets, policies and logs remain in your AWS account and may incur charges.
* `--yes` (*boolean*) — Confirm without typing the project name.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer destroy --data-custody delete --env dev
# Keep the data, then purge it later
saaslayer destroy --data-custody retain --env prod --reason "project retired"
saaslayer destroy --purge-retained --env prod --reason "retention period over"
```

## `login`

Log in to your SaaSLayer account, or with --deployment to a deployment's user-service.

Log in to your SaaSLayer account (Cognito SRP) and cache the tokens in `~/.saaslayer`. The control-plane login selects the account for org, project and deploy commands; it is not a deployment administrator credential. When no org is active and the account belongs to exactly one, that org becomes the active org, and its project too when it has exactly one and none is active.

With `--deployment`, log in to a deployment's user-service as an access admin instead. The pool, client and API bases are discovered from the deployment's public outputs (an environment name resolves the active project's deployment). The deployment login is kept separately: your control-plane login stays logged in. `saaslayer users` and `saaslayer permissions` commands act as it.

Both forms answer the same challenges: a first-login password change through `--new-password-stdin` (or a hidden prompt in a terminal), and MFA through `--mfa-code` (or a hidden prompt). Secrets are never echoed.

**Usage**

```bash
saaslayer login [--email E --password P] [--config-url URL | --user-pool-id ID --client-id ID --region R]
saaslayer login --deployment <dep_id|env> [--user-service-instance NAME] [--permissions-instance NAME] [--project P] [--region R] [--config-url URL]
```

**Flags**

* `--env` (*string*) — Validate the deployment environment with --deployment; management login labels use --control-plane.
* `--email` (*string*, env `SAASLAYER_EMAIL`) — Account email; prompted when absent.
* `--password` (*string*, env `SAASLAYER_PASSWORD`, secret) — Account password; prompted (hidden) when absent.
* `--new-password-stdin` (*boolean*) — Read the new password from stdin when the account must change its password at first login. Without it, a terminal prompts twice (hidden); without a terminal the login fails.
* `--mfa-code` (*string*, secret) — The 6-digit MFA code, used once: a rejected code fails the login. Without it, a terminal prompts (up to 3 attempts); without a terminal the login fails.
* `--control-plane` (*string*, default `prod`) — Label for the control plane this login belongs to, stored with the cached account and printed by `whoami`, `account list` and `context`. Control-plane login only.
* `--user-pool-id` (*string*, env `SAASLAYER_USER_POOL_ID`) — Log in to this Cognito user pool directly instead of the one the control plane names. Needs `--client-id`; ignored when `--config-url` or `$SAASLAYER_CONFIG_URL` is set (the control plane then supplies the pool).
* `--client-id` (*string*, env `SAASLAYER_USER_POOL_CLIENT_ID`) — App client of `--user-pool-id`.
* `--region` (*string*) — With `--user-pool-id`, the pool region (default `$SAASLAYER_USER_POOL_REGION`, then `$AWS_REGION`, else us-east-1). With `--deployment` and an environment name, picks the deployment in that region.
* `--deployment` (*string*) — Log in to this deployment's user-service: a deployment id (dep\_…), or an environment of the project.
* `--user-service-instance` (*string*) — With `--deployment`, the named user-service instance to log in to (default: the default instance).
* `--permissions-instance` (*string*) — With `--deployment`, the named permissions-service instance whose API the login uses.
* `--project` (*string*) — With `--deployment` and an environment name, the project; defaults to the active project.

**Examples**

```bash
saaslayer login
# Without a terminal: password from $SAASLAYER_PASSWORD
saaslayer login --email you@example.com --mfa-code 123456
# Log in to the dev deployment's user-service
saaslayer login --deployment dev
saaslayer login --deployment dep_123abc --user-service-instance admin
```

| Subcommand | Description |
| --- | --- |
| [`login sessions`](#login-sessions) | List and switch cached deployment sessions. |

### `login sessions`

List and switch cached deployment sessions.

Deployment logins come from `saaslayer login --deployment` and are kept apart from your control-plane login. Deployment commands act as the current one.

| Subcommand | Description |
| --- | --- |
| [`login sessions list`](#login-sessions-list) | List cached deployment sessions. |
| [`login sessions use`](#login-sessions-use) | Select the deployment login that deployment commands act as. |

### `login sessions list`

List cached deployment sessions.

List cached deployment sessions, most recently used first; `*` marks the current one and an expired token is flagged.

**Usage**

```bash
saaslayer login sessions list
```

**Examples**

```bash
saaslayer login sessions list
```

### `login sessions use`

Select the deployment login that deployment commands act as.

Select the deployment login that deployment commands act as. `--deployment` and `--as` on a command pick one for that command; when several match, the command fails and names the flag to add.

**Usage**

```bash
saaslayer login sessions use (<dep_id|env> | --deployment DEP_ID|ENV) [--as <email>] [--user-service-instance NAME]
```

**Arguments**

* `dep_id|env` (optional) — Deployment id (dep\_…) or environment of a cached deployment login. Or pass `--deployment`.

**Flags**

* `--deployment` (*string*) — Same as the `<dep_id|env>` argument, which wins when both are given.
* `--as` (*string*) — Pick the login of this email (or user id) when several match.
* `--user-service-instance` (*string*) — Pick the login of this named user-service instance when several match.

**Examples**

```bash
saaslayer login sessions use dev
saaslayer login sessions use dep_123abc --as admin@example.com
```

## `logout`

Clear a cached control-plane account, or with --deployment a deployment login.

Clear the current control-plane account, or the one `--user` names. Deployment logins are kept.

With `--deployment` (or `--as`, `--user-service-instance`), clear one deployment login instead; the control-plane login is kept. When several deployment logins match, the command fails and names the flag to add.

**Usage**

```bash
saaslayer logout [--user <email|userId>]
saaslayer logout --deployment <dep_id|env> [--as <email>] [--user-service-instance NAME]
```

**Flags**

* `--user` (*string*) — The cached control-plane account to clear, by email or user id; defaults to the active account.
* `--deployment` (*string*) — Clear the deployment login of this deployment id (dep\_…) or environment.
* `--as` (*string*) — Clear the deployment login of this email (or user id).
* `--user-service-instance` (*string*) — Clear the deployment login of this named user-service instance.

**Examples**

```bash
saaslayer logout
saaslayer logout --user you@example.com
saaslayer logout --deployment dev --as admin@example.com
```

## `org`

Create, list and select your SaaSLayer orgs, and manage their members.

An org owns projects and connected AWS accounts. Requires login (`saaslayer login`).

The active org is remembered locally (`saaslayer context` shows it) and is the default for commands that take `--org`.

These are your SaaSLayer account orgs, not a deployment's runtime orgs (`saaslayer permissions orgs`).

| Subcommand | Description |
| --- | --- |
| [`org create`](#org-create) | Create an org, with you as its owner, and make it the active org. |
| [`org list`](#org-list) | List the orgs you belong to. |
| [`org members`](#org-members) | Manage who belongs to an org and who may deploy (org owners only). |
| [`org use`](#org-use) | Set the active org. |

### `org create`

Create an org, with you as its owner, and make it the active org.

You become the org's owner. Prints the new org's name and id.

**Usage**

```bash
saaslayer org create <name>
```

**Arguments**

* `name` — Display name of the org.

**Examples**

```bash
saaslayer org create "Acme"
```

### `org list`

List the orgs you belong to.

Prints each org's id and name, one per line.

**Usage**

```bash
saaslayer org list
```

**Examples**

```bash
saaslayer org list
```

### `org members`

Manage who belongs to an org and who may deploy (org owners only).

Org owners only. Members are managed by account id: the teammate prints theirs with `saaslayer whoami`.

A member is either a plain member or a deployer. A deployer may update deployments and cancel its own runs; owner powers stay with owners.

`--org` defaults to the active org.

| Subcommand | Description |
| --- | --- |
| [`org members add`](#org-members-add) | Add an account to the org by account id, optionally as a deployer. |
| [`org members list`](#org-members-list) | List the org's members with their email and role. |
| [`org members remove`](#org-members-remove) | Remove a member from the org. |
| [`org members set-role`](#org-members-set-role) | Make a member a deployer, or a plain member again. |

### `org members add`

Add an account to the org by account id, optionally as a deployer.

Shows the account's email and asks for it to be typed back unless `--yes`. An account whose email is not verified is refused (`EMAIL_NOT_PROVEN`); its owner verifies it with `saaslayer account verify-email`.

**Usage**

```bash
saaslayer org members add (--user ACCOUNT_ID | <accountId>) [--role deployer] [--org ID] [--yes]
```

**Arguments**

* `accountId` (optional) — Account id of the member; the same as `--user`.

**Flags**

* `--user` (*string*) — Account id of the member (they print it with `saaslayer whoami`). It can also be given as the argument.
* `--role` (*string*) — `deployer` also lets the member deploy. It is the only role an owner grants; omit it for a plain member.
* `--org` (*string*) — Org id; defaults to the active org.
* `--yes` (*boolean*) — Add without typing the account's email to confirm.

**Examples**

```bash
saaslayer org members add --user usr_123
# Add a deployer to another org, without the confirmation
saaslayer org members add --user usr_123 --role deployer --org org_123 --yes
```

### `org members list`

List the org's members with their email and role.

Prints each member's account id, email and role (`owner`, `deployer` or `member`).

**Usage**

```bash
saaslayer org members list [flags]
```

**Flags**

* `--org` (*string*) — Org id; defaults to the active org.

**Examples**

```bash
saaslayer org members list
saaslayer org members list --org org_123
```

### `org members remove`

Remove a member from the org.

Revokes the member's deployer role first, then the membership.

**Usage**

```bash
saaslayer org members remove (--user ACCOUNT_ID | <accountId>) [--org ID]
```

**Arguments**

* `accountId` (optional) — Account id of the member; the same as `--user`.

**Flags**

* `--user` (*string*) — Account id of the member (they print it with `saaslayer whoami`). It can also be given as the argument.
* `--org` (*string*) — Org id; defaults to the active org.

**Examples**

```bash
saaslayer org members remove --user usr_123
```

### `org members set-role`

Make a member a deployer, or a plain member again.

`--role deployer` grants the deployer role; `--role member` revokes it.

**Usage**

```bash
saaslayer org members set-role (--user ACCOUNT_ID | <accountId>) --role deployer|member [--org ID]
```

**Arguments**

* `accountId` (optional) — Account id of the member; the same as `--user`.

**Flags**

* `--user` (*string*) — Account id of the member (they print it with `saaslayer whoami`). It can also be given as the argument.
* `--role` (*string*, required) — `deployer` lets the member deploy; `member` takes that away.
* `--org` (*string*) — Org id; defaults to the active org.

**Examples**

```bash
saaslayer org members set-role --user usr_123 --role deployer
```

### `org use`

Set the active org.

The active org is stored locally and used by commands that take `--org` when you omit it.

**Usage**

```bash
saaslayer org use <id>
```

**Arguments**

* `id` — Org id.

**Examples**

```bash
saaslayer org use org_123
```

## `permissions`

Manage a deployment's permissions: catalog, roles, admins, API keys and login providers.

Commands that call a deployment's permissions API, at `--api-base URL` (or `$SAASLAYER_API_BASE`). They authenticate with one of:

* your deployment login (`saaslayer login --deployment`); `--deployment`, `--as` or `--user-service-instance` picks one when you have several;
* an API key: `--token KEY` or `$SAASLAYER_TOKEN` (`$SAASLAYER_TOKEN` next to a current deployment login is refused: pass --token, --iam or --deployment to choose);
* one of your declared IAM principals: `--iam PRINCIPAL`, with your AWS credentials (`--profile`, `--region`);
* an external ID token: `--id-token-file FILE` or `$SAASLAYER_ID_TOKEN`.

External ID token: `--id-token-file FILE` (or `$SAASLAYER_ID_TOKEN`) sends the raw OIDC ID token from your own login provider (Cognito, Auth0, Okta, …) as the credential, for example `saaslayer permissions access-admins activate --id-token-file id.jwt --deployment dep_123abc`. It goes only to a pinned host: `--deployment <dep_id|env>` (its permissions API, read through the control plane with your `saaslayer login`; commands that need --api-base must name that same API) or an https `--api-base` whose host you type to confirm (`--yes` confirms).

Pass the ID token, not an access token: Cognito access tokens carry no `aud`, and the deployment only accepts a token whose `aud` is one of the provider's allowed audiences. Use a dedicated app client for administrators so its client id can be the only admin audience. Expired tokens and access tokens are refused locally, before anything is sent. An ID token is never combined with --iam, --token, `$SAASLAYER_TOKEN` or a deployment login, and is never printed. Keep the file chmod 600.

| Subcommand | Description |
| --- | --- |
| [`permissions register`](#permissions-register) | Register a service's permissions manifest under the product that owns it. |
| [`permissions inspect`](#permissions-inspect) | Print a principal's or a session's permissions, with size stats and paging. |
| [`permissions model`](#permissions-model) | Apply, show or export a product's authorization model. |
| [`permissions owner`](#permissions-owner) | Bootstrap or reconcile the owners of a product's orgs. |
| [`permissions service-principal`](#permissions-service-principal) | List, grant or revoke the roles of a service principal, and issue verifier keys. |
| [`permissions machine-trust`](#permissions-machine-trust) | Manage the AWS IAM roles the deployment trusts as machines. |
| [`permissions access-admins`](#permissions-access-admins) | Manage the deployment's administrators and hand the role over. |
| [`permissions support-staff`](#permissions-support-staff) | Grant, revoke or list the deployment's support staff. |
| [`permissions orgs`](#permissions-orgs) | Create a deployment's runtime orgs, add members and set hook-joinable roles. |
| [`permissions api-keys`](#permissions-api-keys) | Create, list, show and revoke scoped API keys on the deployment's permissions API. |
| [`permissions trust-policies`](#permissions-trust-policies) | Manage the external login providers whose ID tokens the deployment accepts. |
| [`permissions audit`](#permissions-audit) | Manage a deployment's audit trail. |

### `permissions register`

Register a service's permissions manifest under the product that owns it.

Upserts the manifest into the permissions catalog (`POST /catalog/register`) under its product; a service belongs to exactly one product. Publishes a new registry snapshot version, live in every container within 60 s. Run it by hand or from CI. Prints the service, its product, its resource type count and the registry version.

Needs `saaslayer:catalog:service:register`: a deployment administrator holds it; a machine (`--iam`) needs the `catalog:register` scope and a grant of it.

**Usage**

```bash
saaslayer permissions register <manifest.json> --api-base URL [flags]
```

**Arguments**

* `manifest.json` — Path to the service's permissions manifest.

**Flags**

* `--product` (*string*) — Product that owns the service; defaults to the manifest's `product`, and is required when the manifest has none.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
# From CI, with an API key in $SAASLAYER_TOKEN
saaslayer permissions register ./manifest.json --product acme --api-base https://api.example.com
# As one of your IAM principals
saaslayer permissions register ./manifest.json --api-base https://api.example.com --iam ci-deployer --profile my-profile
```

### `permissions inspect`

Print a principal's or a session's permissions, with size stats and paging.

Prints a principal's permissions: the assignments table (role, scope, direct / inherited / derived, expiry), then the global allows and denies, then each scope's, with the granting role or policy and conditions. Always prints size stats: item bytes against the 340 KB gate, defs, ref sets and scopes. Scopes and assignments page independently, and the output ends with copy-paste commands for the next pages. Works the same for v1 and v2 (compact) stored docs: the CLI reads the server's expanded view and never parses the stored format.

`session:<id>` inspects a session's stored permission set instead.

Needs `saaslayer:identity` read authority over the principal. An API key must carry it explicitly: a key without explicit permissions confers none, even when its owner is an admin. Exits 1 with a message on 401, 403 or 404 (no authority, or the principal is not where you have authority) and on a malformed reference.

**Usage**

```bash
saaslayer permissions inspect <TYPE:id> --api-base URL [flags]
```

**Arguments**

* `TYPE:id` — The principal as `TYPE:id` (for example `USER:alice` or `SERVICE_ACCOUNT:svc-1`), or `session:<id>`.

**Flags**

* `--scope` (*string*, repeatable) — Show only this scope (at most 50). Turns off scope paging.
* `--scope-page` (*string*) — Show the next page of scopes, from the cursor the previous run printed. A 409 means the doc was rebuilt: start again without a cursor.
* `--assignment-page` (*string*) — Show the next page of assignments, from the cursor the previous run printed.
* `--all-scopes` (*boolean*) — Follow every scope page. Restarts once, with a message, if the doc is rebuilt mid-way.
* `--stored` (*boolean*) — Print the stored doc's inspection model instead: its format label ("Stored v1" / "Stored v2 (compact)"), sizes, counts, defs / ref sets or v1 buckets, and validation problems.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions inspect USER:alice --api-base https://api.example.com
# Only two scopes
saaslayer permissions inspect USER:alice --scope org_123 --scope site:org_123:s1 --api-base https://api.example.com
# Every scope page, as JSON for scripting
saaslayer permissions inspect USER:alice --all-scopes --json --api-base https://api.example.com
# A session's stored permission set
saaslayer permissions inspect session:sess_123 --api-base https://api.example.com
```

### `permissions model`

Apply, show or export a product's authorization model.

A product's versioned authorization model is its role catalog: the managed system roles its permissions API serves. The registry snapshot is what every container of the permissions API loads.

| Subcommand | Description |
| --- | --- |
| [`permissions model apply`](#permissions-model-apply) | Apply a product's authorization model to its permissions API. |
| [`permissions model export`](#permissions-model-export) | Write the published registry snapshot to a file. |
| [`permissions model get`](#permissions-model-get) | Print the authorization model currently applied for a product. |

### `permissions model apply`

Apply a product's authorization model to its permissions API.

Applies a product's versioned authorization model (role catalog: managed system roles) to its permissions API, for the product the manifest names. Fails if the manifest's selfCheck fails.

Prints the plan and the role diff (added, changed, removed with their assignment counts, unchanged, adopted), the selfCheck result and the registry version published. Fails if written roles are not verified on read-back.

**Usage**

```bash
saaslayer permissions model apply <authorization-model.json> --api-base URL [flags]
```

**Arguments**

* `authorization-model.json` — Path to the product's authorization model manifest.

**Flags**

* `--dry-run` (*boolean*) — Print the plan and the role diff without writing.
* `--allow-orphan` (*boolean*) — Allow removing roles that still have assignments.
* `--adopt` (*boolean*) — Convert org-owned roles with catalog ids into shared catalog roles; their assignments are kept.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions model apply ./authorization-model.json --api-base https://api.example.com --iam ci-deployer --dry-run
saaslayer permissions model apply ./authorization-model.json --api-base https://api.example.com --iam ci-deployer --profile my-profile
```

### `permissions model export`

Write the published registry snapshot to a file.

Writes the currently published registry snapshot (`{ meta, snapshot }`) to FILE: the pinned registry that `@saaslayer/permissions` direct mode loads at deploy. Prints the snapshot version and the path written.

**Usage**

```bash
saaslayer permissions model export --snapshot --out FILE --api-base URL [flags]
```

**Flags**

* `--snapshot` (*boolean*, required) — Export the registry snapshot, the only export format.
* `--out` (*string*, required) — File to write.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions model export --snapshot --out registry.json --api-base https://api.example.com --iam ci-deployer
```

### `permissions model get`

Print the authorization model currently applied for a product.

Prints, as JSON, the authorization model currently applied for a product: its version, content hash, role ids and manifest.

**Usage**

```bash
saaslayer permissions model get <product> --api-base URL [flags]
```

**Arguments**

* `product` — Product id, as in its manifest's `product`.

**Flags**

* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions model get acme --api-base https://api.example.com --iam ci-deployer
```

### `permissions owner`

Bootstrap or reconcile the owners of a product's orgs.

The owners of the deployment's runtime orgs, by the product's owner role.

| Subcommand | Description |
| --- | --- |
| [`permissions owner bootstrap`](#permissions-owner-bootstrap) | Make a member the first owner of an org. |
| [`permissions owner reconcile`](#permissions-owner-reconcile) | Compare each org's owner counter with a live recount. Report only unless --apply. |

### `permissions owner bootstrap`

Make a member the first owner of an org.

Makes a member the FIRST owner of an org; refused once the org has an owner. Prints `<user> is now <role> of <scope>`.

Needs `saaslayer:catalog:owner:bootstrap` (a machine: the `owners:bootstrap` scope and a grant of it).

**Usage**

```bash
saaslayer permissions owner bootstrap <product> --org ORG --user USER --api-base URL [flags]
```

**Arguments**

* `product` — Product whose owner role to grant.

**Flags**

* `--org` (*string*, required) — Org to give its first owner.
* `--user` (*string*, required) — User id (suid) of the member to make owner.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions owner bootstrap acme --org org_123 --user usr_123 --api-base https://api.example.com --iam ci-deployer
```

### `permissions owner reconcile`

Compare each org's owner counter with a live recount. Report only unless --apply.

Compares each org's owner counter with a live recount and prints one line per org (`ok` or `DRIFT`, with the counter and the actual count). Report only unless --apply.

Needs `saaslayer:catalog:owner:reconcile` (a machine: the `catalog:write` scope and a grant of it).

**Usage**

```bash
saaslayer permissions owner reconcile <product> --api-base URL [flags]
```

**Arguments**

* `product` — Product whose orgs to check.

**Flags**

* `--org` (*string*) — Check only this org.
* `--complete-owners` (*boolean*) — Also grant the product's ownerRole to every org's platform owners (`saaslayer:org-owner`) who lack it, and print the counts. Dry run unless --apply; resumes from its checkpoint.
* `--apply` (*boolean*) — Repair mismatched counters and, with --complete-owners, make the grants.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions owner reconcile acme --api-base https://api.example.com --iam ci-deployer
# Repair drift and grant missing owner roles
saaslayer permissions owner reconcile acme --complete-owners --apply --api-base https://api.example.com --iam ci-deployer
```

### `permissions service-principal`

List, grant or revoke the roles of a service principal, and issue verifier keys.

A service principal is a service account id, or a declared IAM principal's mapped principal (`iam.PRINCIPAL`, chosen with `--machine PRINCIPAL`), which acts with its machine-trust scopes AND these grants. Role commands need `roles:role:{assign,unassign}` + `identity:principal:read`.

| Subcommand | Description |
| --- | --- |
| [`permissions service-principal roles`](#permissions-service-principal-roles) | List a service principal's role assignments. |
| [`permissions service-principal grant`](#permissions-service-principal-grant) | Grant a role to a service principal. |
| [`permissions service-principal revoke`](#permissions-service-principal-revoke) | Revoke a role from a service principal. |
| [`permissions service-principal verifier-key`](#permissions-service-principal-verifier-key) | Issue keys that can only verify API keys. |

### `permissions service-principal roles`

List a service principal's role assignments.

Prints the service principal's role assignments (role and scope) as JSON.

**Usage**

```bash
saaslayer permissions service-principal roles (<id> | --machine PRINCIPAL) --api-base URL [flags]
```

**Arguments**

* `id` (optional) — Service principal (service account) id. Omit it with --machine.

**Flags**

* `--machine` (*string*) — Target the mapped principal (`iam.PRINCIPAL`) of this declared IAM principal instead of \<id>.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions service-principal roles --machine ci-deployer --api-base https://api.example.com
saaslayer permissions service-principal roles svc-billing --api-base https://api.example.com
```

### `permissions service-principal grant`

Grant a role to a service principal.

Grants a role, deployment-wide unless --scope names an org scope. Prints the role, the principal and the scope.

Needs `roles:role:assign` + `identity:principal:read`.

**Usage**

```bash
saaslayer permissions service-principal grant (<id> | --machine PRINCIPAL) --role ROLE --api-base URL [flags]
```

**Arguments**

* `id` (optional) — Service principal (service account) id. Omit it with --machine.

**Flags**

* `--machine` (*string*) — Target the mapped principal (`iam.PRINCIPAL`) of this declared IAM principal instead of \<id>.
* `--role` (*string*, required) — Role id to grant.
* `--scope` (*string*) — Org scope to grant the role in; deployment-wide when omitted.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions service-principal grant --machine ci-deployer --role acme:publisher --api-base https://api.example.com
# In one org only
saaslayer permissions service-principal grant svc-billing --role acme:billing-reader --scope org_123 --api-base https://api.example.com
```

### `permissions service-principal revoke`

Revoke a role from a service principal.

Revokes the role, at --scope when given. Prints the role revoked.

Needs `roles:role:unassign` + `identity:principal:read`.

**Usage**

```bash
saaslayer permissions service-principal revoke (<id> | --machine PRINCIPAL) --role ROLE --api-base URL [flags]
```

**Arguments**

* `id` (optional) — Service principal (service account) id. Omit it with --machine.

**Flags**

* `--machine` (*string*) — Target the mapped principal (`iam.PRINCIPAL`) of this declared IAM principal instead of \<id>.
* `--role` (*string*, required) — Role id to revoke.
* `--scope` (*string*) — Org scope the role was granted in; deployment-wide when omitted.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions service-principal revoke --machine ci-deployer --role acme:publisher --api-base https://api.example.com
```

### `permissions service-principal verifier-key`

Issue keys that can only verify API keys.

| Subcommand | Description |
| --- | --- |
| [`permissions service-principal verifier-key create`](#permissions-service-principal-verifier-key-create) | Issue a service account a key that can only verify API keys. Prints it once. |

### `permissions service-principal verifier-key create`

Issue a service account a key that can only verify API keys. Prints it once.

Issues service account \<id> (created, owned by you, when missing) a deployment-wide key whose only permission is verifying API keys, for a backend that accepts its users' keys. Prints the key id and the key, once.

Needs `keys:api-key:issue-verifier`.

To rotate: create a new key, deploy it, then revoke the old one (`DELETE /api-keys/<keyId>`).

**Usage**

```bash
saaslayer permissions service-principal verifier-key create <id> --api-base URL [flags]
```

**Arguments**

* `id` — Service account id.

**Flags**

* `--ssm-parameter` (*string*) — Also write the key to this SSM SecureString parameter (replacing the key it held), with your AWS credentials.
* `--api-base` (*string*, required, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. With an ID token pinned by --deployment, it must be that deployment's permissions API.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region of --ssm-parameter (required with it; defaults to $AWS_REGION) and of the --iam token exchange (defaults to $AWS_REGION, else us-west-2).
* `--profile` (*string*) — AWS CLI profile whose credentials --ssm-parameter and --iam use; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions service-principal verifier-key create svc-billing --api-base https://api.example.com
# Store it in SSM for your backend
saaslayer permissions service-principal verifier-key create svc-billing --ssm-parameter /acme/prod/verifier-key --region us-east-1 --profile my-profile --api-base https://api.example.com
```

### `permissions machine-trust`

Manage the AWS IAM roles the deployment trusts as machines.

The deployment's trusted AWS IAM roles (machine trust), managed through the permissions API, which writes the backing SSM parameter. A declaration grants nothing: grant roles with `permissions service-principal grant --machine`. Changes reach already-issued `iam_` tokens within 60 s.

Every machine call needs scope AND grant (`broker:<p>` and attest routes are scope-only). Scopes:

* `catalog:read`, `catalog:write`, `catalog:register`, `owners:bootstrap`
* `orgs:read`, `orgs:write`
* `users:read`, `users:write`, `users:write-reserved`, `users:set-password`, `users:adopt`
* `machine-trust:read`, `machine-trust:write`
* `broker:<p>`, `attributes:attest:<p>`, `context:attest:<p>`

Authenticate with an access-admin login (`saaslayer login --deployment`), `--token KEY` or `--iam PRINCIPAL`. Each command prints its result as JSON.

| Subcommand | Description |
| --- | --- |
| [`permissions machine-trust list`](#permissions-machine-trust-list) | List the deployment's machine-trust declarations. |
| [`permissions machine-trust get`](#permissions-machine-trust-get) | Show one machine-trust declaration. |
| [`permissions machine-trust declare`](#permissions-machine-trust-declare) | Declare an IAM role the deployment trusts, with its scope ceiling. Grants nothing. |
| [`permissions machine-trust update`](#permissions-machine-trust-update) | Change a declaration's IAM role or scope ceiling. |
| [`permissions machine-trust remove`](#permissions-machine-trust-remove) | Remove a declaration and unassign every role of its mapped principal. |
| [`permissions machine-trust reconcile`](#permissions-machine-trust-reconcile) | Rewrite the deployment's backing SSM parameter from the declarations. |

### `permissions machine-trust list`

List the deployment's machine-trust declarations.

**Usage**

```bash
saaslayer permissions machine-trust list (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust list --api-base https://api.example.com
```

### `permissions machine-trust get`

Show one machine-trust declaration.

**Usage**

```bash
saaslayer permissions machine-trust get <principalId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `principalId` — Declared IAM principal id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust get ci-deployer --api-base https://api.example.com
```

### `permissions machine-trust declare`

Declare an IAM role the deployment trusts, with its scope ceiling. Grants nothing.

Declares that the AWS IAM role may act as the machine \<principalId>, within the given scopes (its scope ceiling). It grants nothing: grant roles to its mapped principal with `permissions service-principal grant --machine <principalId>`.

**Usage**

```bash
saaslayer permissions machine-trust declare <principalId> --role-arn ARN --scope SCOPE [--scope SCOPE…] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `principalId` — Principal id for the machine; its mapped principal is `iam.<principalId>`.

**Flags**

* `--role-arn` (*string*, required) — ARN of the AWS IAM role to trust.
* `--scope` (*string*, required, repeatable) — Scope the machine may use. Scopes are listed in `saaslayer permissions machine-trust --help`.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust declare ci-deployer --role-arn arn:aws:iam::123456789012:role/ci-deployer --scope catalog:register --scope catalog:write --api-base https://api.example.com
```

### `permissions machine-trust update`

Change a declaration's IAM role or scope ceiling.

Give --role-arn, --scope or both.

**Usage**

```bash
saaslayer permissions machine-trust update <principalId> [--role-arn ARN] [--scope SCOPE…] [--expected-revision N] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `principalId` — Declared IAM principal id.

**Flags**

* `--role-arn` (*string*) — ARN of the AWS IAM role to trust instead.
* `--scope` (*string*, repeatable) — Scope the machine may use. The given scopes become its whole scope ceiling.
* `--expected-revision` (*number*) — Change the declaration only if it is still at this revision (an integer).
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust update ci-deployer --scope catalog:register --expected-revision 3 --api-base https://api.example.com
```

### `permissions machine-trust remove`

Remove a declaration and unassign every role of its mapped principal.

Removes the declaration and unassigns every role of the mapped principal (`iam.<principalId>`); the report lists each.

**Usage**

```bash
saaslayer permissions machine-trust remove <principalId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `principalId` — Declared IAM principal id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust remove ci-deployer --api-base https://api.example.com
```

### `permissions machine-trust reconcile`

Rewrite the deployment's backing SSM parameter from the declarations.

**Usage**

```bash
saaslayer permissions machine-trust reconcile (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions machine-trust reconcile --api-base https://api.example.com
```

### `permissions access-admins`

Manage the deployment's administrators and hand the role over.

The deployment's administrators (`saaslayer:access-admin`). At least one usable human administrator always remains: enabled, and activated (signed in themselves with a verified email or phone number); machines never count. So the last one can't be revoked, disabled, deleted or unverified (`409 LAST_ADMIN`).

To add or replace an administrator, `offer` grants them the role at once; it counts once they `accept` with their own deployment login. Each command prints its result as JSON. See https://saaslayer.com/docs/permissions/access-admins.

| Subcommand | Description |
| --- | --- |
| [`permissions access-admins list`](#permissions-access-admins-list) | List the administrators and how many count as usable. |
| [`permissions access-admins offer`](#permissions-access-admins-offer) | Offer the administrator role to a user, handing over your seat or adding one. |
| [`permissions access-admins status`](#permissions-access-admins-status) | Show an administrator transfer. |
| [`permissions access-admins cancel`](#permissions-access-admins-cancel) | Cancel a pending offer you made; its grant is revoked. |
| [`permissions access-admins accept`](#permissions-access-admins-accept) | Accept an administrator offer made to you. |
| [`permissions access-admins activate`](#permissions-access-admins-activate) | Record your own activation as an administrator. |

### `permissions access-admins list`

List the administrators and how many count as usable.

**Usage**

```bash
saaslayer permissions access-admins list (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins list --api-base https://api.example.com
```

### `permissions access-admins offer`

Offer the administrator role to a user, handing over your seat or adding one.

Grants \<suid> the `saaslayer:access-admin` role at once; it counts once they accept with their own deployment login. With `--mode transfer` (the default) you are then removed; `--mode add` keeps you. Prints the transfer, whose id they accept.

**Usage**

```bash
saaslayer permissions access-admins offer <suid> [--mode transfer|add] [--expires-in-hours N] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `suid` — User id of the person to offer the role; find one with `saaslayer users get --email`.

**Flags**

* `--mode` (*transfer | add*, default `transfer`) — `transfer` removes you once they accept; `add` keeps you.
* `--expires-in-hours` (*number*) — Hours until the offer expires.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins offer usr_123 --api-base https://api.example.com
# Add a second administrator and stay one yourself
saaslayer permissions access-admins offer usr_123 --mode add --expires-in-hours 48 --api-base https://api.example.com
```

### `permissions access-admins status`

Show an administrator transfer.

**Usage**

```bash
saaslayer permissions access-admins status <transferId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `transferId` — Transfer id printed by `offer`.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins status tr_123 --api-base https://api.example.com
```

### `permissions access-admins cancel`

Cancel a pending offer you made; its grant is revoked.

**Usage**

```bash
saaslayer permissions access-admins cancel <transferId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `transferId` — Transfer id of your pending offer.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins cancel tr_123 --api-base https://api.example.com
```

### `permissions access-admins accept`

Accept an administrator offer made to you.

Run it signed in as yourself, with a verified email or phone number: your deployment login, or an ID token. An interrupted accept leaves both admins; accept again to finish.

**Usage**

```bash
saaslayer permissions access-admins accept <transferId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `transferId` — Transfer id of the offer.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins accept tr_123 --api-base https://api.example.com
saaslayer permissions access-admins accept tr_123 --id-token-file id.jwt --deployment dep_123abc
```

### `permissions access-admins activate`

Record your own activation as an administrator.

Run it signed in as yourself, with a verified email or phone number: your deployment login, or an ID token. An administrator counts as usable once activated.

**Usage**

```bash
saaslayer permissions access-admins activate (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions access-admins activate --id-token-file id.jwt --deployment dep_123abc
```

### `permissions support-staff`

Grant, revoke or list the deployment's support staff.

Support staff view as a member of any org without belonging to it. `saaslayer:support-view-only` refuses every write while viewing; `saaslayer:support-act-as` also allows them; reserved operations stay refused. The role is granted at deployment scope. Each command prints its result as JSON.

See https://saaslayer.com/docs/permissions/support-staff for sessions, modes and the impersonation settings.

| Subcommand | Description |
| --- | --- |
| [`permissions support-staff grant`](#permissions-support-staff-grant) | Make a user support staff, view-only or act-as. |
| [`permissions support-staff revoke`](#permissions-support-staff-revoke) | Revoke a user's support staff role. |
| [`permissions support-staff list`](#permissions-support-staff-list) | List support staff with their mode and expiry. |

### `permissions support-staff grant`

Make a user support staff, view-only or act-as.

Only an access admin signed in themselves grants it: `--id-token-file` or a deployment login, never an API key or IAM machine. Find a suid with `saaslayer users get --email`.

**Usage**

```bash
saaslayer permissions support-staff grant <suid> --mode view-only|act-as [--expires-at ISO] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `suid` — User id of the person.

**Flags**

* `--mode` (*view-only | act-as*, required) — `view-only` is the `saaslayer:support-view-only` role (every write refused while viewing); `act-as` is `saaslayer:support-act-as` (view-only and act-as sessions).
* `--expires-at` (*string*) — When it expires, as an ISO 8601 time; never when omitted.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions support-staff grant usr_123 --mode act-as --expires-at 2027-01-01T00:00:00Z --id-token-file id.jwt --deployment dep_123abc
saaslayer permissions support-staff grant usr_123 --mode view-only --api-base https://api.example.com
```

### `permissions support-staff revoke`

Revoke a user's support staff role.

Only an access admin signed in themselves revokes it: `--id-token-file` or a deployment login, never an API key or IAM machine.

**Usage**

```bash
saaslayer permissions support-staff revoke <suid> --mode view-only|act-as (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `suid` — User id of the person.

**Flags**

* `--mode` (*view-only | act-as*, required) — Which support role to revoke: `view-only` (`saaslayer:support-view-only`) or `act-as` (`saaslayer:support-act-as`).
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions support-staff revoke usr_123 --mode act-as --id-token-file id.jwt --deployment dep_123abc
```

### `permissions support-staff list`

List support staff with their mode and expiry.

Prints each support staff member: user id, mode, role and expiry.

**Usage**

```bash
saaslayer permissions support-staff list (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions support-staff list --id-token-file id.jwt --deployment dep_123abc
```

### `permissions orgs`

Create a deployment's runtime orgs, add members and set hook-joinable roles.

A deployment's runtime orgs, not your SaaSLayer account org (that is `saaslayer org`). Create an org, add users with `members add`, then `permissions owner bootstrap` makes a member its first owner. Each command prints its result as JSON.

| Subcommand | Description |
| --- | --- |
| [`permissions orgs create`](#permissions-orgs-create) | Create a runtime org in the deployment. |
| [`permissions orgs members`](#permissions-orgs-members) | Add users to a runtime org. |
| [`permissions orgs hook-joinable`](#permissions-orgs-hook-joinable) | Set which roles a user-service lifecycle hook may grant in an org. |

### `permissions orgs create`

Create a runtime org in the deployment.

Needs `orgs:write` (an access admin holds it).

**Usage**

```bash
saaslayer permissions orgs create <name> [--id ID] [--description TEXT] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `name` — Org name.

**Flags**

* `--id` (*string*) — Org id; generated when omitted.
* `--description` (*string*) — Org description.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions orgs create "Acme Inc" --api-base https://api.example.com
saaslayer permissions orgs create "Acme Inc" --id org_123 --description "Pilot customer" --api-base https://api.example.com
```

### `permissions orgs members`

Add users to a runtime org.

| Subcommand | Description |
| --- | --- |
| [`permissions orgs members add`](#permissions-orgs-members-add) | Add a user to a runtime org. |

### `permissions orgs members add`

Add a user to a runtime org.

Needs `orgs:write` (an access admin holds it). Then `permissions owner bootstrap` can make them the org's first owner.

**Usage**

```bash
saaslayer permissions orgs members add <orgId> --user <suid> [--email EMAIL] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `orgId` — Org id.

**Flags**

* `--user` (*string*, required) — User id to add.
* `--email` (*string*) — Email stored as a profile copy for member lists.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions orgs members add org_123 --user usr_123 --email you@example.com --api-base https://api.example.com
```

### `permissions orgs hook-joinable`

Set which roles a user-service lifecycle hook may grant in an org.

Which roles one user-service instance's lifecycle hook may grant in the org: exact role ids, at most 20; privileged roles are refused. Only an owner of the org, signed in as themselves (deployment login), may change it.

| Subcommand | Description |
| --- | --- |
| [`permissions orgs hook-joinable set`](#permissions-orgs-hook-joinable-set) | Publish the roles one user-service instance's lifecycle hook may grant in an org. |
| [`permissions orgs hook-joinable disable`](#permissions-orgs-hook-joinable-disable) | Stop an org's lifecycle hooks granting any role. |

### `permissions orgs hook-joinable set`

Publish the roles one user-service instance's lifecycle hook may grant in an org.

Publishes the list for that --consumer. Privileged or unknown roles are refused (400); anyone but an owner of the org signed in as themselves is refused (403). Prints the org's hook-joinable policy.

**Usage**

```bash
saaslayer permissions orgs hook-joinable set <orgId> --consumer <user-service@<deploymentId>/<instance>> --role <roleId> [--role …]
  (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `orgId` — Org id.

**Flags**

* `--consumer` (*string*, required) — The user-service instance whose hook may grant the roles, as `user-service@<deploymentId>/<instance>`.
* `--role` (*string*, required, repeatable) — Role id the hook may grant (at most 20).
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions orgs hook-joinable set org_123 --consumer user-service@dep_123abc/default --role acme:member --role acme:viewer --api-base https://api.example.com
```

### `permissions orgs hook-joinable disable`

Stop an org's lifecycle hooks granting any role.

Prints the org's hook-joinable policy.

**Usage**

```bash
saaslayer permissions orgs hook-joinable disable <orgId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `orgId` — Org id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions orgs hook-joinable disable org_123 --api-base https://api.example.com
```

### `permissions api-keys`

Create, list, show and revoke scoped API keys on the deployment's permissions API.

Scoped API keys on the deployment's permissions API, for deployments without a console (for example permissions-only with an outside login provider). A key never holds more than the caller holds. Each command prints its result as JSON.

| Subcommand | Description |
| --- | --- |
| [`permissions api-keys create`](#permissions-api-keys-create) | Create a scoped API key. Prints the key once. |
| [`permissions api-keys list`](#permissions-api-keys-list) | List the API keys you may see. |
| [`permissions api-keys get`](#permissions-api-keys-get) | Show one API key. |
| [`permissions api-keys revoke`](#permissions-api-keys-revoke) | Revoke an API key; it stops authenticating at once. |

### `permissions api-keys create`

Create a scoped API key. Prints the key once.

The key holds exactly its --allow permissions minus --deny, never more than the caller holds. Prints the key once, with its id.

**Usage**

```bash
saaslayer permissions api-keys create --user OWNER --name NAME --allow PERMISSION [--allow …] [--deny …] [--scope ORG]
  [--expires-at ISO] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--user` (*string*, required) — User id of the key's owner.
* `--name` (*string*, required) — Key name.
* `--allow` (*string*, required, repeatable) — Permission the key holds, as `service:resource:action` (or `product:service:resource:action`).
* `--deny` (*string*, repeatable) — Permission taken out of the --allow set, in the same format.
* `--scope` (*string*) — Limit the key to this org scope.
* `--expires-at` (*string*) — When it expires, as an ISO 8601 time; never when omitted.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions api-keys create --user usr_123 --name reporting --allow acme:reports:read --api-base https://api.example.com
# Limited to one org, with an exception, expiring
saaslayer permissions api-keys create --user usr_123 --name ci --allow acme:projects:read --allow acme:projects:write --deny acme:projects:delete --scope org_123 --expires-at 2027-01-01T00:00:00Z --id-token-file id.jwt --deployment dep_123abc
```

### `permissions api-keys list`

List the API keys you may see.

**Usage**

```bash
saaslayer permissions api-keys list [--user OWNER] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--limit` (*number*) — Page size from 1 to 100. Without pagination flags, retains the existing unpaged listing.
* `--cursor` (*string*) — Opaque nextCursor returned by the previous page; defaults the page size to 50 when limit is omitted.
* `--user` (*string*) — Only this owner's keys.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions api-keys list --api-base https://api.example.com
saaslayer permissions api-keys list --user usr_123 --api-base https://api.example.com
```

### `permissions api-keys get`

Show one API key.

**Usage**

```bash
saaslayer permissions api-keys get <keyId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `keyId` — Key id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions api-keys get key_123 --api-base https://api.example.com
```

### `permissions api-keys revoke`

Revoke an API key; it stops authenticating at once.

**Usage**

```bash
saaslayer permissions api-keys revoke <keyId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `keyId` — Key id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions api-keys revoke key_123 --api-base https://api.example.com
```

### `permissions trust-policies`

Manage the external login providers whose ID tokens the deployment accepts.

The external login providers (OIDC issuers: your Cognito pool, Auth0, Okta, …) whose ID tokens the deployment accepts. Needs an access admin (or a trust-manager holder); an administrator who signs in through such a provider passes `--id-token-file FILE` (see `saaslayer permissions --help`).

Providers added here are external (people get `ext_` principal ids) and never impersonate; the deployment's own pool is read-only (`409 FIRST_PARTY_POLICY`). A change that would leave no usable access admin a way to sign in is refused (`409 LAST_ADMIN_PROVIDER`). Each command prints its result as JSON.

| Subcommand | Description |
| --- | --- |
| [`permissions trust-policies list`](#permissions-trust-policies-list) | List the login providers the deployment trusts. |
| [`permissions trust-policies get`](#permissions-trust-policies-get) | Show one trusted login provider. |
| [`permissions trust-policies create`](#permissions-trust-policies-create) | Trust an external OIDC login provider. |
| [`permissions trust-policies update`](#permissions-trust-policies-update) | Change a provider's audiences, subject rule, signing keys URL or description. |
| [`permissions trust-policies disable`](#permissions-trust-policies-disable) | Stop trusting a login provider without deleting it. |
| [`permissions trust-policies enable`](#permissions-trust-policies-enable) | Trust a disabled login provider again. |
| [`permissions trust-policies delete`](#permissions-trust-policies-delete) | Delete a login provider; everyone who signs in through it loses access. |

### `permissions trust-policies list`

List the login providers the deployment trusts.

**Usage**

```bash
saaslayer permissions trust-policies list (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies list --id-token-file id.jwt --deployment dep_123abc
```

### `permissions trust-policies get`

Show one trusted login provider.

**Usage**

```bash
saaslayer permissions trust-policies get <policyId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `policyId` — Trust policy id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies get tp_123 --api-base https://api.example.com
```

### `permissions trust-policies create`

Trust an external OIDC login provider.

\<issuerUrl> is the EXACT `iss` of the provider's ID tokens, an https URL: add reads `<issuerUrl>/.well-known/openid-configuration` and refuses unless it names that issuer. Give a subject rule, --subject or --allow-any-subject: a policy with neither authorizes nobody.

**Usage**

```bash
saaslayer permissions trust-policies create <issuerUrl> --audience CLIENT_ID [--audience …] (--subject SUBJECT … | --allow-any-subject)
  [--principal-claim CLAIM] [--jwks-uri URL] [--description TEXT] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `issuerUrl` — The exact `iss` of the provider's ID tokens.

**Flags**

* `--audience` (*string*, required, repeatable) — Accepted `aud` of the provider's ID tokens (an app client id).
* `--subject` (*string*, repeatable) — Accept only this subject (`sub`). Not with --allow-any-subject.
* `--allow-any-subject` (*boolean*) — Accept every subject the provider signs in.
* `--principal-claim` (*string*, default `sub`) — ID token claim used as the person's principal id. It can't change later.
* `--jwks-uri` (*string*) — URL of the provider's signing keys; defaults to the `jwks_uri` of its discovery document.
* `--description` (*string*) — Description of the provider.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies create https://acme.okta.com --audience 0oa1admin --allow-any-subject --id-token-file id.jwt --deployment dep_123abc
# Only two people of a Cognito pool
saaslayer permissions trust-policies create https://cognito-idp.us-east-1.amazonaws.com/us-east-1_AbC123 --audience 1example23456789 --subject sub-1 --subject sub-2 --api-base https://api.example.com
```

### `permissions trust-policies update`

Change a provider's audiences, subject rule, signing keys URL or description.

The issuer and principal claim never change: they key every principal the provider signs in. Add a new provider instead.

**Usage**

```bash
saaslayer permissions trust-policies update <policyId> [--audience CLIENT_ID …] [--subject SUBJECT … | --allow-any-subject]
  [--jwks-uri URL] [--description TEXT] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `policyId` — Trust policy id.

**Flags**

* `--audience` (*string*, repeatable) — Accepted `aud` of the provider's ID tokens.
* `--subject` (*string*, repeatable) — Accept only this subject (`sub`). Not with --allow-any-subject.
* `--allow-any-subject` (*boolean*) — Accept every subject the provider signs in.
* `--jwks-uri` (*string*) — URL of the provider's signing keys.
* `--description` (*string*) — Description of the provider.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies update tp_123 --audience 0oa1admin --audience 0oa2admin --api-base https://api.example.com
```

### `permissions trust-policies disable`

Stop trusting a login provider without deleting it.

**Usage**

```bash
saaslayer permissions trust-policies disable <policyId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `policyId` — Trust policy id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies disable tp_123 --api-base https://api.example.com
```

### `permissions trust-policies enable`

Trust a disabled login provider again.

**Usage**

```bash
saaslayer permissions trust-policies enable <policyId> (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `policyId` — Trust policy id.

**Flags**

* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Send an ID token to --api-base without typing its host to confirm.

**Examples**

```bash
saaslayer permissions trust-policies enable tp_123 --api-base https://api.example.com
```

### `permissions trust-policies delete`

Delete a login provider; everyone who signs in through it loses access.

Asks you to type the issuer to confirm (--yes confirms).

**Usage**

```bash
saaslayer permissions trust-policies delete <policyId> --reason TEXT [--yes] (--api-base URL | --deployment ID --id-token-file FILE) [flags]
```

**Arguments**

* `policyId` — Trust policy id.

**Flags**

* `--reason` (*string*, required) — Why you are deleting it; sent with the request.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except when --deployment pins an ID token: then the API is resolved for you and a different --api-base is refused.
* `--deployment` (*string*) — Deployment (dep\_… id or environment name) whose deployment login to use. With an ID token, sends it only to this deployment's permissions API, read through the control plane with your `saaslayer login`.
* `--project` (*string*) — Project whose environment --deployment names, when an ID token is pinned that way; defaults to the active project.
* `--as` (*string*) — Use the deployment login of this email or user id.
* `--user-service-instance` (*string*) — Use the deployment login made through this user-service instance.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). Keep the file chmod 600. See `saaslayer permissions --help`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for the --iam token exchange; defaults to $AWS_REGION, else us-west-2. With an ID token and --deployment naming an environment, also the region of that environment's deployment.
* `--profile` (*string*) — AWS CLI profile whose credentials --iam uses; defaults to the AWS CLI default credential chain.
* `--yes` (*boolean*) — Delete without typing the issuer to confirm (and send an ID token to --api-base without typing its host).

**Examples**

```bash
saaslayer permissions trust-policies delete tp_123 --reason "Moved to the new Okta tenant" --api-base https://api.example.com
```

### `permissions audit`

Manage a deployment's audit trail.

Commands on a deployment's audit trail, through its permissions API.

| Subcommand | Description |
| --- | --- |
| [`permissions audit erase`](#permissions-audit-erase) | Erase a person from a deployment's audit trail (GDPR). |

### `permissions audit erase`

Erase a person from a deployment's audit trail (GDPR).

GDPR erasure of a person from the deployment's audit trail, through its permissions API (`POST /audit/identities/:personId/erase`). Their name and email come off every audit entry that names them, and each `--email` address comes off the invitation entries holding it; ids and events stay. The erasure itself is recorded as `audit.identity_erased` (ids only).

Invitation entries are found only by the addresses you pass: give every address the person had, including any the deployment never knew.

For operators, and to retry the erasure after `saaslayer users delete`. Needs the platform-only scope `audit:person:erase` (an IAM principal or API key granted it; org admins never have it); a `403` says so. A `503` means the deployment has no audit table.

Prints `{ personId, status, emails: <count> }`; addresses are never printed. `status` is `done`, or `requested` when the sweep did not finish in the request: the deployment's audit worker then finishes it within minutes. There is no status read, so the command does not wait. Safe to run again, with more addresses; each run records another `audit.identity_erased` entry.

**Usage**

```bash
saaslayer permissions audit erase <suid> [--email E …] (--iam PRINCIPAL [--region R] [--profile P] | --token KEY)
  (--api-base PERMISSIONS_URL | --deployment <dep_id|env> [--config-url URL] | --discovery-url URL)
```

**Arguments**

* `suid` — The person's SaaSLayer id.

**Flags**

* `--email` (*string*, repeatable) — An address to erase from the invitation entries; repeat for each address the person had (at most 50).
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam`; default `$AWS_REGION`, else us-west-2.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — The deployment's permissions API, instead of discovering it.
* `--deployment` (*string*) — Discover the permissions API from this deployment's public outputs: a deployment id (dep\_…) or an environment of the active project.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: `--deployment` (its permissions API, read through the control plane with your `saaslayer login`; a different `--api-base` is refused) or an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer permissions audit erase usr_123 --email you@example.com --email old@example.com --iam eraser --deployment dep_123abc
saaslayer permissions audit erase usr_123 --token $API_KEY --api-base https://api.example.com
```

## `project`

Create, select, destroy and transfer projects.

A project belongs to an org and holds its deployments. Requires login (`saaslayer login`).

The active project is remembered locally (`saaslayer context` shows it) and is the default for `deploy`, `status` and the other commands that take `--project`.

| Subcommand | Description |
| --- | --- |
| [`project list`](#project-list) | List the projects of the active org. |
| [`project create`](#project-create) | Create a project in the active org and make it the active project. |
| [`project destroy`](#project-destroy) | Delete a project and release its public name for reuse. |
| [`project use`](#project-use) | Set the active project for deploy, status and other project commands. |
| [`project transfer`](#project-transfer) | Offer, inspect and decide project transfers. |

### `project list`

List the projects of the active org.

Prints each project's id and name, one per line. Requires login (`saaslayer login`). Select one with `saaslayer project use <id>`.

**Usage**

```bash
saaslayer project list [flags]
```

**Flags**

* `--org` (*string*) — Org whose projects are listed; defaults to the active org.

**Examples**

```bash
saaslayer project list
saaslayer project list --org org_123
```

### `project create`

Create a project in the active org and make it the active project.

Prints the new project's name and id, and its org.

**Usage**

```bash
saaslayer project create <name> [--slug <slug>] [--org ID]
```

**Arguments**

* `name` — Display name of the project.

**Flags**

* `--slug` (*string*) — Public deploy name: letter-first, lowercase letters, digits and hyphens, at most 15 characters. Derived from the name when omitted.
* `--org` (*string*) — Org to create the project in; defaults to the active org.

**Examples**

```bash
saaslayer project create "Acme app" --slug acme-app
saaslayer project create "Acme app" --org org_123
```

### `project destroy`

Delete a project and release its public name for reuse.

Refused while any of its deployments is live: destroy each with `saaslayer deployment destroy` first. Asks for the project id to be typed unless `--yes`. Needs `saaslayer:deployer:project:delete`.

Prints the public names it released, and any held by another project that it left alone.

**Usage**

```bash
saaslayer project destroy [id] [flags]
```

**Arguments**

* `id` (optional) — Project id; defaults to the active project.

**Flags**

* `--yes` (*boolean*) — Destroy without typing the project id to confirm.

**Examples**

```bash
saaslayer project destroy tnt_123
```

### `project use`

Set the active project for deploy, status and other project commands.

The active project is stored locally and used by commands that take `--project` when you omit it.

**Usage**

```bash
saaslayer project use <id>
```

**Arguments**

* `id` — A project id (`tnt_…`) or a customer id.

**Examples**

```bash
saaslayer project use tnt_123
```

### `project transfer`

Offer, inspect and decide project transfers.

| Subcommand | Description |
| --- | --- |
| [`project transfer offer`](#project-transfer-offer) | Offer a project and all its deployments to another org. |
| [`project transfer accept`](#project-transfer-accept) | Accept a transfer offered to your org. |
| [`project transfer cancel`](#project-transfer-cancel) | Cancel your org's transfer of a project. |
| [`project transfer decline`](#project-transfer-decline) | Decline a transfer offered to your org. |
| [`project transfer get`](#project-transfer-get) | Show the project's current or latest transfer. |
| [`project transfer list`](#project-transfer-list) | List your org's project transfers, newest first, with their status. |

### `project transfer offer`

Offer a project and all its deployments to another org.

Source-org owners offer the project (the active one by default) to another org. Prints the members of your org whose access to the project ends. The offer expires (default 72 hours). Refused for a billed project (`PROJECT_BILLED`) or while another transfer of it is pending (`PROJECT_TRANSFER_PENDING`).

An owner of the destination org then accepts or declines; source-org owners can cancel. An accepted transfer is executed by SaaSLayer at a scheduled time; the project keeps working until then.

**Usage**

```bash
saaslayer project transfer offer [projectId] --to-org ORG_ID --reason TEXT [flags]
```

**Arguments**

* `projectId` (optional) — Project id; defaults to the active project. A project id can never be `show`, `accept`, `decline` or `cancel`: those words select the subcommands.

**Flags**

* `--to-org` (*string*, required) — Org that receives the project.
* `--reason` (*string*, required) — Why you are offering the project; shown to the destination org's owners (at most 500 characters).
* `--expires-in-hours` (*number*, default `72`) — Hours until the offer expires: a whole number, at most 168.

**Examples**

```bash
saaslayer project transfer offer tnt_123 --to-org org_123 --reason "Moving to the Acme org"
# Offer the active project for one day
saaslayer project transfer offer --to-org org_123 --reason "Moving to the Acme org" --expires-in-hours 24
```

### `project transfer accept`

Accept a transfer offered to your org.

Destination-org owners only. Checks that your org holds an active connection to every AWS account the project deploys into, that the project's slug is free and that your deployment quota fits, and names what is missing.

An accepted transfer is executed by SaaSLayer at a scheduled time; the project keeps working until then.

**Usage**

```bash
saaslayer project transfer accept [projectId] [flags]
```

**Arguments**

* `projectId` (optional) — Project id; defaults to the active project.

**Flags**

* `--reason` (*string*) — Note sent with your decision (at most 500 characters).

**Examples**

```bash
saaslayer project transfer accept tnt_123
```

### `project transfer cancel`

Cancel your org's transfer of a project.

Source-org owners only. Cancels an offered or accepted transfer.

**Usage**

```bash
saaslayer project transfer cancel [projectId] [flags]
```

**Arguments**

* `projectId` (optional) — Project id; defaults to the active project.

**Flags**

* `--reason` (*string*) — Note sent with your decision (at most 500 characters).

**Examples**

```bash
saaslayer project transfer cancel tnt_123 --reason "Offered to the wrong org"
```

### `project transfer decline`

Decline a transfer offered to your org.

Destination-org owners only.

**Usage**

```bash
saaslayer project transfer decline [projectId] [flags]
```

**Arguments**

* `projectId` (optional) — Project id; defaults to the active project.

**Flags**

* `--reason` (*string*) — Note sent with your decision (at most 500 characters).

**Examples**

```bash
saaslayer project transfer decline tnt_123
```

### `project transfer get`

Show the project's current or latest transfer.

Prints its status, the source and destination orgs, who offered it and when the offer expires, the deployments it moves, the members who lose access, and the next step.

**Usage**

```bash
saaslayer project transfer get [projectId]
```

**Arguments**

* `projectId` (optional) — Project id; defaults to the active project.

**Examples**

```bash
saaslayer project transfer get tnt_123
```

### `project transfer list`

List your org's project transfers, newest first, with their status.

Org owners only. Prints each transfer's id, direction, project, the other org, status and creation time.

**Usage**

```bash
saaslayer project transfer list [--org ID] [--incoming | --outgoing]
```

**Flags**

* `--org` (*string*) — Org id; defaults to the active org.
* `--incoming` (*boolean*) — Only transfers into the org. Not with `--outgoing`.
* `--outgoing` (*boolean*) — Only transfers out of the org. Not with `--incoming`.

**Examples**

```bash
saaslayer project transfer list
saaslayer project transfer list --incoming
```

## `signup`

Create a SaaSLayer account, confirm the emailed code and log in.

Create a SaaSLayer account, confirm the code emailed to you (prompted, or `--code`), and log in (choosing the active org as `saaslayer login` does). Signup is allowlist-gated: an email without beta admission is refused, and creating AWS resources does not grant admission.

Without a terminal it stops once the code is sent and prints the command that finishes it (`saaslayer signup --email E --code C`). An email that already has an account is refused with a pointer to `saaslayer login`, or to `--code` for a pending signup. When the account is confirmed but no password is available, it prints the `saaslayer login` command to run instead of logging in.

**Usage**

```bash
saaslayer signup [--config-url URL] [--email E --password P] [--code C | --resend]
```

**Flags**

* `--email` (*string*, env `SAASLAYER_EMAIL`) — Email of the new account; prompted when absent.
* `--password` (*string*, env `SAASLAYER_PASSWORD`, secret) — Password of the new account; prompted (hidden) in a terminal when absent.
* `--code` (*string*, secret) — The code emailed to you. Finishes a pending signup without signing up again.
* `--resend` (*boolean*) — Email a new code for a pending signup.

**Examples**

```bash
saaslayer signup
# Without a terminal: send the code, then finish with it
saaslayer signup --email you@example.com
saaslayer signup --email you@example.com --code 123456
```

## `sso`

Manage the enterprise SSO connections of a deployment's user-service.

Enterprise SSO connections (SAML or OIDC) of a user-service instance with `EnableSso` on. Commands go through the control plane as your own deployment login (`saaslayer login --deployment`) and need an owner of the org that owns the deployment.

They act on the active project's deployment for `--env` (default `prod`), or `--deployment`, and on its only user-service instance unless `--service` names one. Secrets are never shown: a client secret reads back as set, and setup links and SCIM tokens are written to SSM or a new 0600 file, never printed.

A refusal prints its code and title, the fields at fault and what to do next; with `--json` it prints the refusal document. The setup guide is the enterprise SSO section of the Users docs.

| Subcommand | Description |
| --- | --- |
| [`sso list`](#sso-list) | List the SSO connections of a user-service instance. |
| [`sso status`](#sso-status) | Show a connection's settings, health, IdP registration and pending DNS proofs. |
| [`sso create`](#sso-create) | Create a draft SSO connection for a tenant and print what to register in the IdP. |
| [`sso update`](#sso-update) | Change a connection's settings or identity-provider details. |
| [`sso activate`](#sso-activate) | Apply a connection in Cognito and trust it for sign-in. |
| [`sso disable`](#sso-disable) | Withdraw trust in a connection at once, keeping it for re-activation. |
| [`sso rotate-secret`](#sso-rotate-secret) | Replace a connection's SAML metadata or OIDC client secret in place. |
| [`sso delete`](#sso-delete) | Delete a connection after showing the people affected and its delete policy. |
| [`sso domains`](#sso-domains) | Add, remove and verify a connection's email domains. |
| [`sso link`](#sso-link) | Issue, check and revoke the setup link that hands a connection to the customer's IT admin. |
| [`sso scim`](#sso-scim) | Manage a connection's SCIM tokens and confirm its initial directory sync. |
| [`sso reactivate`](#sso-reactivate) | Restore one deactivated person of a connection that SCIM does not manage. |
| [`sso audit`](#sso-audit) | Read the redacted SSO audit trail of a connection, a tenant or the deployment. |
| [`sso mappings`](#sso-mappings) | Map identity-provider groups to orgs and roles on the deployment's permissions API. |
| [`sso enforcement`](#sso-enforcement) | Check or turn off a connection's domain enforcement. |

### `sso list`

List the SSO connections of a user-service instance.

Prints each connection's id, tenant, protocol, status, issuer and domains with their verification status.

**Usage**

```bash
saaslayer sso list [flags]
```

**Flags**

* `--tenant` (*string*) — Only the connections of this tenant org.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso list
saaslayer sso list --tenant org_123 --env staging --json
```

### `sso status`

Show a connection's settings, health, IdP registration and pending DNS proofs.

Shows the connection's settings and its health: sign-in, signing certificate, SCIM, domains and open issues, with the refusal reason of recent failed sign-ins. Also prints what to register in the identity provider (entity id and ACS URL, or redirect URI) and the DNS proof of each unverified domain. Secrets are never shown: a client secret reads back as set.

**Usage**

```bash
saaslayer sso status <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso status conn_123abc
```

### `sso create`

Create a draft SSO connection for a tenant and print what to register in the IdP.

Creates a draft connection for the tenant and prints what to register in the identity provider, the DNS proof of each domain and notes. Refused when the tenant already has a connection for that issuer (or, without `--issuer`, a draft of that protocol with no issuer yet).

Without the issuer and IdP flags it starts from scratch: the draft lists what is missing, and `saaslayer sso link issue` hands the rest to the customer's IT admin. Activation waits until the issuer and the SAML metadata, or the OIDC client id and secret, are set.

The client secret is read from stdin only. `issuer`, `providerTenant`, `subjectSource` and the OIDC client id lock at the first activation.

**Usage**

```bash
saaslayer sso create --tenant ORG --protocol saml|oidc [--issuer URL] [--metadata-url URL | --metadata-file FILE |
  --client-id ID --client-secret-stdin [--oidc-scope SCOPE ...]] [--domain DOMAIN ...] [settings] [--json]
```

**Flags**

* `--tenant` (*string*, required) — Org id of the customer company the connection belongs to. It comes back in every SSO token as `sso_tenant`. Never changes.
* `--protocol` (*saml | oidc*, required) — Protocol of the identity provider. Never changes.
* `--issuer` (*string*) — The identity provider's issuer (SAML entity id or OIDC issuer URL). Locks at the first activation.
* `--metadata-url` (*string*) — SAML: URL of the identity provider's metadata.
* `--metadata-file` (*string*) — SAML: file holding the identity provider's metadata XML.
* `--client-id` (*string*) — OIDC: the client id registered at the identity provider. Locks at the first activation.
* `--client-secret-stdin` (*boolean*) — OIDC: read the client secret from stdin (a pipe or file, never a terminal). The secret is never taken from a flag, a settings file or the environment, and reads back only as set.
* `--oidc-scope` (*string*, repeatable) — OIDC: a scope to request; repeat for several (for example `openid`, `email`, `profile`, `groups`).
* `--domain` (*string*, repeatable) — An email domain of the company; repeat for several. Each prints the DNS TXT proof to publish.
* `--allowed-org` (*string*, repeatable) — An org people signing in through the connection may be added to; repeat for several. Deployment owner only.
* `--provider-tenant` (*string*) — The identity provider's own tenant id (for example the Entra tenant id). Locks at the first activation.
* `--subject-source` (*nameid | sub | oid*) — Which claim holds the person's immutable identity-provider id. Locks at the first activation.
* `--jit` (*on | off*) — `on` (the default) creates or joins the account at the first SSO sign-in. `off` refuses anyone SCIM has not provisioned first, and needs `--scim on`.
* `--create-personal-org` (*on | off*) — `off` skips the personal org a new SSO person would otherwise get.
* `--scim` (*on | off*) — SCIM provisioning. SAML sign-ins carry no group authority: turn SCIM on for group-based access and directory-driven removal.
* `--deprovision` (*disable_and_remove_from_org | remove_from_org_only | disable*) — What happens to a person the identity provider deprovisions: `disable_and_remove_from_org`, `remove_from_org_only` or `disable`. A new connection uses `disable_and_remove_from_org`.
* `--mfa` (*delegated | saaslayer*) — `delegated` (the default): the identity provider is the MFA. `saaslayer`: the person also enrolls a SaaSLayer TOTP or passkey, used only as a second factor.
* `--delegated-tokens` (*blocked | short_lived*) — Whether an SSO session may mint Permissions session tokens (assumed roles, delegated sessions): `blocked` (the default) or `short_lived` (capped at 15 minutes and the session's deadline).
* `--session-cap-hours` (*number*) — Fixed session deadline from the sign-in time, in hours (1-24; 12 for a new connection). Refreshes never extend it.
* `--token-ttl-minutes` (*number*) — Lifetime of the connection's ID and access tokens, in minutes (5-60; 5 for a new connection).
* `--idp-initiated` (*on | off*) — Allow sign-ins started from the identity provider's dashboard tiles (off for a new connection).
* `--enforce` (*on*) — Turn domain enforcement on: after the notice period, native sign-in (password, social, passkey) ends for the connection's verified domains. Needs an email sender (the user-service `CognitoEmailFromAddress` setting).  Turning it off is its own audited action: `saaslayer sso enforcement disable`.
* `--notice-days` (*number*) — Days of notice before domain enforcement takes effect (0-90; default 14). People are emailed, and signed out of native sessions on the day.
* `--manager-group` (*string*) — Identity-provider group whose members manage the connection, or `none`. Deployment owner only.
* `--break-glass` (*string*, repeatable) — A person (user id) who may unlock native sign-in with an emailed code during an identity-provider outage; repeat for up to 2. `none` clears the list. Deployment owner only.
* `--break-glass-minutes` (*number*) — How long a break-glass unlock lasts, in minutes (15-1440).
* `--delete-policy` (*keep_dormant_reinvite | block_while_sso_only | delete_sso_only_people*) — What deleting the connection does to people whose only way in is this connection: `keep_dormant_reinvite` keeps them as dormant accounts to re-invite, `block_while_sso_only` refuses the delete while any exist, `delete_sso_only_people` deletes them permanently. Deployment owner only.
* `--settings-file` (*string*) — Connection settings as one JSON object (the API's connection attributes). Flags override it. It never holds the client secret.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
# SAML, with the metadata URL and SCIM
saaslayer sso create --tenant org_123 --protocol saml --issuer http://www.okta.com/exk123abc --metadata-url https://acme.okta.com/app/exk123abc/sso/saml/metadata --domain acme.com --scim on
# OIDC, with the client secret piped in
saaslayer sso create --tenant org_123 --protocol oidc --issuer https://acme.okta.com/oauth2/default --client-id 0oa123abc --client-secret-stdin --oidc-scope openid --oidc-scope email --domain acme.com --subject-source sub
# From scratch: the IT admin completes it from a setup link
saaslayer sso create --tenant org_123 --protocol saml
```

### `sso update`

Change a connection's settings or identity-provider details.

Changes the connection at the version it reads; a re-run with the same values changes nothing. Settings the flags leave out keep their stored values: `--notice-days` alone keeps enforcement on or off, and `--break-glass-minutes` alone keeps the break-glass list.

Turning domain enforcement on asks to confirm (the typed connection id, or `--yes`): native sign-in ends for every verified domain after the notice, and those people are signed out then.

A connection never moves to another tenant or protocol, and domains change with `saaslayer sso domains`. `issuer`, `providerTenant`, `subjectSource` and the OIDC client id are fixed once the connection is activated: changing them needs a migration or a replacement connection. The client secret is read from stdin only.

**Usage**

```bash
saaslayer sso update <connectionId> [settings] [--issuer URL] [--metadata-url URL | --metadata-file FILE]
  [--client-id ID] [--client-secret-stdin] [--yes] [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--issuer` (*string*) — The identity provider's issuer (SAML entity id or OIDC issuer URL). Locks at the first activation.
* `--metadata-url` (*string*) — SAML: URL of the identity provider's metadata.
* `--metadata-file` (*string*) — SAML: file holding the identity provider's metadata XML.
* `--client-id` (*string*) — OIDC: the client id registered at the identity provider. Locks at the first activation.
* `--client-secret-stdin` (*boolean*) — OIDC: read the client secret from stdin (a pipe or file, never a terminal). The secret is never taken from a flag, a settings file or the environment, and reads back only as set.
* `--oidc-scope` (*string*, repeatable) — OIDC: a scope to request; repeat for several (for example `openid`, `email`, `profile`, `groups`).
* `--allowed-org` (*string*, repeatable) — An org people signing in through the connection may be added to; repeat for several. Deployment owner only.
* `--provider-tenant` (*string*) — The identity provider's own tenant id (for example the Entra tenant id). Locks at the first activation.
* `--subject-source` (*nameid | sub | oid*) — Which claim holds the person's immutable identity-provider id. Locks at the first activation.
* `--jit` (*on | off*) — `on` (the default) creates or joins the account at the first SSO sign-in. `off` refuses anyone SCIM has not provisioned first, and needs `--scim on`.
* `--create-personal-org` (*on | off*) — `off` skips the personal org a new SSO person would otherwise get.
* `--scim` (*on | off*) — SCIM provisioning. SAML sign-ins carry no group authority: turn SCIM on for group-based access and directory-driven removal.
* `--deprovision` (*disable_and_remove_from_org | remove_from_org_only | disable*) — What happens to a person the identity provider deprovisions: `disable_and_remove_from_org`, `remove_from_org_only` or `disable`. A new connection uses `disable_and_remove_from_org`.
* `--mfa` (*delegated | saaslayer*) — `delegated` (the default): the identity provider is the MFA. `saaslayer`: the person also enrolls a SaaSLayer TOTP or passkey, used only as a second factor.
* `--delegated-tokens` (*blocked | short_lived*) — Whether an SSO session may mint Permissions session tokens (assumed roles, delegated sessions): `blocked` (the default) or `short_lived` (capped at 15 minutes and the session's deadline).
* `--session-cap-hours` (*number*) — Fixed session deadline from the sign-in time, in hours (1-24; 12 for a new connection). Refreshes never extend it.
* `--token-ttl-minutes` (*number*) — Lifetime of the connection's ID and access tokens, in minutes (5-60; 5 for a new connection).
* `--idp-initiated` (*on | off*) — Allow sign-ins started from the identity provider's dashboard tiles (off for a new connection).
* `--enforce` (*on*) — Turn domain enforcement on: after the notice period, native sign-in (password, social, passkey) ends for the connection's verified domains. Needs an email sender (the user-service `CognitoEmailFromAddress` setting). Asks to confirm. Turning it off is its own audited action: `saaslayer sso enforcement disable`.
* `--notice-days` (*number*) — Days of notice before domain enforcement takes effect (0-90; default 14). People are emailed, and signed out of native sessions on the day.
* `--manager-group` (*string*) — Identity-provider group whose members manage the connection, or `none`. Deployment owner only.
* `--break-glass` (*string*, repeatable) — A person (user id) who may unlock native sign-in with an emailed code during an identity-provider outage; repeat for up to 2. `none` clears the list. Deployment owner only.
* `--break-glass-minutes` (*number*) — How long a break-glass unlock lasts, in minutes (15-1440).
* `--delete-policy` (*keep_dormant_reinvite | block_while_sso_only | delete_sso_only_people*) — What deleting the connection does to people whose only way in is this connection: `keep_dormant_reinvite` keeps them as dormant accounts to re-invite, `block_while_sso_only` refuses the delete while any exist, `delete_sso_only_people` deletes them permanently. Deployment owner only.
* `--settings-file` (*string*) — Connection settings as one JSON object (the API's connection attributes). Flags override it. It never holds the client secret.
* `--yes` (*boolean*) — Confirm without typing the connection id. Required when not running in a terminal.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso update conn_123abc --scim on --delegated-tokens short_lived
# Replace the OIDC client secret
saaslayer sso update conn_123abc --client-secret-stdin
# Enforce SSO for the verified domains after 14 days' notice
saaslayer sso update conn_123abc --enforce on --notice-days 14 --yes
```

### `sso activate`

Apply a connection in Cognito and trust it for sign-in.

Applies the provider and its app client in Cognito, then trusts the connection; on an active connection it applies them again. From then on the identity namespace (`issuer`, `providerTenant`, `subjectSource`, the OIDC client id) is fixed: a change needs a migration or a replacement connection.

**Usage**

```bash
saaslayer sso activate <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso activate conn_123abc
```

### `sso disable`

Withdraw trust in a connection at once, keeping it for re-activation.

Withdraws trust at once: every SSO sign-in and session of the connection stops. Its settings, provider and client are kept, so `saaslayer sso activate` trusts it again. Asks to confirm (the typed connection id, or `--yes`).

**Usage**

```bash
saaslayer sso disable <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--yes` (*boolean*) — Confirm without typing the connection id. Required when not running in a terminal.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso disable conn_123abc
```

### `sso rotate-secret`

Replace a connection's SAML metadata or OIDC client secret in place.

Replaces the SAML metadata (two signing certificates may overlap) or the OIDC client secret in place, keeping the same client and sessions. Takes exactly one of the three flags; other identity-provider details change with `saaslayer sso update`.

**Usage**

```bash
saaslayer sso rotate-secret <connectionId> (--metadata-url URL | --metadata-file FILE | --client-secret-stdin) [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--metadata-url` (*string*) — SAML: URL of the new metadata.
* `--metadata-file` (*string*) — SAML: file holding the new metadata XML.
* `--client-secret-stdin` (*boolean*) — OIDC: read the new client secret from stdin (a pipe or file, never a terminal).
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso rotate-secret conn_123abc --metadata-url https://acme.okta.com/app/exk123abc/sso/saml/metadata
saaslayer sso rotate-secret conn_123abc --client-secret-stdin
```

### `sso delete`

Delete a connection after showing the people affected and its delete policy.

Shows the people affected and the delete policy, then deletes after the typed connection id (or `--yes`). Domain enforcement is turned off first. The delete ends the connection's sign-ins and removes its provider, client and directory links. The `delete_sso_only_people` policy also needs the SSO-only count (`--sso-only-people`).

A delete that stops part way resumes when run again. Needs the deployment owner or the tenant's org admin.

**Usage**

```bash
saaslayer sso delete <connectionId> --reason TEXT [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--reason` (*string*, required) — Why the connection is deleted; recorded in the audit trail.
* `--sso-only-people` (*number*) — Confirms the delete_sso_only_people policy: the number of people whose only way in is this connection, who are deleted permanently. Must match the current count.
* `--yes` (*boolean*) — Confirm without typing the connection id. Required when not running in a terminal.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso delete conn_123abc --reason "Acme moved to another provider"
```

### `sso domains`

Add, remove and verify a connection's email domains.

A connection's domains decide where their people sign in, never what they may do. Each domain is verified by a DNS TXT record: `_saaslayer-sso.<domain>` with the value `saaslayer-sso-verification=<token>`.

| Subcommand | Description |
| --- | --- |
| [`sso domains add`](#sso-domains-add) | Add an email domain to a connection and print its DNS TXT proof. |
| [`sso domains verify`](#sso-domains-verify) | Check a domain's DNS TXT proof now. |
| [`sso domains remove`](#sso-domains-remove) | Remove an email domain from a connection. |

### `sso domains add`

Add an email domain to a connection and print its DNS TXT proof.

Lists the domain on the connection and prints the DNS TXT record that proves it. A domain another connection on the instance owns is refused. A domain already listed changes nothing.

**Usage**

```bash
saaslayer sso domains add <connectionId> <domain> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.
* `domain` — Email domain, for example acme.com.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso domains add conn_123abc acme.com
```

### `sso domains verify`

Check a domain's DNS TXT proof now.

Checks the domain's DNS proof now. When it is not verified yet, prints the record to publish.

**Usage**

```bash
saaslayer sso domains verify <connectionId> <domain> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.
* `domain` — Email domain to verify.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso domains verify conn_123abc acme.com
```

### `sso domains remove`

Remove an email domain from a connection.

Removes the domain from the connection. Removing a verified domain asks to confirm (the typed connection id, or `--yes`): its sign-ins stop routing to this connection and its claim is released.

**Usage**

```bash
saaslayer sso domains remove <connectionId> <domain> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.
* `domain` — Email domain to remove.

**Flags**

* `--yes` (*boolean*) — Confirm without typing the connection id. Required when not running in a terminal.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso domains remove conn_123abc acme.com --yes
```

### `sso link`

Issue, check and revoke the setup link that hands a connection to the customer's IT admin.

A connection has one setup link for the customer's IT admin, who completes the identity-provider side on the setup page. It ends when setup completes, when it is revoked or replaced, or when it expires.

| Subcommand | Description |
| --- | --- |
| [`sso link issue`](#sso-link-issue) | Issue the connection's setup link and write it to SSM or a new file. Never printed. |
| [`sso link status`](#sso-link-status) | Show the setup link's status, expiry and how often it was opened. |
| [`sso link revoke`](#sso-link-revoke) | Revoke the setup link and every session it opened. |

### `sso link issue`

Issue the connection's setup link and write it to SSM or a new file. Never printed.

Issues the setup link (valid 7 days by default). It is never printed: it goes to an SSM SecureString in your AWS account or a new 0600 file, and a link that cannot be stored is revoked. Send it to the IT admin over a private channel.

The stored value is the link token, which the IT admin opens at `<your app>/sso-setup#setup=<token>`; `--app-url` stores the whole link. A new link ends the active one (`--replace`) and every session it opened.

**Usage**

```bash
saaslayer sso link issue <connectionId> [--valid-hours 1-168] [--app-url URL] [--replace]
  (--to-ssm NAME [--ssm-region R] [--profile P] | --to-file PATH) [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--valid-hours` (*number*) — How long the link is valid, in hours (1-168). Default 168 (7 days).
* `--app-url` (*string*) — Your app's base URL: stores the whole `<app>/sso-setup#setup=<token>` link instead of the token.
* `--replace` (*boolean*) — Replace an active link: it and every session it opened end.
* `--to-ssm` (*string*) — Write the setup link to this SSM SecureString parameter in your AWS account (replaced if it exists). One of `--to-ssm` or `--to-file` is required.
* `--ssm-region` (*string*) — Region of the SSM parameter; defaults to the deployment's region.
* `--profile` (*string*) — AWS CLI profile whose credentials write the SSM parameter; defaults to the AWS CLI default credential chain.
* `--to-file` (*string*) — Write the setup link to this new file, created 0600. An existing file is never overwritten.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso link issue conn_123abc --app-url https://app.example.com --to-ssm /acme/sso-setup-link
saaslayer sso link issue conn_123abc --replace --to-file ./acme-setup-link.txt
```

### `sso link status`

Show the setup link's status, expiry and how often it was opened.

Shows the active setup link's status, expiry, how many times it was opened (and when last), and who issued it when. Never the link itself.

**Usage**

```bash
saaslayer sso link status <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso link status conn_123abc
```

### `sso link revoke`

Revoke the setup link and every session it opened.

Revokes the setup link: it and every session it opened are refused from their next request.

**Usage**

```bash
saaslayer sso link revoke <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso link revoke conn_123abc
```

### `sso scim`

Manage a connection's SCIM tokens and confirm its initial directory sync.

SCIM bearer tokens and the SCIM URL to enter with them in the identity provider. A token is never shown: it is written like a setup link (an SSM SecureString or a new 0600 file), and a token that cannot be stored is revoked. Google directory sync is not supported.

| Subcommand | Description |
| --- | --- |
| [`sso scim status`](#sso-scim-status) | Show the SCIM URL and the connection's SCIM tokens. |
| [`sso scim issue`](#sso-scim-issue) | Issue a SCIM token and write it to SSM or a new file. Never printed. |
| [`sso scim rotate`](#sso-scim-rotate) | Replace a SCIM token, keeping the old one working for an overlap. |
| [`sso scim revoke`](#sso-scim-revoke) | Revoke a SCIM token. |
| [`sso scim sync-complete`](#sso-scim-sync-complete) | Confirm the IdP's initial SCIM provisioning so SCIM becomes the group authority. |

### `sso scim status`

Show the SCIM URL and the connection's SCIM tokens.

Prints the SCIM URL and each token's id, status, last characters, creation and expiry, and its replacement. Never a token.

**Usage**

```bash
saaslayer sso scim status <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso scim status conn_123abc
```

### `sso scim issue`

Issue a SCIM token and write it to SSM or a new file. Never printed.

Issues the connection's SCIM token and prints the SCIM URL to enter with it. The token is never printed: it goes to an SSM SecureString in your AWS account or a new 0600 file, and a token that cannot be stored is revoked. Refused while a token is active: replace it with `saaslayer sso scim rotate`.

**Usage**

```bash
saaslayer sso scim issue <connectionId> [--expires-in-days N] (--to-ssm NAME [--ssm-region R] | --to-file PATH) [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--expires-in-days` (*number*) — Days until the token expires.
* `--to-ssm` (*string*) — Write the SCIM token to this SSM SecureString parameter in your AWS account (replaced if it exists). One of `--to-ssm` or `--to-file` is required.
* `--ssm-region` (*string*) — Region of the SSM parameter; defaults to the deployment's region.
* `--profile` (*string*) — AWS CLI profile whose credentials write the SSM parameter; defaults to the AWS CLI default credential chain.
* `--to-file` (*string*) — Write the SCIM token to this new file, created 0600. An existing file is never overwritten.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso scim issue conn_123abc --to-ssm /acme/scim-token
```

### `sso scim rotate`

Replace a SCIM token, keeping the old one working for an overlap.

Issues a replacement token, written like `saaslayer sso scim issue` (never printed), and keeps the old token working for the overlap (default 1 day). If the new token cannot be stored, it is revoked and the old one still ends at its overlap: rotate again before then.

**Usage**

```bash
saaslayer sso scim rotate <connectionId> <credentialId> [--overlap-seconds N] [--expires-in-days N]
  (--to-ssm NAME [--ssm-region R] | --to-file PATH) [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.
* `credentialId` — Id of the token to replace, as `saaslayer sso scim status` prints it.

**Flags**

* `--overlap-seconds` (*number*) — How long the old token keeps working, in seconds. Default 86400 (1 day).
* `--expires-in-days` (*number*) — Days until the new token expires.
* `--to-ssm` (*string*) — Write the SCIM token to this SSM SecureString parameter in your AWS account (replaced if it exists). One of `--to-ssm` or `--to-file` is required.
* `--ssm-region` (*string*) — Region of the SSM parameter; defaults to the deployment's region.
* `--profile` (*string*) — AWS CLI profile whose credentials write the SSM parameter; defaults to the AWS CLI default credential chain.
* `--to-file` (*string*) — Write the SCIM token to this new file, created 0600. An existing file is never overwritten.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso scim rotate conn_123abc scim_123abc --to-ssm /acme/scim-token
```

### `sso scim revoke`

Revoke a SCIM token.

Revokes the token: its next SCIM request is refused.

**Usage**

```bash
saaslayer sso scim revoke <connectionId> <credentialId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.
* `credentialId` — Id of the token to revoke, as `saaslayer sso scim status` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso scim revoke conn_123abc scim_123abc
```

### `sso scim sync-complete`

Confirm the IdP's initial SCIM provisioning so SCIM becomes the group authority.

Confirms the identity provider's initial provisioning, so SCIM becomes the connection's group authority. A large directory is written over several calls, up to 50 per run; when the sync is still in progress, run it again to continue. Refused when SCIM has written no groups yet (start provisioning in the identity provider first) or already is the group authority.

**Usage**

```bash
saaslayer sso scim sync-complete <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso scim sync-complete conn_123abc
```

### `sso reactivate`

Restore one deactivated person of a connection that SCIM does not manage.

Restores one deactivated person of a connection SCIM does not manage, by their stable identity-provider id, and prints their user id.

**Usage**

```bash
saaslayer sso reactivate <connectionId> --directory-id ID --reason TEXT [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--directory-id` (*string*, required) — The person's stable id at the identity provider.
* `--reason` (*string*, required) — Why the person is restored; recorded in the audit trail.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso reactivate conn_123abc --directory-id 00u123abc --reason "rehired"
```

### `sso audit`

Read the redacted SSO audit trail of a connection, a tenant or the deployment.

The connection's (or a tenant's, or the deployment's) redacted SSO audit trail, newest first, one page a call; the next page's `--cursor` is printed. A refused sign-in shows its reason code, explained in the SSO troubleshooting guide.

Each read is itself recorded as `audit.exported`; those are listed only with `--include-exports` (or a `--type` naming them).

**Usage**

```bash
saaslayer sso audit [<connectionId> | --tenant ORG] [--type TYPE] [--from ISO] [--to ISO] [--limit N] [--cursor C]
  [--include-exports] [--json]
```

**Arguments**

* `connectionId` (optional) — Only this connection's events. Without it, the tenant's (`--tenant`) or the whole deployment's.

**Flags**

* `--tenant` (*string*) — Only this tenant org's events (ignored with a connection id).
* `--type` (*string*) — Only events of this type, for example `sign-in.refused`.
* `--from` (*string*) — Only events from this ISO 8601 time on.
* `--to` (*string*) — Only events up to this ISO 8601 time.
* `--limit` (*number*) — Most events on the page.
* `--cursor` (*string*) — Page to read, as the previous page printed it.
* `--include-exports` (*boolean*) — Also list the `audit.exported` events recorded by reads of the trail.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso audit conn_123abc
saaslayer sso audit conn_123abc --type sign-in.refused --json
```

### `sso mappings`

Map identity-provider groups to orgs and roles on the deployment's permissions API.

Group-to-role mappings of a connection in its tenant org. The deployment owner first sets the ceiling (`ceiling`); the tenant's admin then sets the rules within it (`rules`).

Group-to-role mappings live on the deployment's permissions API, not the user-service, so these commands take `--api-base` and permissions API auth: your deployment login, `--token`, `--iam` or `--id-token-file`.

| Subcommand | Description |
| --- | --- |
| [`sso mappings get`](#sso-mappings-get) | Show a connection's group mapping ceiling and rules. |
| [`sso mappings ceiling`](#sso-mappings-ceiling) | Set the orgs a connection may add people to and the privileged roles its rules may grant. |
| [`sso mappings rules`](#sso-mappings-rules) | Set a connection's group-to-role rules within its ceiling. |

### `sso mappings get`

Show a connection's group mapping ceiling and rules.

Prints the mapping's revision, its ceiling (allowed orgs and privileged roles), its rules and its default grant.

Group-to-role mappings live on the deployment's permissions API, not the user-service, so these commands take `--api-base` and permissions API auth: your deployment login, `--token`, `--iam` or `--id-token-file`.

**Usage**

```bash
saaslayer sso mappings get <connectionId> --tenant ORG --api-base URL [--deployment ID | --token KEY | --iam PRINCIPAL] [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--tenant` (*string*, required) — The connection's tenant org id.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except with an ID token pinned by `--deployment`.
* `--deployment` (*string*) — Deployment id (`dep_…`) or environment whose deployment login to use. With `--id-token-file`, the deployment whose permissions API receives the token.
* `--as` (*string*) — Email or user id of the deployment login to use, when you hold several.
* `--project` (*string*) — With `--id-token-file` and an environment in `--deployment`: the project whose deployment it names; defaults to the active project.
* `--org` (*string*) — With `--id-token-file` and an environment in `--deployment`: the org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--user-service-instance` (*string*) — User-service instance of the deployment login to use, when you hold logins for several.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for `--iam` (defaults to `$AWS_REGION`, else us-west-2). With `--id-token-file` and an environment in `--deployment`, also the region of that deployment.
* `--profile` (*string*) — AWS CLI profile for `--iam`; defaults to the AWS CLI default credential chain.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an external OIDC ID token to authenticate with. It is sent only to the permissions API of `--deployment`, or to an https `--api-base` whose host you confirm.
* `--yes` (*boolean*) — Confirm the `--api-base` host an ID token is sent to without typing it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso mappings get conn_123abc --tenant org_123 --api-base https://api.example.com --deployment dep_123abc
```

### `sso mappings ceiling`

Set the orgs a connection may add people to and the privileged roles its rules may grant.

Sets the ceiling: the orgs the connection may add people to and the privileged roles its rules may grant. The deployment owner sets it. Prints how many people were recomputed.

Group-to-role mappings live on the deployment's permissions API, not the user-service, so these commands take `--api-base` and permissions API auth: your deployment login, `--token`, `--iam` or `--id-token-file`.

**Usage**

```bash
saaslayer sso mappings ceiling <connectionId> --tenant ORG --allow-org ID ... [--approve-role ORG/ROLE ...]
  --api-base URL [--deployment ID | --token KEY | --iam PRINCIPAL] [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--tenant` (*string*, required) — The connection's tenant org id.
* `--allow-org` (*string*, required, repeatable) — An org the connection may add people to; repeat for several.
* `--approve-role` (*string*, repeatable) — A privileged role the rules may grant, as `<orgId>/<roleId>`; repeat for several.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except with an ID token pinned by `--deployment`.
* `--deployment` (*string*) — Deployment id (`dep_…`) or environment whose deployment login to use. With `--id-token-file`, the deployment whose permissions API receives the token.
* `--as` (*string*) — Email or user id of the deployment login to use, when you hold several.
* `--project` (*string*) — With `--id-token-file` and an environment in `--deployment`: the project whose deployment it names; defaults to the active project.
* `--org` (*string*) — With `--id-token-file` and an environment in `--deployment`: the org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--user-service-instance` (*string*) — User-service instance of the deployment login to use, when you hold logins for several.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for `--iam` (defaults to `$AWS_REGION`, else us-west-2). With `--id-token-file` and an environment in `--deployment`, also the region of that deployment.
* `--profile` (*string*) — AWS CLI profile for `--iam`; defaults to the AWS CLI default credential chain.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an external OIDC ID token to authenticate with. It is sent only to the permissions API of `--deployment`, or to an https `--api-base` whose host you confirm.
* `--yes` (*boolean*) — Confirm the `--api-base` host an ID token is sent to without typing it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso mappings ceiling conn_123abc --tenant org_123 --allow-org org_123 --approve-role org_123/billing-admin --api-base https://api.example.com --deployment dep_123abc
```

### `sso mappings rules`

Set a connection's group-to-role rules within its ceiling.

Sets the rules from a JSON file, `{ "rules": [{ "group", "orgId", "roleIds" }], "defaultGrant" }`, at the revision it reads. The tenant's admin sets them, within the ceiling the deployment owner set first (refused while there is none). Prints how many people were recomputed.

Group-to-role mappings live on the deployment's permissions API, not the user-service, so these commands take `--api-base` and permissions API auth: your deployment login, `--token`, `--iam` or `--id-token-file`.

**Usage**

```bash
saaslayer sso mappings rules <connectionId> --tenant ORG --file RULES.json
  --api-base URL [--deployment ID | --token KEY | --iam PRINCIPAL] [--json]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--tenant` (*string*, required) — The connection's tenant org id.
* `--file` (*string*, required) — JSON file holding `{ rules: [{ group, orgId, roleIds }], defaultGrant }`.
* `--api-base` (*string*, env `SAASLAYER_API_BASE`) — Base URL of the deployment's permissions API. Required, except with an ID token pinned by `--deployment`.
* `--deployment` (*string*) — Deployment id (`dep_…`) or environment whose deployment login to use. With `--id-token-file`, the deployment whose permissions API receives the token.
* `--as` (*string*) — Email or user id of the deployment login to use, when you hold several.
* `--project` (*string*) — With `--id-token-file` and an environment in `--deployment`: the project whose deployment it names; defaults to the active project.
* `--org` (*string*) — With `--id-token-file` and an environment in `--deployment`: the org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--user-service-instance` (*string*) — User-service instance of the deployment login to use, when you hold logins for several.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--iam` (*string*) — Authenticate as this declared IAM principal, using your AWS credentials.
* `--region` (*string*) — AWS region for `--iam` (defaults to `$AWS_REGION`, else us-west-2). With `--id-token-file` and an environment in `--deployment`, also the region of that deployment.
* `--profile` (*string*) — AWS CLI profile for `--iam`; defaults to the AWS CLI default credential chain.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding an external OIDC ID token to authenticate with. It is sent only to the permissions API of `--deployment`, or to an https `--api-base` whose host you confirm.
* `--yes` (*boolean*) — Confirm the `--api-base` host an ID token is sent to without typing it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso mappings rules conn_123abc --tenant org_123 --file rules.json --api-base https://api.example.com --deployment dep_123abc
```

### `sso enforcement`

Check or turn off a connection's domain enforcement.

Domain enforcement ends native sign-in (password, social, passkey) for a connection's verified domains after a notice period. It is turned on with `saaslayer sso update --enforce on`.

| Subcommand | Description |
| --- | --- |
| [`sso enforcement status`](#sso-enforcement-status) | Show where a connection's domain enforcement stands and whom it affects. |
| [`sso enforcement disable`](#sso-enforcement-disable) | Turn off domain enforcement, or cancel a scheduled cutover, with a recorded reason. |

### `sso enforcement status`

Show where a connection's domain enforcement stands and whom it affects.

Shows where domain enforcement stands (off, scheduled or enforced; in effect only on an active connection), the sweep's notices and sign-outs, and how many people of each verified domain it affects. That count is an upper bound: SSO-only people count too.

**Usage**

```bash
saaslayer sso enforcement status <connectionId> [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso enforcement status conn_123abc
```

### `sso enforcement disable`

Turn off domain enforcement, or cancel a scheduled cutover, with a recorded reason.

Turns domain enforcement off, or cancels a scheduled cutover, with a recorded reason after the typed connection id (or `--yes`): native sign-in works again at once. To enforce again, `saaslayer sso update --enforce on` starts a new notice period. The deployment owner or the tenant's org admin only.

**Usage**

```bash
saaslayer sso enforcement disable <connectionId> --reason TEXT [flags]
```

**Arguments**

* `connectionId` — The SSO connection's id, as `saaslayer sso list` prints it.

**Flags**

* `--reason` (*string*, required) — Why enforcement is turned off; recorded in the audit trail.
* `--yes` (*boolean*) — Confirm without typing the connection id. Required when not running in a terminal.
* `--deployment` (*string*) — Deployment id (`dep_…`). Without it, the active project's deployment for `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--as` (*string*) — Email or user id of the deployment login to act as, when you hold several for that instance.
* `--org` (*string*) — Org whose deployed projects are listed when no deployment matches; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer sso enforcement disable conn_123abc --reason "IdP outage at Acme" --yes
```

## `status`

Show the deployments of a project in every environment, or in one.

Show the deployed instances of a project: each one's environment, region, status, deployment id and release (its version, or the commit it was deployed at). A fleet state other than ACTIVE (for example migrations awaiting approval) is shown, and a RETIRED deployment shows when and by whom it was retired.

An unfiltered empty collection succeeds. A supplied deployment selector with no match returns a not-found result. Requires `saaslayer login`.

**Usage**

```bash
saaslayer status [flags]
```

**Flags**

* `--deployment` (*string*) — Focus on one deployment by ID or environment; conflicting or ambiguous selectors fail.
* `--project` (*string*) — Project id (tnt\_…) or customer id; defaults to the active project.
* `--env` (*string*) — Show only this environment (for example dev, staging or prod); default every environment.
* `--region` (*string*) — Show only this AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer status
saaslayer status --project tnt_123 --env dev
```

## `update`

Move a deployment to another release or retry its deployed release.

Change the release using --version, --channel or --commit-sha, or retry the deployed release with --retry. Waits unless --no-wait. Use deployment settings set for settings and deployment releases promote for a tested manifest. Protected-environment gates and required reasons still apply.

**Usage**

```bash
saaslayer update (--version X.Y.Z | --channel NAME) [--env E] [--region R] [--reason TEXT] [--force] [--no-wait]
saaslayer update --retry [--env E] [--region R] [--reason TEXT] [--no-wait]
```

**Flags**

* `--version` (*string*) — Version to move the deployment to (`saaslayer deployment releases list`); checked against the control plane before the update.
* `--channel` (*string*) — Move to the release the channel points at now, e.g. `stable`. Once, not a subscription.
* `--commit-sha` (*string*) — Move to a commit instead of a version. Still works until the control plane refuses it.
* `--retry` (*boolean*) — Redeploy the deployed release with the stored settings. Takes no `--version`, `--channel`, `--commit-sha` or `--set`.
* `--force` (*boolean*) — Update past the drift gate (audited with the reason).
* `--reason` (*string*) — Why you are making the change; recorded with it. Required on the protected environments (staging, prod), and by `--set` for a billing or security change or an added sign-in method.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the operation starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer update --version 1.4.0 --env staging --reason "release 1.4.0"
# Retry a failed update
saaslayer update --retry --env dev
# Change one setting, keeping the release
```

## `users`

Administer a deployment's users, or import users from another identity system.

Administer a deployment's users through its user-service `/api/users`; you never call Cognito yourself. `create`, `get`, `list`, `update`, `disable`, `enable`, `delete`, `reset-password`, `set-password`, `adopt` and `reset-mfa` print JSON. They authenticate as one of:

* the current deployment login (`saaslayer login --deployment`; pick one with `--deployment`/`--as`), which needs the `saaslayer:users:account:<action>` grant
* an IAM principal: `--iam PRINCIPAL [--region R] [--profile P]`, with the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`
* an API key: `--token KEY`
* an external ID token: `--id-token-file FILE` or `$SAASLAYER_ID_TOKEN`, sent only to an https `--api-base` you confirm

They reach the login's own APIs, or `--api-base USERS_URL [--permissions-api-base PERMISSIONS_URL]`, or the deployment's public discovery (`--deployment <dep_id|env> [--config-url URL]` or `--discovery-url URL`). A user is `<suid>`, `--suid ID` or `--email E` (looked up).

`export` and `import` move people from another identity system into a deployment; `admin` manages a user-service instance locally.

| Subcommand | Description |
| --- | --- |
| [`users admin`](#users-admin) | Manage one user-service instance locally: owners, machine keys and human grants. |
| [`users adopt`](#users-adopt) | Adopt an account made outside SaaSLayer, optionally setting its password. |
| [`users create`](#users-create) | Create a user, with a password from stdin or an emailed invitation. |
| [`users delete`](#users-delete) | Delete a user everywhere (GDPR). Needs --yes. |
| [`users disable`](#users-disable) | Sign a user out everywhere and refuse their sign-in. |
| [`users enable`](#users-enable) | Allow a disabled user to sign in again. |
| [`users export`](#users-export) | Export users from another identity system into a reviewable manifest. |
| [`users get`](#users-get) | Show one user: status, enabled and email verification. |
| [`users import`](#users-import) | Import users from a manifest into a deployment. Dry run unless --apply. |
| [`users list`](#users-list) | List users by email or default org. |
| [`users reset-mfa`](#users-reset-mfa) | Remove the MFA factors of a user who lost all of them. |
| [`users reset-password`](#users-reset-password) | Mail a user a password reset code; their current password stops working. |
| [`users set-password`](#users-set-password) | Set a user's password from stdin. |
| [`users update`](#users-update) | Update a user's profile attributes, or reserved ones. |
| [`users operations`](#users-operations) | Inspect or follow an existing user operation. |
| [`users first-admin`](#users-first-admin) | Resend a deployment's first admin sign-in, or designate a new first admin. |
| [`users social`](#users-social) | Configure Google sign-in for a user-service instance with your own Google OAuth app. |
| [`users login-domain`](#users-login-domain) | Manage a user-service instance's branded login domain. |
| [`users hooks`](#users-hooks) | Read, change and test a user-service instance's lifecycle hooks. |
| [`users verifier-keys`](#users-verifier-keys) | Manage the server keys your backend uses to verify a deployment's tokens. |
| [`users integration-credentials`](#users-integration-credentials) | Inspect or revoke a user-service instance's console integration credentials. |

### `users admin`

Manage one user-service instance locally: owners, machine keys and human grants.

Opt-in local management of one user-service instance (off by default): owners, machine keys and human grants with fixed purposes, usable without the control plane or permissions-service.

* **Standalone** (`--manifest`, with your target-account IAM): the manifest is checked against the flags, your credentials' account and the stack's outputs before any write.
* **Managed** (no `--manifest`): an owner of the deployment's owning org, through the control plane. Each request starts an operation and waits for completion. Use `--no-wait` to return its accepted handle and supported continuation.

Purposes: `account-read`, `account-provisioning`, `account-import`, `account-administration`, `account-deletion`, `account-sensitive`, `account-recovery` (humans only), `reconciliation`, `config`, `email-authoring`, `sso-management` (SSO connections, setup links and management sessions), `verifier-keys` (humans only).

Results list owners, key ids and states with their age, and grants; an email, hash or raw key is never printed.

| Subcommand | Description |
| --- | --- |
| [`users admin bootstrap`](#users-admin-bootstrap) | Make one or more people owners (roots) of a user-service instance. |
| [`users admin keys`](#users-admin-keys) | Introduce, activate, retire, revoke or list a machine caller's keys. |
| [`users admin grants`](#users-admin-grants) | Grant, revoke or list human management grants on a user-service instance. |

### `users admin bootstrap`

Make one or more people owners (roots) of a user-service instance.

Make each `--owner-suid`/`--owner-email` pair an owner of the instance with the `--purpose` purposes. With `--reason`, it is an explicit, audited owner action: adding a root to an initialized instance, or recovering one; a revoked root comes back only with `--reason`. Standalone, the stack must report a `CoreTableName` output.

**Usage**

```bash
saaslayer users admin bootstrap --owner-suid SUID --owner-email EMAIL [repeat the pair] --purpose PURPOSE [repeat] [--reason TEXT]
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
```

**Flags**

* `--owner-suid` (*string*, required, repeatable) — An owner's SaaSLayer id; repeat for several, each paired with an `--owner-email` in the same order.
* `--owner-email` (*string*, required, repeatable) — The owner's email, paired with the `--owner-suid` in the same position.
* `--purpose` (*string*, required, repeatable) — A purpose the owners hold; repeat for several.
* `--reason` (*string*) — Why; makes the bootstrap an audited owner action (adding a root to an initialized instance, recovering one, or bringing back a revoked root).
* `--deployment` (*string*, required) — Deployment id (dep\_…) of the instance.
* `--service` (*string*, required) — `user-service`, or `user-service@<instance>` for a named instance.
* `--aws-account` (*string*, required) — 12-digit AWS account id of the deployment; checked against the deployment (managed) or the manifest (standalone).
* `--region` (*string*, required) — AWS region of the deployment; checked like `--aws-account`.
* `--manifest` (*string*) — Standalone: the instance's management manifest, checked against the flags and the stack's outputs before any write. Without it, the request goes through the control plane.
* `--profile` (*string*) — Standalone: AWS CLI profile for the target account; its credentials must be for the manifest's account.
* `--no-wait` (*boolean*) — Managed: return the accepted operation instead of waiting for completion. Standalone requests stay in the foreground and refuse this flag.

**Examples**

```bash
saaslayer users admin bootstrap --owner-suid usr_123 --owner-email admin@example.com --purpose account-administration --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1
# Standalone, with your target-account credentials
saaslayer users admin bootstrap --owner-suid usr_123 --owner-email admin@example.com --purpose account-administration --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1 --profile my-profile --manifest management.json
```

### `users admin keys`

Introduce, activate, retire, revoke or list a machine caller's keys.

Manage a machine caller's keys by `--phase`:

* `introduce` issues a new key for `--caller` with the `--purpose` purposes. The raw key is written only to `--to-file` (mode 0600) and stays pending until activated.
* `activate`, `retire` and `revoke` act on `--key-id`; `revoke` needs `--reason`.
* `status` lists the callers with their keys, states, ages and purposes.

**Usage**

```bash
saaslayer users admin keys --phase introduce --caller ID --purpose PURPOSE --to-file FILE
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
saaslayer users admin keys --phase activate|retire|revoke --caller ID --key-id ID [--reason TEXT]
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
saaslayer users admin keys --phase status
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
```

**Flags**

* `--phase` (*introduce | activate | retire | revoke | status*, required) — What to do with the key.
* `--caller` (*string*) — The machine caller; required except with `--phase status`.
* `--purpose` (*string*, repeatable) — With `--phase introduce`, a purpose of the key; repeat for several.
* `--to-file` (*string*) — With `--phase introduce`, a new private file (mode 0600) that receives the raw key. Managed, an existing file or link is refused, since the key is returned once; standalone, an existing file must already hold the same key.
* `--key-id` (*string*) — The key to activate, retire or revoke.
* `--reason` (*string*) — Why; required with `--phase revoke`.
* `--deployment` (*string*, required) — Deployment id (dep\_…) of the instance.
* `--service` (*string*, required) — `user-service`, or `user-service@<instance>` for a named instance.
* `--aws-account` (*string*, required) — 12-digit AWS account id of the deployment; checked against the deployment (managed) or the manifest (standalone).
* `--region` (*string*, required) — AWS region of the deployment; checked like `--aws-account`.
* `--manifest` (*string*) — Standalone: the instance's management manifest, checked against the flags and the stack's outputs before any write. Without it, the request goes through the control plane.
* `--profile` (*string*) — Standalone: AWS CLI profile for the target account; its credentials must be for the manifest's account.
* `--no-wait` (*boolean*) — Managed: return the accepted operation instead of waiting for completion. Standalone requests stay in the foreground and refuse this flag.

**Examples**

```bash
saaslayer users admin keys --phase introduce --caller billing-sync --purpose account-read --to-file billing-sync.key --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1
saaslayer users admin keys --phase status --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1
```

### `users admin grants`

Grant, revoke or list human management grants on a user-service instance.

Manage human grants by `--phase`: `grant` gives each `--principal` the `--purpose` purposes, `revoke` removes their grant and needs `--reason`, and `status` lists the grants. A revoked grant comes back only with `--reason`. Standalone, granting needs the stack to report a `CoreTableName` output.

**Usage**

```bash
saaslayer users admin grants --phase grant|revoke --principal SUID [repeat] [--purpose PURPOSE …] [--reason TEXT]
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
saaslayer users admin grants --phase status
  --deployment ID --service REF --aws-account ID --region REGION [--profile P --manifest FILE] [--no-wait]
```

**Flags**

* `--phase` (*grant | revoke | status*, required) — What to do with the grants.
* `--principal` (*string*, repeatable) — A person to grant or revoke; repeat for several. Required except with `--phase status`.
* `--purpose` (*string*, repeatable) — With `--phase grant` (required there), a purpose to grant; repeat for several.
* `--reason` (*string*) — Why; required with `--phase revoke`, and to grant again after a revoke.
* `--deployment` (*string*, required) — Deployment id (dep\_…) of the instance.
* `--service` (*string*, required) — `user-service`, or `user-service@<instance>` for a named instance.
* `--aws-account` (*string*, required) — 12-digit AWS account id of the deployment; checked against the deployment (managed) or the manifest (standalone).
* `--region` (*string*, required) — AWS region of the deployment; checked like `--aws-account`.
* `--manifest` (*string*) — Standalone: the instance's management manifest, checked against the flags and the stack's outputs before any write. Without it, the request goes through the control plane.
* `--profile` (*string*) — Standalone: AWS CLI profile for the target account; its credentials must be for the manifest's account.
* `--no-wait` (*boolean*) — Managed: return the accepted operation instead of waiting for completion. Standalone requests stay in the foreground and refuse this flag.

**Examples**

```bash
saaslayer users admin grants --phase grant --principal usr_123 --purpose account-read --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1
saaslayer users admin grants --phase revoke --principal usr_123 --reason "left the team" --deployment dep_123abc --service user-service --aws-account 123456789012 --region us-east-1
```

### `users adopt`

Adopt an account made outside SaaSLayer, optionally setting its password.

Adopt an account made outside SaaSLayer's routes (self sign-up, the Cognito console): it is recorded as adopted and its email verified. Invitation-registered and SaaSLayer-created accounts are never adopted. Needs its own scope `users:adopt` and grant (`users:write` never implies it).

`--password-stdin` then sets its password, which is password initialization: it needs `users:set-password` and its grant, and the deployment needs `user-service.EnablePasswordInitialization=true` (never prod). Passwords are read from stdin only; a `--password` flag is refused. Prints `{ suid, adopted, passwordSet }`.

**Usage**

```bash
saaslayer users adopt (<suid> | --suid ID | --email E) [--password-stdin] [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--password-stdin` (*boolean*) — Read the password from stdin. A `--password` flag is refused.
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users adopt --email you@example.com
```

### `users create`

Create a user, with a password from stdin or an emailed invitation.

A durable operation (identity, profile, permissions principal, password or invitation). Re-running the same command replays it (the default Idempotency-Key is derived from the email); a running operation is waited for; a failed step is an error: run the same command again to resume.

An email that belongs to another account is refused (`409`) and that account is left as it is (see `users adopt`). A warning, such as the email's domain signing in through SSO, is included in the result; the user is created all the same.

Example with a password: `printf '%s' "$PW" | saaslayer users create --email qa@example.com --password-stdin`

**Usage**

```bash
saaslayer users create --email E [--password-stdin | --delivery invitation] [--name N] [--soid ORG] [--suid ID]
  [--idempotency-key K] [--interval SECONDS] [--no-wait] [flags]
```

**Flags**

* `--email` (*string*, required) — The new user's email.
* `--password-stdin` (*boolean*) — Read a permanent password from stdin. Password initialization: needs `users:set-password` and its grant, and the deployment needs `user-service.EnablePasswordInitialization=true` (never prod). A `--password` flag is refused.
* `--delivery` (*invitation*) — Without a password, `invitation` has Cognito mail the user a temporary one.
* `--name` (*string*) — The user's display name.
* `--soid` (*string*) — The user's default org. It does not make them a member of it (`saaslayer permissions orgs members add`).
* `--suid` (*string*) — The SaaSLayer id to give the new user.
* `--no-wait` (*boolean*) — Return the actual accepted user operation instead of waiting; follow it with users operations watch.
* `--idempotency-key` (*string*) — Idempotency-Key of the operation; defaults to one derived from the email.
* `--interval` (*number*, default `5`) — How often to poll a running operation.
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users create --email you@example.com --delivery invitation --name Vera
# As an IAM principal, APIs discovered from the deployment
saaslayer users create --email you@example.com --delivery invitation --iam seeder --deployment dep_123abc
```

### `users delete`

Delete a user everywhere (GDPR). Needs --yes.

GDPR delete everywhere (sign-in, passwordless data, profile); it cannot be undone. Before anything is purged it erases the person from the audit (with every address user-service holds for them), removes their profile copies from their memberships and removes their own personal workspace (never a shared org). It prints:

* `auditIdentities`: `requested`, `done`, or `not-configured` without an audit table
* `profileCopies`: `removed` or `not-configured`
* `personalWorkspace`: `removed`, `none` when they have none, or `not-configured`

If any of these fails, nothing is deleted: run it again. After a finished delete the user no longer resolves, so erase again (or erase an address user-service never held, such as an invitation's) with `saaslayer permissions audit erase <suid> --email E`.

**Usage**

```bash
saaslayer users delete (<suid> | --suid ID) --yes [--email E] [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid`.

**Flags**

* `--yes` (*boolean*, required) — Confirm the delete (and the `--id-token-file` destination host).
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — The user's email, to find a user that was never projected. It does not replace the suid.
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.

**Examples**

```bash
saaslayer users delete usr_123 --yes
```

### `users disable`

Sign a user out everywhere and refuse their sign-in.

Sign the user out everywhere and refuse their sign-in until `saaslayer users enable`. Their grants and credentials are kept. The last usable owner of an org can't be disabled.

**Usage**

```bash
saaslayer users disable (<suid> | --suid ID | --email E) [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users disable usr_123
```

### `users enable`

Allow a disabled user to sign in again.

Allow a user disabled with `saaslayer users disable` to sign in again. Their grants and credentials were kept.

**Usage**

```bash
saaslayer users enable (<suid> | --suid ID | --email E) [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users enable usr_123
```

### `users export`

Export users from another identity system into a reviewable manifest.

Read users from another identity system with YOUR credentials into a reviewable manifest: accounts, their people and each person's role. Everyone is their account's owner unless `--role-map` says otherwise. Providers: `cognito`. It runs locally, and nothing passes through SaaSLayer.

No secrets are exported (no passwords or MFA secrets: imported users set a new password and set up MFA again). The file holds personal data: keep it private and delete it after the import. Disabled source users are exported and then skipped by import. It reads one pool: a SaaSLayer deployment's second sign-in pool (phone or email) is not exported.

**Usage**

```bash
saaslayer users export --provider cognito --user-pool-id POOL --region REGION --out FILE [flags]
```

**Flags**

* `--provider` (*cognito*, required) — The identity system to read.
* `--user-pool-id` (*string*, required) — The source user pool, read with `ListUsers`.
* `--region` (*string*, required) — Region of the source pool.
* `--profile` (*string*) — AWS CLI profile with read access to the source pool.
* `--account-attribute` (*string*) — User attribute naming the account a user belongs to (e.g. `custom:orgId`). Users sharing a value become one account, and the value becomes its org id. Without it, each user gets an account of their own.
* `--account-name-attribute` (*string*) — User attribute holding the account's display name (e.g. `custom:company`); default: the first user's name, or their email.
* `--role-map` (*string*) — A module exporting `({ user, account, index }) => roleId`; default: everyone is `owner`.
* `--out` (*string*, required) — Where to write the manifest (mode 0600).

**Examples**

```bash
saaslayer users export --provider cognito --user-pool-id us-east-1_AbC123 --region us-east-1 --account-attribute custom:orgId --out manifest.json
```

### `users get`

Show one user: status, enabled and email verification.

Show one user: status, enabled and email verification. With `--org`, the member view of that org.

**Usage**

```bash
saaslayer users get (<suid> | --suid ID | --email E) [--org ORG] [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--org` (*string*) — Show the member view of this org.
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users get usr_123
saaslayer users get --email you@example.com --org org_123
```

### `users import`

Import users from a manifest into a deployment. Dry run unless --apply.

Dry run by default: prints what would be created or linked (with `--iam`, also checks the profile permissions and counts the profiles to create). It runs locally with your AWS credentials.

`--apply`:

* imports new users through a Cognito CSV import job: they land reset-required, no emails are sent, and on first sign-in `<SignIn>` sends them a reset code
* stamps their SaaSLayer id and default org
* creates each person's user-service profile (no email, no password), so products see their name before they sign in
* creates each permissions principal and org, adds the members and bootstraps the first Owner

`--apply` needs `--iam` with the IAM scopes `users:write`, `users:read`, `users:write-reserved`, `orgs:write` and `owners:bootstrap`; the user-service ones are checked before anything is written. `--token` is for the dry run only: user-service doesn't accept Permissions API keys. The product's catalog must be applied (`saaslayer permissions model apply`).

Idempotent: re-run to retry failures; it resumes from `<manifest>.profiles-checkpoint.json`. Exits 1 when any user or profile needs attention.

**Usage**

```bash
saaslayer users import --manifest FILE --user-pool-id POOL --region R [--profile P]
  [--permissions-api-base URL --product P (--iam PRINCIPAL | --token KEY) [--logs-role-arn ARN] --apply] [--report FILE]
```

**Flags**

* `--manifest` (*string*, required) — The manifest from `saaslayer users export`; validated first.
* `--user-pool-id` (*string*, required) — The target SaaSLayer deployment's user pool.
* `--region` (*string*) — Region of the target pool; default `$AWS_REGION`.
* `--profile` (*string*) — AWS CLI profile for the target account.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The target deployment's permissions API. Required with `--apply`.
* `--product` (*string*) — The product whose owner role is granted. Required with `--apply`.
* `--iam` (*string*) — The declared IAM principal to call the permissions API and user-service as, with your AWS credentials. Required with `--apply`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key for the dry run (no profile check); `--apply` refuses it.
* `--logs-role-arn` (*string*) — Logs role for the Cognito import job; default: the one the target pool's user-service stack publishes. Pass it only to use a role `cognito-idp.amazonaws.com` can assume.
* `--apply` (*boolean*) — Import. Without it, only the plan is printed.
* `--report` (*string*) — Where `--apply` writes the report of what was created, linked, failed or skipped per person; default `<manifest>.import-report.json`.

**Examples**

```bash
saaslayer users import --manifest manifest.json --user-pool-id us-east-1_AbC123 --region us-east-1
saaslayer users import --manifest manifest.json --user-pool-id us-east-1_AbC123 --region us-east-1 --permissions-api-base https://api.example.com --product acme --iam importer --apply
```

### `users list`

List users by email or default org.

List the users holding an email, or whose default org is ORG. Prints `nextCursor` for the next page.

**Usage**

```bash
saaslayer users list (--email E | --default-org ORG) [--limit N] [--cursor C] [flags]
```

**Flags**

* `--email` (*string*) — List the users holding this email.
* `--default-org` (*string*) — List the users whose default org is ORG.
* `--limit` (*number*) — Most users to return.
* `--cursor` (*string*) — The `nextCursor` of the previous page.
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users list --default-org org_123 --limit 20
saaslayer users list --email you@example.com
```

### `users reset-mfa`

Remove the MFA factors of a user who lost all of them.

For a user who lost every MFA factor: removes their passkeys and authenticator-app MFA, clears step-up evidence and signs them out everywhere, so they can enroll a new factor. Access admins only: it needs `saaslayer:users:account:reset-mfa`, no IAM scope opens it (never `--iam`), and an impersonated session is refused. Resetting your own MFA needs a fresh MFA sign-in.

**Usage**

```bash
saaslayer users reset-mfa (<suid> | --suid ID | --email E) --reason TEXT [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--reason` (*string*, required) — Why; recorded in the audit line.
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users reset-mfa usr_123 --reason "lost phone and passkey"
```

### `users reset-password`

Mail a user a password reset code; their current password stops working.

Cognito mails a reset code to the verified email; the current password stops working.

**Usage**

```bash
saaslayer users reset-password (<suid> | --suid ID | --email E) [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users reset-password usr_123
```

### `users set-password`

Set a user's password from stdin.

Set the password read from stdin. Permanent unless `--temporary` (replaced at next sign-in). Password initialization: needs `users:set-password` and its grant, and the deployment needs `user-service.EnablePasswordInitialization=true` (never prod). Access admins are refused.

**Usage**

```bash
saaslayer users set-password (<suid> | --suid ID | --email E) --password-stdin [--temporary] [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--password-stdin` (*boolean*, required) — Read the password from stdin. A `--password` flag is refused.
* `--temporary` (*boolean*) — Make the user replace the password at next sign-in.
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users set-password usr_123 --password-stdin --temporary
```

### `users update`

Update a user's profile attributes, or reserved ones.

Update profile attributes (`name`, `given_name`, `family_name`, `locale`, `zoneinfo`, `picture`), or reserved ones (`email`, `email_verified=true|false`, `soid`) through the reserved route, which needs `saaslayer:users:account:update-reserved`. Profile and reserved attributes are separate updates; one command never mixes them.

**Usage**

```bash
saaslayer users update (<suid> | --suid ID | --email E) [--name N] [--attr name=value …] [flags]
```

**Arguments**

* `suid` (optional) — The user's SaaSLayer id. Or pass `--suid` or `--email`.

**Flags**

* `--name` (*string*) — Set the `name` attribute.
* `--attr` (*string*, repeatable) — Set one attribute; repeat for several. At least one of `--name` or `--attr` is required.
* `--suid` (*string*) — The user's SaaSLayer id, instead of the `<suid>` argument.
* `--email` (*string*) — Find the user by email (needs `users:read`).
* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users update --email you@example.com --attr locale=en
# Reserved: needs saaslayer:users:account:update-reserved
saaslayer users update usr_123 --attr email_verified=false
```

### `users operations`

Inspect or follow an existing user operation.

Read the user-service operation created by users create. This does not start, cancel or replay the operation.

| Subcommand | Description |
| --- | --- |
| [`users operations get`](#users-operations-get) | Show an existing user operation and its component outcomes. |
| [`users operations watch`](#users-operations-watch) | Wait for an existing user operation to finish. |

### `users operations get`

Show an existing user operation and its component outcomes.

Read the operation and its actual status. A successful read exits 0 even when the operation failed.

**Usage**

```bash
saaslayer users operations get <operation-id> [flags]
```

**Arguments**

* `operation-id` — The operation ID returned by users create.

**Flags**

* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.

**Examples**

```bash
saaslayer users operations get op_example --deployment dev
```

### `users operations watch`

Wait for an existing user operation to finish.

Poll the existing operation. Failed or partial work returns a failure with the observed operation retained. Local interruption stops polling without remotely cancelling it.

**Usage**

```bash
saaslayer users operations watch <operation-id> [flags]
```

**Arguments**

* `operation-id` — The operation ID returned by users create.

**Flags**

* `--deployment` (*string*) — Deployment id (dep\_…) or an environment of the active project. Picks the deployment login to act as; with `--iam` or `--token`, the deployment whose public outputs name the APIs.
* `--as` (*string*) — Pick the deployment login of this email when several match.
* `--user-service-instance` (*string*) — Pick the deployment login, or the discovered APIs, of this named user-service instance.
* `--iam` (*string*) — Authenticate as this declared IAM principal: your AWS credentials are exchanged for an `iam_` token at the permissions API. Needs the IAM scope (`users:read`, `users:write`, `users:write-reserved`, `users:set-password` or `users:adopt`) and the matching `saaslayer:users:account:*` grant on `iam.PRINCIPAL`.
* `--token` (*string*, env `SAASLAYER_TOKEN`, secret) — API key to authenticate with instead of your deployment login.
* `--region` (*string*) — AWS region of the IAM token exchange with `--iam` (default `$AWS_REGION`, else us-west-2). With an environment name in `--deployment`, also picks the deployment in that region.
* `--profile` (*string*) — AWS CLI profile whose credentials `--iam` uses.
* `--api-base` (*string*, env `SAASLAYER_USERS_API_BASE`) — The deployment's users API, instead of the deployment login's own or the discovered one.
* `--permissions-api-base` (*string*, env `SAASLAYER_API_BASE`) — The permissions API that exchanges `--iam` for a token. Required with `--iam` and `--api-base`; otherwise discovered.
* `--project` (*string*) — With an environment name in `--deployment`, the project; defaults to the active project.
* `--discovery-url` (*string*) — URL of the deployment's public discovery document, instead of `--deployment`.
* `--id-token-file` (*string*, env `SAASLAYER_ID_TOKEN`) — File holding the raw OIDC ID token from your own login provider, sent as the credential (the environment variable holds the token itself). It goes only to a pinned host: an https `--api-base` whose host you type to confirm (`--yes` confirms). Expired tokens and access tokens are refused locally; never combined with `--iam`, `--token`, `$SAASLAYER_TOKEN` or a deployment login; the token is never printed. Keep the file chmod 600.
* `--yes` (*boolean*) — Confirm the `--id-token-file` destination host without typing it.
* `--interval` (*number*, default `5`) — Seconds between operation reads.

**Examples**

```bash
saaslayer users operations watch op_example --deployment dev
```

### `users first-admin`

Resend a deployment's first admin sign-in, or designate a new first admin.

The deployment's first administrator is named at deploy (`--admin-email`). If their first sign-in never arrived, or nobody can administer the deployment any more, an org owner can act from the control plane.

Needs `saaslayer:deployer:deployment:admin-bootstrap`; org owners hold it. Both subcommands start an operation and wait for it (`--no-wait` returns); the deployment's activity records who asked and why.

| Subcommand | Description |
| --- | --- |
| [`users first-admin resend`](#users-first-admin-resend) | Deliver the designated first admin's first sign-in again. |
| [`users first-admin recover`](#users-first-admin-recover) | Designate a new first admin when no usable access admin remains. |

### `users first-admin resend`

Deliver the designated first admin's first sign-in again.

Delivers the designated admin's first sign-in again. This is the only rotation of its temporary password. Refused once they activated.

Needs `saaslayer:deployer:deployment:admin-bootstrap` (org owners hold it). Waits for its operation.

**Usage**

```bash
saaslayer users first-admin resend [--deployment ID | --project P --env E --region R] [--reason TEXT] [--no-wait] [--interval SECONDS]
```

**Flags**

* `--deployment` (*string*) — Deployment id (`dep_…`); without it the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--reason` (*string*) — Why you are making the change; recorded in the activity log.
* `--no-wait` (*boolean*) — Return once the operation starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the operation while waiting for it.

**Examples**

```bash
saaslayer users first-admin resend --env prod
saaslayer users first-admin resend --deployment dep_123abc --reason "first sign-in email never arrived"
```

### `users first-admin recover`

Designate a new first admin when no usable access admin remains.

Designates a new first admin and retires the bindings nobody can use. Refused with ADMIN_EXISTS while any usable access admin remains (the count `GET /access-admins` reports): hand the role over with `saaslayer permissions access-admins offer` instead.

Needs `saaslayer:deployer:deployment:admin-bootstrap` (org owners hold it). Waits for its operation.

**Usage**

```bash
saaslayer users first-admin recover (--email E | --phone-number +E164) --reason TEXT [--suid ID] [--deployment ID | --project P --env E --region R] [--no-wait]
  [--interval SECONDS]
```

**Flags**

* `--email` (*string*) — Email of the new first admin. Give this or `--phone-number`.
* `--phone-number` (*string*) — Phone number of the new first admin in E.164 form (for example +15555550100), on a phone-primary deployment. Give this or `--email`.
* `--reason` (*string*, required) — Why you are making the change; recorded in the activity log.
* `--suid` (*string*) — Principal id (suid) to give the new first admin.
* `--deployment` (*string*) — Deployment id (`dep_…`); without it the deployment is resolved from `--project`, `--env` and `--region`.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--no-wait` (*boolean*) — Return once the operation starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the operation while waiting for it.

**Examples**

```bash
saaslayer users first-admin recover --env prod --email admin@example.com --reason "first admin left"
# On a phone-primary deployment
saaslayer users first-admin recover --env prod --phone-number +15555550100 --reason "first admin left"
```

### `users social`

Configure Google sign-in for a user-service instance with your own Google OAuth app.

Social sign-in (Google so far) for one user-service instance, with your own Google OAuth app. Each change is one request and one deployment run, the same as a save on the console's Social login page; the command waits for the run unless `--no-wait`. A retry after a dropped connection repeats the same request and answers the same run.

The client secret is read only from stdin (e.g. `< secret.txt`): it is never a flag, never printed and never stored in the CLI. Requires `saaslayer login`.

| Subcommand | Description |
| --- | --- |
| [`users social status`](#users-social-status) | Show the instance's social sign-in and the values the Google console needs. |
| [`users social enable`](#users-social-enable) | Turn on a provider's sign-in, setting its client and URL lists. |
| [`users social rotate-secret`](#users-social-rotate-secret) | Replace a provider's client secret, read from stdin. |
| [`users social disable`](#users-social-disable) | Turn off a provider's sign-in. |

### `users social status`

Show the instance's social sign-in and the values the Google console needs.

One user-service instance's social sign-in: each provider on or off, its client id and hosted domains, the callback/logout URLs and app origins, and the redirect URI and JavaScript origin to paste into the Google console (plus any other redirect URI to keep registered, such as a pending custom login domain's). Warns about a callback URL registered without its trailing-slash twin, which Cognito refuses after the provider's sign-in.

**Usage**

```bash
saaslayer users social status [flags]
```

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users social status --env dev
saaslayer users social status --env prod --service user-service@team --json
```

### `users social enable`

Turn on a provider's sign-in, setting its client and URL lists.

Turn on the provider's sign-in. The stored client id and secret are kept unless given; the first enable needs `--client-id`. Each `--callback-url`, `--app-origin` and `--hosted-domain` list replaces the stored one.

**Usage**

```bash
saaslayer users social enable <provider> [--client-id ID] [--client-secret-stdin] [--hosted-domain DOMAIN ...] [--callback-url URL ...]
  [--app-origin ORIGIN ...] [--env E] [--service REF] [--reason TEXT] [--no-wait]
```

**Arguments**

* `provider` — The sign-in provider. `google` is the only one so far.

**Flags**

* `--client-id` (*string*) — OAuth client id of your Google app; default the stored one.
* `--client-secret-stdin` (*boolean*) — Read the client secret from stdin (a pipe or file; a terminal is refused). Default: keep the stored secret.
* `--hosted-domain` (*string*, repeatable) — A Google Workspace domain allowed to sign in. The values replace the stored list.
* `--callback-url` (*string*, repeatable) — A URL sign-in may return to. Register each page at the exact address the site serves, trailing slash included. The values replace the stored list.
* `--app-origin` (*string*, repeatable) — An app origin allowed to use the sign-in. The values replace the stored list.
* `--reason` (*string*) — Why you are making the change; recorded with it. Required on the protected environments (staging, prod).
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the deployment run starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
# The client secret comes from stdin: run it with < secret.txt
saaslayer users social enable google --env dev --client-id 1234.apps.googleusercontent.com --client-secret-stdin --callback-url http://localhost:5173/ --app-origin http://localhost:5173
# Restrict sign-in to one Workspace domain, keeping the client
saaslayer users social enable google --env dev --hosted-domain example.com
```

### `users social rotate-secret`

Replace a provider's client secret, read from stdin.

Replace the provider's stored client secret with the one on stdin. The provider must be enabled.

**Usage**

```bash
saaslayer users social rotate-secret <provider> --client-secret-stdin [flags]
```

**Arguments**

* `provider` — The sign-in provider. `google` is the only one so far.

**Flags**

* `--client-secret-stdin` (*boolean*, required) — Read the new client secret from stdin (a pipe or file; a terminal is refused).
* `--reason` (*string*) — Why you are making the change; recorded with it. Required on the protected environments (staging, prod).
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the deployment run starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
# Run with < new-secret.txt
saaslayer users social rotate-secret google --env dev --client-secret-stdin
```

### `users social disable`

Turn off a provider's sign-in.

Turn off the provider's sign-in. Refused (SOCIAL_ONLY_USERS_AFFECTED, with the count) while users sign in only with that provider, even with `--confirm`, until they have another method (a signed-in user can add a password from their profile).

**Usage**

```bash
saaslayer users social disable <provider> [flags]
```

**Arguments**

* `provider` — The sign-in provider. `google` is the only one so far.

**Flags**

* `--confirm` (*boolean*) — Confirm the disable; sent with the request.
* `--reason` (*string*) — Why you are making the change; recorded with it. Required on the protected environments (staging, prod).
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--no-wait` (*boolean*) — Return once the deployment run starts; follow it with `saaslayer deployment operations watch`.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users social disable google --env prod --reason "switching to Workspace SSO"
```

### `users login-domain`

Manage a user-service instance's branded login domain.

A user-service instance's branded login domain: `managed` (`auth.<space>.saaslayer-cloud.com`) or your own host. `provision` sets it up while the opaque login domain stays advertised, `activate` advertises it, `deactivate` advertises the opaque one again and `remove` deletes it.

The login-domain settings (`user-service.CustomCognitoDomainName`, `CustomCognitoDomainCertificateArn`, `ActiveLoginDomain`) are set only by these commands; `saaslayer deployment settings set` refuses them (LOGIN_DOMAIN_MANAGED_SETTING). A protected env (staging, prod) needs `--reason` for every change.

| Subcommand | Description |
| --- | --- |
| [`users login-domain status`](#users-login-domain-status) | Show an instance's login domain: host, state, certificate, DNS records and redirect URIs. |
| [`users login-domain provision`](#users-login-domain-provision) | Set up a managed or custom login domain; the opaque one stays advertised until activate. |
| [`users login-domain activate`](#users-login-domain-activate) | Advertise the custom login domain instead of the opaque one. |
| [`users login-domain deactivate`](#users-login-domain-deactivate) | Advertise the opaque login domain again instead of the custom one. |
| [`users login-domain remove`](#users-login-domain-remove) | Delete the custom login domain, its DNS alias and certificate, and free its quota slot. |

### `users login-domain status`

Show an instance's login domain: host, state, certificate, DNS records and redirect URIs.

Prints one user-service instance's branded login domain:

* kind (managed | custom), host and state
* the active and opaque hosts
* the certificate status and whether DNS points correctly
* the records a custom domain needs at your DNS provider
* the redirect URIs to keep registered in each provider console
* the account+region quota

**Usage**

```bash
saaslayer users login-domain status [--env E] [--region R] [--service REF] [--json]
  [--project P] [--deployment ID]
```

**Flags**

* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users login-domain status
saaslayer users login-domain status --env staging --service user-service@staff
```

### `users login-domain provision`

Set up a managed or custom login domain; the opaque one stays advertised until activate.

Sets up the instance's branded login domain:

* `managed`: `auth.<space>.saaslayer-cloud.com`.
* HOST: your own (for example `auth.acme.com`). The first call requests its certificate and prints the two records to add at your DNS provider; run it again once the certificate is ISSUED to start the provision run.

Provisioning keeps the opaque login domain advertised until `activate`.

**Usage**

```bash
saaslayer users login-domain provision managed|HOST [--env E] [--service REF] [--reason TEXT] [--no-wait] [--json]
  [--project P] [--deployment ID] [--region R] [--interval SECONDS]
```

**Arguments**

* `domain` — `managed`, or your own host (for example `auth.acme.com`).

**Flags**

* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--reason` (*string*) — Why you are making the change; recorded in the activity log. Required in a protected env (staging, prod).
* `--no-wait` (*boolean*) — Return once the run starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the run while waiting for it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users login-domain provision managed --env prod --reason "branded login host"
# Your own host: run once for the DNS records, again once the certificate is ISSUED
saaslayer users login-domain provision auth.acme.com --env prod --reason "branded login host"
```

### `users login-domain activate`

Advertise the custom login domain instead of the opaque one.

Advertises the provisioned custom login domain. Register the new redirect URI before `activate` and keep the old one.

Switching breaks the provider redirects and app callbacks registered against the current host, so it is refused (LOGIN_DOMAIN_HANDOFF_REQUIRED, listing them) unless `--confirm-domain` names the current host. Passkeys and the issuer do not change.

A completion checklist is printed: the switch is done when the new host serves sign-in and every listed redirect and callback is updated.

**Usage**

```bash
saaslayer users login-domain activate --confirm-domain HOST --reason TEXT [--env E] [--service REF] [--no-wait] [--json]
  [--project P] [--deployment ID] [--region R] [--interval SECONDS]
```

**Flags**

* `--confirm-domain` (*string*, required) — The current login host, acknowledging the redirects and callbacks the switch breaks.
* `--reason` (*string*, required) — Why you are making the change; recorded in the activity log.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--no-wait` (*boolean*) — Return once the run starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the run while waiting for it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users login-domain activate --confirm-domain abc123.auth.us-east-1.amazoncognito.com --reason "switch to branded login" --env prod
```

### `users login-domain deactivate`

Advertise the opaque login domain again instead of the custom one.

Advertises the opaque login domain again. Google sign-in there needs its redirect URI (`https://<opaque host>/oauth2/idpresponse`) registered in the Google client; re-add it first if it was removed.

Switching breaks the provider redirects and app callbacks registered against the current host, so it is refused (LOGIN_DOMAIN_HANDOFF_REQUIRED, listing them) unless `--confirm-domain` names the current host. Passkeys and the issuer do not change.

A completion checklist is printed: the switch is done when the new host serves sign-in and every listed redirect and callback is updated.

**Usage**

```bash
saaslayer users login-domain deactivate --confirm-domain HOST --reason TEXT [--env E] [--service REF] [--no-wait] [--json]
  [--project P] [--deployment ID] [--region R] [--interval SECONDS]
```

**Flags**

* `--confirm-domain` (*string*, required) — The current login host, acknowledging the redirects and callbacks the switch breaks.
* `--reason` (*string*, required) — Why you are making the change; recorded in the activity log.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--no-wait` (*boolean*) — Return once the run starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the run while waiting for it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users login-domain deactivate --confirm-domain auth.acme.com --reason "roll back branded login" --env prod
```

### `users login-domain remove`

Delete the custom login domain, its DNS alias and certificate, and free its quota slot.

Deletes the custom login domain, its DNS alias and (for HOST) its certificate, and frees its quota slot. Refused while it is active: `deactivate` first.

Apps configured with the removed login domain's URL (`SAASLAYER_HOSTED_LOGIN_URL` from `saaslayer bindings export`) stop reaching sign-in until they re-read discovery or are rebuilt.

**Usage**

```bash
saaslayer users login-domain remove [--env E] [--service REF] [--reason TEXT] [--no-wait] [--json]
  [--project P] [--deployment ID] [--region R] [--interval SECONDS]
```

**Flags**

* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--reason` (*string*) — Why you are making the change; recorded in the activity log. Required in a protected env (staging, prod).
* `--no-wait` (*boolean*) — Return once the run starts instead of waiting for it; follow it with `saaslayer deployment operations watch`.
* `--interval` (*number*, default `5`) — How often to poll the run while waiting for it.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users login-domain remove --env prod --reason "branded login retired"
```

### `users hooks`

Read, change and test a user-service instance's lifecycle hooks.

Lifecycle hooks call your URL or Lambda at points of a user-service instance's sign-up and sign-in:

* `beforeSignUp`, `afterUserCreated`, `beforeTokenIssue`, `afterSignIn`, `message`;
* `ssoLifecycle`: SSO lifecycle events, ids only (EnableSso instances only).

Calls are signed with the instance's signing secret. Changes (set, unset, grants, rotate-secret) are for owners of the deployment's org only. Requires `saaslayer login`.

| Subcommand | Description |
| --- | --- |
| [`users hooks status`](#users-hooks-status) | Show each hook point's target, the grants a hook may make and the signing-secret key ids. |
| [`users hooks set`](#users-hooks-set) | Set the target of one hook point, replacing its whole configuration. |
| [`users hooks unset`](#users-hooks-unset) | Remove the target of one hook point. |
| [`users hooks grants`](#users-hooks-grants) | Set which \{org, role} pairs a hook may grant. |
| [`users hooks test`](#users-hooks-test) | Send one hook point a signed test event and show what it proposed. |
| [`users hooks rotate-secret`](#users-hooks-rotate-secret) | Create a new hook signing secret, printed once. |
| [`users hooks claims-cache`](#users-hooks-claims-cache) | Manage the cache of beforeTokenIssue claims. |
| [`users hooks logs`](#users-hooks-logs) | List the newest hook calls of the last 14 days, metadata only. |

### `users hooks status`

Show each hook point's target, the grants a hook may make and the signing-secret key ids.

One user-service instance's lifecycle hooks: each point's target (URL or Lambda), failure mode, timeout and claims cache time, the \{org, role} pairs a hook may grant, and the signing-secret key ids (never the secret).

**Usage**

```bash
saaslayer users hooks status [flags]
```

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks status --env dev
saaslayer users hooks status --env prod --service user-service@team --json
```

### `users hooks set`

Set the target of one hook point, replacing its whole configuration.

Set the target of one point. `set` replaces the point's whole configuration. A Lambda must first be listed in the instance's `HookLambdaArns` setting (`saaslayer deployment settings set`; a protected env needs `--reason` there). Owners of the deployment's org only.

**Usage**

```bash
saaslayer users hooks set <point> (--url URL | --lambda ARN) [--on-failure allow|deny] [--timeout-ms N] [--claims-ttl-seconds N]
  [--env E] [--service REF]
```

**Arguments**

* `point` — Hook point: beforeSignUp, afterUserCreated, beforeTokenIssue, afterSignIn, message, ssoLifecycle.

**Flags**

* `--url` (*string*) — HTTPS URL to call. Give `--url` or `--lambda`, not both.
* `--lambda` (*string*) — Lambda function ARN to invoke; it must be listed in `HookLambdaArns`.
* `--on-failure` (*allow | deny*) — What happens when the hook call fails: allow or deny the sign-up or token. beforeSignUp and beforeTokenIssue only.
* `--timeout-ms` (*number*) — Milliseconds to wait for the hook. beforeSignUp and beforeTokenIssue only.
* `--claims-ttl-seconds` (*number*) — beforeTokenIssue only: seconds the hook's `app:` claims are reused before it is asked again; `0` asks on every issuance.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks set beforeSignUp --url https://api.example.com/hooks/signup --on-failure deny --timeout-ms 2000 --env dev
saaslayer users hooks set beforeTokenIssue --lambda arn:aws:lambda:us-east-1:123456789012:function:claims --claims-ttl-seconds 300 --env dev
```

### `users hooks unset`

Remove the target of one hook point.

Remove the target of one point, so the instance no longer calls a hook there. Owners of the deployment's org only.

**Usage**

```bash
saaslayer users hooks unset <point> [flags]
```

**Arguments**

* `point` — Hook point: beforeSignUp, afterUserCreated, beforeTokenIssue, afterSignIn, message, ssoLifecycle.

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks unset afterSignIn --env dev
```

### `users hooks grants`

Set which \{org, role} pairs a hook may grant.

| Subcommand | Description |
| --- | --- |
| [`users hooks grants set`](#users-hooks-grants-set) | Replace the exact \{org, role} pairs a hook may grant. |

### `users hooks grants set`

Replace the exact \{org, role} pairs a hook may grant.

Replace the exact \{org, role} pairs a hook may grant; each `--grant-org` pairs with the `--role` after it. The org's owner must also list the role as hook-joinable (`saaslayer permissions orgs hook-joinable set`). Owners of the deployment's org only.

**Usage**

```bash
saaslayer users hooks grants set --grant-org ID --role ROLE [--grant-org ID --role ROLE ...] [--env E] [--service REF]
```

**Flags**

* `--grant-org` (*string*, required, repeatable) — Org id of a pair; pairs with the next `--role`.
* `--role` (*string*, required, repeatable) — Role id of a pair; pairs with the `--grant-org` before it.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks grants set --grant-org org_123 --role member --env dev
saaslayer users hooks grants set --grant-org org_123 --role member --grant-org org_456 --role viewer --env dev
```

### `users hooks test`

Send one hook point a signed test event and show what it proposed.

The instance sends the point a signed test event (`test: true`, sample data naming no real account) and shows what the hook proposed, or why the call failed and what a real call would then do. Nothing is applied.

**Usage**

```bash
saaslayer users hooks test <point> [flags]
```

**Arguments**

* `point` — Hook point: beforeSignUp, afterUserCreated, beforeTokenIssue, afterSignIn, message, ssoLifecycle.

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks test beforeSignUp --env dev
```

### `users hooks rotate-secret`

Create a new hook signing secret, printed once.

A new signing secret, printed once: store it in your receiver. The previous key keeps signing until the time shown, so verify with both until then. Owners of the deployment's org only.

**Usage**

```bash
saaslayer users hooks rotate-secret [flags]
```

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks rotate-secret --env dev
```

### `users hooks claims-cache`

Manage the cache of beforeTokenIssue claims.

| Subcommand | Description |
| --- | --- |
| [`users hooks claims-cache invalidate`](#users-hooks-claims-cache-invalidate) | Drop every cached beforeTokenIssue claim so the next sign-in asks the hook again. |

### `users hooks claims-cache invalidate`

Drop every cached beforeTokenIssue claim so the next sign-in asks the hook again.

Drop every cached beforeTokenIssue claim, so the next sign-in asks the hook again (after changing its logic).

**Usage**

```bash
saaslayer users hooks claims-cache invalidate [flags]
```

**Flags**

* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks claims-cache invalidate --env dev
```

### `users hooks logs`

List the newest hook calls of the last 14 days, metadata only.

The newest hook calls (kept 14 days): when, point, event and attempt, target kind, outcome, HTTP status, time, reason code and the names of the actions a reply proposed. Never a body, target, secret or personal data. Use --cursor with the returned nextCursor to read older calls.

**Usage**

```bash
saaslayer users hooks logs [flags]
```

**Flags**

* `--limit` (*number*) — Page size from 1 to 100; default 50.
* `--cursor` (*string*) — Opaque nextCursor returned by the previous page.
* `--point` (*beforeSignUp | afterUserCreated | beforeTokenIssue | afterSignIn | message | ssoLifecycle*) — Only calls of this hook point.
* `--service` (*string*) — The user-service instance: `user-service` or `user-service@<instance>`. Required when the deployment has several.
* `--deployment` (*string*) — Deployment id (dep\_…) when the environment has more than one; without `--env`, the environment that holds it.
* `--project` (*string*) — Project id; defaults to the active project.
* `--env` (*string*, default `prod`) — Environment of the deployment (for example dev, staging or prod).
* `--region` (*string*) — AWS region.
* `--org` (*string*) — Org id for the scope line, and for listing the projects that have deployments when none is found; defaults to the active org.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users hooks logs --env dev
saaslayer users hooks logs --point beforeTokenIssue --env prod --json
```

### `users verifier-keys`

Manage the server keys your backend uses to verify a deployment's tokens.

Verifier keys of one user-service instance: server keys for your backend or SDK that verify the deployment's tokens (SSO on). A key is never printed or listed.

Deployment owners only: an owner of the owning org, acting as their own deployment login of that instance (`saaslayer login --deployment`; `--as` picks one of several).

| Subcommand | Description |
| --- | --- |
| [`users verifier-keys create`](#users-verifier-keys-create) | Create a verifier key and store it in SSM or a file; it is never printed. |
| [`users verifier-keys list`](#users-verifier-keys-list) | List a user-service instance's verifier key ids, scopes and states. |
| [`users verifier-keys revoke`](#users-verifier-keys-revoke) | Revoke a verifier key; its next request is refused. |

### `users verifier-keys create`

Create a verifier key and store it in SSM or a file; it is never printed.

Creates a server key for your backend or SDK that verifies this deployment's tokens (SSO on). Its scope limits it to one job:

* `trusted-clients` reads the trusted-clients registry only.
* `token-status` checks a token's live standing (`POST /api/auth/status`) only.

The key is never printed: it goes to an SSM SecureString in your AWS account (with your AWS credentials, in the deployment's region by default) or to a new 0600 file. A key that cannot be stored is revoked. At most two active keys per scope.

**Usage**

```bash
saaslayer users verifier-keys create --purpose trusted-clients|token-status (--to-ssm NAME [--ssm-region R] [--profile P] | --to-file PATH)
  [--env E] [--project P] [--deployment ID] [--region R] [--service REF] [--as EMAIL] [--json]
```

**Flags**

* `--purpose` (*trusted-clients | token-status*, required) — What the key may do: read the trusted-clients registry, or check a token's live standing.
* `--to-ssm` (*string*) — Write the key to this SSM SecureString parameter in your AWS account. Give this or `--to-file`.
* `--ssm-region` (*string*) — Region of the `--to-ssm` parameter; defaults to the deployment's region.
* `--profile` (*string*) — AWS CLI profile used to write the `--to-ssm` parameter; defaults to the AWS CLI default credential chain.
* `--to-file` (*string*) — Write the key to a new file with mode 0600. Give this or `--to-ssm`.
* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--as` (*string*) — Which of your deployment logins of that instance to act as, when you have several.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users verifier-keys create --purpose token-status --to-ssm /acme/prod/verifier-key
# Store it in a local file for a staging backend
saaslayer users verifier-keys create --purpose trusted-clients --to-file ./verifier-key --env staging
```

### `users verifier-keys list`

List a user-service instance's verifier key ids, scopes and states.

Prints each key's id, scope and state, and who created or revoked it and when. Never a key. Deployment owners only.

**Usage**

```bash
saaslayer users verifier-keys list [flags]
```

**Flags**

* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--as` (*string*) — Which of your deployment logins of that instance to act as, when you have several.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users verifier-keys list
saaslayer users verifier-keys list --env staging --service user-service@staff --json
```

### `users verifier-keys revoke`

Revoke a verifier key; its next request is refused.

Revokes one verifier key: the key is refused from its next request. Deployment owners only.

**Usage**

```bash
saaslayer users verifier-keys revoke <keyId> [flags]
```

**Arguments**

* `keyId` — Id of the verifier key to revoke, as `users verifier-keys list` prints it.

**Flags**

* `--env` (*string*, default `prod`) — Environment of the project whose deployment to use.
* `--project` (*string*) — Project id; defaults to the active project.
* `--deployment` (*string*) — Deployment id (`dep_…`) of the project; without `--env` it is found in whichever environment holds it.
* `--region` (*string*) — Region of the deployment, when the environment has deployments in several regions.
* `--service` (*string*) — user-service instance (`user-service` or `user-service@<instance>`); required when the deployment has several.
* `--as` (*string*) — Which of your deployment logins of that instance to act as, when you have several.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users verifier-keys revoke vk_123
```

### `users integration-credentials`

Inspect or revoke a user-service instance's console integration credentials.

The console integration credentials of a user-service instance: key ids, state and age, never a value. Org owners only.

| Subcommand | Description |
| --- | --- |
| [`users integration-credentials status`](#users-integration-credentials-status) | Show a user-service instance's integration credential keys: ids, state and age. |
| [`users integration-credentials revoke`](#users-integration-credentials-revoke) | Revoke one integration credential key at once, in an emergency. |

### `users integration-credentials status`

Show a user-service instance's integration credential keys: ids, state and age.

Prints each key's kind, id, state, age and whether every verifier accepted it, then any pending operation. Never a value. Org owners only.

**Usage**

```bash
saaslayer users integration-credentials status --deployment ID --service REF [flags]
```

**Flags**

* `--deployment` (*string*, required) — Deployment id (`dep_…`).
* `--service` (*string*, required) — user-service instance (`user-service` or `user-service@<instance>`).
* `--operation` (*string*) — Inspect this existing credential operation instead of only the current pending one.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users integration-credentials status --deployment dep_123abc --service user-service
```

### `users integration-credentials revoke`

Revoke one integration credential key at once, in an emergency.

An emergency revoke of one key, with no delay. Waits for the operation by default; --no-wait returns its pending handle. The key stops working once every verifier holds the replacement. Follow it with `saaslayer users integration-credentials status`. Org owners only.

**Usage**

```bash
saaslayer users integration-credentials revoke --deployment ID --service REF --kind email-authoring|config|hooks --key-id ID --reason TEXT [flags]
```

**Flags**

* `--deployment` (*string*, required) — Deployment id (`dep_…`).
* `--service` (*string*, required) — user-service instance (`user-service` or `user-service@<instance>`).
* `--kind` (*email-authoring | config | hooks*, required) — Which credential the key belongs to.
* `--key-id` (*string*, required) — Id of the key to revoke, as `users integration-credentials status` prints it.
* `--reason` (*string*, required) — Why you are making the change; recorded in the activity log.
* `--no-wait` (*boolean*) — Return acceptance with the actual operation handle instead of waiting for verifier convergence.
* `--json` (*boolean*) — Return exactly one JSON result document on stdout, including failures.

**Examples**

```bash
saaslayer users integration-credentials revoke --deployment dep_123abc --service user-service --kind config --key-id key_123 --reason "key leaked in a log"
```

## `whoami`

Show the logged-in account, its account id, its control plane and the active org and project.

Show the current logged-in control-plane account, its account id, its control plane, and the active org and project. Share the account id with an org owner to be added to their org. Prints `not logged in` when there is no current account; `saaslayer context` shows more.

**Usage**

```bash
saaslayer whoami
```

**Examples**

```bash
saaslayer whoami
```
