API docs

Input contract

A batch is one POST /batches request. Its body lists the videos to process, one input for each video. Each input becomes one job.

This page states every header and field of that request, the rules of each, and the message the API sends when a rule is broken.

Headers

HeaderRequiredRule
AuthorizationyesBearer and your API key, as on the overview.
Content-Typeyesapplication/json, optionally with charset=utf-8.
Idempotency-KeyyesA key that you choose for this batch. See Idempotency.

A broken header rule gets 400 with the header's name as the param:

paramMessage
Content-TypeContent-Type must be application/json, optionally with charset=utf-8.
Idempotency-KeyIdempotency-Key must be 1 to 255 printable ASCII characters without spaces.

This route accepts no query parameters. A query parameter gets 400 with the message This path accepts no query parameters.

A full example

This body asks for every output for one video. It states the lens values with intrinsics, which your organisation may do only when the service has allowed it. Otherwise name a camera profile instead. The values are examples.

{
  "inputs": [
    {
      "type": "video_url",
      "video_url": { "url": "https://videos.example.com/kitchen.mp4" },
      "filename": "kitchen.mp4",
      "sha256": "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b",
      "camera": {
        "intrinsics": {
          "model": "pinhole",
          "width": 1920,
          "height": 1080,
          "fx": 1400.0,
          "fy": 1400.0,
          "cx": 959.5,
          "cy": 539.5,
          "distortion": [-0.12, 0.03, 0.0, 0.0, 0.0],
          "rotation_deg": 0
        }
      },
      "imu": {
        "source": "csv",
        "url": "https://videos.example.com/kitchen-imu.csv",
        "clock_offset_s": 0.0,
        "imu_in_camera": {
          "rotation": [[1, 0, 0], [0, 1, 0], [0, 0, 1]],
          "translation_m": [0.0, 0.0, 0.0]
        }
      },
      "operator_height_m": 1.75
    }
  ],
  "depth": true,
  "trajectory": true
}

The smallest valid body has one input with only type and video_url. It asks for pii_blur alone.

Body fields

FieldRequiredWhat it isMessage when the value breaks a rule
inputsyesAn array of 1 to 1,000 inputs.Must contain between 1 and 1000 inputs.
depthnoAsk for depth. The default is false.depth must be true or false.
trajectorynoAsk for the trajectory. The default is false. It needs "depth": true.trajectory must be true or false.
hand_trackingnoNot offered. Omit it or send false.This option is not offered. Omit it or send false.
hand_activitynoNot offered. Omit it or send false.This option is not offered. Omit it or send false.

A body that is not a JSON object gets the message The body must be a JSON object. with the param null. A field that is not on this page gets the message This field is not accepted. at every level, with the field's path as the param. In each object, this check comes before the checks of the other fields.

Input fields

FieldRequiredWhat it isMessage when the value breaks a rule
typeyesAlways "video_url".type must be "video_url".
video_urlyesAn object with the one field url.video_url must be an object with the field url.
video_url.urlyesThe https link to the video. See Links.See Links.
filenamenoA name for the video, for your own use. It appears in the job's input_metadata.filename must be 1 to 255 characters without control characters, slashes or backslashes, and must not be '.' or '..'.
sha256noThe SHA-256 of the video file. When it is present, the service checks the downloaded video against it.sha256 must be 64 lower-case hexadecimal characters.
cameranoThe lens values of the camera. See Camera fields.camera must be an object with exactly one of profile and intrinsics.
imunoThe IMU data of the video. See IMU fields.imu must be an object with source, clock_offset_s and imu_in_camera, and url when source is csv.
operator_height_mnoThe height of the person who wears the camera, in metres.operator_height_m must be a number from 0.5 to 3.0.

An input that is not a JSON object gets the message Each input must be an object.

A video_url object without url gets the message of the link rules, with the param inputs[n].video_url.url.

A video whose bytes do not match its sha256 fails its job with the code video_invalid and the message The video does not match the SHA-256 that the input stated.

Camera fields

camera holds exactly one of two fields. The camera profiles page says what the lens values mean.

FieldWhat it isMessage when the value breaks a rule
profileThe name of a camera profile.profile must be 1 to 64 lower-case letters, digits, '_', '.' or '-', starting with a letter or a digit.
intrinsicsThe lens values themselves. Your organisation must be allowed to state them.intrinsics must be an object with exactly model, width, height, fx, fy, cx, cy, distortion and rotation_deg.

The fields of intrinsics are checked in this order. The first broken rule answers, with the field's path as the param.

FieldMessage when the value breaks a rule
modelmodel must be "pinhole" or "fisheye".
widthwidth must be a whole number of at least 2.
heightheight must be a whole number of at least 2.
fxfx must be a number above 0.
fyfy must be a number above 0.
cxcx must be a number from 0 to width - 1.
cycy must be a number from 0 to height - 1.
distortiondistortion must be 5 numbers for pinhole or 4 numbers for fisheye.
rotation_degrotation_deg must be 0, 90, 180 or 270.

IMU fields

The IMU page describes the formats and the clock.

