Skip to content
For developers

Video conversion API with compression and trimming

Send a video and get it back as an MP4 or in another format such as WebM. Set the size and quality, or keep only a part, in the same request.

Free for 20 files a day.

# API key: switchfile.io/dashboard/keys
code=$(curl -sL "https://api.switchfile.io/v1/convert?wait=30" \
  -o reply -D headers -w "%{http_code}" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Accept: application/octet-stream" \
  -F 'options={"crf":28,"width":1280}' \
  -F file=@talk.mov -F to=mp4)
if grep -qi '^x-incomplete' headers; then
  grep -i '^x-notes' headers  # partial result, left in reply
elif [ "$code" = 200 ] && grep -qi '^content-disposition' headers; then
  mv reply talk.mp4
else
  # 202: still running, fetch links.self. Several files: result.files.
  cat reply  # otherwise the error
fi

What comes back

With Accept: application/octet-stream, as in the curl example, a 200 response is the file itself when the conversion has exactly one result file. With several result files, for example one image per page, or without that header, you get the conversion as JSON, and the files are in result.files:

200 OK, application/json
{
  "id": "0b8a7c1e-5d0f-4a51-9f39-2f7f4c1d9a10",
  "object": "conversion",
  "status": "finished",
  "progress": 100,
  "input": {
    "filename": "talk.mov",
    "format": "mov",
    "size": 48213
  },
  "to": "mp4",
  "options": {
    "crf": 28,
    "width": 1280
  },
  "result": {
    "files": [
      {
        "filename": "talk.mp4",
        "size": 61544,
        "url": "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/talk.mp4?expires=1794074402&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8"
      }
    ],
    "incomplete": false
  },
  "download_url": "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/talk.mp4?expires=1794074402&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8",
  "error": null,
  "credits": 1,
  "batch_id": null,
  "created_at": "2026-11-06T18:00:00+00:00",
  "finished_at": "2026-11-06T18:00:02+00:00",
  "expires_at": "2026-11-07T18:00:02+00:00",
  "links": {
    "self": "https://api.switchfile.io/v1/conversions/0b8a7c1e-5d0f-4a51-9f39-2f7f4c1d9a10"
  }
}
download_url is a signed link to the result. It works without your API key until expires_at, 24 hours after the conversion finished.
A 202 response means the conversion is still running: at once without the wait parameter, after 30 seconds with it. Fetch links.self with GET until status is finished, then download download_url. If you set a webhook URL for the request or your account, we also call it when the conversion is done. Up to 50 files go into one batch. Waiting and webhooks in the docs.
No browser at hand? POST /v1/signup with an email address sends a code, and POST /v1/signup/verify with that code returns the key. Get an API key without a browser

What you get

30 input formats

Recordings from phones and cameras go in, MKV and WebM too. 22 video formats come out, GIF among them.

Smaller files

crf sets the quality: higher values give smaller files. width and height scale the picture down.

Keep a part

trim_start and trim_end cut out the part you need, in seconds or as HH:MM:SS.

Sound only

Convert a video to MP3 or another audio format to get only its sound.
Converter pages for single files: MOV to MP4, MKV to MP4, AVI to MP4, WEBM to MP4, MP4 to GIF.

Options

Send them in options as JSON. Options that do not fit the format are rejected with a message that names them.

Options for Video conversion
OptionMeaning
crfConstant Rate Factor: lower values mean higher quality and larger files. 0 to 51 for H.264 and H.265, 0 to 63 for VP9 and AV1.
widthWidth of the video in pixels.
heightHeight of the video in pixels.
fpsFrame rate of the output.
trim_startStart of the part to keep, in seconds or HH:MM:SS.
trim_endEnd of the part to keep, in seconds or HH:MM:SS.
audio_bitrateAudio bitrate in kbit/s. Without a value the encoder picks a quality-based rate.
Every option of every format is in the formats and options reference.

Where your files go

Converted on our server

Conversions run on our server in the EU. Stored files and results are deleted after 24 hours. Hosting in the privacy policy

Without storage: store=false

The file and the result are processed in memory while the request runs and are not written to our file storage or database. The service that converts them cannot open connections to the internet. In this mode files can be up to 50 MB. Your usage history keeps the time, formats, sizes and credits, never the file name. Converting without storage

Data processing agreement

We sign a data processing agreement (DPA) under Art. 28 GDPR on request. Write to hello@switchfile.io. Security
Without storage: the result comes back in the response
code=$(curl -s "https://api.switchfile.io/v1/convert?store=false" \
  -o reply -D headers -w "%{http_code}" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -F file=@talk.mov -F to=mp4)
if grep -qi '^x-incomplete' headers; then
  grep -i '^x-notes' headers  # partial result, left in reply
elif [ "$code" = 200 ] && grep -qi '^content-disposition' headers; then
  mv reply talk.mp4
else
  cat reply  # otherwise the error
fi

Pricing

  • Free

    20files/day

    free API key

  • Credit pack

    from€7

    500 credits, one-time, no subscription

  • Monthly

    from€4

    500 credits a month, cancel at any time

Video conversions: 1 credit per started minute of conversion time, at least 1 per file.

A file that is done within a minute uses 1 credit, which costs €0.0043 to €0.014 depending on the plan or pack.

Add ?dry_run=1 to a convert request to see the credits and the price of a file before you convert it. Cost before converting

See all prices

SDKs and integrations

The examples use our official SDKs, and the PHP example needs only the curl extension. The SDK overview lists every client library and integration with its install line.

See the SDK overview

Questions

About video conversion through the API.

What are the limits?

Files can be up to 1 GB. A file sent in the request can be up to 100 MB; larger files go through an upload, which the SDKs do on their own. One conversion can run for up to 5 minutes. Without storage (store=false), files can be up to 50 MB.

Does converting reduce the quality?

With the default settings most videos keep their original quality. If you change any video setting or set a start or end time, the video is converted with those settings and the picture can change slightly.

How long can a video be?

One conversion can run for up to 5 minutes. For a long video, send it without the wait parameter and let a webhook tell you when it is done, or cut it into parts with trim_start and trim_end.

How long do you keep my files?

A stored conversion keeps the file and the result for 24 hours, then both are deleted. With store=false no file is stored: the result comes back in the response, and only an entry with time, formats, sizes and credits stays in your usage history for 400 days.

Try it with your own files

Free for 20 files a day. Other tasks for the same API key are on the overview of use cases.