Skip to content
Hydda One API
Esc
↑↓navigate↵open⌘Jpreview

Price a booking before requesting it

Returns what a booking would cost and checks it against the resource’s rules, without booking anything. Send the resource, time and extras the request will carry. Whether the time is still free is checked only by the request, so it can still be refused after a preview succeeds. A discountCode that does not apply is not an error here: quote.discountCodeRefusal says why, and quote.amount is the price without it.

POST/v1/booking/booking-requests/preview
Authorization
AuthorizationOAuth2 access token · headerrequired

An access token for an Application, from the client_credentials grant. An integration of your own uses the same grant. A connector from Hydda gets its token from the installation-token grant instead. Send it as Authorization: Bearer <token>.

Request body
requiredapplication/json
bookableResourceIdstring<uuid>required

The resource to book.

timeSpecobjectrequired

The time a booking is for. Its model must match the resource's bookingRules.model, and each model sends a different shape.

Show properties
One of:
object
modelstringrequired

For a resource booked by a start and an end time.

Allowed:time_interval
startsAtstring<date-time>required

When the booking starts, as an ISO 8601 timestamp in UTC.

endsAtstring<date-time>required

When the booking ends, as an ISO 8601 timestamp in UTC.

object
modelstringrequired

For a resource booked as a stay between two dates.

Allowed:date_interval
fromDatestring<date>required

The arrival date, as YYYY-MM-DD in the resource's time zone.

toDatestring<date>required

The departure date, as YYYY-MM-DD in the resource's time zone. After fromDate.

object
modelstringrequired

For a resource booked one slot at a time.

Allowed:time_slots
datestring<date>required

The date of the slot, as YYYY-MM-DD in the resource's time zone.

startMinuteOfDayintegerrequired

The slot's start, in minutes after local midnight, as the schedule lists it.

min 0 · max 1439
object
modelstringrequired

For a resource booked by the date a fixed window starts on.

Allowed:date_span
datestring<date>required

The date the window starts on, as YYYY-MM-DD in the resource's time zone.

discountCodestring

A discount code. Matched ignoring case and spaces. A code that does not apply refuses the booking with the reason as its error code.

max length 64
roomLayoutstring

A furniture layout for a room: conference chairs facing the front, u_shape tables in a U, islands round tables with chairs around them.

Allowed:conferenceu_shapeislands
addOnLinesobject[]

The extras to order with the booking.

Show properties
Array of object
addOnProductIdstring<uuid>required

The product to order, one of the resource's add-on products.

quantityintegerrequired

How many units to order: people for a per-person product, orders otherwise.

min 1 · max 10000
deliveryAtstring<date-time>required

When to deliver it, as an ISO 8601 timestamp in UTC. It must fall within the booking.

specialPortionsobject[]

Parts of the quantity with dietary needs. Only catering takes them.

max items 20
Show properties
Array of object
countintegerrequired

How many of the ordered units need these options.

min 1 · max 10000
dietaryOptionsstring[]required

The dietary options these units must meet. Each must be one the product lists.

min items 1
notestring

A note for whoever prepares the order.

max length 500
Responses
200

What the booking would cost.

startsAtstring<date-time>required

When the booking would start, as an ISO 8601 timestamp in UTC.

endsAtstring<date-time>required

When the booking would end, as an ISO 8601 timestamp in UTC.

quoteobjectrequired

What the booked time costs. unitPrice is the price of one pricing unit and amount the resource's price. When price windows priced the booking, unitPrice is amount divided by the hours. totalAmount adds the ordered extras.

Show properties
tenantGroupIdstring<uuid>

The tenant group whose price applied, when a single group explains it.

pricingUnitstringrequired

How the price is counted. hour is charged per hour, pro rata. session is one flat price per booking. night is charged per night of a stay.

Allowed:hoursessionnight
quantitynumberrequired

How many pricing units the booking lasts: hours, sessions or nights. Hours can be fractional.

unitPriceobjectrequired

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
amountobjectrequired

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
discountobject

