AzerlightAPI reference
Azerlight API

Phone photos in, a walkable 3D house tour out.

One REST API to turn the photos of a house into a 3D tour your clients can walk through from any browser. Add tours to your portal, CRM or app in an afternoon.

The API speaks JSON over HTTPS, uses standard HTTP status codes and sends errors in plain words. Every call is authenticated with your secret key.

Base URL
https://azerlight.com/v1
Two ways to build a tour
# 1. One call: photos in walking order
POST /v1/tours            multipart, photos[]

# 2. Point by point, with full control
POST /v1/tours            create the tour
POST /v1/tours/{id}/spots add a point
POST .../spots/{id}/photos
POST .../spots/{id}/complete
POST /v1/tours/{id}/finalize

Quickstart

The fastest way to a tour: send one 360° photo per point, in the order you walk through the house, starting at the front door. You get the tour link back at once and the tour is ready a few minutes later.

  1. Create an account and copy your API key from your account page.
  2. Send the photos with POST /v1/tours.
  3. Wait for status to become ready, by polling the tour or with a webhook.
  4. Share viewer_url, or embed it on your site. Publish it to remove the preview mark.
Phone photos without a 360° camera? Use the point-by-point flow below: each point is a series of normal photos taken while turning on the spot. Our free capture page at azerlight.com/capture does it for you.

Authentication

Send your secret key as a bearer token in the Authorization header of every request. Your key is on your account page, where you can also replace it at any time.

Keep the key on your server. Never put it in a mobile app or in the code of a public web page. A tour can only be read and changed with the key that created it.

A missing or wrong key gets 401 invalid_api_key.

Header
Authorization: Bearer YOUR_API_KEY

Errors

Errors always have the same shape: a stable code your program can check, and a message you can show to a person.

StatusMeaning
400Something in the request is missing or not allowed.
401Missing or wrong API key.
402Publishing needs a plan or more tours left this month.
404The tour or point does not exist, or belongs to another key.
409Not possible right now, for example the tour is still being built.
413 415A photo is too large, or not a photo (JPEG, PNG, HEIC or WebP).
422A field has the wrong type or value. details says which.
5xxOur side. Retry with the same Idempotency-Key.
Error response 404
{"error": {"code": "tour_not_found", "message": "No tour with id tr_8c1d0f2a9b3e."}}

Idempotency

Networks fail. To retry POST /v1/tours safely, send an Idempotency-Key header with a unique value (a UUID works). If a tour was already created with that key, you get the same tour back with status 200 instead of a second tour.

Header
Idempotency-Key: 5f0c2b8e-4d1a-4c7e-9a52-1b3f6e0d7a44

How a tour is built

A tour is a house. A spot (a point) is one place where the photographer stood and turned around. Spots are linked in walking order, starting at the front door.

Tour status

capturingCreated. You are still adding spots and photos.
processingThe tour is being built. progress goes from 0 to 100.
readyDone. viewer_url shows the tour.
failedThe tour could not be built. error says why.

Spot status

waiting_photosCreated, no photos yet.
uploadedPhotos received. Call complete to check them.
checkingQuick quality check running (a few seconds).
okGood to go. Walk to the next spot.
retakeSomething is wrong. issues says what, in words you can show.
A spot that needs a retake
{
  "id": "spt_41e9a07c2d15",
  "status": "retake",
  "issues": [
    {"code": "spot_too_dark", "level": "retake",
     "message": "This spot is too dark. Turn on the lights or open the curtains and retake."}
  ]
}

Webhooks

Give a webhook_url when you create a tour and we POST a JSON event to it when the tour is ready. We retry up to 3 times if your server does not answer with a 2xx.

Every event is signed. The X-Azerlight-Signature header is sha256= followed by the HMAC-SHA256 of the raw body with your signing secret. Compare it before trusting the event. Ask us for your signing secret from the help center.

EventWhen
tour.readyThe tour is built and viewer_url works.
POST to your webhook_url
{
  "event": "tour.ready",
  "tour_id": "tr_8c1d0f2a9b3e",
  "status": "ready",
  "viewer_url": "https://azerlight.com/t/bRN7YxeoT5dt",
  "warnings": []
}
Check the signature
import crypto from "node:crypto";

function isFromAzerlight(rawBody, header, secret) {
  const mine = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  return header.length === mine.length &&
    crypto.timingSafeEqual(Buffer.from(header), Buffer.from(mine));
}

Embed a tour

Every tour lives at its own private, unguessable link. Put it in an iframe to show it on a listing page. On phones, visitors can turn their phone to look around, so keep the allow attribute.

Until the tour is published, it shows a preview mark. Building and previewing tours is free.

HTML
<iframe
  src="https://azerlight.com/t/bRN7YxeoT5dt"
  width="100%" height="560" style="border:0"
  allow="fullscreen; accelerometer; gyroscope"
  allowfullscreen></iframe>