---
title: "Read a channel’s calendar and set it against the bookings held"
method: POST
path: "/api/v1/short-stay/connections/{id}/sync"
tags: ["Short stay"]
---

# Read a channel’s calendar and set it against the bookings held

`POST /api/v1/short-stay/connections/{id}/sync`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/short-stay/connections/{id}/sync`
- Auth: API key in cookie `better-auth.session_token`

Fetches the connection’s iCal export, or reads a feed sent as `ical`, and reconciles it against this unit. A stay the feed shows and we have no record of is written **held rather than sold**: a calendar carries dates and rarely money, so it blocks the nights and earns nothing until somebody prices it. Where the feed’s descriptions state a payout, a model is asked once per template where it sits, the answer is proved against those descriptions, and each stay is then priced from its own description only while it still reads as that template. A stay we already hold has the channel’s reference filled in. Nothing is cancelled and no overlap is resolved here; both raise a task instead.

## Path parameters

- `id` string, required

## Request body

- object
  - `unitId` string: Required when the connection covers more than one unit: a calendar feed is one listing, and which listing is not ours to guess.
  - `ical` string: The feed itself, for a channel whose export URL we do not hold. Given this, nothing is fetched.

## Response `200`

What the feed said, and what was written.

- object
  - `ok` unknown, required
  - `data` object, required
    - `connectionId` string, required: Stable record id, e.g. `lse_012`.
    - `unitId` string, required: Stable record id, e.g. `lse_012`.
    - `status` 'connected' | 'error', required
    - `read` number, required: Events in the feed, blocks included.
    - `created` number, required: Stays the feed showed and we had no record of. Written held, earning nothing, unless the stay’s own description states its payout.
    - `nights` number, required: Nights those stays put on the calendar.
    - `linked` number, required: Stays we already held, now carrying the channel’s own reference.
    - `priced` number, required: Stays given the payout their own description states, read through a template learned from the feed and checked against each description before a figure is taken.
    - `unchanged` number, required
    - `blocked` number, required: Dates the channel is closing rather than selling. Counted, never written as a booking.
    - `skipped` number, required: Events with no usable id or dates.
    - `gone` string[], required: Future stays we hold that the feed no longer shows. Reported and never cancelled here: a feed that failed to load looks exactly like a feed with nothing in it.
    - `clashes` object[], required: Nights sold twice, on two channels. Each raises a task, because there is a guest on the end of it.
      - `bookingId` string, required: Stable record id, e.g. `lse_012`.
      - `heldChannel` 'airbnb' | 'booking_com' | 'vrbo' | 'direct' | 'expedia' | 'other', required
      - `uid` string, required: The channel’s own id for the stay it is trying to add.
      - `from` string, required: A calendar date, `YYYY-MM-DD`.
      - `to` string, required: A calendar date, `YYYY-MM-DD`.
    - `tasksRaised` number, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: No calendar to read, the connection covers several units and none was named, or the channel could not be reached.
- `404`: No connection with that id on this portfolio.

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
