{"openapi":"3.1.0","info":{"title":"bokning.io","version":"1.0.0","summary":"Bokningssystem för salonger, byggt för att kunna köras av en agent.","description":"Tjänster och personal får anges med namn i stället för id. POST /bookings klarar hela bokningen i ett anrop: ange tjänst, kund och en period så väljs första lediga tid. Samma funktioner finns som MCP-verktyg på https://bokning.io/api/mcp.","contact":{"url":"https://bokning.io"}},"servers":[{"url":"https://bokning.io/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API-nyckel från portalen under Integration. Nyckeln avgör vilken salong anropen gäller."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}},"Customer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Elin Karlsson"},"email":{"type":"string","format":"email"},"phone":{"type":"string","example":"+46701112233"}},"description":"E-post eller telefon krävs — bekräftelsen skickas dit."}}},"paths":{"/business":{"get":{"summary":"Salongens uppgifter och bokningsregler","responses":{"200":{"description":"Salongen"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/services":{"get":{"summary":"Bokningsbara tjänster","responses":{"200":{"description":"Tjänster"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/staff":{"get":{"summary":"Personal och vad var och en utför","parameters":[{"name":"service","in":"query","schema":{"type":"string"},"description":"Namn eller id — filtrerar till dem som utför tjänsten."}],"responses":{"200":{"description":"Personal"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/slots":{"get":{"summary":"Lediga tider","parameters":[{"name":"service","in":"query","required":true,"schema":{"type":"string"},"description":"Namn eller id."},{"name":"from","in":"query","schema":{"type":"string","format":"date"},"description":"Standard: i dag."},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":31,"default":7}},{"name":"staff","in":"query","schema":{"type":"string"},"description":"Namn eller id. Utelämna för vem som helst."},{"name":"earliest","in":"query","schema":{"type":"string","example":"09:00"}},{"name":"latest","in":"query","schema":{"type":"string","example":"17:00"}}],"responses":{"200":{"description":"Lediga tider med både ISO-tidpunkt och lokal tid"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/bookings":{"get":{"summary":"Lista bokningar","parameters":[{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["confirmed","cancelled","completed","no_show"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"Bokningar"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}},"post":{"summary":"Boka en tid","description":"Ange antingen starts_at, eller from/days och earliest/latest för att låta systemet välja första lediga tid. Databasen avgör om tiden är ledig, så samtidiga anrop kan aldrig ta samma tid.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["service","customer"],"properties":{"service":{"type":"string","example":"Klippning"},"customer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Elin Karlsson"},"email":{"type":"string","format":"email"},"phone":{"type":"string","example":"+46701112233"}},"description":"E-post eller telefon krävs — bekräftelsen skickas dit."},"starts_at":{"type":"string","format":"date-time"},"staff":{"type":"string","example":"Alma Berg"},"from":{"type":"string","format":"date"},"days":{"type":"integer","minimum":1,"maximum":31,"default":14},"earliest":{"type":"string","example":"09:00"},"latest":{"type":"string","example":"17:00"},"notes":{"type":"string"}}},"examples":{"första lediga":{"value":{"service":"Klippning","customer":{"name":"Elin Karlsson","email":"elin@example.se"},"from":"2026-10-01","days":7,"earliest":"09:00","latest":"15:00"}},"exakt tid":{"value":{"service":"Klippning","staff":"Alma Berg","starts_at":"2026-10-01T09:00:00+02:00","customer":{"name":"Elin Karlsson","phone":"+46701112233"}}}}}}},"responses":{"200":{"description":"Bokningen, med referens och länk för kunden"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/bookings/{reference}":{"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string"},"example":"894EAD75"}],"get":{"summary":"Hämta en bokning","responses":{"200":{"description":"Bokningen"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}},"patch":{"summary":"Flytta en bokning","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["starts_at"],"properties":{"starts_at":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Den flyttade bokningen"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}},"delete":{"summary":"Avboka och meddela kunden","responses":{"200":{"description":"Den avbokade bokningen"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}},"/waitlist":{"post":{"summary":"Ställ kunden i väntelista","description":"När ingen tid passar. Kunden hör av sig-meddelande när någon avbokar.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["service","customer","from","to"],"properties":{"service":{"type":"string"},"customer":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Elin Karlsson"},"email":{"type":"string","format":"email"},"phone":{"type":"string","example":"+46701112233"}},"description":"E-post eller telefon krävs — bekräftelsen skickas dit."},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"staff":{"type":"string"},"earliest":{"type":"string","example":"09:00"},"latest":{"type":"string","example":"17:00"}}}}}},"responses":{"200":{"description":"Bevakningen"},"400":{"description":"Felaktig indata","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"401":{"description":"Saknad eller ogiltig nyckel","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"403":{"description":"Nyckeln saknar skrivbehörighet","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"404":{"description":"Hittades inte","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}},"409":{"description":"Tiden är upptagen","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string","nullable":true,"description":"Stabil felkod, t.ex. BK409."},"hint":{"type":"string","nullable":true,"description":"Vad anroparen kan göra i stället."}}}}}}}}}}}