instaenv
DevelopersGet an API key

Developers

Webhooks

Webhooks send an HTTPS POST to your server when something happens to your agency's homes, so you can update your CRM or portal without polling.

Set up an endpoint

  1. In Settings → Developers → Webhooks, choose Add endpoint.
  2. Enter your HTTPS URL and, optionally, a description.
  3. Pick All events or the specific events you want. All events includes event types added later.
  4. Copy the signing secret (whsec_…). It is shown only now and when you rotate it.

URLs must use HTTPS and resolve to a public address: private, loopback, link-local and cloud metadata addresses are refused when you save and again when we send. Redirects are not followed.

Events

EventSent whendata.object
property.createdA home is created, in the app or through the API.Property
property.updatedA meaningful field of a home changes. At most one per home per minute.Property
property.deletedA home is deleted.id and reference only
recording.uploadedA recording's upload is confirmed and processing starts.Property, plus data.recording
recording.failedA recording could not be processed. data.recording.error_code says why and data.recording.retry_useful whether retrying the same recording can help (otherwise, record again).Property, plus data.recording
tour.readyThe tour made from a recording is available.Property, plus data.recording
kit.readyEvery kit piece is ready or has failed.Property
property.publishedThe home's public page is published.Property
property.unpublishedThe home's public page is taken down.Property
lead.createdA visitor sends a contact request from a home's page.Lead

Events fire the same way whether the change came from the dashboard, the app, the API or our processing. recording.* and tour.ready belong to homes recorded with the app: uploading 360 photos does not send them. GET /webhook-events lists the types, for discovery.

Payload

Every event is a JSON envelope. data.object is the same property (or lead) object the API returns, so you rarely need a second call. Recording events (recording.uploaded, recording.failed, tour.ready) also carry the recording in data.recording: its id, status, whether it is a corrective recording, and uploaded_at and created_at.

{
  "id": "evt_01JC8Z2Q4M5N6P7R8S9T0V1W2X",
  "type": "property.created",
  "created_at": "2026-11-07T18:00:00Z",
  "api_version": "2026-11-07",
  "organization_id": "1",
  "data": {
    "object": {
      "id": "123",
      "reference": "ABC123",
      "title": "Piso en Gràcia",
      "address": "Carrer de Verdi 10, 3º 2ª",
      "city": "Barcelona",
      "postal_code": "08012",
      "operation": "sale",
      "price": 345000,
      "currency": "EUR",
      "bedrooms": 3,
      "bathrooms": 2,
      "area_m2": 92,
      "kit_enabled": true,
      "show_exact_location": false,
      "status": "no_recording",
      "attention": [
        "needs_recording"
      ],
      "tour": null,
      "page": {
        "published": false,
        "url": null,
        "published_at": null
      },
      "texts": null,
      "photos": [],
      "thumbnail": {
        "url": "https://files.instaenv.com/p/123/photo-1.jpg?X-Amz-Expires=21600&X-Amz-Signature=...",
        "width": 1600,
        "height": 1200,
        "sources": []
      },
      "created_at": "2026-11-05T09:12:44Z",
      "updated_at": "2026-11-07T17:58:12Z"
    }
  }
}

Each request also carries these headers:

HTTP
POST /webhooks/instaenv HTTP/1.1
Host: crm.example.com
Content-Type: application/json
User-Agent: Instaenv-Webhooks/1
Instaenv-Event-Id: evt_01JC8Z2Q4M5N6P7R8S9T0V1W2X
Instaenv-Event-Type: ping
Instaenv-Signature: t=1794074400,v1=a3a031be93f25acbaab997c168a5c81df72b17f57df9d67bd39a7e28810abe28

{"id":"evt_01JC8Z2Q4M5N6P7R8S9T0V1W2X","type":"ping","created_at":"2026-11-07T18:00:00Z","api_version":"2026-11-07","organization_id":"1","data":{"object":{"endpoint_id":"01jc8y5k3w2q4n5m6p7r8s9t0v","message":"Test event from Instaenv."}}}

Verify signatures

Anyone can send a POST to your URL. Check the Instaenv-Signature header on every request before trusting it:

  1. Split the header on commas into t (a Unix timestamp) and one or more v1 signatures.
  2. Reject the request if t is more than 5 minutes away from your clock. This stops replays of old requests.
  3. Compute HMAC-SHA256 of the string <t>.<raw body> with your endpoint's secret as the key (the whole string, whsec_ included), as lowercase hex.
  4. Compare it with each v1 value in constant time. Accept the request if one matches.

Use the raw request body, byte for byte. Frameworks that parse JSON first and re-serialise it change spacing or key order, and the signature no longer matches.

// npm install express
import crypto from "node:crypto";
import express from "express";

