NAV Navbar
shell

Introduction

Our REST based APIs allow you to get access to the Smoobu Application. We have different APIs for different usecases. On this page we explain you a little bit more detailled what you need for your usecase as a host.

Please contact us before you start coding. We send you the necessary keys and all further information you need to know. Tell us a few words about your ideas and plans. We are always happy to help our customers and our partners to build a perfect integrated and easy to use solution.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "Api-Key: secretApiKey"

Make sure to replace secretApiKey with your API key.

For security issues you need a special API-Key. For your api key please contact us.

Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’

Smoobu Availability API

curl -X POST \
  https://login.smoobu.com/booking/checkApartmentAvailability \
  -H 'Api-Key: secretApiKey),' \
  -H 'cache-control: no-cache' \
  -d '{
    "arrivalDate" : "2017-11-01",
    "departureDate":  "2017-12-03",
    "apartments": [2, 3, 14],
    "customerId": 9
}'

The above command returns JSON structured like this:

{
    "availableApartments": [
        2,
        3,
        14

    ],
    "prices": {
        "3": {
            "price": 36560,
            "currency": "IDR"
        },
        "14": {
            "price": 4415,
            "currency": "IDR"
        }
    },
    "errorMessages": {
        "2": {
            "errorCode": 401,
            "message": "The duration of the booking is too short.",
            "minimumLengthOfStay": 50
        }
    }
}

If the authentication failed it return this jason:

{
    "title": "Error occurred",
    "detail": "verification error"
}

Partners and customers of Smoobu can check their availability of properties and dates. For that you send a request with arrival and departure date and the property ID.

HTTP Request

POST https://login.smoobu.com/booking/checkApartmentAvailability

Json Request Body

Parameter Format Description
arrivalDate yyyy-mm-dd Start date of the booking.
departureDate yyyy-mm-dd End date of the booking.
apartments array Check availability in the given apartments. If apartments is empty it check all apartments.
customerId int Id of the customer/user with the given apartment and the api key.

Json Response

We send you more than available or unavailable. If it is available we send you the price for that period. If you have restrictions which don't allow this reservation we show the reason for disapproval.

Parameter Format Description
availableApartments array All available apartments from request.
prices object The Key of the price object match with the apartment id. The price object contain the price and the currency.
prices.price int price for the range and for the apartment.
prices.currency string Currency of the price.
errorMessages object The Key of the error message object match with the apartment id. The error message object contain all unavailable apartments with reason why it not available.
errorMessages.errorCode int Error id.
errorMessages.message string Error message.
errorMessages.minimumLengthOfStay int Number of required days. Occur only if the booking is to short.
errorMessages.numberOfGuest int Max number of guests. Occur only if the number of guests is to high.
errorMessages.leadTime int Number of days before a booking. Occur Only if the number of days before is to small.
errorMessages.minimumLengthBetweenBookings int Number of days between bookings. Occur only if the Distance between bookings is to short.
errorMessages.arrivalDays int Allowed arrival dates. Occur only if the arrival day is not in the list of allowed days.

Errors

Error Code Message
400 The number of guests exceeds the limit of the apartment.
401 The duration of the booking is too short.
402 The chosen day of arrival is not available
403 Arrival day is too short term.
404 Minimum between bookings is too short.

Create Booking Api

The above command create a booking only with the mandatory fields:

curl -X POST \
  http://login.smoobu.com/api/apartment/54/booking \
  -H 'Api-Key: secretApiKey' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
  "arrivalDate": "01.09.2019",
  "departureDate": "03.09.2019",
  "channelId": 63
}'

The above command returns JSON structured like this with Status code 200:

{
    "id": 906
}

The above comand create a booking with all fields:

curl -X POST \
  http://login.smoobu.com/api/apartment/54/booking \
  -H 'Api-Key: secretApiKey' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
  "arrivalDate": "05.09.2019",
  "departureDate": "08.09.2019",
  "channelId": 63,
  "arrivalTime": "12:00",
  "departureTime": "15:00",
  "firstName": "Max",
  "lastName": "Mustermann",
  "email": "ma@muster.de",
  "phone": "0177123456789",
  "notice": "Breakfast, one dog",
  "adults": 2,
  "children": 3,
  "price": 150.20,
  "priceStatus": 1,
  "deposit": 50,
  "depositStatus": 1
}'

Response if authentication failed Status code 401:

{
    "status": 401,
    "title": "Unauthorized",
    "detail": "Authentication required"
}

Response if there is an validation error code 400:

{
    "status": 400,
    "title": "Bad Request",
    "detail": "Failed validation",
    "validation_messages": {
        "error": "There exists already a reservation from 05.09.2019 to 08.09.2019."
    }
}

Partners and customers of Smoobu can send bookings to Smoobu. Our application receives them like a booking from a booking channel and synchronizes it into every other channel.

HTTP Request

POST https://login.smoobu.com/api/apartment/<apartmentId>/booking

URL Parameters

Parameter Description
apartmentId Id of the apartment

Json Request Body

