• VillaSlotDocumentation
  • Introduction
  • Getting Started
  • API
    • Discovery
      • GETGet my context
    • Villas
      • GETList villas
      • POSTCreate a villa
      • GETGet a villa
      • PATCHRename a villa
      • POSTArchive a villa
      • POSTUpload a villa photo
      • GETGet opening hours
      • PUTReplace opening hours
      • GETGet the rate grid
      • PUTReplace the rate grid
      • GETGet availability
    • Bookings
      • GETList bookings over a period
      • POSTCreate a booking
      • GETGet a booking
      • POSTConfirm a booking
      • POSTComplete a booking
      • POSTCancel a booking
      • POSTReschedule a booking
    • Customers
      • GETList customers
      • POSTCreate a customer
      • POSTImport a batch of customers
      • GETGet a customer
      • PATCHUpdate a customer
    • Booking settings
      • GETGet booking settings
      • PATCHUpdate booking settings
  1. Documentation
  2. API
  3. Villas
  4. Replace opening hours
Buydocschangelogsdemocommunity

Replace opening hours

PreviousGet opening hoursNextGet the rate grid
On this page
AuthorizationRequest bodyExampleResponseWhat it refusesNotes

PUT /api/v1/properties/{propertyId}/opening-hours

Replaces the whole week. This is a PUT, not a PATCH: a day absent from the body becomes closed. Send every open day, every time.

Only one continuous range per day is supported.

Authorization

Role in the organizationThis endpoint
ownerAllowed
adminAllowed
memberRefused — 403

Request body

FieldTypeRequiredDescription
openingHoursarrayyesOne object per open day
openingHours[].dayOfWeekintegeryes0 Sunday … 6 Saturday, each day at most once
openingHours[].openMinuteintegeryes0 to 1440, local minutes
openingHours[].closeMinuteintegeryesStrictly after openMinute

Example

bash
curl -X PUT -H "x-api-key: $VILLASLOT_API_KEY" -H "content-type: application/json" \
  -d '{"openingHours":[{"dayOfWeek":1,"openMinute":480,"closeMinute":1200}]}' \
  "https://villaslot.app/api/v1/properties/1f0a…/opening-hours"

Response

  • 200 OK — the saved week, read back.

What it refuses

  • 403 Forbidden — the key bearer is a member.
  • 422 Unprocessable Entity — openingHours missing or not a list, a closing time before its opening time, a duplicated day, or a minute outside 0–1440.
  • 401 Unauthorized — missing or invalid key, or a key whose bearer left the organization.
  • 404 Not Found — unknown id, or an id belonging to another organization. The two are deliberately indistinguishable.
  • 429 Too Many Requests — over 120 requests in a minute for this key.

Notes

  • Existing bookings are not touched. Closing a day does not cancel what was already booked on it; the calendar shows it and the team decides.