---
title: "tractorbeam service-user"
description: "The Tractorbeam API's service user operations."
sidebar:
  label: "service-user"
  order: 23
---

```sh
tractorbeam service-user <subcommand> [flags]
```

## Shared flags

Every subcommand takes these flags.

| Flag | Description |
| --- | --- |
| `--config <string>` | The Project's `tractorbeam.config.ts`. Defaults to the one in the current directory or its nearest ancestor. |
| `--workspace <string>` | Workspace name. Environment variable: `TRACTORBEAM_WORKSPACE`. |
| `--origin <string>` | The Tractorbeam origin to call instead of the default, such as a proxy's. Environment variable: `TRACTORBEAM_ORIGIN`. |
| `--token <string>` | Access token. Defaults to the saved interactive session. Environment variable: `TRACTORBEAM_TOKEN`. |

## `service-user list`

Returns the service users of the Workspace whose host the request addresses, including its default service user. Needs `service-users:read`. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user list [flags]
```

## `service-user create`

Creates a service user of the Workspace with the permissions the request names. It has no client secret until `createServiceUserSecret` adds one. Needs `service-users:create` and every permission the service user names. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user create [flags]
```

| Flag | Description |
| --- | --- |
| `--name <string>` |  |
| `--permissions <json>` | The permissions the service user holds. |
| `--json <json>` | The body's fields as one JSON object. Flags given as well override its fields. |

## `service-user get`

Returns one of the Workspace's service users. Another client ID returns 404. Needs `service-users:read`. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user get [flags] <service-user>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |

## `service-user update`

Changes a service user's name or permissions. Needs `service-users:update` and every permission the service user holds afterward, including those it keeps. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user update [flags] <service-user>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |

| Flag | Description |
| --- | --- |
| `--name <string>` |  |
| `--permissions <json>` | The permissions the service user holds. |
| `--json <json>` | The body's fields as one JSON object. Flags given as well override its fields. |

## `service-user delete`

Deletes a service user and its client secrets. Deleting the Workspace's default service user clears it, and the next background run without a service user creates a new default. A schedule's runs as a deleted service user fail. Needs `service-users:delete`. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user delete [flags] <service-user>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |

## `service-user list-secrets`

Returns a service user's client secrets, without their values. Needs `service-users:read`. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user list-secrets [flags] <service-user>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |

## `service-user create-secret`

Adds a client secret to a service user and returns its value once. Its other secrets keep working. To rotate, add the new secret, then delete the old. Needs `service-users:update` and every permission the service user holds, because the secret signs in with them. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user create-secret [flags] <service-user>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |

## `service-user delete-secret`

Deletes one of a service user's client secrets. The secret stops signing it in. Needs `service-users:update`. Any principal of the Workspace's organization holding it can call it; an App token can't.

```sh
tractorbeam service-user delete-secret [flags] <service-user> <secret>
```

| Argument | Description |
| --- | --- |
| `<service-user>` | The WorkOS M2M client ID of a service user. |
| `<secret>` |  |