Parameter Format Mandatory Description
arrivalDate yyyy-mm-dd Yes Start date of the booking.
departureDate yyyy-mm-dd Yes End date of the booking.
channelId int Yes Id of the channel. Smoobu provide the id.
arrivalTime string * Time when the guest will arrive. In the Format "HH:ii"
departureTime string No Time when the guest will departs. In the Format "HH:ii"
firstName string * First name of the guest
lastName string * First name of the guest
notice string * Notes. Free text field for you information.
adults int No Number of adults
children int No Number of children
price float No Total price of the booking.
priceStatus int No Id of the price status. See table below.
deposit float No Deposit of the booking.
depositStatus int No Id of the deposit status. See table below.
address object * address of the guest
address.street string * street of the address
address.postalCode string * postal code of the address
address.location string * location of the address
country string * country of the address
email string * Email of the guest
phone string * Phone Number of the guest

* depend on the user settings which can be found in the booking-tool settings in "Form Content"

Price/Deposit Status

Id Description
1 open/not payed
2 partially paid
3 complete payment

Json Response

Parameter Format Description
id int If booking successful entered it return the booking id

Get Booking Api

The above command get all bookings:

curl -X GET \
  http://login.smoobu.com/api/apartment/1/booking \
  -H 'Api-Key: secretApiKey' \
  -H 'Cache-Control: no-cache''

The above command returns JSON structured like this with Status code 200:

{
 "page_count": 1,
 "page_size": 25,
 "total_items": 3,
 "page": 1,
 "bookings": [
 {
  "id": 291,
  "type": "reservation",
  "arrival": "2018-01-10",
  "departure": "2018-01-12",
  "created-at": "2018-01-03 13:51",
  "apartment": {
   "id": 50017,
   "name": "Seaside apartment"
  },
  "channel": {
   "id": 465614,
   "name": "Booking.com"
  },
  "guest-name": "Harry Potter",
  "email": "HarryPotter@hogwarts.com",
  "phone": "+49123456789"
  "adults": 3,
  "children": 2,
  "check-in": "16:00",
  "check-out": "10:00",
  "notice": "",
  "price": 150,
  "price-paid": "Yes",
  "deposit": 0,
  "deposit-paid": "No"
 },
 {
  "id": 292,
  "type": "reservation",
  "arrival": "2018-01-22",
  "departure": "2018-01-25",
  "created-at": "2018-01-03 13:51",
  "apartment": {
   "id": 50017,
   "name": "Seaside apartment"
  },
  "channel": {
   "id": 465885,
   "name": "Airbnb"
  },
  "guest-name": "Hermine Granger",
  "email": "Hermine@hogwarts.com",
  "phone": "+49123456789",
  "adults": 1,
  "children": 0,
  "check-in": "18:00",
  "check-out": "",
  "notice": "she arrives by plane and is maybe a little bit late",
  "price": 200,
  "price-paid": "YES",
  "deposit": 0,
  "deposit-paid": "No"
  },
 ]
}

Response if authentication failed Status code 401:

{
    "status": 401,
    "title": "Unauthorized",
    "detail": "Authentication required"
}

With this Call you can get all your existing reservations with all information.

HTTP Request

GET https://login.smoobu.com/api/apartment/<apartmentId>/booking

URL Parameters

Parameter Description
apartmentId Id of the apartment

URL Query Parameters

Parameter Format Mandatory Description
created_from yyyy-mm-dd No show all bookings with the created at in the range
created_to yyyy-mm-dd No show all bookings with the created at in the range
from yyyy-mm-dd No show all bookings in the range
to yyyy-mm-dd No show all bookings in the range
showCancellation boolean No show canceled bookings too
page int No current page

Json Response

Parameter Format Description
page_count int number of all pages
page_size int max number of bookings on one page
total_items int number of all bookings
page int number of current page
bookings array contain all booking objects
bookings.id int id of the booking
bookings.type string see types in the table below
bookings.arrival string start date of the booking
bookings.departure string end date of the booking
bookings.created-at string create date of the booking
bookings.apartment object apartment of the booking
bookings.apartment.id int id of the apartment
bookings.apartment.name string name of the apartment
bookings.channel object channel of the booking
bookings.channel.id int id of the channel
bookings.channel.name int name of the channel
bookings.guest-name string name of the guest
bookings.email string email of the guest
bookings.phone string phone number of the guest
bookings.adults int number of adults
bookings.children int number of children
bookings.check-in string check in time of the guests
bookings.check-out string check in time of the guests
bookings.notice string notice from the guests
bookings.price int price of the booking
bookings.price-paid bool price already paid ("yes"/"no")
bookings.deposit int deposit of the booking
bookings.deposit-paid bool deposit already paid ("yes"/"no")

booking type

booking type
reservation
modification of booking
cancellation

Change Log

2018-11-13

Add missing Address in create Booking Call. And add correct Mandatory fields for some fields in createBooking call.

2018-10-23

Added Get Reservations. Clarifying functions, fixing typos, cleaning up. Added changelog.