# Headless API

> Build your own date and time slot picker for a custom storefront or a mobile app, with the store's Buunto availability.

Source: https://www.buunto.com/docs/developers/headless-api

If the Buunto widget can't be used on your store, for example because you're building a custom storefront or a mobile app, you can build your own date and time slot picker on these endpoints. They return the dates and time slots the store offers, following its settings in the Buunto app. Then [save the customer's choice](https://www.buunto.com/docs/developers/headless-api#save-the-customers-selection) on the Shopify cart, so Buunto records the order.

All endpoints are `GET` requests to `https://datepicker.buunto.com`. They need no authentication: the `shop` parameter says which store to read. Errors come back with a `4xx` status and a JSON body whose `reason` explains them.

The endpoints are also described as OpenAPI 3.1 at [`https://datepicker.buunto.com/api/v1/openapi.json`](https://datepicker.buunto.com/api/v1/openapi.json), with every parameter, response and error. It's the most precise source for generating a client, or for an AI assistant.

## Get the available dates

Returns the dates the customer can choose, for each delivery method the store offers. Optionally, it returns each date's time slots too.

```
GET https://datepicker.buunto.com/api/v1/available_dates
```

Parameters:

- `shop` (required): The store's myshopify domain. Example: `shopname.myshopify.com`.
- `withTimeSlots` (optional): When `true`, each date comes with its time slots. Only allowed when there are 50 available dates or fewer: above that, the request fails with a `400` and you should call [`available_time_slots`](https://www.buunto.com/docs/developers/headless-api#get-the-available-times) for the chosen date instead. Defaults to `false`.
- `productVariantIds` (optional): The Shopify IDs of the product variants being ordered, separated by commas. Always pass them: Buunto looks up the products' tags, collections and options itself, so the store's settings for those products apply with nothing else to send. Without them, the store's default settings apply. Example: `234567,9876543,5432167`.
- `locationId` (optional): A pickup or delivery location's ID. Pass it when the store uses locations and availability or order limits differ by location. An unknown location returns `400`. Example: `123456789`.
- `locale` (optional): The language of the `formatted` values. Defaults to the shop's primary language. Example: `fr`.

Example response:

```json
{
  "LOCAL_DELIVERY": [
    {
      "date": "2022-10-20",
      "formatted": "20 October 2022",
      "soldOut": false,
      "remaining": 2
    },
    {
      "date": "2022-10-21",
      "formatted": "21 October 2022",
      "soldOut": false,
      "remaining": 5
    }
  ],
  "STORE_PICKUP": [
    {
      "date": "2022-10-19",
      "formatted": "19 October 2022",
      "soldOut": false,
      "remaining": 10
    },
    {
      "date": "2022-10-20",
      "formatted": "20 October 2022",
      "soldOut": false,
      "remaining": 10
    },
    {
      "date": "2022-10-21",
      "formatted": "21 October 2022",
      "soldOut": false,
      "remaining": 8
    }
  ]
}
```

The response has one key for each delivery method the store offers: `LOCAL_DELIVERY`, `STORE_PICKUP` or `SHIPPING`. Each method can have different dates. A store that offers a single method has a single key.

Each date is an object with these properties:

- `date`: the date, in `YYYY-MM-DD` format.
- `formatted`: the date in the shop's date format and language, both to show and to save on the cart.
- `soldOut`: `true` when the store's order limit for that date has been reached.
- `remaining`: how many more orders the date can take. Only returned when the store has daily order limits turned on. If its limits or settings differ by location, pass `locationId` to get it.
- `timeSlots`: only when `withTimeSlots` is `true`. The date's time slots, in the same format as [`available_time_slots`](https://www.buunto.com/docs/developers/headless-api#get-the-available-times) returns them.

Example response with `withTimeSlots=true`:

```json
{
  "LOCAL_DELIVERY": [
    {
      "date": "2022-10-21",
      "formatted": "21 October 2022",
      "soldOut": false,
      "remaining": 6,
      "timeSlots": [
        {
          "from": "10:00",
          "to": "11:00",
          "formatted": "10:00 AM - 11:00 AM",
          "disabled": false,
          "soldOut": false,
          "remaining": 2
        },
        {
          "from": "11:00",
          "to": "12:00",
          "formatted": "11:00 AM - 12:00 PM",
          "disabled": false,
          "soldOut": false,
          "remaining": 1
        }
      ]
    }
  ]
}
```

## Get the available times

Returns the time slots for a date and a delivery method.

```
GET https://datepicker.buunto.com/api/v1/available_time_slots
```

Parameters:

- `shop` (required): The store's myshopify domain. Example: `shopname.myshopify.com`.
- `date` (required): The date, in `YYYY-MM-DD` format. Example: `2022-10-19`.
- `method` (optional): `LOCAL_DELIVERY`, `STORE_PICKUP` or `SHIPPING`. Defaults to the store's default delivery method.
- `productVariantIds` (optional): As for [`available_dates`](https://www.buunto.com/docs/developers/headless-api#get-the-available-dates). Example: `234567,9876543,5432167`.
- `locationId` (optional): As for [`available_dates`](https://www.buunto.com/docs/developers/headless-api#get-the-available-dates). An unknown location returns `400`. Example: `123456789`.
- `locale` (optional): The language of the `formatted` values. Defaults to the shop's primary language. Example: `fr`.

Example response:

```json
[
  {
    "from": "10:00",
    "to": "11:00",
    "formatted": "10:00 AM - 11:00 AM",
    "disabled": true,
    "soldOut": false,
    "remaining": 2
  },
  {
    "from": "11:00",
    "to": "12:00",
    "formatted": "11:00 AM - 12:00 PM",
    "disabled": false,
    "soldOut": false,
    "remaining": 1
  },
  {
    "from": "12:00",
    "to": "13:00",
    "formatted": "12:00 PM - 1:00 PM",
    "disabled": false,
    "soldOut": true,
    "remaining": 0
  }
]
```

Each time slot is an object with these properties:

- `from` and `to`: the start and end of the time slot, as `HH:MM`.
- `formatted`: the time slot in the shop's format and language, both to show and to save on the cart. Save this exact value, so Buunto can read the time slot from the order.
- `disabled`: `true` when the time slot can't be chosen, for example because it's past its preparation time cut-off.
- `soldOut`: `true` when the store's order limit for that time slot has been reached.
- `remaining`: how many more orders the time slot can take. Only returned when the store has time slot order limits turned on. If its limits or settings differ by location, pass `locationId` to get it.

## Get the cut-off times

Returns the first available date and its cut-off time, the moment after which that date can no longer be chosen, for each delivery method.

```
GET https://datepicker.buunto.com/api/v1/cut_off_times
```

Parameters:

- `shop` (required): The store's myshopify domain. Example: `shopname.myshopify.com`.
- `productVariantIds` (optional): As for [`available_dates`](https://www.buunto.com/docs/developers/headless-api#get-the-available-dates). Example: `234567,9876543,5432167`.

Example response:

```json
{
  "LOCAL_DELIVERY": {
    "firstAvailableDate": "2025-03-03",
    "cutOffTime": "2025-03-01 12:00:00"
  },
  "STORE_PICKUP": {
    "firstAvailableDate": "2025-03-01",
    "cutOffTime": "2025-02-28 18:00:00"
  }
}
```

A method with no available date is left out.

`cutOffTime` is in the store's time zone, without an offset. Read it as the store's local time: `new Date(cutOffTime)` in a browser would read it in the customer's time zone, so a customer elsewhere would see the wrong cut-off.

## Save the customer's selection

Once the customer has picked a date, save it on the Shopify cart, so Buunto can record the order and, when Checkout Validation is turned on, check the date at checkout.

Where Buunto reads it depends on where the store's date picker is set to show in the Buunto app. With the Storefront API, use `cartAttributesUpdate` when it's set to show on the cart page. When it's set to show on the product page, add the same attributes to the product's cart line instead (`cartLinesAdd` or `cartLinesUpdate`). If you don't know which, write them in both places: that works when the cart has one dated line.

### Order attributes

Buunto reads these attributes to tag the order and count it towards order limits, so write them even when you write `__buunto_selection` below. Their names are the labels set in the store's Buunto messages, in the customer's language (for example `Delivery Date` and `Delivery Time` in English).

- Date: the `formatted` value returned by `available_dates`.
- Time slot: the `formatted` value returned by `available_time_slots`.
- Method: the method's label as the widget shows it. Only needed when the store offers several delivery methods.
- Location: the location's name. Only needed when the store uses pickup or delivery locations.

The easiest way to get the exact names and values is to place a test order with the Buunto widget and copy the attributes from the order's **Additional details** in Shopify.

### Checkout validation attribute

Checkout Validation, and the delivery options shown at checkout, read the selection stored in the `__buunto_selection` attribute. Set it in the same place as the order attributes above. Its value is made of four fields separated by `|`:

```
METHOD|DATE|TIME_SLOT|LOCATION_ID
```

- `METHOD`: `LOCAL_DELIVERY`, `STORE_PICKUP` or `SHIPPING`. Always write it, even when the store offers a single delivery method: the delivery options at checkout ignore a cart line's selection without a method.
- `DATE`: the `date` value returned by `available_dates` (`YYYY-MM-DD`).
- `TIME_SLOT`: the time slot's `from` and `to` values joined by a space, a hyphen and a space, for example `10:00 - 11:00`, in 24-hour time. This isn't the `formatted` value (`10:00 AM - 11:00 AM`), which goes in the time slot order attribute. Leave it empty when there's no time slot.
- `LOCATION_ID`: the ID of the location the customer chose, the same you pass as `locationId`: the Shopify location ID, or the ID Buunto gave a location created in Buunto. Leave it empty when you don't use locations.

Examples:

```
LOCAL_DELIVERY|2026-10-20|10:00 - 11:00|
STORE_PICKUP|2026-10-21||123456789
```

If the attribute is missing or the date is no longer available, checkout shows an error and the customer can't complete the order.

### Skipping checkout validation

To let a cart through checkout without a selection, set `__buunto_selection` to this special value instead of a selection, exactly as written (five `|`, then `SKIP_VALIDATION`):

```
|||||SKIP_VALIDATION
```

This only works when the date picker is set to show on the cart page and **Allow skipping checkout validation from storefront code** is turned on in the Buunto app, under **Validation and advanced settings** > **Advanced settings**.

This setting is on for stores that installed Buunto before October 22, 2026, and off for stores that installed later. If you don't use it, turn it off: otherwise anyone who can edit the cart could skip checkout validation.
