v4

Quickstart

This guide takes you from zero to a working credential in five steps. It uses the Mosler Direct path (your system calls Mosler over REST); if a PMS already drives your bookings, see PMS Integrations instead.

You will need a company-scoped API key. Generate one in the Mosler Admin Portal under Settings → API Keys, or ask your Mosler contact. Every request below sends it in the apikey header.


1. Confirm your key works

A quick authenticated call against the event service confirms your key is live before you build anything else.

curl https://webhook.mosler.in/webhook/events \
  -H "apikey: YOUR_MOSLER_API_KEY"

A 200 with a (possibly empty) events array means you are authenticated. A 401 means the key is missing or wrong.


2. Map your locations

Bookings attach a guest to a room or bed that already exists in Mosler. Before your first booking, mirror your physical inventory (sites → buildings → floors → rooms → beds) into Mosler once. This is a one-time setup per property — see Mapping Locations for the full walkthrough.

You only need the room number (or bed number) and site to create a booking — those are the keys Mosler matches against. Rooms and beds match by name within a site; a site is identified by its Mosler _id or your own external_id, never by name.


3. Create a booking

Send the reservation to the webhook service. The response is asynchronous: you get a 202 Accepted with an eventId immediately, and provisioning happens on Mosler's side.

curl -X POST https://webhook.mosler.in/webhook/generic \
  -H "apikey: YOUR_MOSLER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "BOOKING_CREATE",
    "referenceId": "RES-20250718-001",
    "guest": { "name": "Jordan Rivera", "phone": "+919876543210" },
    "site": "6530f9dce0c1bd73ded0d1be",
    "roomNumber": "101",
    "startDate": "2025-08-01T08:30:00.000Z",
    "endDate": "2025-08-05T05:30:00.000Z"
  }'
{
    "success": true,
    "eventId": "a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f",
    "status": "RECEIVED"
}

The referenceId is yours — use your own reservation number. It is the key you use to read access back later, so it must be unique within your company. See Creating Bookings for the full field list.


4. Confirm it processed

Provisioning is queued, so poll the event until it reaches COMPLETED (or subscribe to a callback — see Delivering Access).

curl https://webhook.mosler.in/webhook/events/a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f \
  -H "apikey: YOUR_MOSLER_API_KEY"
{
    "success": true,
    "eventId": "a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f",
    "status": "COMPLETED",
    "message": null
}

The full set of states and retry behaviour is documented in Event Lifecycle.


5. Retrieve the credential

Once COMPLETED, read the guest's access from the API, keyed by your referenceId.

curl https://api.mosler.in/api/v4/bookings/RES-20250718-001/access \
  -H "apikey: YOUR_MOSLER_API_KEY"
{
    "success": true,
    "booking": { "referenceId": "RES-20250718-001", "status": "active" },
    "access": [
        {
            "deviceName": "Room 101 Door",
            "roomNumber": "101",
            "type": "passcode",
            "passcode": "482910"
        }
    ]
}

Share the passcode with your guest, or for Bluetooth e-keys hand the lock data to the Mobile Key SDK. The complete read API — passcodes, cards, e-keys, and remote unlock — is in Retrieving Access.


Where to go next

If you want to…Read
Understand the full booking schemaCreating Bookings
Have Mosler push access to you or the guestDelivering Access
Secure and verify your webhooksSecurity
Look up a response codeResponse Codes
Connect through a PMS insteadPMS Integrations