Skip to content

Menu

  • Media
  • Pricing
  • Docs
  • Language: English

    This page isn’t available in the greyed-out languages.

    • English
    • Español
    • Português
    • Français
    • Deutsch
    • Italiano
    • Nederlands
    • Polski
    • 日本語
    • 한국어
    • Bahasa Indonesia
    • Tiếng Việt
    • Türkçe
    • العربية
    • ไทย
    • Български
    • Català
    • Hrvatski
    • Eesti
    • Magyar
    • Latviešu
    • Lietuvių
    • Srpski
    • Slovenčina
    • Slovenščina
    • Українська
    • Čeština
    • Română
    • Svenska
    • Dansk
    • Norsk bokmål
    • Suomi
    • עברית
    • हिन्दी
    • Tagalog
    • Bahasa Melayu
    • Ελληνικά
    • 简体中文
    • 繁體中文

Running jobs

A job runs one operation on one or more uploaded files. It starts at once, runs in the background and reports each file’s outcome.

On this page

Operations

An operation is what a job does, such as video.compress. GET /v1/operations lists them all, and GET /v1/operations/{id} gives one with its settings schema.

curl https://api.filesokay.com/v1/operations/video.compress
const res = await fetch("https://api.filesokay.com/v1/operations/video.compress");
const operation = await res.json();
import requests

res = requests.get(
    "https://api.filesokay.com/v1/operations/video.compress",
)
operation = res.json()

Each operation says what it takes and how it works:

FieldMeaning
input_formatsThe file extensions it takes. A file with another extension is taken too when the type you send for it is of the operation’s kind, such as video/mp4.
max_filesThe most input files one job takes.
limits.max_file_bytesThe largest input file, in bytes.
groupingseparate: one task per file, each with its own result. together: one task for all the files, as in a merge.
settings_schemaThe JSON Schema its settings follow, with every setting’s default.

Start a job

Send the operation, the input files by ID and, if you want, its settings and your own reference. Send an Idempotency-Key too, so a retry never starts a second job.

curl -X POST https://api.filesokay.com/v1/jobs \
  -H "Authorization: Bearer $FILESOKAY_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operation": "video.compress",
    "inputs": [
      {
        "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c"
      }
    ],
    "settings": {
      "method": "target_size",
      "target": {
        "unit": "percent",
        "value": 50
      }
    },
    "client_reference": "lecture-0412"
  }'
const res = await fetch("https://api.filesokay.com/v1/jobs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    operation: "video.compress",
    inputs: [
      {
        file_id: "file_3cf0737aefa34b89b7b4443c9467d60c"
      }
    ],
    settings: {
      method: "target_size",
      target: {
        unit: "percent",
        value: 50
      }
    },
    client_reference: "lecture-0412"
  }),
});
const job = await res.json();
import os
import uuid

import requests

res = requests.post(
    "https://api.filesokay.com/v1/jobs",
    headers={
        "Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
      "operation": "video.compress",
      "inputs": [
        {
          "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c"
        }
      ],
      "settings": {
        "method": "target_size",
        "target": {
          "unit": "percent",
          "value": 50
        }
      },
      "client_reference": "lecture-0412"
    },
)
job = res.json()
Response
{
  "id": "job_a1c9531eeb00434aba0058796f1ca517",
  "operation": "video.compress",
  "status": "waiting",
  "client_reference": "lecture-0412",
  "settings": {
    "audio": "keep",
    "codec": "same",
    "method": "target_size",
    "target": {
      "unit": "percent",
      "value": 50
    },
    "frame_rate": "original",
    "resolution": "auto",
    "output_format": "same"
  },
  "created_at": "2026-12-03T09:23:14Z",
  "reserved_credits": 2,
  "charged_credits": 0,
  "tasks": [
    {
      "id": "task_3f648f64472b4ea4b88568eea9d4f88c",
      "status": "waiting",
      "progress": 0,
      "reserved_credits": 2,
      "inputs": [
        {
          "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c",
          "name": "lecture.mp4"
        }
      ],
      "outputs": []
    }
  ]
}
  • settings is checked against the operation’s schema. A setting you leave out takes its default, and the job shows every setting with its default filled in.
  • tasks has one task per input, in your order.
  • reserved_credits is the most the job can cost. It’s charged only what it uses: see credits.

