RatesSpot

v0.42.0
io.github.Nimisoere/ratesspot Checked 18 hours ago Published 9 hours ago

Booking engine for rooms, desks, sessions and courses: listings, rates, availability and bookings.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_business Business overview

Today's date, time and weekday in the business's timezone; the business's name, currency, timezone and tax; what's left to set up before it can take bookings; and how guests can pay right now.

list_catalog What the business sells

Every listing with its units, rates (prices and ways to pay) and photos, plus add-ons and courses. Includes switched-off items, marked active: false.

create_listing Add a listing

Add something people can book (a room type, apartment, desk, office, meeting room, studio...), with its units and, optionally, its first rate so it can be booked straight away. Units are the individual bookable things: 4 identical studios is one listing with 4 units.

ParameterTypeDescription
name *stringe.g. 'Studio flat' or 'Hot desk'
peoplePerUnit *integerHow many people one unit holds
units *Unit names (['Room 1','Room 2']) or a count (named '<name> 1', '<name> 2'...)
descriptionstringShown on booking pages. Blank lines separate paragraphs
featuresarraye.g. ['Air conditioning', 'Fast Wi-Fi']
rateobject
taglinestring
webAddressstringSlug for booking pages; made from the name if omitted

update_listing Change a listing

Change a listing's name, description, features, web address or capacity, or switch it off (active: false stops new bookings; existing ones are kept).

ParameterTypeDescription
listingId *string
activeboolean
descriptionstring
featuresarray
namestring
peoplePerUnitinteger
taglinestring
webAddressstring

set_rate Add or change a price

Add a rate (price) to a listing, or change an existing one with rateId. A listing can have several, e.g. nightly and monthly. Existing bookings keep the price they were booked at.

ParameterTypeDescription
listingId *string
activeboolean
isDefaultboolean
namestring
needsApprovalbooleantrue: bookings are requests the business approves or declines (answer_request); the guest pays after approval
perstringRequired when adding
pricenumberRequired when adding
rateIdstringTo change an existing rate; omit to add one
waysToPayarrayfull: pay everything when booking. deposit_one_unit: pay the first night/day now (non-refundable), the rest on arrival. on_arrival: pay nothing now

add_photo Add a photo

Add a photo to a listing or course, from a file on this computer or a public https URL. JPEG, PNG or WebP up to 8 MB. The first photo is the main one.

ParameterTypeDescription
source *stringA local file path, or an https:// URL
courseIdstring
descriptionstringWhat the photo shows (alt text)
listingIdstring

create_course Add a course or event

Add a course, class or event that sells seats on one or more dates. Leave dates empty to list it as 'dates to be announced' (not bookable until dates are added).

ParameterTypeDescription
name *string
pricePerSeat *numberFor the whole course, in normal currency units
seats *integer
datesarray
descriptionstring
roomListingIdstringA listing (room) it uses; closed to other bookings while the course runs

set_opening_hours Set opening hours

Set weekly opening hours for the whole business, or for one listing. Hourly and daily bookings must fit inside them; nightly stays aren't affected. An empty list means always open (business) or 'use the business hours' (listing).

ParameterTypeDescription
hours *arraye.g. [{day:'monday', open:'08:00', close:'18:00'}]. Several entries per day are allowed
listingIdstringOmit for the whole business

set_payment_methods Choose how guests pay

Switch card payments on or off (card needs Paystack or Stripe connected in the dashboard first), and set up bank transfer: account details and how long a booking is held while the guest transfers. Staff confirm a transfer booking by recording the payment (record_payment).

ParameterTypeDescription
bankTransferobject
cardbooleantrue to take cards, false to pause them (keys are kept)

list_discount_codes List discount codes

The business's discount codes with their limits and how many bookings have used each. Pass a code to quote or book to apply it.

create_discount_code Create a discount code

