Leads, availability and bookings
A practical guide to version 2 of the data contract: idempotent writes, signed webhooks with code examples, the lead stages and what to know about personal data.
Switched off by default
Version 2 is built on our side, but it stays off until we agree on it in writing and you grant the permission in your own system. Without both, we only read. See Security & data.
The calls, bodies and responses are in the reference. This page adds what you need to build them well.
Idempotency
Every write we send carries an Idempotency-Key header. Your API must treat the same key as the same request:
- The first call creates the lead or hold and returns its
id. - A repeated call with the same key returns the same result and creates nothing new.
This makes our retries safe: if we don't hear back from you, asking again can never create a duplicate lead or booking. Store the key together with the result for as long as retries are possible.
Lead stages
Your system reports the stage of each lead. The values are received, contacted, viewing, proposal, won and lost.
- receivedcontactedyour team reaches out
- contactedviewinga visit is arranged
- viewingproposalan offer is sent
- proposalwonsigned
- proposallostdeclined
We learn about changes either by asking (GET /leads/{id}) or from your webhook lead.updated.
Holds and bookings
- 1.GET /availability?productIds=…&from=…&to=…
- 2.{ slots: [...] }
- 3.POST /holds
- 4.{ id, status: "held", holdExpiresAt? }
- 5.POST /holds/{id}/confirm
available in a slot is the number of free units, or true/false. holdExpiresAt is optional.
Signed webhooks
Webhooks are optional but recommended. You send events to the URL we give you, so we don't have to ask. Sign the raw body with the secret we give you and send the result as:
X-CoworkingView-Signature: sha256=<hex HMAC-SHA256>Rules:
- Compute the HMAC-SHA256 over the exact bytes you send, not over a re-serialised copy.
- Give every event a unique
id: we ignore repeated ids, so retries are safe. - Event types are
lead.updated,booking.updated,availability.changedandcatalogue.changed.
The same computation lets you test your signature. Compare in constant time, never with ==.
import { createHmac, timingSafeEqual } from 'node:crypto';
// rawBody: the exact bytes (Buffer) of the request body
export function sign(rawBody, secret) {
return 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex');
}
// Check a signature header against the body, in constant time
export function isValid(rawBody, header, secret) {
const expected = Buffer.from(sign(rawBody, secret));
const received = Buffer.from(header ?? '');
return expected.length === received.length && timingSafeEqual(expected, received);
}Personal data
Leads contain personal data of the people who ask about your spaces (name, email, and optionally company and phone). Because of that:
- Version 2 only runs under the agreement we make with you, and the customer data follows the partner agreement.
- We send only the fields of the lead body shown in the reference.
- Don't put personal data in URLs, in the
referenceor in logs that are widely shared. - If you need a data processing agreement or have questions about data protection, write to info@coworkingview.com. Our privacy policy is at coworkingview.com.