Lesson 1 of 10

Getting Started

Set up your project, get an API key, and make your first authenticated request. No FFmpeg install, no npm package. Just fetch.

Follow along with a live API key. 100 free minutes, no credit card.

Get free API key

No install, no SDK. Just an API

FFmpeg Micro is a REST API. You don't install FFmpeg, you don't manage a worker queue, and there is no npm package to add. You send an HTTP request describing the job, and the API runs FFmpeg on dedicated hardware and hands back a URL to the result. Everything in this course uses Node's built-in fetch, so there are no dependencies to install.

What you need

  • Node 18 or newer. fetch is global, so no node-fetch dependency.
  • An API key. Create one on the API Keys page in your dashboard.

Check your Node version:

node --version   # v18.0.0 or higher

Follow along with the example repo

Every example in this course lives in a companion GitHub repo. Cloning it is the fastest way to follow along, though it's optional. The lessons don't assume you have it.

git clone https://github.com/javidjamae/ffmpeg-api-node.git
cd ffmpeg-api-node
cp .env.example .env   # paste your API key (next section)

There are no dependencies to install. Once your key is in .env, run any example:

npm run transcode

Store your API key

Never hard-code your key. Put it in a .env file and load it. Node 20.6+ can read it directly with --env-file, so you don't even need the dotenv package:

# .env
FFMPEG_MICRO_API_KEY=your_api_key_here

Run any script in this course like this:

node --env-file=.env script.mjs

Authentication

Every request carries your key in the Authorization header as a Bearer token. That's the only auth step. There's no login call or token exchange.

const API_URL = 'https://api.ffmpeg-micro.com'
const API_KEY = process.env.FFMPEG_MICRO_API_KEY

const authHeaders = {
  Authorization: `Bearer ${API_KEY}`,
  'Content-Type': 'application/json',
}

Your first request

Before transcoding anything, confirm your key works by listing your recent jobs. A fresh account returns an empty list, and that's a successful call.

// hello.mjs
const API_URL = 'https://api.ffmpeg-micro.com'
const API_KEY = process.env.FFMPEG_MICRO_API_KEY

const res = await fetch(`${API_URL}/v1/transcodes?limit=5`, {
  headers: { Authorization: `Bearer ${API_KEY}` },
})

if (!res.ok) {
  throw new Error(`Request failed: ${res.status} ${await res.text()}`)
}

const data = await res.json()
console.log(`You have ${data.items.length} recent job(s).`)

Run it:

node --env-file=.env hello.mjs
# You have 0 recent job(s).

What could go wrong: A 401 Unauthorized means the key is missing, mistyped, or deleted. Confirm the Authorization header reads exactly Bearer YOUR_KEY and that --env-file=.env is actually loading. A common miss is running node hello.mjs without the flag, which leaves API_KEY undefined.

Key takeaways

  • FFmpeg Micro is a REST API. No FFmpeg install, no SDK, just fetch.
  • Node 18+ has global fetch; Node 20.6+ reads .env via --env-file.
  • Authenticate with Authorization: Bearer YOUR_API_KEY on every request.
  • Listing jobs is a safe way to verify your key before you spend any minutes.

Next up: get a video into the API so you have something to process.

Build this into your app. No FFmpeg install

One call kicks off a job. No local FFmpeg, no servers, no worker queue to run.

const res = await fetch('https://api.ffmpeg-micro.com/v1/transcodes', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.FFMPEG_MICRO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    inputs: [{ url: 'gs://your-bucket/input.mp4' }],
    outputFormat: 'mp4',
    preset: { quality: 'medium', resolution: '1080p' },
  }),
})
const job = await res.json() // { id, status: 'pending' }