const SECRET = process.env.INSTAENV_WEBHOOK_SECRET; // whsec_..., the whole string is the key
const TOLERANCE_SECONDS = 5 * 60;

export function verifyInstaenvSignature(rawBody, header, secret, now = Math.floor(Date.now() / 1000)) {
  if (!header) return false;
  let timestamp = null;
  const signatures = [];
  for (const part of header.split(",")) {
    const [key, value] = part.trim().split("=", 2);
    if (key === "t" && /^\d+$/.test(value ?? "")) timestamp = Number(value);
    if (key === "v1" && value) signatures.push(value);
  }
  if (timestamp === null || signatures.length === 0) return false;
  if (Math.abs(now - timestamp) > TOLERANCE_SECONDS) return false; // too old (or from the future): a replay

  const expected = crypto.createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
  return signatures.some((signature) => {
    const received = Buffer.from(signature, "hex");
    return received.length === expected.length && crypto.timingSafeEqual(received, expected);
  });
}

const app = express();

// The raw body, exactly as sent: parsing and re-serialising the JSON would change the bytes and break the signature.
app.post("/webhooks/instaenv", express.raw({ type: "application/json" }), (req, res) => {
  if (!verifyInstaenvSignature(req.body, req.get("Instaenv-Signature"), SECRET)) {
    return res.status(400).send("invalid signature");
  }
  const event = JSON.parse(req.body.toString("utf8"));
  res.sendStatus(200); // answer within 10 s; do the slow work afterwards
  handleEvent(event); // your code: skip event.id if you already processed it
});

app.listen(3000);

To check your implementation, these inputs must produce this signature (call your function with now set to t):

Test vector
secret     whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw
t          1794074400
raw body   {"id":"evt_01JC8Z2Q4M5N6P7R8S9T0V1W2X","type":"ping","created_at":"2026-11-07T18:00:00Z","api_version":"2026-11-07","organization_id":"1","data":{"object":{"endpoint_id":"01jc8y5k3w2q4n5m6p7r8s9t0v","message":"Test event from Instaenv."}}}
signed     1794074400.{"id":"evt_01JC8Z2Q4M5N6P7R8S9T0V1W2X","type":"ping","created_at":"2026-11-07T18:00:00Z","api_version":"2026-11-07","organization_id":"1","data":{"object":{"endpoint_id":"01jc8y5k3w2q4n5m6p7r8s9t0v","message":"Test event from Instaenv."}}}
v1         a3a031be93f25acbaab997c168a5c81df72b17f57df9d67bd39a7e28810abe28

Respond quickly

Answer with any 2xx status within 10 seconds; anything else, a timeout or a redirect counts as a failure. Verify, store the event, answer, and do the slow work (calling your CRM, sending emails) in a background job.

Retries

A failed delivery is retried with exponential backoff, 7 times, after:

Retry1234567
Wait1 min5 min30 min2 h6 h12 h24 h

After the seventh retry, about two days after the event, the delivery is marked failed. You can still resend it by hand from the deliveries log for 30 days.

At-least-once delivery

Delivery is at least once: a retry after a timeout, or a manual resend, can bring an event you already handled. Events can also arrive out of order. So:

  • Deduplicate by the event id (also in the Instaenv-Event-Id header). Retries and resends keep the same id.
  • Use created_at and the object's updated_at to ignore a stale event, or fetch the home from the API when the order matters.
// Redis: remember each event id for 7 days; SET NX succeeds only the first time.
async function handleOnce(event, handle) {
  const isNew = await redis.set(`instaenv:event:${event.id}`, "1", { NX: true, EX: 7 * 24 * 3600 });
  if (!isNew) return; // a retry or a replay of an event already handled
  await handle(event);
}

Testing

  • In Settings → Developers → Webhooks, open an endpoint and choose Send test event. It sends a signed ping event to that endpoint.
  • The deliveries log of each endpoint shows every attempt: the event, status, your response code, how long it took, when, and the payload and the start of your response. Resend sends a delivery again, with the same event id.
  • While you develop, a tunnel (ngrok, Cloudflare Tunnel) gives your local server a public HTTPS URL.

Auto-disable

An endpoint that keeps failing is switched off automatically after 3 consecutive days of failures or 50 failed deliveries in a row, and the agency's owner gets an email. Settings shows it as Disabled automatically. Fix your server, switch the endpoint back on and resend the deliveries you need from the log.

Rotating the secret

Rotate secret in the endpoint's settings creates a new secret and shows it once. Update your server with it straight away: requests are signed with the new secret from then on. If a secret leaks, rotate it.

Managing endpoints through the API

Integrations that set themselves up can create and manage endpoints with a key that has the webhooks:manage scope. The endpoints have the same shape as in Settings; see the API reference.