# Execute shell or JavaScript

Source: https://docs.wabe.sh/api-reference/operations/execute/

`POST https://api.wabe.sh/v1/disks/{disk}/exec`

Select body, script or path as source. Source limit is 64 KiB. HTTP 200 starts the response; require a final exit record and inspect its code. Runtime failures are stderr/exit records. Default elapsed deadline is 30 seconds. JS runs as an async function body on Linux.

## Authorization

Project API key from the Wabe Dashboard or actor runtime access token for the disk URL supplied by the broker.

## Parameters

- `disk` (path, string, required) — Project disk name, or the disk ID in the actor runtime disk URL.

- `kind` (query, string) Allowed values: `bash`, `js`.

- `script` (query, string)

- `path` (query, string)

- `branch` (query, string)

- `commit` (query, string)

- `label` (query, string)

## Request body

`text/plain`

Example

```text
echo Hello
```

Schema

```json
{
  "type": "string"
}
```

`application/octet-stream`

Schema

```json
{
  "type": "string",
  "format": "binary"
}
```

## Responses

### 200

Newline-delimited JSON records; consume or close the body to release the request lease.

`application/x-ndjson`

Example

```text
{"type":"stdout","data":"SGVsbG8K"}
{"type":"exit","code":0}
```

Schema

```json
{
  "type": "string",
  "x-record-schema": "#/components/schemas/ExecutionRecord"
}
```

Stream record schema

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "stdout",
            "stderr"
          ]
        },
        "data": {
          "type": "string",
          "contentEncoding": "base64"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "const": "result"
        },
        "value": {}
      },
      "required": [
        "type",
        "value"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "const": "exit"
        },
        "code": {
          "type": "integer"
        }
      },
      "required": [
        "type",
        "code"
      ],
      "additionalProperties": false
    }
  ]
}
```

### 400

Invalid input, query, name or source.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 401

Missing, invalid or revoked project API key, or an invalid runtime access token.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 403

Actor runtime token does not authorize this disk or instance generation.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 404

Requested file, parent or script was not found.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 500

Storage, I/O or corruption failure.

`text/plain`

Schema

```json
{
  "type": "string"
}
```

### 503

Disk unavailable.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```
