Quickstart

From keys to a confirmed booking in the property's rack. The calendar is read from the browser; the booking is made from your server.

  1. Step 1: Get the property's keys#

    You need three things, all for the same property:

    • A secret key (tulo_sk_...; keys made before 1.4.1 start tulo_pk_ and keep working) for your server. A manager creates it in the Tulo console under Settings, then API keys. The full key is shown once.
    • A publishable key (tulo_pub_...) for the browser, bound to your website's exact https origins, for example https://hotel.example.
    • A registered signing key: the public half of an Ed25519 key pair your server holds (step 2). Tulo answers with its id, which you send as X-Tulo-Key-Id.
  2. Step 2: Make a signing key pair#

    Generate an Ed25519 key pair on your server. The private key never leaves it; the public key is what Tulo registers. Any of these works:

    import { generateKeyPairSync } from "node:crypto";
    
    const { publicKey, privateKey } = generateKeyPairSync("ed25519");
    
    // Keep this on your server only (an environment variable or a secret store).
    console.log(privateKey.export({ type: "pkcs8", format: "pem" }));
    
    // Register this with Tulo: the raw 32-byte public key in base64url.
    console.log(publicKey.export({ format: "jwk" }).x);
  3. Step 3: Read the calendar from the browser#

    In the browser, send the publishable key in the X-Api-Key (or Authorization) header. The browser sends a preflight and your page's Origin, and Tulo allows exactly that origin when it is one of the key's. The key query parameter still works as a fallback (a simple GET with no preflight). See Sending a key.

    // On https://hotel.example, with the publishable key in a header (from 1.4.1).
    const params = new URLSearchParams({ from: "2026-12-01", to: "2026-12-31" });
    const res = await fetch(`https://api.tulo.homes/partner/v1/calendar?${params}`, {
      headers: { "X-Api-Key": "tulo_pub_..." },
    });
    // Fallback (no preflight): add key: "tulo_pub_..." to params and send no headers.
    const { calendar } = await res.json();
    
    for (const roomType of calendar.room_types) {
      for (const night of roomType.nights) {
        // night.bookable, night.nightly_rate (ngwee), night.min_stay ...
      }
    }

    Each room type lists its nights from from up to, not including, to (at most 90 nights). A night you can sell has bookable: true. See Availability and pricing.

  4. Step 4: Price the stay#

    GET /quote prices one stay for a party and lists every room type that can sell it. Reading needs no signature, so it works from the browser with the publishable key too.

    curl "https://api.tulo.homes/partner/v1/quote?check_in=2026-12-01&check_out=2026-12-03&adults=2" \
      -H "Authorization: Bearer $TULO_SECRET_KEY"
  5. Step 5: Create the booking from your server#

    POST /bookings needs the secret key, the four signature headers and an Idempotency-Key. The samples use the helpers from Signing requests, which serialise the body once and sign exactly those bytes.

    import { randomUUID } from "node:crypto";
    import { privateKeyFromPem, tuloRequest } from "./tulo-signing.mjs";
    
    // One Idempotency-Key per booking attempt. Store it with the attempt and
    // send the same key (and the same body) if you retry.
    const idempotencyKey = randomUUID();
    
    const { booking } = await tuloRequest({
      secretKey: process.env.TULO_SECRET_KEY,
      keyId: process.env.TULO_SIGNING_KEY_ID,
      privateKey: privateKeyFromPem(process.env.TULO_SIGNING_PRIVATE_KEY),
      method: "POST",
      pathWithQuery: "/partner/v1/bookings",
      idempotencyKey,
      body: {
        room_type_id: "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
        check_in: "2026-12-01",
        check_out: "2026-12-03",
        adults: 2,
        guest: { name: "Mwila Banda", phone: "0971234567" },
      },
    });
    // booking.status === "confirmed", booking.source === "website"

    Tulo answers 201 with the booking, already confirmed. If two guests race for the last room, one of you gets 409 no_availability and nothing is booked.

  6. Step 6: Check it in the rack#

    Open the property's Tulo console. The booking is on the Rack and in Bookings, with source website, the guest's name and phone, and the nights taken out of availability. From here the property runs it like any other booking; you hear about every change by webhook.

    Next: read Errors and work through the Certification checklist before going live.

Questions? Email support@mail.tulo.homes or WhatsApp +260 77 235 2417.