The discount on the room's price. The booking's amount is already net of it, so the price before it is amount plus amountOff.

Show properties
bookingDiscountIdstring<uuid>required

The discount the booking took.

namestringrequired

The discount's name when the booking took it.

entryKindstringrequired

percent for a percentage or free, fixed for an amount off or a fixed price.

Allowed:percentfixed
basisPointsinteger

The percentage in basis points, 2000 is 20%. Present exactly when entryKind is percent.

min 1 · max 10000
amountOffobjectrequired

What the discount took off the room's price.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
viaCodeboolean

True when the booking took the discount through a shared or a personal code, false for an automatic discount.

amountBeforeDiscountobject

The resource's price before discount. Present exactly when discount is.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
discountCodeRefusalstring

Why the typed code does not apply under this quote. amount is then the price without it, after any automatic discount.

Allowed:not_foundnot_applicableused_upalready_usedno_reduction
baseHourlyPriceobject

The price per hour outside every window, under the price that applied. Present exactly when priceWindows is not empty.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
priceWindowsobject[]

The times of the week priced apart from the base hourly price, under the price that applied. Absent when there are none.

max items 28
Show properties
Array of object
weekdaysstring[]required

The weekdays the window starts on.

min items 1
startMinuteOfDayintegerrequired

When the window starts, in minutes after local midnight: 480 is 08:00.

min 0 · max 1439
endMinuteOfDayintegerrequired

When the window ends, in minutes after local midnight. An end at or before the start ends on the next day.

min 1 · max 1440
hourlyPriceobjectrequired

The price per hour inside the window.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
pricePiecesobject[]

What each part of the booked time costs. Absent when no price window priced any of it, and then amount is the hours times unitPrice.

Show properties
Array of object
startsAtstring<date-time>required

When the part starts, as an ISO 8601 timestamp in UTC.

endsAtstring<date-time>required

When the part ends, as an ISO 8601 timestamp in UTC.

minutesintegerrequired

How long the part lasts, in minutes.

max 9007199254740991
hourlyPriceobjectrequired

The price per hour the part is charged at.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
amountobjectrequired

What the part costs.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
vatRateBasisPointsintegerrequired

The VAT rate in basis points. 2500 is 25%.

min 0 · max 9007199254740991
vatTreatmentstring

Why a line is taxed at 0%: exempt when the supply is exempt from VAT, reverseCharge when the buyer accounts for the VAT.

Allowed:exemptreverseCharge
totalAmountobject

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
vatBreakdownobject[]

The total split by VAT rate and treatment, the resource included.

Show properties
Array of object
vatRateBasisPointsintegerrequired

The VAT rate in basis points. 2500 is 25%.

min 0 · max 9007199254740991
vatTreatmentstring

Why a line is taxed at 0%: exempt when the supply is exempt from VAT, reverseCharge when the buyer accounts for the VAT.

Allowed:exemptreverseCharge
amountobjectrequired

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
cancellationDeadlinestring<date-time>

The last moment the booking could be cancelled, as an ISO 8601 timestamp in UTC. The earliest of the resource's notice and every extra's cutoff.

addOnLinesobject[]required

The extras as they would be ordered, each with its price.

Show properties
Array of object
idstring<uuid>required

The order line id.

addOnProductIdstring<uuid>required

The product ordered.

productNamestringrequired

The product's name when it was ordered.

kindstringrequired

What kind of product it is.

Allowed:cateringequipmentservice
pricingUnitstringrequired

How the price multiplies. per_person is charged per person, per_order once per order.

Allowed:per_personper_order
quantityintegerrequired

How many units were ordered.

max 9007199254740991
deliveryAtstring<date-time>required

When it is delivered, as an ISO 8601 timestamp in UTC.

specialPortionsobject[]required

Parts of the quantity with dietary needs. Empty when there are none.

Show properties
Array of object
countintegerrequired

How many of the ordered units need these options.

min 1 · max 10000
dietaryOptionsstring[]required

