
# People and workspaces

Invite a teammate into a workspace with the role they need, and keep each team's or project's keys, limits and spend apart.

**Dashboard**

1. Choose **Invite teammate** on **Home** or **Members**.
2. Optionally, enter **Their email (optional)**, so nobody else can use the link.
3. Under **Where they will work**, choose a workspace, and under **What they can do**, choose a role. **Developer** is the default.
4. Choose when **Their access ends** and how long the **Link works for**: **1 day**, **3 days** (the default) or **7 days**. Give a contractor an end date, so their access stops on its own.
5. Choose **Create invite link**, then **Copy link**, and send it privately.

The person opens the link and chooses a password, or signs in with your identity provider. They then appear on **Members** with their role.

You need: an organisation Owner or Admin account, or a Workspace admin account to invite into your workspace.

Before anyone has an account, **Invite teammate** first asks you to create your own, and you become the Owner. **The whole organisation** appears under **Where they will work** once the gateway has teammates.

**HTTP API**

```bash
curl -sS "$TOKEDEX_URL/control/v1/invites" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ana@example.com",
    "target": { "workspaceId": "<workspace-id>", "role": "developer" }
  }'
```

The gateway answers `201` with the link, shown this once:

```json
{
  "object": "invite",
  "id": "inv_01M7V8NW…",
  "email": "ana@example.com",
  "targetLabel": "Developer of Research",
  "status": "pending",
  "expiresAt": "2026-11-23T01:21:03.798Z",
  "url": "http://127.0.0.1:4000/#invite=tokedex_iv_…",
  "shownOnce": "This link is shown once and works once. Send it over a channel you trust."
}
```

Send `url` to the person privately. They open it and choose a password, or sign in with your identity provider.

You need: an admin key with the `admin` preset in `TOKEDEX_ADMIN_KEY`, and `export TOKEDEX_URL='http://127.0.0.1:4000'`.

`email` is optional and binds the link to that address. A workspace role's `role` is `admin`, `developer` or `viewer`; for an organisation role, send `"target": { "role": "viewer" }` or `"member"`. `target.accessEndsAt`, an ISO time, ends the workspace role then; set it for a contractor, so their access stops on its own. `expiresInHours` sets how long the link works, from 1 to 168; the default is 72. `GET /control/v1/invites/targets` lists the targets you can invite to.

Inviting someone as Owner, Admin or Workspace admin needs a signed-in dashboard session, and answers `session_required` to an admin key. Invites work once the gateway has its first Owner account, which is created in the dashboard; until then the gateway answers `409` `first_account_required`.

The link works once. The gateway sends no email, and a person who already has an account cannot accept an invite: change their access instead. An invite that gives administrative access names the person's email address and works for at most a day.

With the gateway at a local address such as `127.0.0.1`, an invite link opens only on that machine until the gateway has a public address; see [HTTPS and reverse proxies](/gateway/https).

## Roles

An organisation role applies to every workspace. Give a workspace role when someone needs one workspace only.

| Role | Scope | What it allows |
| --- | --- | --- |
| Owner | Organisation | Everything, including sign-in settings |
| Admin | Organisation | Everything except sign-in settings, and Workspace admin of every workspace |
| Viewer | Organisation | Reads every workspace, key, budget, report and the audit log; spends nothing without a workspace role |
| Member | Organisation | Signs in; everything else, the **Playground** included, comes from workspace roles |
| Workspace admin | Workspace | The workspace's people, keys, admin keys and limits, and budgets on its people and models |
| Developer | Workspace | Their own keys in the workspace, within its limits |
| Workspace viewer | Workspace | Reads the workspace's keys, limits, budgets, spend and usage |

Give each person the narrowest role that covers their work: Developer to build with models, Workspace viewer to read spend, Workspace admin to run a team's workspace. Keep organisation Owner and Admin to the few people who run the gateway, because those roles reach every workspace.

Roles can also come from identity-provider groups; see [Single sign-on](/gateway/single-sign-on).

## Create a workspace

Creating a workspace needs an organisation Owner or Admin.

**Dashboard**

![The Workspaces page listing the Default, Platform and Research workspaces](/images/dashboard/workspaces.png)

1. Choose **New workspace** on **Workspaces**.
2. Under **What it is for**, choose **Project**, **Team**, **App**, **Environment** or **Sandbox**, which fills in suggested settings.
3. Enter a **Name**.
4. Check **Models <name> can call**, **Monthly budget (USD, optional)**, **Longest a key lives (days, optional)** and **Create a key for <name>'s app**, then choose **Create workspace**.

The workspace appears on **Workspaces**, and a key you asked for is shown this once. A **Sandbox** starts with a $20 monthly budget, 7-day keys and only the models under $1 per million input tokens, so use one for experiments: a forgotten key there expires soon and spends little. To rename a workspace, edit **Name** in its **Settings** and choose **Save**.

**HTTP API**

```bash
curl -sS "$TOKEDEX_URL/control/v1/workspaces" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Research", "purpose": "team" }'
```

```json
{ "object": "workspace", "id": "ws_01M7V8K7…", "slug": "research", "name": "Research", "purpose": "team", "status": "active" }
```

