# CapsuleProcessCommand

A command or operation sent to a capsule run, with its status and result. In a start request's `commands`, only `command`, `arguments`, `runAsUser` and `maximumDuration` are read: each runs as a shell command once the capsule is ready.

**Kind:** an object, used in requests and responses. In a request it is called `CapsuleProcessCommandInput`.

## In a request

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` |  | The command's id. |
| `operationType` | [`CapsuleOperationType`](https://docs.maitento.com/reference/types/capsule-operation-type.md) |  | What it does: `Command` runs a shell command; the others change the running capsule (mount, add a user, install a package, stop it and so on). |
| `command` | `string` |  | For `Command`, the shell command that runs. For other operations, what they act on, such as the mount name, user name or package name. |
| `arguments` | `string[]` |  | For `Command`, the command's arguments. For other operations, their parameters. |
| `runAsUser` | `string \| null` |  | The user the command runs as. Null: the default user. |
| `maximumDuration` | `timespan \| null` |  | The longest the command may run before it is stopped. Null: five minutes. |
| `status` | [`CapsuleProcessCommandStatus`](https://docs.maitento.com/reference/types/capsule-process-command-status.md) |  | Where the command is. |
| `outputStandard` | `string \| null` |  | What the command wrote to standard output: at most the last 65,536 characters (see `outputStandardFullLength`). Null until it ends. |
| `outputError` | `string \| null` |  | What the command wrote to standard error: at most the last 65,536 characters (see `outputErrorFullLength`). Null until it ends. |
| `exitCode` | `integer \| null` |  | The command's exit code. Null until it ends, and when it was stopped before it exited. |
| `failureDetails` | `string \| null` |  | Why the command failed, when its status is `Error` or `AbortedOnTermination`. Null otherwise. |
| `isAsync` | `boolean` |  | Whether the command was started in the background: the capsule moves on to the next command without waiting for it, and records its result when it ends. |
| `dateQueued` | `datetime \| null` |  | When the command was queued, in UTC. May be null on older runs. |
| `dateStarted` | `datetime \| null` |  | When the command started executing, in UTC. Null while it waits its turn. |
| `dateEnded` | `datetime \| null` |  | When the command reached its final status (`Finished`, `Error` or `AbortedOnTermination`), in UTC. |
| `outputStandardFullLength` | `integer \| null` |  | For `Command`: the full length of the standard output, in characters, when it was longer than is kept, so `outputStandard` holds only its last part. Null when `outputStandard` is complete. |
| `outputErrorFullLength` | `integer \| null` |  | For `Command`: the full length of the standard error, in characters, when it was longer than is kept, so `outputError` holds only its last part. Null when `outputError` is complete. |
| `timedOut` | `boolean \| null` |  | For `Command`: true when it was stopped for its time limit. It then has no exit code, and `failureDetails` says so. Null otherwise. |

```json
{
  "id": "3f2b8c1e-5d4a-4e6b-9c7d-2a1b0c9d8e7f",
  "operationType": "Command",
  "command": "...",
  "arguments": [
    "..."
  ],
  "runAsUser": "...",
  "maximumDuration": "00:05:00",
  "status": "Pending",
  "outputStandard": "...",
  "outputError": "...",
  "exitCode": 0,
  "failureDetails": "...",
  "isAsync": false,
  "dateQueued": "2026-10-26T12:00:00.0000000Z",
  "dateStarted": "2026-10-26T12:00:00.0000000Z",
  "dateEnded": "2026-10-26T12:00:00.0000000Z",
  "outputStandardFullLength": 0,
  "outputErrorFullLength": 0,
  "timedOut": false
}
```

## In a response

Every field is present in a response; empty ones are `null`.

| Field | Type | Description |
|---|---|---|
| `id` | `uuid` | The command's id. |
| `operationType` | [`CapsuleOperationType`](https://docs.maitento.com/reference/types/capsule-operation-type.md) | What it does: `Command` runs a shell command; the others change the running capsule (mount, add a user, install a package, stop it and so on). |
| `command` | `string` | For `Command`, the shell command that runs. For other operations, what they act on, such as the mount name, user name or package name. |
| `arguments` | `string[]` | For `Command`, the command's arguments. For other operations, their parameters. |
| `runAsUser` | `string \| null` | The user the command runs as. Null: the default user. |
| `maximumDuration` | `timespan \| null` | The longest the command may run before it is stopped. Null: five minutes. |
| `status` | [`CapsuleProcessCommandStatus`](https://docs.maitento.com/reference/types/capsule-process-command-status.md) | Where the command is. |
| `outputStandard` | `string \| null` | What the command wrote to standard output: at most the last 65,536 characters (see `outputStandardFullLength`). Null until it ends. |
| `outputError` | `string \| null` | What the command wrote to standard error: at most the last 65,536 characters (see `outputErrorFullLength`). Null until it ends. |
| `exitCode` | `integer \| null` | The command's exit code. Null until it ends, and when it was stopped before it exited. |
| `failureDetails` | `string \| null` | Why the command failed, when its status is `Error` or `AbortedOnTermination`. Null otherwise. |
| `isAsync` | `boolean` | Whether the command was started in the background: the capsule moves on to the next command without waiting for it, and records its result when it ends. |
| `dateQueued` | `datetime \| null` | When the command was queued, in UTC. May be null on older runs. |
| `dateStarted` | `datetime \| null` | When the command started executing, in UTC. Null while it waits its turn. |
| `dateEnded` | `datetime \| null` | When the command reached its final status (`Finished`, `Error` or `AbortedOnTermination`), in UTC. |
| `outputStandardFullLength` | `integer \| null` | For `Command`: the full length of the standard output, in characters, when it was longer than is kept, so `outputStandard` holds only its last part. Null when `outputStandard` is complete. |
| `outputErrorFullLength` | `integer \| null` | For `Command`: the full length of the standard error, in characters, when it was longer than is kept, so `outputError` holds only its last part. Null when `outputError` is complete. |
| `timedOut` | `boolean \| null` | For `Command`: true when it was stopped for its time limit. It then has no exit code, and `failureDetails` says so. Null otherwise. |

```json
{
  "id": "3f2b8c1e-5d4a-4e6b-9c7d-2a1b0c9d8e7f",
  "operationType": "Command",
  "command": "...",
  "arguments": [
    "..."
  ],
  "runAsUser": "...",
  "maximumDuration": "00:05:00",
  "status": "Pending",
  "outputStandard": "...",
  "outputError": "...",
  "exitCode": 0,
  "failureDetails": "...",
  "isAsync": false,
  "dateQueued": "2026-10-26T12:00:00.0000000Z",
  "dateStarted": "2026-10-26T12:00:00.0000000Z",
  "dateEnded": "2026-10-26T12:00:00.0000000Z",
  "outputStandardFullLength": 0,
  "outputErrorFullLength": 0,
  "timedOut": false
}
```

## Where it's used

- [`capsuleRuns.addUser`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/users`)
- [`capsuleRuns.exec`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/commands`)
- [`capsuleRuns.getCommand`](https://docs.maitento.com/reference/api/capsule-runs.md) (`GET /capsule-processes/by-id/{id}/commands/{commandId}`)
- [`capsuleRuns.installPackage`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/packages`)
- [`capsuleRuns.mountSecret`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/mounts/secrets`)
- [`capsuleRuns.mountVfs`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/mounts/vfs`)
- [`capsuleRuns.removePackage`](https://docs.maitento.com/reference/api/capsule-runs.md) (`DELETE /capsule-processes/by-id/{id}/packages/{packageName}`)
- [`capsuleRuns.removeUser`](https://docs.maitento.com/reference/api/capsule-runs.md) (`DELETE /capsule-processes/by-id/{id}/users/{username}`)
- [`capsuleRuns.terminate`](https://docs.maitento.com/reference/api/capsule-runs.md) (`POST /capsule-processes/by-id/{id}/terminate`)
- [`capsuleRuns.unmountSecret`](https://docs.maitento.com/reference/api/capsule-runs.md) (`DELETE /capsule-processes/by-id/{id}/mounts/secrets/{mountName}`)
- [`capsuleRuns.unmountVfs`](https://docs.maitento.com/reference/api/capsule-runs.md) (`DELETE /capsule-processes/by-id/{id}/mounts/vfs/{mountName}`)
- Inside [`CapsuleProcess`](https://docs.maitento.com/reference/types/capsule-process.md)
- Inside [`CapsuleProcessStartRequest`](https://docs.maitento.com/reference/types/capsule-process-start-request.md)
- Inside [`CapsuleProcessWithDetails`](https://docs.maitento.com/reference/types/capsule-process-with-details.md)
