> ## Documentation Index
> Fetch the complete documentation index at: https://docs.widgetic.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Keys and workspaces

> Which CLI commands need a partner key, which workspace a change goes to, and what happens when the workspace has no plan.

The CLI has no door of its own. It sends your API key over REST and over MCP, so the rules that hold for the key everywhere else hold here: it opens what the key may open, in the workspace the key was made for.

## Which commands need which key

The CLI does not decide who may do what. The API does, on every call, from the key. A command that the key may not run is refused with `403`, and the CLI exits with `3`: the same answer you would get from an SDK or from `curl`. The CLI only makes what your key may already do easy to find, and each command's help says what it needs.

| Commands | The key they need |
| - | - |
| Most of `widgetic api`, and every `widgetic mcp` command | Any API key. `widgetic mcp` needs one made with **full access**, because the MCP server refuses a key that is limited to some scopes. `widgetic api` works with a limited key, within its scopes. |
| `widgetic api partners` (41 of 41 commands), `widgetic api entitlements` (2 of 2), `widgetic api invoices` (1 of 1) and `widgetic api managed-users` (16 of 18) | A **partner key** (`wgt_prt_…`), made in your partner's home workspace. Their help says `Needs a partner API key`. Any other key is refused with `403`. |
| The 10 `public-embed` operations, which `--help` does not list | None. Browsers call them, and `widgetic api call <operationId>` runs one without sending a key. |

[API keys](https://docs.widgetic.com/docs/api-keys.md) explains what makes a key a partner key. To check which one you hold from the CLI, `widgetic auth status` says what the key is and where it works, and `widgetic api partners get-my-partners` answers only a key that acts as a partner: an organisation key gets `403`, which is exit code `3`.

## Which workspace a change goes to

A key works in one workspace, the one it was made for, and nowhere else. It does not follow the workspace you have open on widgetic.com. A person with several workspaces makes a key in each of them (**Settings → API keys**, with that workspace chosen), and keeps a [profile](https://docs.widgetic.com/docs/cli/configuration.md#profiles) for each.

To see where a key works:

* `widgetic auth login` and `widgetic auth status` say which workspace the key works in.
* `widgetic doctor` says it with the plan, on its `Workspace` line.
* `widgetic mcp get-profile` returns it as `workspace`: the name and the plan.

### Hold a change to a workspace

Of the `widgetic mcp` commands, 13 take `--expected-workspace <name>`: the ones that start a widget (`create-widget`, `create-widget-batch`) and the ones that change a workflow, an A/B test or a translation. `widgetic schema mcp <command>` says whether a command takes it.

```bash theme={"theme":"css-variables"}
widgetic mcp create-widget \
  --title "Launch countdown" \
  --brief "A countdown to 14 March 2027" \
  --expected-workspace "Acme Studio"
```

`--expected-workspace` never picks or switches a workspace. It says where the change is meant for. When the key works anywhere else, the server refuses the call and changes nothing, and the command exits with `5`.

A script can say it once for every change it makes, so that it cannot forget:

```bash theme={"theme":"css-variables"}
export WIDGETIC_WORKSPACE="Acme Studio"
```

* A flag, or an `expected_workspace` key in `--input`, wins over `WIDGETIC_WORKSPACE` for that call.
* A read is not held, and neither is a command that takes no workspace.
* A hold that cannot be made is not a change that goes through. With the variable set, the CLI stops a change with exit code `2`, and sends nothing, when the variable is empty, when this version of the CLI was built from a tool contract that cannot hold a change (run `widgetic update`), or when the command is one the CLI does not know (`widgetic mcp call <tool>`) and `--input` has no `expected_workspace`.
* Only `widgetic mcp` commands are held. The `widgetic api` commands are not.

At a terminal, a command that publishes or changes something asks first, and the question names the workspace the key works in:

```text theme={"theme":"css-variables"}
… in the workspace "Acme Studio" (Teams plan). Continue?
```

Once you say yes, the change is held to the workspace the question named, so a key that turns out to work elsewhere changes nothing. With `--yes` or `--json` nothing is asked and nothing is added, so a script gives `--expected-workspace` or sets the variable.

## When the workspace has no plan

A key is a credential for a paying workspace. A workspace in its free trial, or one without a plan (the trial ended, the plan was cancelled, the payment ended), is not served, and the CLI is held to the same rule as the key everywhere else ([Keys and your workspace plan](https://docs.widgetic.com/docs/authentication.md#keys-and-your-workspace-plan)).

* A `widgetic api` command exits with `3` and prints the server's own words and code, with the request id: `WORKSPACE_LOCKED` when the workspace has no plan, `AUTHZ_PLAN_RESTRICTION` for a free trial or a payment that is overdue. With `--json` the same fields are in `error`. Nothing is retried, and the CLI does not tell you to log in again, because the key is genuine.
* `widgetic auth login` does not save such a key, and says why. `widgetic auth status` reports the key as not accepted, with the code, and keeps the key you saved, so the same key works again as soon as the workspace has a plan.
* A free trial is refused at the MCP endpoint itself, so every `widgetic mcp` command exits with `3`. A workspace without a plan is let through to the tools, which refuse what starts work in the plan's own words, and the command exits with `5` (a tool answered with an error). `get_profile`, and following or cancelling a build that was already started, still answer.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.