Workspaces

When belonging to different workspaces, it's possible you need to switch between Workspaces when working on a project.

Imagine the following scenario: You have a personal Tinybird account and you belong to two Workspaces: production and staging. You want to be able switch from staging to production when necessary in order to push the current status of your project.

Authenticate

Let's authenticate using the admin token of the staging account:

Authenticate
$> tb auth
Copy the admin token from https://app.tinybird.co/tokens and paste it here: <pasted token>
** Auth successful!
** Configuration written to .tinyb file, consider adding it to .gitignore

List workspaces

Then, you can list the Workspaces you have access to, and the one that you're currently authenticated to:

List workspaces
$> tb workspace ls

-------------------------------------------------------------------------------------------
| name                | id                                   | role  | plan     | current |
-------------------------------------------------------------------------------------------
| Staging             | 3a798a68-38b1-4947-a0eb-399b7adbfa25 | admin | personal | True    |
| Production          | 841717b1-2472-44f9-9a81-42f1263cabe7 | guest | personal | False   |
-------------------------------------------------------------------------------------------

Create a workspace

You can create new empty Workspaces or from a starter kit template.

You need your user token for this operation.

In the interactive way, when we don't provide any options, it asks for: the user token, the template (if so), and the Workspace name:

Authenticate
$> tb workspace create

In order to create a new workspace we need your user token. Copy it from https://app.tinybird.co/tokens and paste it here: <pasted token>

------------------------------------------------------------------------------------
| Idx | Id            | Description                                                |
------------------------------------------------------------------------------------
|   1 | blank         | Empty workspace                                            |
|   2 | web-analytics | Starting workspace ready to track visits and custom events |
|   3 | log-analytics | Build your own logging & telemetry solution                |
------------------------------------------------------------------------------------

    [0] to cancel

Use starter kit [1]: 1

Please enter the name for your new workspace. Remember the name you choose must be unique, you can add a suffix in case of collision.
You can bypass this step by supplying it after the command.

Workspace name [new_workspace_9e07]: <workspace_name>

We only need the name and the user token in the options:

Authenticate
$> tb workspace create workspace_name --user_token <token>

** Workspace 'workspace_name' has been created

Switch to a workspace

Now, you can switch to another Workspace:

Switch to the Production Workspace using the Workspace id or the Workspace name
$> tb workspace use 841717b1-2472-44f9-9a81-42f1263cabe7
$> tb workspace use Production

** Now using Production workspace (841717b1-2472-44f9-9a81-42f1263cabe7)

$> tb workspace ls

-------------------------------------------------------------------------------------------
| name                | id                                   | role  | plan     | current |
-------------------------------------------------------------------------------------------
| Staging             | 3a798a68-38b1-4947-a0eb-399b7adbfa25 | admin | personal | False   |
| Production          | 841717b1-2472-44f9-9a81-42f1263cabe7 | guest | personal | True    |
-------------------------------------------------------------------------------------------

You can also quickly check which Workspace you're currently in:

Show current Workspace
$> tb workspace current

-------------------------------------------------------------------------------------------
| name                | id                                   | role  | plan     | current |
-------------------------------------------------------------------------------------------
| Production          | 841717b1-2472-44f9-9a81-42f1263cabe7 | admin | personal | True    |
-------------------------------------------------------------------------------------------

Members management

You can manage Workspace members (users) using the Web UI, or the CLI using the workspace members commands.

Add members:

Adding users to the current Workspace
$ tb workspace members add "user1@example.com,user2@example.com,user3@example.com"

Remove members:

Removing members from current Workspace
$ tb workspace members rm user3@example.com

List them:

Listing current Workspace members
$ tb workspace members ls

---------------------
| email             |
---------------------
| user1@example.com |
| user2@example.com |
---------------------