Skip to content

Sending photos

Send each photo as it is taken, one call per photo. A job is opened the first time you send a photo for it, and every later photo adds to it.

What to send

Field (SDK) Field (HTTP) Required What it is
jobId external_job_id Yes Your own id for the job.
template template Yes The template's key, e.g. site-completion.
imageUrl image_url Yes An https link Sight can read the photo from for a few minutes, e.g. a presigned S3 link. Only public addresses are fetched; redirects are not followed.
slot slot Usually Which photo this is, as the template names it.
photoId external_photo_id Recommended Your own id for the photo. Sending the same photo again is harmless, and you can remove it later by this id.
site site For site checks { "key": "<your site id>" }, for checks such as "unique per site".
readings readings No What your device already read from the photo (below).
detect detect No Just the things to find on this photo (below).
wait mode No How long the call waits (below).

Photos must be JPEG or PNG, up to 25 MB.

How long the call waits

SDK wait HTTP mode Answer
(omitted) async 202 at once, with accepted: true. The photo is checked moments later.
"fast" fast 200 with the job as the rules and the model see it (about a second). Checks that need a reading say pending, and checking is true until the final answer.
true or "final" sync 200 once everything is checked, readings included.

async is the right default for an app: the user is never kept waiting, and the result arrives by webhook or when you ask for it. Use fast when you want to tell the user something straight away.

Readings your device already made

If your app reads something from the photo itself (a serial number off a label, a value off a screen), send it:

await checks.addPhoto({ jobId, template, slot: "label", photoId, imageUrl,
                        readings: { serial: "AB12345678" } });

Sight uses your reading instead of reading the photo again when it fits what the template expects (its list of answers or its pattern). That check then answers at once, and its evidence says source: "device". A reading that does not fit is ignored, and Sight reads the photo as usual.

Readings can arrive after the photo (from an offline queue, say): send the same photo again with the same photoId and its readings, and they are added to it.

Find just the things you name

A model may be trained to find many kinds of thing. To have one photo looked at for just a few of them, name them (up to 20; see classes() for the names your model knows):

const job = await checks.addPhoto({ jobId, template, slot: "front_view", photoId, imageUrl,
                                    detect: ["front_door", "meter"], wait: "fast" });

for (const photo of job.found ?? []) {
  for (const d of photo.detections ?? []) {
    console.log(d.class, d.score, d.confident, d.box);   // box: [left, top, right, bottom] in pixels
  }
}
  • found lists, for each photo that named things, just those, best first. confident is true when the score clears the template's pass mark; anything below its lower mark is left out.
  • The photo with its boxes drawn on then shows only those.
  • The photo goes to the model even if no check in the template needs it to.
  • Sending the photo again with other names replaces them; the model is not asked again.

Removing a photo

await checks.removePhoto(jobId, photoId);

The job is judged again without it.

Completing a job

await checks.complete(jobId);

No more photos are coming: anything still missing becomes fail. Safe to call twice.