# startSandboxBackgroundCommand

```graphql
mutation StartSandboxBackgroundCommand($sandboxId: ID!, $input: SandboxCommandInput!) {
  startSandboxBackgroundCommand(sandboxId: $sandboxId, input: $input) {
    commandId
    command
    status
    signal
    heartbeatStatus
    lastHeartbeatAt
    lastHeartbeatError
    heartbeatFailureCount
    exitCode
    startedAt
    finishedAt
  }
}
```

Start a background command. Requires project.sandboxes.manage.

## Arguments

| Name                   | Type                 | Required | Description |
| ---------------------- | -------------------- | -------- | ----------- |
| `sandboxId`            | ID!                  | Yes      |             |
| `input`                | SandboxCommandInput! | Yes      |             |
| `input.command`        | String!              | Yes      |             |
| `input.cwd`            | String               |          |             |
| `input.timeoutSeconds` | Int                  |          |             |
| `input.env`            | StringMap            |          |             |

## Variables

```json
{
  "sandboxId": "string",
  "input": {
    "command": "string"
  }
}
```

## Responses

| Status | Description                                                          |
| ------ | -------------------------------------------------------------------- |
| 200    | The SandboxBackgroundCommand! in data.startSandboxBackgroundCommand. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation StartSandboxBackgroundCommand($sandboxId: ID!, $input: SandboxCommandInput!) {\n  startSandboxBackgroundCommand(sandboxId: $sandboxId, input: $input) {\n    commandId\n    command\n    status\n    signal\n    heartbeatStatus\n    lastHeartbeatAt\n    lastHeartbeatError\n    heartbeatFailureCount\n    exitCode\n    startedAt\n    finishedAt\n  }\n}",
  "variables": {
    "sandboxId": "string",
    "input": {
      "command": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "startSandboxBackgroundCommand": {
      "commandId": "string",
      "command": "string",
      "status": "pending",
      "signal": "string",
      "heartbeatStatus": "disabled",
      "lastHeartbeatAt": "2026-01-01T00:00:00Z",
      "lastHeartbeatError": "string",
      "heartbeatFailureCount": 0,
      "exitCode": 0,
      "startedAt": "string",
      "finishedAt": "string"
    }
  }
}
```
