# render

URL: /business/nouns/document/render · Id: `verb:Document.render` · Call: `await $.Document.render({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Render produces a file from a Document in the format the reader asks for.

Render produces a file from a [Document](/business/nouns/document) in the format the reader asks for.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `document` | [Document](/business/nouns/document) | Yes | The Document to render. |
| `format` | `string` | Yes | The file format. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | `url` | Yes | Where the file lives. |
| `document` | [Document](/business/nouns/document) | Yes | The Document rendered. |

## Effects
- Emits [`Document.rendered`](/business/events/Document.rendered).

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The input does not match the schema of the operation. | [`invalid-input`](/code/api/errors/invalid-input) | Read the schema of the operation, then send every required field with the right type. | [Document.render](/business/nouns/document/render) |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [Document.render](/business/nouns/document/render) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Render the latest document.
```

**API**

```bash
curl -X POST https://api.sb/ledgerlark.com/documents/document_1/render \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"format":"Example format"}'
```

```json
{
  "api": "https://api.sb/ledgerlark.com",
  "file": "https://ledgerlark.com",
  "document": {
    "$id": "https://api.sb/ledgerlark.com/documents/document_1",
    "$type": "Document",
    "form": "document"
  },
  "action": {
    "$id": "https://api.sb/ledgerlark.com/actions/action_1",
    "operation": "Document.render",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/ledgerlark.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const { file, document } = await $.Document.render({ document: 'document_1', format: 'Example format' })
```

**CLI**

```bash
npx startup-builder do Document.render --json '{"document":"document_1","format":"Example format"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Document.render({ document: 'document_1', format: 'Example format' })"
  }
}
```