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

# Export Run files

> Export selected Run files into one private archive File.

Create one private archive File from Files associated with a Run. Use this to
keep the artifacts from one execution together after the Run finishes.

## Export Run files

```ts
const result = await bctrl.tools.call("run.files.export", {
  runId: run.id,
  fileIds: ["file_01JQXYZ8ABCD1234EFGH5678JK"],
  name: "checkout-artifacts.zip",
});

console.log(result.fileId, result.name, result.size);
```

`fileIds` is optional and accepts up to 500 File IDs. When omitted, the Tool
exports all eligible Files associated with the Run.

## Request parameters

| Parameter | Type       | Required | Description                                  |
| --------- | ---------- | -------- | -------------------------------------------- |
| `runId`   | `RunId`    | Yes      | Run whose Files are being exported.          |
| `fileIds` | `FileId[]` | No       | Files to include, up to 500 IDs.             |
| `name`    | `string`   | No       | Archive File name, from 1 to 255 characters. |

## Response

| Field    | Type     | Always present | Description                  |
| -------- | -------- | -------------- | ---------------------------- |
| `fileId` | `FileId` | Yes            | New archive File identifier. |
| `name`   | `string` | Yes            | Archive File name.           |
| `size`   | `number` | Yes            | Archive size in bytes.       |

## Run asynchronously

```ts
const call = await bctrl.tools.start("run.files.export", {
  runId: run.id,
  fileIds: ["file_01JQXYZ8ABCD1234EFGH5678JK"],
});

const result = await bctrl.toolCalls.result(call.id, {
  waitSeconds: 60,
});
```

Use `bctrl.toolCalls.get(call.id)` to inspect progress or
`bctrl.toolCalls.cancel(call.id)` to cancel an active export.

## Next

* [Runs](/sdk/runs) — inspect the execution and its Files
* [Files](/sdk/files) — manage the resulting archive
* [Tools](/sdk/tools) — understand ToolCalls