apyhub
Back
▣ FILE CONVERSION · FILE MANIPULATION

Compress Video File API

Hosted on ApyHub

What it does

The video compression API reduces a video's file size by re-encoding it. Send the file as video or point it at a public video_url, set compression_percentage, and get the smaller file back as a direct download or as a signed link.

compression_percentage runs from 0 to 100 and defaults to 50. Higher values produce a smaller file at lower quality, so it is worth running two or three values against a sample clip to find the point where quality still holds for your content. Uploads accept .mp4, .mkv, .avi, .mov, .flv, .3gp and .webm, up to 100 MB per request, and the URL routes handle anything larger.

Teams use the video compression API to cut storage and bandwidth bills on user-generated uploads, to get clips under the size limits that email and chat tools enforce, and to shrink background and hero videos so a page loads faster on a slow connection.

One percentage controls the result. To see what you started with, the Video Metadata API returns duration, resolution, frame rate, codec and file size as JSON, which makes it easier to pick a sensible value.

For long videos and batch work, the Async Video Compression API runs the same compression as a job: submit, get a job_id, poll until it finishes. Compression also pairs with the Video Converter API when the output needs a different container. All of them are callable by AI agents through ApyHub MCP.

▣ ENDPOINT 01 / 04
POST
Compress video (upload → download)
https://api.eu.apyhub.com/apyhub/compress-video/multi-part/download

QUICKSTART

GUIDE

Quickstart

Upload a video file to get back the compressed video binary.

curl -X POST "https://api.eu.apyhub.com/apyhub/compress-video/multi-part/download" \
  -H "apy-token: $APY_TOKEN" \
  -F "video=@/path/to/video.mp4" \
  -F "compression_percentage=50"

What you'll get back

Returns a binary containing the compressed video file.

TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
Video file (.mp4 .mkv .avi .mov .flv .3gp .webm)
Compression strength 0–100 (higher = smaller file, lower quality).

About this endpoint

What it does

Uploads a video file and returns the compressed video as a binary file in the response. You can optionally control the compression strength with compression_percentage.

Request Body

ParameterTypeMandatoryDescription
videoBinaryYesVideo file (.mp4, .mkv, .avi, .mov, .flv, .3gp, .webm).
compression_percentageIntegerNoCompression strength from 0 to 100. Higher values produce a smaller file with lower quality. Default: 50.

Response

Returns a binary file as the response body — the compressed video output. The output schema is a binary string, so there is no JSON wrapper or named response field.

ParameterTypeMandatoryDescription
binary response bodyStringYesCompressed video file returned as raw binary data.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 03 / 04
POST
Compress video (URL → download)
https://api.eu.apyhub.com/apyhub/compress-video/url/download

QUICKSTART

GUIDE

Quickstart

Compress a video from a public URL by sending the source video_url in the JSON body.

curl -X POST "https://api.eu.apyhub.com/apyhub/compress-video/url/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"video_url":"https://assets.apyhub.com/samples/sample.mp4", "compression_percentage":"50"}'

What you'll get back

Returns a binary file that contain the compressed video content.

TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Compression strength 0–100 as a string or number.

About this endpoint

What it does

Compresses a video from a provided URL and returns the compressed file as binary content for download.

Request Body

ParameterTypeMandatoryDescription
video_urlStringYesVideo URL to compress. Must be a URI.
compression_percentageStringNoCompression strength from 0 to 100, provided as a string or number. Default: 50.

Response

Returns binary file content in the success response. The output schema is a string with binary format, so the endpoint responds with the compressed video data itself rather than a JSON object.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.