{"openapi":"3.1.0","info":{"title":"Timcheh API","version":"1","description":"Timcheh is Dornyx's single source of truth for **availability, prices and bookings**. Every sales channel, our own sites included, uses the same calls.\n\n## Getting started\n1. Get a channel API key from Dornyx. Use the **sandbox** key while you build.\n2. Send it on every call: `Authorization: Bearer <key>`.\n3. Read `GET /v1/availability`, hold places with `POST /v1/holds`, confirm with `POST /v1/bookings`.\n\n## The booking flow\n| # | Call | What happens |\n|---|---|---|\n| 1 | `GET /v1/availability` | Slots, places left and the price per person |\n| 2 | `POST /v1/holds` | Places are kept for a few minutes and the price is fixed |\n| 3 | `POST /v1/bookings` | The hold becomes a final booking. Safe to retry: the same hold always returns the same booking |\n| 4 | `POST /v1/bookings/{id}/cancel` | Cancel within the product's cancellation window |\n\n## Conventions\n- `date` (`YYYY-MM-DD`) and `time` (`HH:MM`) are **Barcelona local time**; `start` and every `*_at` are **UTC**.\n- Money is **integer cents** in EUR: `2199` = 21.99 €.\n- Errors are `{\"error\": {\"code\", \"message\"}}` with HTTP 400 (bad input), 401 (key), 404 (not found) or 409 (not possible right now).","contact":{"name":"Dornyx","email":"hello@dornyx.travel","url":"https://dornyx.travel"}},"servers":[{"url":"/","description":"This Timcheh"}],"tags":[{"name":"Products","description":"What can be sold"},{"name":"Availability","description":"Slots, places and prices"},{"name":"Holds","description":"Keep places while the traveller pays"},{"name":"Bookings","description":"Final sales and cancellations"}],"security":[{"channelKey":[]}],"components":{"securitySchemes":{"channelKey":{"type":"http","scheme":"bearer","description":"The channel's API key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","examples":["not_enough_places"]},"message":{"type":"string"}}}}},"Slot":{"type":"object","example":{"date":"2026-11-27","time":"15:00","start":"2026-11-27T14:00:00.000Z","state":"open","available":18,"capacity":20,"sold":2,"held":0,"price_cents":2199,"price_label":"Launch offer"},"properties":{"date":{"type":"string","examples":["2026-11-27"]},"time":{"type":"string","examples":["15:00"]},"start":{"type":"string","format":"date-time","description":"UTC"},"state":{"type":"string","enum":["open","closed","no_places","sold_out"],"description":"open: can be sold; closed: sales cut-off passed; no_places: slot has 0 capacity; sold_out: all taken"},"available":{"type":"integer","description":"Places that can be held now (0 unless open)"},"capacity":{"type":"integer"},"sold":{"type":"integer"},"held":{"type":"integer"},"price_cents":{"type":"integer","description":"Per person"},"price_label":{"type":["string","null"],"description":"e.g. the launch offer"}}},"Hold":{"type":"object","example":{"hold_id":"hld_15ba150978374addbe18","product":"park-guell","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"expires_at":"2026-11-24T15:26:01Z"},"properties":{"hold_id":{"type":"string","examples":["hld_15ba150978374addbe18"]},"product":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"quantity":{"type":"integer"},"unit_price_cents":{"type":"integer"},"total_cents":{"type":"integer"},"expires_at":{"type":"string","format":"date-time"}}},"Booking":{"type":"object","example":{"booking_id":"bkg_fa0d0ddb7a4b4ef388ca","hold_id":"hld_15ba150978374addbe18","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"channel_reference":"GYG-123456","status":"confirmed","created_at":"2026-11-24T15:22:10Z","cancelled_at":null},"properties":{"booking_id":{"type":"string","examples":["bkg_fa0d0ddb7a4b4ef388ca"]},"hold_id":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"quantity":{"type":"integer"},"unit_price_cents":{"type":"integer"},"total_cents":{"type":"integer"},"channel_reference":{"type":["string","null"]},"status":{"type":"string","enum":["confirmed","cancelled"]},"created_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":["string","null"],"format":"date-time"}}}}},"paths":{"/v1/products":{"get":{"tags":["Products"],"operationId":"listProducts","summary":"List products","responses":{"200":{"description":"Products and their purchase limits","content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string","examples":["park-guell"]},"name":{"type":"string"},"limits":{"type":"object","properties":{"min":{"type":"integer"},"max":{"type":"integer"}}}}}}}}}}},"401":{"description":"Missing or unknown API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/availability":{"get":{"tags":["Availability"],"operationId":"getAvailability","summary":"Slots, places and prices in a date range","parameters":[{"name":"product","in":"query","required":true,"schema":{"type":"string","default":"park-guell"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","examples":["2026-11-27"]},"description":"YYYY-MM-DD"},{"name":"to","in":"query","required":true,"schema":{"type":"string","examples":["2026-11-30"]},"description":"YYYY-MM-DD, at most 100 days after from"}],"responses":{"200":{"description":"Every slot in the range","content":{"application/json":{"schema":{"type":"object","properties":{"product":{"type":"string"},"min_per_purchase":{"type":"integer"},"max_per_purchase":{"type":"integer"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/Slot"}}}},"example":{"product":"park-guell","min_per_purchase":1,"max_per_purchase":9,"slots":[{"date":"2026-11-27","time":"15:00","start":"2026-11-27T14:00:00.000Z","state":"open","available":18,"capacity":20,"sold":2,"held":0,"price_cents":2199,"price_label":"Launch offer"}]}}}},"400":{"description":"bad_range, range_too_long","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"product_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/holds":{"post":{"tags":["Holds"],"operationId":"createHold","summary":"Hold places for a few minutes (Park Güell: 5)","description":"Price is fixed at hold time. An unconfirmed hold expires by itself.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product","date","time","quantity"],"properties":{"product":{"type":"string"},"date":{"type":"string"},"time":{"type":"string"},"quantity":{"type":"integer"}}},"example":{"product":"park-guell","date":"2026-11-27","time":"15:00","quantity":2}}}},"responses":{"201":{"description":"Held","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Hold"},"example":{"hold_id":"hld_15ba150978374addbe18","product":"park-guell","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"expires_at":"2026-11-24T15:26:01Z"}}}},"400":{"description":"bad_date, bad_time, bad_quantity, no_such_slot, sale_refused (e.g. more than 9 people)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"product_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"closed, no_places, sold_out, not_enough_places","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/holds/{id}":{"delete":{"tags":["Holds"],"operationId":"releaseHold","summary":"Release a hold","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Released"},"404":{"description":"hold_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"hold_not_active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/bookings":{"post":{"tags":["Bookings"],"operationId":"createBooking","summary":"Confirm a hold as a booking","description":"Idempotent: sending the same hold_id again returns the same booking, never a second one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hold_id"],"properties":{"hold_id":{"type":"string"},"channel_reference":{"type":"string","description":"The channel's own booking number"}}},"example":{"hold_id":"hld_…","channel_reference":"GYG-123"}}}},"responses":{"201":{"description":"Booked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"},"example":{"booking_id":"bkg_fa0d0ddb7a4b4ef388ca","hold_id":"hld_15ba150978374addbe18","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"channel_reference":"GYG-123456","status":"confirmed","created_at":"2026-11-24T15:22:10Z","cancelled_at":null}}}},"400":{"description":"bad_hold","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"hold_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"hold_not_active, hold_expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/bookings/{id}":{"get":{"tags":["Bookings"],"operationId":"getBooking","summary":"One booking","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The booking","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"},"example":{"booking_id":"bkg_fa0d0ddb7a4b4ef388ca","hold_id":"hld_15ba150978374addbe18","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"channel_reference":"GYG-123456","status":"confirmed","created_at":"2026-11-24T15:22:10Z","cancelled_at":null}}}},"404":{"description":"booking_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/bookings/{id}/cancel":{"post":{"tags":["Bookings"],"operationId":"cancelBooking","summary":"Cancel a booking (Park Güell: until 24 h before)","description":"Cancelling an already cancelled booking returns it unchanged.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"},"example":{"booking_id":"bkg_fa0d0ddb7a4b4ef388ca","hold_id":"hld_15ba150978374addbe18","date":"2026-11-27","time":"15:00","quantity":2,"unit_price_cents":2199,"total_cents":4398,"channel_reference":"GYG-123456","status":"confirmed","created_at":"2026-11-24T15:22:10Z","cancelled_at":null}}}},"404":{"description":"booking_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"cancel_refused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}