The dietary options these units must meet. Each must be one the product lists.

min items 1
notestringrequired

A note for whoever prepares the order. An empty string when there is none.

unitPriceobjectrequired

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
amountobjectrequired

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
vatRateBasisPointsintegerrequired

The VAT rate in basis points. 2500 is 25%.

min 0 · max 9007199254740991
vatTreatmentstring

Why a line is taxed at 0%: exempt when the supply is exempt from VAT, reverseCharge when the buyer accounts for the VAT.

Allowed:exemptreverseCharge
cancellationCutoffMinutesintegerrequired

How many minutes before delivery the line can still be changed or cancelled.

min 0 · max 9007199254740991
cancellationDeadlinestring<date-time>required

The last moment the line can be changed or cancelled, as an ISO 8601 timestamp in UTC.

createdAtstring<date-time>required

When the line was ordered, as an ISO 8601 timestamp in UTC.

chargeEmittedbooleanrequired

Whether the line has been sent for invoicing.

orderedByGuestboolean

True when the guest ordered it through the link in their booking email.

lateOrderLeadMinutesinteger

The product's order lead, in minutes, that staff ordered inside. Absent when the line was ordered in time.

max 9007199254740991
addOnAmountobject

An amount of money in one currency, never negative.

Show properties
minorUnitsintegerrequired

The amount in minor units of the currency, such as öre for SEK. 0 means free.

min 0 · max 9007199254740991
currencystringrequired

An ISO 4217 currency code, for example SEK.

Allowed:SEKNOKDKKEURUSDGBP
400

The request is not valid, or a business rule refused it. code names the rule.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request, when the failure has one. Match on this, not on detail.

Allowed:VALIDATION_FAILEDBOOKING_TIME_SPEC_MODEL_MISMATCHBOOKING_SLOT_NOT_IN_SCHEDULEBOOKING_STAY_TOO_SHORTBOOKING_STAY_TOO_LONGBOOKING_DATE_INTERVAL_EMPTYBOOKING_DATE_SPAN_EMPTYBOOKING_IN_THE_PASTBOOKING_HORIZON_EXCEEDEDBOOKING_DURATION_CEILING_EXCEEDEDBOOKING_DURATION_TOO_SHORTBOOKING_DURATION_TOO_LONGBOOKING_DURATION_NOT_ON_INCREMENTBOOKING_START_NOT_ON_INCREMENTBOOKING_OUTSIDE_OPEN_HOURSBOOKING_NOTICE_TOO_SHORTBOOKING_ROOM_LAYOUT_NOT_OFFEREDBOOKING_ROOM_LAYOUT_CUTOFF_PASSEDBOOKING_ADD_ON_LINE_LIMIT_EXCEEDEDBOOKING_ADD_ON_NOT_OFFEREDBOOKING_ADD_ON_DELIVERY_OUTSIDE_BOOKINGBOOKING_ADD_ON_DELIVERY_OUTSIDE_AVAILABILITYBOOKING_ADD_ON_SPECIAL_PORTIONS_INVALIDBOOKING_ADD_ON_ORDER_LEAD_TOO_SHORT
parametersobject

Values the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.

issuesobject[]

With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.

401

The access token is missing, expired or not valid.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.

issuesobject[]

With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.

403

The token does not allow this request.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.

issuesobject[]

With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.

404

The resource does not exist, or the token cannot see it.

typestringrequired

Always about:blank.

titlestringrequired

The HTTP status phrase, for example Not Found.

statusintegerrequired

The HTTP status code.

min -9007199254740991 · max 9007199254740991
detailstring

What went wrong, for a person to read. Do not parse it.

codestring

Names the rule that refused the request. Match on this, not on detail.

parametersobject

Values the refusal names, keyed by what they are, for example occurrenceDate with BOOKING_SERIES_CONFLICT.

issuesobject[]

With VALIDATION_FAILED: one entry per field that failed validation, each with its path and message.