`purpose` is optional: `project`, `team`, `app`, `environment` or `sandbox`. It sets no limits. Keep `id` to [create keys](/gateway/api-keys) and invite people into the workspace. To rename it, send `{ "name": "…" }` with `PATCH /control/v1/workspaces/<workspace-id>`.

Every installation has a **Default** workspace. A workspace's slug comes from its first name and never changes, even when you rename it.

Create a workspace for each team, project or environment whose spend you want to see and cap on its own, such as production apart from testing, since keys, limits, budgets and spend belong to one workspace.

## Pages that follow the workspace

Each workspace has its own keys, people, limits, budgets and spend. Providers, models and prices are shared by every workspace.

**Dashboard**

The selector at the top of the sidebar sets the workspace the dashboard shows, and the page's address keeps it, so a link or a reload opens the same one.

| Pages | Show |
| --- | --- |
| **Home**, **Observability**, **Usage**, **Spend & budgets**, **API keys**, **Playground**, **Alerts**, **Settings** | The chosen workspace |
| **Providers**, **Models & Routing**, **Pricing** | Every workspace; **Providers** and **Models & Routing** also mark what the chosen one can use |
| **Workspaces**, **Members**, **Audit log** | The organisation |

The selector lists the workspaces your roles reach. Organisation Owners and Admins can also choose **All workspaces** for totals and organisation-wide settings. With more than eight workspaces, type part of a name to find one.

**HTTP API**

A route about one workspace names it, in its path or as `workspaceId`; without one, a list covers every workspace the key can read.

## Change someone's access

**Dashboard**

1. Open **Members**, choose **All workspaces** above the list, and choose the person.
2. On **Access**, set their **Org role**, change or **Remove** a workspace role, or choose **Add to a workspace…**.
3. Choose **Save access**.

A Workspace admin chooses their workspace above the list instead, opens the person and changes their role there.

To stop someone for now, open **Danger zone** and choose **Disable**: their sessions end and their keys stop working until you choose **Enable**. **Offboard…** removes their access for good after you review their keys. Disable first when you are unsure, because **Enable** undoes it.

**HTTP API**

Find the person's `id` with `GET /control/v1/users`, then send the roles they should hold:

```bash
curl -sS -X PUT "$TOKEDEX_URL/control/v1/users/<user-id>/role-assignments" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "places": [{ "workspaceId": "<workspace-id>" }],
    "assignments": [
      { "role": "workspace_developer", "scope": { "workspaceId": "<workspace-id>" }, "expiresAt": "2027-01-31T00:00:00Z" }
    ]
  }'
```

```json
{
  "object": "user",
  "assignments": [
    { "role": "workspace_developer", "scope": { "workspaceId": "ws_01M7V8K7…" }, "expiresAt": "2027-01-31T00:00:00.000Z" },
    { "role": "workspace_viewer", "scope": { "workspaceId": "ws_default" }, "expiresAt": null }
  ]
}
```

`places` names the workspaces whose roles you are setting, and the person keeps their roles elsewhere. Always send it: without it, the list replaces every role you can manage, the person's other workspaces and organisation role included. Workspace roles are `workspace_admin`, `workspace_developer` and `workspace_viewer`, with a `scope`; organisation roles are `owner`, `admin`, `viewer` and `member`, without one. `POST /control/v1/users/<user-id>/disable` stops the person and their keys until `…/enable`.

Giving or changing an Owner, Admin or Workspace admin role, and disabling a person who holds one, need a signed-in dashboard session, and answer `session_required` to an admin key.

When a workspace role ends, the person's personal keys in that workspace stop with it. Workspace keys keep working, so run applications on workspace keys and a person's departure never stops one. Disabling or offboarding a person needs an organisation Owner or Admin.

## Pause or archive a workspace

Pausing and archiving a workspace need an organisation Owner or Admin. You can pause **Default** but not archive it.

**Dashboard**

Choose the workspace and open **Settings**. At the bottom, choose **Pause <workspace>**, give a reason under **Why (optional)** and choose **Review the pause**. Check the keys that stop, then choose **Pause <workspace>**; **Resume** undoes it. To archive, revoke its API keys first, choose **Archive…**, check who loses access and choose **Archive <workspace>**. To restore it, switch **Workspaces** to **Archived**, open it and choose **Restore**.

**HTTP API**

```bash
curl -sS -X POST "$TOKEDEX_URL/control/v1/workspaces/<workspace-id>/pause" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Quarterly review" }'
```

The gateway first answers `409` `review_required` with the keys that stop under `review.keysSuspended`. Send the same body with `"acknowledge": "<digest>"` to apply it. `…/resume` and `…/restore` work the same way. `…/archive` is reviewed too, listing the people who lose access, the admin keys revoked and the invites cancelled; it answers `409` `workspace_not_empty` while live API keys remain.

| Action | What happens | To undo | Use it when |
| --- | --- | --- | --- |
| Pause | The workspace's API keys stop working, and no key is created or rotated there. Nothing is deleted. | Resume: access returns as it was | Spend must stop for now, such as during a review |
| Archive | Revoke its live API keys first. People lose their roles there, pending invites are cancelled and its admin keys are revoked. Its history and spend stay. | Restore: it returns without its people or admin keys | The team or project is finished |

Next: [API keys](/gateway/api-keys), [Model access and limits](/gateway/model-access-and-limits) or [Budgets](/gateway/budgets).
