> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# runCode

> Reference for the `runCode` schema.

## Referenced In

* [Markup definition](/reference/schemas/markup-definition)
* [test](/reference/schemas/test)
* [Resolved context](/reference/schemas/resolved-context)

## Fields

| Field   | Type                                                                | Description                      | Default |
| :------ | :------------------------------------------------------------------ | :------------------------------- | :------ |
| runCode | object([Run code (detailed)](/reference/schemas/run-code-detailed)) | Required. Assemble and run code. | —       |

## Examples

```json
{
  "runCode": {
    "language": "javascript",
    "code": "console.log('Hello, ${process.env.USER}!');"
  }
}
```

```json
{
  "runCode": {
    "language": "bash",
    "code": "docker run hello-world",
    "timeout": 20000,
    "exitCodes": [
      0
    ],
    "stdio": "Hello from Docker!"
  }
}
```

```json
{
  "runCode": {
    "language": "javascript",
    "code": "return false",
    "exitCodes": [
      1
    ]
  }
}
```

```json
{
  "runCode": {
    "language": "python",
    "code": "print('Hello from Python')",
    "workingDirectory": ".",
    "exitCodes": [
      0
    ],
    "stdio": "Hello from Python!",
    "path": "python-output.txt",
    "directory": "output",
    "maxVariation": 0.1,
    "overwrite": "aboveVariation"
  }
}
```

```json
{
  "runCode": {
    "language": "javascript",
    "code": "require('http').createServer((req, res) => res.end('ok')).listen(8088);",
    "background": {
      "name": "api",
      "waitUntil": {
        "port": 8088
      }
    },
    "timeout": 15000
  }
}
```