GuideGuias/Receitas/Update opening hours

Este guia está disponível em inglês.

How do I update a location's opening hours through the API?

Update a Location's Opening Hours via API

Set a weekly schedule with the Synup API, handle split shifts and 24-hour days, and avoid the read-versus-write time format that breaks naive diffs.

Em resumo

O que este guia realiza
Replace a location's weekly hours, including split shifts and full-day openings, with one update call.
APIs utilizadas
Referência
Locations
Pré-requisitos
  • An API key with write access
  • The locationId to update
Casos de uso típicos
  • Syncing hours from your own scheduling system
  • Correcting hours a customer entered wrong at onboarding
  • Rolling out a seasonal schedule change

Weekly hours are the regularHours field on PATCH /api/v1/locations/{id}: one entry per day, each with a closed flag and a list of { open, close } periods. Send the whole week. The list replaces what is there, so a day you leave out is a day you erase.

curl -X PATCH https://ai.synup.com/api/v1/locations/LOCATION_ID \
  -H "Authorization: Bearer $SYNUP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "regularHours": [
      { "day": "MONDAY",    "closed": false, "periods": [{ "open": "09:00", "close": "17:00" }] },
      { "day": "TUESDAY",   "closed": false, "periods": [{ "open": "09:00", "close": "17:00" }] },
      { "day": "WEDNESDAY", "closed": false, "periods": [{ "open": "09:00", "close": "17:00" }] },
      { "day": "THURSDAY",  "closed": false, "periods": [{ "open": "09:00", "close": "19:00" }] },
      { "day": "FRIDAY",    "closed": false, "periods": [{ "open": "09:00", "close": "17:00" }] },
      { "day": "SATURDAY",  "closed": false, "periods": [{ "open": "10:00", "close": "14:00" }] },
      { "day": "SUNDAY",    "closed": true,  "periods": [] }
    ]
  }'

Times go out as 24-hour HH:MM. A day open around the clock is one period from "00:00" to "24:00". A lunch break is a split shift: two periods on the same day, for example 09:00 to 13:00 and 14:00 to 18:00.

Holidays and one-off days are not regularHours. Those go in specialHours, and a temporary closure is its own recipe: temporarily close a location. Delivery, takeout and senior hours live in moreHours; the managing listings guide covers both in full.