FieldWhat it isMessage when the value breaks a rule
source"csv" for a CSV file at a link, or "embedded" for telemetry inside the video file.source must be "csv" or "embedded".
urlThe https link to the CSV file. Required when source is "csv", refused when it is "embedded".url is required when source is csv and refused when source is embedded.
clock_offset_sThe seconds to add to the IMU times to get the video's times.clock_offset_s must be a number from -3600 to 3600.
imu_in_cameraWhere the IMU sits in the camera: an object with rotation and translation_m.imu_in_camera must be an object with exactly rotation and translation_m.
imu_in_camera.rotationThree rows of three numbers.rotation must be 3 rows of 3 numbers that form a rotation matrix.
imu_in_camera.translation_mThree numbers, in metres.translation_m must be 3 numbers from -10 to 10.

url follows the same link rules as the video's link.

What each output needs

pii_blur needs nothing more than the video. The other outputs need more fields on every input of the batch:

The batch asks forEvery input needsparam of the refusalMessage
trajectory"depth": true in the bodytrajectorytrajectory requires depth.
depthcamerainputs[n].cameradepth requires a camera profile or camera intrinsics on every input.
trajectoryimuinputs[n].imutrajectory requires IMU data on every input.
trajectoryoperator_height_minputs[n].operator_height_mtrajectory requires operator_height_m on every input.

An input with imu also needs camera. Without it, the request gets 400 with the param inputs[n].imu and the message IMU data requires a camera profile or camera intrinsics.

A camera profile must exist. An unknown name gets 400 with the param inputs[n].camera.profile and the message No camera profile has this name.

Your organisation may state intrinsics only when the service has allowed it. Otherwise the request gets 400 with the param inputs[n].camera.intrinsics and the message This organisation may not state camera intrinsics. Name a camera profile instead.

In each param, n is the index of the input in inputs, counted from 0.

The service downloads each video, and each CSV IMU file, from the link you give. A link is read in two steps.

First, the API must be able to read the link. A link it cannot read gets 400 with the link's path as the param and this message:

The URL must be an absolute URL of 1 to 4096 printable ASCII characters without backslashes. It must start with <scheme>:// and name its host right after the two slashes, and the part before the path must not contain '%'. The host must have at most 253 characters and no empty label, such as two dots in a row.

Second, a readable link must follow five rules. A link that breaks one does not stop the batch. The batch is accepted with 202, and that input's job is created already failed. The rules are checked in this order:

RuleThe job's message when the video's link breaks it
The link uses https.The video link must use https.
The link holds no username or password.The video link must not contain a username or a password.
The link uses port 443, the https default.The video link must use port 443.
The host is a name, not an IP address.The video link must name a host, not an IP address.
The host is allowed.The video link names a host that is not allowed.

A job whose video link breaks a rule fails with the code video_invalid. A job whose IMU link breaks a rule fails with the code camera_data_invalid and the message The IMU link must use https on port 443, carry no username or password, and name an allowed host rather than an IP address.

These hosts are not allowed:

One dot at the end of a host name is allowed, and the rules above ignore it. It still counts toward the 253 characters of the host.

A job that failed at acceptance reserves no credit, and its finished_at equals its created_at. A batch whose inputs all failed at acceptance still goes through the checks that come after the link rules, such as the 24-hour cap and the prices. When it passes them, it is accepted, and it is done at once. The limits page states how the service downloads a link.

Idempotency

Every batch needs an Idempotency-Key header. Keys belong to your organisation. Choose a new key for each new batch.

The API compares bodies by their JSON meaning. The order of keys in an object and the spaces between values do not matter. Numbers are compared by value, so 1.5 equals 1.50. Other changes make another body: inputs in another order, or a default written out, such as "depth": false.

The API matches a repeated request before it checks the caps on your jobs and video and your credit. So a repeat of an accepted batch gets 202 even when a new batch would not fit.

Strict JSON

The API reads the body as strict JSON:

The body may be at most 8 MiB. A larger body gets 413 request_too_large with the message The request body is larger than 8 MiB.

A body that breaks a JSON rule gets 400 with one of these messages:

ProblemMessage
Not UTF-8The body is not valid UTF-8.
A byte-order mark firstThe body must not start with a byte-order mark.
Not JSONThe body is not valid JSON.
Text after the valueUnexpected text after the JSON value.
A key twice in one objectA key appears twice in one object.
nullnull is not accepted. Omit an optional field instead.
U+0000 in a stringStrings must not contain U+0000.
An unpaired surrogateStrings must not contain an unpaired surrogate.
A number too largeA number is too large.
Nesting too deepThe body nests arrays and objects deeper than 32 levels.
Too many valuesThe body holds more than 100,000 JSON values.
A string too longThe body holds a string of more than 65,536 UTF-16 code units.

The param of a refusal is the JSON path of the value, such as inputs[1].filename or inputs[0].camera.intrinsics.distortion[2]. It is null when the problem is the whole body. The refusals for too many values and for a string too long have the param null as well. A path stops before a key name that the API does not repeat back.

The order of the checks

The first check that fails answers the request:

  1. The query string, Content-Type and Idempotency-Key.
  2. The size of the body.
  3. The JSON rules.
  4. The body fields, in the order of the tables above, and then each input in turn. In each object, a field that this page does not name comes first.
  5. A repeated Idempotency-Key. See Idempotency.
  6. A pause of your organisation (403 operation_paused), then a pause of every organisation (503 operation_paused).
  7. trajectory without "depth": true.
  8. Each input in turn: its camera profile, whether your organisation may state intrinsics, what each output needs, and imu without camera.
  9. The caps on your jobs and video. The 400 answers come first, in this order: the 24-hour cap, the cap on unfinished jobs, the queue window. Then come the 429 answers.
  10. The prices of the outputs, and then your credit.