A code customers enter when booking: a percentage or an amount off the price before tax (nights, hours, days, seats and add-ons; never fees). Optional limits: usable dates, stay dates, minimum spend or nights, total uses, once per customer, specific listings. Set active: false (with codeId) to switch one off; bookings that used it keep their discount.

ParameterTypeDescription
activeboolean
amountOffnumberIn normal currency units
codestringLetters, numbers, hyphens, underscores, e.g. WELCOME10
codeIdstringTo switch an existing code on or off (from list_discount_codes); then only active is used
descriptionstring
listingIdsarrayOnly these listings; otherwise every listing and course
maxUsesinteger
minNightsinteger
minSpendnumberPrice before the discount, normal currency units
oncePerCustomerboolean
percentOffnumber
staysFromstringYYYY-MM-DD
staysUntilstringThe whole stay must be inside these dates
usableFromstringYYYY-MM-DD
usableUntilstringLast day it can be entered (inclusive)

check_availability Check availability

How many units (or course seats) are free on each day between two dates, with the price and, for hourly listings, free start times.

ParameterTypeDescription
from *stringYYYY-MM-DD
to *stringYYYY-MM-DD
courseIdstring
hoursintegerHourly listings: length of the booking
listingIdstring
quantityintegerUnits or seats needed

quote Price a booking

The exact price, taxes, cancellation terms and ways to pay for a booking, without reserving anything.

