---
title: "Claim an ingest job"
method: POST
path: "/api/ingest/claim"
tags: ["ingest"]
---

# Claim an ingest job

`POST /api/ingest/claim`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - API key in cookie `sessionid`

Atomically hands the caller the highest-priority claimable job and moves it to `probing`. Claimable means waiting, or claimed by a worker that has not reported for longer than the ingest lease. Concurrent callers are never given the same job. An idle queue answers 204.

## Request body

- IngestClaimRequest: What a worker says about itself when it asks for work. Both fields are optional, and mean different things by their absence. No `kind` is "give me anything", which is right for a single undifferentiated worker pool and stays right once the pool splits -- it is the workers that can only reach one source that have to name one. No `worker` is simply an anonymous claim: the identity is recorded for operators to read and nothing is decided by it.
  - `kind` union
    - 'upload' | 'backfill': * `upload` - Source is a fresh upload in the tusd volume * `backfill` - Source is the media archive
    - unknown
  - `worker` string

## Response `200`

- IngestJob: What ingest reports about an upload, and what its uploader is shown. `status_text` is write-only deliberately: it carries ffmpeg's complaints and the archive paths behind them, which belong in the admin and the logs rather than in a response to an organization's members. What they get instead is `error_code`, which the frontend turns into words -- ingest has no business choosing the Norwegian.
  - `video` integer, required
  - `state` 'pending' | 'probing' | 'archiving' | 'transcoding' | 'done' | 'failed', required: * `pending` - Waiting to be picked up * `probing` - Inspecting the uploaded file * `archiving` - Storing the original * `transcoding` - Generating derived files * `done` - Finished * `failed` - Failed
  - `priority` integer: Claim order among waiting jobs; higher is claimed sooner.
  - `kind` 'upload' | 'backfill': Where this job's source file is, and therefore which workers can take it. * `upload` - Source is a fresh upload in the tusd volume * `backfill` - Source is the media archive
  - `claimedBy` string, nullable, required: Identity of the worker that last claimed this job, if any.
  - `percentageDone` integer, nullable: Progress through the current state, not through the pipeline as a whole. Null where the current state has no progress to report.
  - `errorCode` string: Machine-readable reason the ingest failed; empty otherwise. The wording shown to the uploader is the frontend's to choose, not ingest's.
  - `updatedTime` string, date-time, nullable, required

## Other responses

- `204`: Nothing is claimable right now.
- `400`
- `401`
- `403`
- `404`
- `405`
- `406`
- `415`
- `500`

## Changes

- **2026-08-27** `3761c2b166bb`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/changes/api/ingest/claim/post.md)

---

[API](https://skmtc.dev/frikanalen/apis/frikanalen-django-api.md) - [All operations](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/llms.txt) - [OpenAPI document](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/revisions/ebd4175e41fe?raw)