Estimate first

POST /v1/estimates takes the same body as POST /v1/jobs and runs nothing. It answers the most the job can cost, the credits you have, how many are missing, and what each file would become.

curl -X POST https://api.filesokay.com/v1/estimates \
  -H "Authorization: Bearer $FILESOKAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "video.compress",
    "inputs": [
      {
        "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c"
      }
    ],
    "settings": {
      "method": "target_size",
      "target": {
        "unit": "percent",
        "value": 50
      }
    }
  }'
const res = await fetch("https://api.filesokay.com/v1/estimates", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    operation: "video.compress",
    inputs: [
      {
        file_id: "file_3cf0737aefa34b89b7b4443c9467d60c"
      }
    ],
    settings: {
      method: "target_size",
      target: {
        unit: "percent",
        value: 50
      }
    }
  }),
});
const estimate = await res.json();
import os

import requests

res = requests.post(
    "https://api.filesokay.com/v1/estimates",
    headers={
        "Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
    },
    json={
      "operation": "video.compress",
      "inputs": [
        {
          "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c"
        }
      ],
      "settings": {
        "method": "target_size",
        "target": {
          "unit": "percent",
          "value": 50
        }
      }
    },
)
estimate = res.json()
Response
{
  "available_credits": 1908,
  "operation": "video.compress",
  "reserved_credits": 2,
  "settings": {
    "method": "target_size",
    "target": {
      "unit": "percent",
      "value": 50
    },
    "resolution": "auto",
    "codec": "same",
    "frame_rate": "original",
    "audio": "keep",
    "output_format": "same"
  },
  "shortfall": 0,
  "tasks": [
    {
      "status": "waiting",
      "inputs": [
        {
          "file_id": "file_3cf0737aefa34b89b7b4443c9467d60c",
          "name": "lecture.mp4"
        }
      ],
      "reserved_credits": 2,
      "preview": {
        "output": {
          "format": "mp4",
          "extension": "mp4",
          "file_name": "lecture-compressed.mp4"
        },
        "video": {
          "codec": "h264",
          "width": 1280,
          "height": 720,
          "frame_rate": "original",
          "hdr": "none"
        },
        "smallest_bytes": 634179
      }
    }
  ]
}

Statuses

Job statusMeaning
waitingNo task is running, and at least one is still waiting to start.
processingAt least one task is running.
completedEvery task completed, apart from any that were cancelled.
partly_failedSome tasks completed and some failed.
failedEvery task failed, apart from any that were cancelled.
cancelledIt was cancelled before any task completed.

Each task has its own status: waiting, processing, completed, failed, cancelled or skipped. A running task shows its progress, from 0 to 100. A failed or skipped task gives its reason.

Batches

One job can run an operation on many files, up to its max_files. With separate grouping, each file is its own task: one failed file doesn’t stop the others and isn’t charged.

A file that can’t be used is skipped, with its reason, and the rest run. Skipped files cost nothing. The reasons:

ReasonMeaning
not_foundNo uploaded file has this ID.
not_readyIts upload isn’t completed yet.
refusedIts check refused it.
check_failedIts check failed on our side.
other_operationIt was uploaded for another operation.
file_in_useAnother job is using it.
repeatedIt’s listed twice in this job.

An operation can also skip a file it wouldn’t change with these settings, such as a video already smaller than its target size. When no file would run, the job isn’t started: the request is refused with nothing_to_run, with each file’s reason. An operation with together grouping, which makes one result from all its files, refuses the whole job with files_unusable instead.

Your own reference

client_reference holds your own ID for the job, such as an order number, up to 255 characters. It comes back with the job and in every webhook message, and GET /v1/jobs?client_reference=… finds the job by it. It doesn’t have to be unique.

Cancel a job

POST /v1/jobs/{id}/cancel stops the tasks still waiting or running. A task that hadn’t started costs nothing; one that had is charged for the time it ran. Cancelling a job that has ended changes nothing.

curl -X POST https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/cancel \
  -H "Authorization: Bearer $FILESOKAY_KEY"
const res = await fetch("https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
  },
});
const job = await res.json();
import os

import requests

res = requests.post(
    "https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/cancel",
    headers={
        "Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
    },
)
job = res.json()