Request
curl -X POST 'https://api.hydda.one/v1/booking/booking-requests/preview' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "bookableResourceId": "a7680a56-e013-43cc-a54c-cfce58b19ae9",
  "timeSpec": {
    "model": "time_interval",
    "startsAt": "2019-08-24T14:15:22Z",
    "endsAt": "2019-08-24T14:15:22Z"
  },
  "discountCode": "string",
  "roomLayout": "conference",
  "addOnLines": [
    {
      "addOnProductId": "fab40674-db81-47db-9e19-d14c2fc0ec37",
      "quantity": 1,
      "deliveryAt": "2019-08-24T14:15:22Z",
      "specialPortions": [
        {
          "count": 1,
          "dietaryOptions": [
            "vegetarian"
          ]
        }
      ],
      "note": "string"
    }
  ]
}'
Response
{
  "startsAt": "2019-08-24T14:15:22Z",
  "endsAt": "2019-08-24T14:15:22Z",
  "quote": {
    "tenantGroupId": "a2391159-2e80-43b1-951a-3e9ccb268947",
    "pricingUnit": "hour",
    "quantity": 1,
    "unitPrice": {
      "minorUnits": 0,
      "currency": "SEK"
    },
    "amount": {
      "minorUnits": 0,
      "currency": "SEK"
    },
    "discount": {
      "bookingDiscountId": "d41aebc3-4422-492d-9d9f-a12ed9eb59ea",
      "name": "string",
      "entryKind": "percent",
      "basisPoints": 1,
      "amountOff": {
        "minorUnits": 0,
        "currency": "SEK"
      },
      "viaCode": true
    },
    "amountBeforeDiscount": {
      "minorUnits": 0,
      "currency": "SEK"
    },
    "discountCodeRefusal": "not_found",
    "baseHourlyPrice": {
      "minorUnits": 0,
      "currency": "SEK"
    },
    "priceWindows": [
      {
        "weekdays": [
          "monday"
        ],
        "startMinuteOfDay": 0,
        "endMinuteOfDay": 1,
        "hourlyPrice": {
          "minorUnits": 0,
          "currency": "SEK"
        }
      }
    ],
    "pricePieces": [
      {
        "startsAt": "2019-08-24T14:15:22Z",
        "endsAt": "2019-08-24T14:15:22Z",
        "minutes": 1,
        "hourlyPrice": {
          "minorUnits": 0,
          "currency": "SEK"
        },
        "amount": {
          "minorUnits": 0,
          "currency": "SEK"
        }
      }
    ],
    "vatRateBasisPoints": 0,
    "vatTreatment": "exempt",
    "totalAmount": {
      "minorUnits": 0,
      "currency": "SEK"
    },
    "vatBreakdown": [
      {
        "vatRateBasisPoints": 0,
        "vatTreatment": "exempt",
        "amount": {
          "minorUnits": 0,
          "currency": "SEK"
        }
      }
    ],
    "cancellationDeadline": "2019-08-24T14:15:22Z"
  },
  "addOnLines": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "addOnProductId": "fab40674-db81-47db-9e19-d14c2fc0ec37",
      "productName": "string",
      "kind": "catering",
      "pricingUnit": "per_person",
      "quantity": 1,
      "deliveryAt": "2019-08-24T14:15:22Z",
      "specialPortions": [
        {
          "count": 1,
          "dietaryOptions": [
            "vegetarian"
          ]
        }
      ],
      "note": "string",
      "unitPrice": {
        "minorUnits": 0,
        "currency": "SEK"
      },
      "amount": {
        "minorUnits": 0,
        "currency": "SEK"
      },
      "vatRateBasisPoints": 0,
      "vatTreatment": "exempt",
      "cancellationCutoffMinutes": 0,
      "cancellationDeadline": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z",
      "chargeEmitted": true,
      "orderedByGuest": true,
      "lateOrderLeadMinutes": 1
    }
  ],
  "addOnAmount": {
    "minorUnits": 0,
    "currency": "SEK"
  }
}