> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for CodeInterpreter: every `codeinterpreter.api.*` operation with input and output types.

Every `codeinterpreter.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](/concepts/api), [authentication](/concepts/auth), and [error handling](/concepts/error-handling).

## Code

### execute

`code.execute`

Execute code in the sandbox

**Risk:** `write`

```ts theme={null}
await corsair.codeinterpreter.api.code.execute({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | Yes | — |
| `language` | `string` | No | — |
| `session_id` | `string` | No | — |
| `args` | `string[]` | No | — |
| `files` | `string[]` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `exit_code` | `number` | Yes | — |
| `stdout` | `string` | No | — |
| `stderr` | `string` | No | — |
| `logs` | `string` | No | — |
| `output_files` | `object[]` | No | — |
| `session_id` | `string` | No | — |

> **output\_files full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name: string
> }[]
> ```

***

## File

### delete

`file.delete`

Delete a file from the sandbox

**Risk:** `destructive`

```ts theme={null}
await corsair.codeinterpreter.api.file.delete({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `file_id` | `string` | Yes | — |
| `session_id` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | Yes | — |
| `file_id` | `string` | Yes | — |

***

### download

`file.download`

Download a file from the sandbox

**Risk:** `read`

```ts theme={null}
await corsair.codeinterpreter.api.file.download({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `file_id` | `string` | Yes | — |
| `session_id` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `file_id` | `string` | Yes | — |
| `filename` | `string` | No | — |
| `content` | `string` | Yes | — |
| `mime_type` | `string` | No | — |

***

### list

`file.list`

List files in the sandbox

**Risk:** `read`

```ts theme={null}
await corsair.codeinterpreter.api.file.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `files` | `object[]` | Yes | — |

> **files full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name: string,
>   size?: number,
>   mime_type?: string
> }[]
> ```

***

### upload

`file.upload`

Upload a file to the sandbox

**Risk:** `write`

```ts theme={null}
await corsair.codeinterpreter.api.file.upload({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `filename` | `string` | Yes | — |
| `content` | `string` | Yes | — |
| `content_encoding` | `utf8 \| base64` | No | — |
| `session_id` | `string` | No | — |
| `mime_type` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `file_id` | `string` | Yes | — |
| `filename` | `string` | Yes | — |
| `size` | `number` | No | — |
| `session_id` | `string` | No | — |

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.