ParameterTypeDescription
adultsinteger
childreninteger
courseIdstring
discountCodestringA discount code the customer gave (case doesn't matter); if it doesn't apply, the error says why
listingIdstring
quantityintegerUnits or seats
rateIdstringA specific rate; otherwise the listing's default for that kind of booking
whenWhen, in the shape the listing's rate uses: nights for stays, hours/block/days for spaces, months/years for contracts

book Make a booking

Book for a customer, e.g. one who called or messaged. pay_at_desk and on_arrival confirm straight away (record the money with record_payment when it's taken); bank_transfer holds the booking until the transfer is recorded, then confirms it. card_link holds it for 24 hours and returns paymentLink, a card payment page to send the customer (it needs their email); paying confirms the booking. Asking for exactly the same booking again (same listing, dates, guests, customer and payment) returns the existing one with alreadyBooked: true instead of booking twice.

ParameterTypeDescription
customer *objectName plus an email or phone. Confirmation emails need an email
payment *stringHow the customer will pay
adultsinteger
childreninteger
courseIdstring
discountCodestringA discount code the customer gave (case doesn't matter); if it doesn't apply, the error says why
listingIdstring
quantityinteger
rateIdstring
whenWhen, in the shape the listing's rate uses: nights for stays, hours/block/days for spaces, months/years for contracts

find_bookings Find bookings

Search bookings by guest name, email, phone or reference, or list today's (or a date's) arrivals, departures or everyone checked in.

ParameterTypeDescription
customerIdstringOnly this customer's bookings (from find_customers): their history
datestringFor arrivals or departures; defaults to today
discountCodestringOnly bookings that used this discount code
fromstringBookings overlapping from this date...
limitinteger
searchstringGuest name, email, phone, or booking reference
statusarray
tostring...to this date (exclusive)
viewstring

find_customers Find customers

Search the business's customers by name, email or phone, newest first, with how many times each has booked. Use it for 'what's Ada's number?' or to spot returning guests; pass a customerId to find_bookings for someone's history.

ParameterTypeDescription
limitinteger
searchstringPart of a name, email or phone number

get_occupancy How full a day is

For one day (default today, in the business's timezone): units in use, closed and free, overall and per listing, plus that day's arrivals and departures and the requests waiting for approval. Use it for 'how full are we on Friday?' rather than counting the calendar yourself.

ParameterTypeDescription
datestringYYYY-MM-DD

get_calendar Calendar

Who is in which unit, day by day: every listing's units with the bookings and closures on them between two dates (up to 62 days). Use it to answer 'what's booked next week?' or 'which rooms are free on Friday?'

ParameterTypeDescription
from *stringYYYY-MM-DD
to *stringExclusive
listingIdstring

get_booking A booking in full

One booking: dates, units, customer, money paid and owed, and what cancelling it now would refund.

ParameterTypeDescription
bookingId *string

answer_request Approve or decline a request

For listings whose rate needs approval: approve or decline a booking request (status PENDING_APPROVAL; find them with find_bookings and status ['PENDING_APPROVAL']). Approving confirms it if nothing is due now, otherwise the guest is asked to pay. Declining releases the dates; the guest isn't told the reason. Without confirm: true it only shows what would happen, so you can check with the person first.

ParameterTypeDescription
bookingId *string
decision *string
confirmbooleanMust be true to actually answer
reasonstringDeclining: why, kept in the booking's history

record_payment Record a payment

Record money the business received for a booking: cash, a POS card payment, or a bank transfer. A held bank-transfer booking is confirmed once enough is recorded. Without confirm: true it only shows what would be recorded (the guest, the balance and what's left after), so you can check with the person first. A recorded payment can't be edited or deleted.

ParameterTypeDescription
amount *numberNormal currency units
bookingId *string
method *string
confirmbooleanMust be true to actually record it

check_in Check a guest in

Check in the customer of a confirmed booking, from its arrival day. The result shows anything still owed (record it with record_payment). Use find_bookings with view: arrivals to see who's due today.

ParameterTypeDescription
bookingId *string

check_out Check a guest out

Check out a checked-in customer. On or after the last day, it's done straight away. Leaving early (nothing is refunded, and the unit is free from now) or with something still owed: without confirm: true it only says so, so you can check with the person first.

ParameterTypeDescription
bookingId *string
confirmbooleanNeeded for an early departure or when something is still owed

mark_no_show Mark a no-show

For a customer who didn't arrive, from the arrival day: frees the unit, refunds nothing. Without confirm: true it only shows what would happen, so you can check with the person first.

ParameterTypeDescription
bookingId *string
confirmbooleanMust be true to actually mark it

move_booking Move a booking to another unit

Put a booking in a different unit of the same listing (e.g. Room 4 instead of Room 2), if that unit is free for the whole stay. Same price and dates.

ParameterTypeDescription
bookingId *string
unit *stringThe unit's name (as in list_catalog) or id

list_closures List closures

Units and listings closed now or later (maintenance, renovations), with their ids for reopen_unit. Courses that take a room show on get_calendar.

close_unit Close a unit or listing

Take a unit (or a whole listing) out of service between two local dates or times, e.g. for repairs. Refused if bookings overlap: move or cancel them first. Nobody can book it while closed.

ParameterTypeDescription
from *stringYYYY-MM-DD or YYYY-MM-DDTHH:mm, local
listingId *string
to *stringYYYY-MM-DD or YYYY-MM-DDTHH:mm, local (exclusive for dates)
reasonstring
unitstringThe unit's name or id; leave out to close the whole listing

reopen_unit Reopen a unit or listing

Remove a closure (its id from list_closures), so the unit can be booked again for those dates.

ParameterTypeDescription
closureId *string

get_booking_history Booking history

Everything that happened to a booking, oldest first: when it was made, check-in and check-out, payments and refunds, moves and changes, with who did it.

ParameterTypeDescription
bookingId *string

list_payments List payments

Money in and out across bookings, newest first: cash, POS, transfers, card payments and refunds, with totals that succeeded. For 'what came in today?' or reconciling the till.

ParameterTypeDescription
fromstringOn or after this local date; defaults to today
kindstring
methodstring
tostringBefore this local date (exclusive); defaults to the day after from

add_special_day Set hours for one date

Different opening hours, or closed, on one date: a public holiday, an event, a short day. For the whole business or one listing. Hourly and daily bookings follow it; nightly stays aren't affected. Weekly hours are set_opening_hours.

ParameterTypeDescription
date *stringYYYY-MM-DD
closedbooleanClosed all day
hoursarrayThe hours that day, e.g. [{open:'10:00', close:'14:00'}]; leave out when closed
listingIdstringOnly this listing; leave out for the whole business
reasonstringe.g. Independence Day

remove_special_day Remove a special day

Go back to the usual weekly hours on that date (its id from add_special_day's list).

ParameterTypeDescription
specialDayId *string

end_contract End a contract early

End a monthly or fixed-term contract before its term is up. The customer pays the notice period and the early-termination fee in the contract's terms; later instalments are cancelled and the unit frees up when the notice ends. Without confirm: true it only shows the fee and dates (worked out by RatesSpot), so you can check with the person first.

ParameterTypeDescription
bookingId *string
confirmbooleanMust be true to actually end it
expectedFeenumberWith confirm: the fee the preview showed, in normal currency units; if it has changed, nothing happens

add_charge Add a charge to a stay

Add something used during a stay to the booking's bill: minibar, laundry, a late checkout, damage. Only for guests who are checked in or have left. It adds to what the booking costs (tax as the business has set it), so the guest owes it. Without confirm: true it only shows what would be added and the new balance, so you can check with the person first.

ParameterTypeDescription
amount *numberThe price of one, in normal currency units
bookingId *string
description *stringWhat it's for, as the guest will see it, e.g. 'Minibar: soft drinks'
confirmbooleanMust be true to actually add it
quantityinteger

void_charge Remove a charge from a stay

Cancel a charge added by mistake (get its id from get_booking's charges). It's kept on record as voided, with the reason. Anything already paid above the new total is to be given back. Without confirm: true it only shows which charge would be removed.

ParameterTypeDescription
bookingId *string
chargeId *string
reason *stringWhy, e.g. 'Charged to the wrong room'
confirmbooleanMust be true to actually remove it

change_booking Change a booking

Change a confirmed booking's dates, guests, add-ons or rate (a stay under way can only be extended). Booked nights keep their booked price; added ones are at today's price; removing nights follows the cancellation terms. Without confirm it only shows the new total, what's still to pay or refunded; to change it, call again with confirm: true and expectedTotal set to the newTotal the person agreed to.

ParameterTypeDescription
bookingId *string
adultsinteger
childreninteger
confirmbooleanMust be true to actually change it
expectedTotalstringWith confirm: the newTotal from the preview, e.g. '$1,300'
rateIdstring
whenNew dates, in the shape the rate uses; omit to keep them

record_refund_given_back Record a refund given back

After staff give a customer their money back themselves (cash, bank transfer or POS): for a refund shown as toGiveBack on the booking (a desk refund, or a card refund the provider refused). Without confirm: true it only shows what would be recorded. A refund the card provider is still sending isn't for this.

ParameterTypeDescription
bookingId *string
method *string
confirmbooleanMust be true to actually record it

cancel_booking Cancel a booking

Cancel a booking under its cancellation terms. Without confirm: true it only shows what would be refunded, so you can check with the person first. To cancel, call again with confirm: true and expectedRefund set to the wouldRefund they agreed to; if the refund has changed since (a deadline passed), nothing is cancelled and you get the new amount. Card refunds go back automatically.

ParameterTypeDescription
bookingId *string
confirmbooleanMust be true to actually cancel
expectedRefundstringWith confirm: the wouldRefund from the preview, e.g. '$400'
reasonstring

create_website_key Create a key for a booking website

Make the API key a booking website needs. kind 'website': a server key (listings, availability, prices, holds, payments, reading a booking whose id it has). kind 'browser': a publishable key for web pages (the same, minus reading bookings). Neither can list bookings, see customers or change settings. Through the RatesSpot connector an owner approves it first (use check_approval; the key comes from there, once). The key is shown once: store it straight away.

ParameterTypeDescription
name *stringWhat it's for, e.g. 'Booking site'
kindstring

check_approval Check an approval

Whether an owner or manager has approved or declined something that was waiting for approval (a refund, payment settings, a deletion), and what happened if it ran.

ParameterTypeDescription
approvalId *string