# SDKs and integrations

Use the API from your own code or from a coding agent. Each SDK reads your key from SWITCHFILE_API_KEY.

## SDKs

- [Node.js](https://www.npmjs.com/package/switchfile): `switchfile`
- [Python](https://pypi.org/project/switchfile-sdk/): `switchfile-sdk`
- [PHP](https://packagist.org/packages/switchfile/switchfile-php): `switchfile/switchfile-php`
- [Command line](https://switchfile.io/docs/sdks#cli): `npx switchfile`

## Agents and integrations

- [MCP server](https://www.npmjs.com/package/switchfile-mcp): `switchfile-mcp`
- [Claude Code](https://switchfile.io/docs/mcp#clients): `switchfile-mcp`
- [Cursor](https://switchfile.io/docs/mcp#clients): `switchfile-mcp`
- [VS Code](https://switchfile.io/docs/mcp#clients): `switchfile-mcp`
- [Codex](https://switchfile.io/docs/mcp#clients): `switchfile-mcp`
- [n8n](https://switchfile.io/n8n): `n8n-nodes-switchfile`
- Zapier: coming soon
- Make: coming soon

The SDKs have the same methods as the CloudConvert SDKs, so existing code keeps working after you change the import and the key. They add `convert()` for the [simple API](https://switchfile.io/docs/simple-api). Create a key under [API keys](https://switchfile.io/dashboard/keys) and put it in an environment variable:

```bash
export SWITCHFILE_API_KEY="sf_live_..."
```

## Node.js and TypeScript

Package `switchfile` on npm, for Node.js 20 or newer.

cURL:

```bash
npm install switchfile
```

Node.js:

```js
import Switchfile from "switchfile";

const switchfile = new Switchfile({ apiKey: process.env.SWITCHFILE_API_KEY });
const conversion = await switchfile.convert("talk.mkv", "mp4");
await switchfile.download(conversion, "talk.mp4");
```

Coming from the CloudConvert SDK: import `Switchfile` instead of `CloudConvert` and pass your switchfile key.

## Python

Package `switchfile-sdk` on PyPI, for Python 3.10 or newer.

cURL:

```bash
pip install switchfile-sdk
```

Python:

```python
import os
import switchfile

switchfile.configure(api_key=os.environ["SWITCHFILE_API_KEY"])
conversion = switchfile.convert("talk.mkv", "mp4")
switchfile.download(conversion, "talk.mp4")
```

Coming from the CloudConvert SDK: `import switchfile as cloudconvert` and pass your switchfile key.

## PHP

Package `switchfile/switchfile-php` on Packagist, for PHP 8.1 or newer.

cURL:

```bash
composer require switchfile/switchfile-php
```

PHP:

```php
use Switchfile\Switchfile;

$switchfile = new Switchfile(['api_key' => getenv('SWITCHFILE_API_KEY')]);
$conversion = $switchfile->convert('talk.mkv', 'mp4');
$switchfile->download($conversion, 'talk.mp4');
```

Coming from the CloudConvert SDK: change the namespace to `Switchfile` and pass your switchfile key.

## Command line

The npm package `switchfile` also has a command. Without `--out`, it saves the result next to the input file (for a URL, in the current folder) and picks a free name such as `report-1.docx` if the file exists. With `--out`, it writes to that file or folder and replaces a file with the same name there; only the input file itself is never replaced.

```bash
npx switchfile convert report.pdf --to docx
npx switchfile convert https://example.com/photo.heic --to jpg --out photos/
npx switchfile formats heic
```

Add `--json` for output that scripts can read.

## Coding agents

Claude Code, Cursor, VS Code, Codex and other MCP clients convert files on your computer through the npm package `switchfile-mcp`. The setup for each client is in the [MCP guide](https://switchfile.io/docs/mcp#clients). In Claude or ChatGPT, use the [hosted server](https://switchfile.io/docs/mcp#hosted) instead.

## n8n

The Switchfile node for n8n is verified by n8n and available on n8n Cloud: search for switchfile in the nodes panel of a workflow and install it from More from the community. On a self-hosted instance, open Settings, then Community Nodes, and install `n8n-nodes-switchfile`. Then add a Switchfile API credential with a key from [API keys](https://switchfile.io/dashboard/keys).

The node converts a file from a binary field or a URL and can be used as a tool by AI agents. The Switchfile Trigger starts a workflow when a conversion finishes. Setup and example workflows are on the [n8n page](https://switchfile.io/n8n).

## Next

- [Quickstart](https://switchfile.io/docs/quickstart): Convert your first file with the switchfile API in two minutes, with cURL or Node.js.
- [MCP and command line](https://switchfile.io/docs/mcp): Convert files in Claude or ChatGPT with the hosted server, or from coding agents and the terminal with the switchfile-mcp package.
