{"openapi":"3.1.0","info":{"title":"ONE FLOW Booking API","version":"1.0.0","description":"Online κρατήσεις για μια επιχείρηση του ONE FLOW από το δικό της website. Κάθε κλειδί ανήκει σε μία επιχείρηση. Οδηγός: https://oneflow.gr/developers"},"servers":[{"url":"https://oneflow.gr/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"pk_live_/pk_test_ (browser, μόνο από εγκεκριμένα sites) ή sk_live_/sk_test_ (μόνο server). Test κλειδιά: οι κρατήσεις δεν αποθηκεύονται."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Σταθερός κωδικός για κώδικα, π.χ. slot_unavailable"},"message":{"type":"string","description":"Μήνυμα για τον χρήστη (ελληνικά)"}}}}},"Business":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"timezone":{"type":"string","example":"Europe/Athens"},"description":{"type":["string","null"]},"contact":{"type":"object","properties":{"phone":{"type":["string","null"],"description":"E.164, π.χ. +302101234567"},"phoneDisplay":{"type":["string","null"],"example":"+30 21 0123 4567"},"email":{"type":["string","null"]},"address":{"type":["string","null"]}}},"bookingPageUrl":{"type":"string"},"businessHours":{"type":"array","description":"Κενό = δεν έχει οριστεί ωράριο. dayOfWeek: 0 = Κυριακή ... 6 = Σάββατο.","items":{"type":"object","properties":{"dayOfWeek":{"type":"integer","minimum":0,"maximum":6},"closed":{"type":"boolean"},"open":{"type":["string","null"],"example":"09:00"},"close":{"type":["string","null"],"example":"20:00"}}}}}},"Service":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"durationMinutes":{"type":"integer"},"staff":{"type":"array","items":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}}},"defaultStaffId":{"type":["string","null"]}}},"Staff":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"serviceIds":{"type":"array","items":{"type":"string"}}}},"Slot":{"type":"object","properties":{"start":{"type":"string","format":"date-time","example":"2026-10-01T11:00:00+03:00"},"end":{"type":"string","format":"date-time","example":"2026-10-01T11:30:00+03:00"}}},"BookingRequest":{"type":"object","required":["serviceId","start","customer","consent"],"properties":{"serviceId":{"type":"string"},"staffId":{"type":["string","null"],"description":"null/κενό = οποιοσδήποτε διαθέσιμος"},"start":{"type":"string","format":"date-time","description":"ISO 8601 ΜΕ ζώνη ώρας - ακριβώς το slot.start του /availability"},"customer":{"type":"object","required":["firstName","lastName","email","phone"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string","description":"Κινητό με κωδικό χώρας, π.χ. +306912345678"},"birthday":{"type":"string","format":"date","description":"Προαιρετικό, YYYY-MM-DD"}}},"consent":{"type":"object","required":["privacy"],"properties":{"privacy":{"type":"boolean","const":true,"description":"Ο πελάτης αποδέχτηκε την επεξεργασία των δεδομένων του (υποχρεωτικό)"},"marketing":{"type":"boolean","description":"Συναίνεση για προωθητικά μηνύματα (προαιρετικό)"}}},"customerIp":{"type":"string","description":"ΜΟΝΟ με secret key: το IP του πελάτη, για όριο προσπαθειών ανά πελάτη"},"notes":{"type":"string","maxLength":2000,"description":"Προαιρετικό: σημειώσεις του πελάτη, μπαίνουν στις σημειώσεις του ραντεβού"},"couponCode":{"type":"string","description":"Προαιρετικό: κωδικός κουπονιού της επιχείρησης. Ένα κουπόνι μία φορά ανά πελάτη."}}},"Booking":{"type":"object","properties":{"id":{"type":"string","description":"\"test_appointment\" με test κλειδί"},"status":{"type":"string","enum":["CONFIRMED"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"serviceId":{"type":"string"},"staffId":{"type":"string"},"manageUrl":{"type":["string","null"],"description":"Link του πελάτη για ακύρωση/αλλαγή ώρας (έως 24 ώρες πριν). null με test κλειδί."},"test":{"type":"boolean"},"coupon":{"type":["object","null"],"description":"Το κουπόνι που εφαρμόστηκε· η έκπτωση είναι το description","properties":{"code":{"type":"string"},"description":{"type":["string","null"]}}}}}}},"paths":{"/business":{"get":{"summary":"Στοιχεία της επιχείρησης","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Business"}}}}}},"401":{"description":"Άκυρο/ανακληθέν κλειδί","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Μη επιτρεπόμενο site ή secret key από browser","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/services":{"get":{"summary":"Υπηρεσίες που κλείνονται online","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Service"}}}}}}}}}},"/staff":{"get":{"summary":"Προσωπικό που κλείνεται online","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Staff"}}}}}}}}}},"/availability":{"get":{"summary":"Ελεύθερες ώρες μιας μέρας","parameters":[{"name":"serviceId","in":"query","required":true,"schema":{"type":"string"}},{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"},"example":"2026-10-01","description":"Μία μέρα. Ή αντί γι' αυτό from+to."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Αρχή εύρους (μαζί με to)"},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Τέλος εύρους - έως 62 μέρες. Απάντηση: data.days = [{ date, slots }]"},{"name":"staffId","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"date":{"type":"string"},"timezone":{"type":"string"},"serviceId":{"type":"string"},"staffId":{"type":["string","null"]},"durationMinutes":{"type":"integer"},"slots":{"type":"array","items":{"$ref":"#/components/schemas/Slot"}}}}}}}}},"400":{"description":"missing_parameter / invalid_date","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"service_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookings":{"post":{"summary":"Νέα κράτηση","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":100},"description":"Προτείνεται: ίδιο key = ίδια απάντηση, ποτέ διπλή κράτηση (24 ώρες)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRequest"}}}},"responses":{"201":{"description":"Η κράτηση έγινε (ή, με test κλειδί, θα γινόταν)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Booking"}}}}}},"400":{"description":"invalid_json / invalid_idempotency_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"service_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"slot_unavailable / staff_unavailable / outside_business_hours / no_staff_available / coupon_already_used / request_in_progress","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"invalid_input / invalid_time / invalid_phone / invalid_birthday / privacy_consent_required / invalid_coupon / idempotency_key_reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}