{"openapi":"3.1.0","info":{"title":"Menodi API","version":"v1beta","description":"API för samtal, bokningar, kontakter och tjänster i Menodi. Betaversion: kontraktet kan ändras med förvarning."},"servers":[{"url":"https://menodi.se/api/v1beta"}],"security":[{"apiKey":[]}],"tags":[{"name":"Konto"},{"name":"Samtal"},{"name":"Bokningar"},{"name":"Kontakter"},{"name":"Katalog"}],"paths":{"/me":{"get":{"operationId":"getMe","tags":["Konto"],"summary":"Hämta organisation och nyckel","description":"Bra första anrop för att kontrollera att nyckeln fungerar.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Organisationens id"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"key":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Nyckelns id"},"scopes":{"type":"array","items":{"type":"string","enum":["calls:read","bookings:read","contacts:read","catalog:read","bookings:write"]}}},"required":["id","scopes"],"additionalProperties":false},"api_version":{"type":"string","const":"v1beta"}},"required":["organization","key","api_version"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls":{"get":{"operationId":"listCalls","tags":["Samtal"],"summary":"Lista samtal","description":"Nyast först. Listan innehåller inte transkript och aldrig testsamtal.","x-required-scope":"calls:read","parameters":[{"name":"limit","in":"query","required":false,"description":"Antal rader per sida, 1 till 100","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor från föregående sida","schema":{"type":"string","maxLength":500}},{"name":"created_after","in":"query","required":false,"description":"Bara samtal efter denna tid","schema":{"type":"string","format":"date-time"}},{"name":"created_before","in":"query","required":false,"description":"Bara samtal före denna tid","schema":{"type":"string","format":"date-time"}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["inbound","outbound"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Samtalets id"},"created_at":{"type":"string","format":"date-time","description":"När samtalet registrerades"},"direction":{"type":"string","enum":["inbound","outbound","other"]},"outcome":{"type":"string","enum":["booked","qualified","missed","voicemail","transferred","transfer_failed","cancelled","other"],"description":"booked = bokning gjordes. qualified = samtalet besvarades och hanterades. missed = uppringaren lade på under hälsningen eller samtalet kom aldrig igång. voicemail = telefonsvarare (utgående). transferred = kopplades vidare. transfer_failed = vidarekopplingen gick inte fram. cancelled = bokning avbokades. other = värde som ännu inte är dokumenterat."},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"caller_name":{"type":["string","null"]},"caller_phone":{"description":"Telefonnummer, normalt i E.164-format","type":["string","null"]},"summary":{"type":["string","null"]},"has_recording":{"type":"boolean","description":"Sant om inspelning kan hämtas via /calls/{id}/recording"}},"required":["id","created_at","direction","outcome","duration_seconds","caller_name","caller_phone","summary","has_recording"],"additionalProperties":false}},"next_cursor":{"description":"Skicka som cursor för nästa sida. null = inga fler","type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"invalid_request, invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls/{id}":{"get":{"operationId":"getCall","tags":["Samtal"],"summary":"Hämta ett samtal med transkript","x-required-scope":"calls:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Samtalets id"},"created_at":{"type":"string","format":"date-time","description":"När samtalet registrerades"},"direction":{"type":"string","enum":["inbound","outbound","other"]},"outcome":{"type":"string","enum":["booked","qualified","missed","voicemail","transferred","transfer_failed","cancelled","other"],"description":"booked = bokning gjordes. qualified = samtalet besvarades och hanterades. missed = uppringaren lade på under hälsningen eller samtalet kom aldrig igång. voicemail = telefonsvarare (utgående). transferred = kopplades vidare. transfer_failed = vidarekopplingen gick inte fram. cancelled = bokning avbokades. other = värde som ännu inte är dokumenterat."},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"caller_name":{"type":["string","null"]},"caller_phone":{"description":"Telefonnummer, normalt i E.164-format","type":["string","null"]},"summary":{"type":["string","null"]},"has_recording":{"type":"boolean","description":"Sant om inspelning kan hämtas via /calls/{id}/recording"},"transcript":{"type":["string","null"]}},"required":["id","created_at","direction","outcome","duration_seconds","caller_name","caller_phone","summary","has_recording","transcript"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls/{id}/recording":{"get":{"operationId":"getCallRecording","tags":["Samtal"],"summary":"Hämta länk till inspelningen","description":"Länken är signerad och gäller i 15 minuter. Spara filen om den ska behållas.","x-required-scope":"calls:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Signerad länk till inspelningen"},"expires_at":{"type":"string","format":"date-time","description":"När länken slutar gälla"}},"required":["url","expires_at"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found, recording_unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookings":{"get":{"operationId":"listBookings","tags":["Bokningar"],"summary":"Lista bokningar","description":"Nyast först. Med updated_after sorteras listan i stället på senaste ändring, äldst först, vilket passar stegvis synk.","x-required-scope":"bookings:read","parameters":[{"name":"limit","in":"query","required":false,"description":"Antal rader per sida, 1 till 100","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor från föregående sida","schema":{"type":"string","maxLength":500}},{"name":"updated_after","in":"query","required":false,"description":"Stegvis synk: bara bokningar ändrade efter denna tid, äldst först","schema":{"type":"string","format":"date-time"}},{"name":"start_after","in":"query","required":false,"description":"Bara bokningar som startar efter denna tid","schema":{"type":"string","format":"date-time"}},{"name":"start_before","in":"query","required":false,"description":"Bara bokningar som startar före denna tid","schema":{"type":"string","format":"date-time"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","confirmed","completed","cancelled","no_show"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Bokningens id"},"created_at":{"type":"string","format":"date-time","description":"När bokningen skapades"},"updated_at":{"type":"string","format":"date-time","description":"När bokningen senast ändrades"},"start":{"type":"string","format":"date-time","description":"Starttid"},"duration_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["pending","confirmed","completed","cancelled","no_show","other"]},"source":{"type":"string","enum":["phone_agent","chat_widget","website","manual","api","other"]},"service_id":{"anyOf":[{"type":"string","format":"uuid","description":"Tjänst"},{"type":"null"}]},"staff_id":{"anyOf":[{"type":"string","format":"uuid","description":"Personal"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","description":"Kontakt"},{"type":"null"}]},"customer_name":{"type":["string","null"]},"customer_phone":{"type":["string","null"]},"notes":{"type":["string","null"]}},"required":["id","created_at","updated_at","start","duration_minutes","status","source","service_id","staff_id","contact_id","customer_name","customer_phone","notes"],"additionalProperties":false}},"next_cursor":{"description":"Skicka som cursor för nästa sida. null = inga fler","type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"invalid_request, invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createBooking","tags":["Bokningar"],"summary":"Skapa en bokning","description":"Tiden måste vara en tid som GET /availability skulle visa. Headern Idempotency-Key krävs: samma nyckel ger samma svar utan att bokningen skapas två gånger. Svaret sparas i 24 timmar. Tjänster med manuell bekräftelse ger status pending.","x-required-scope":"bookings:write","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Unikt värde per bokning, till exempel ett UUID. Använd samma värde vid omförsök.","schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"start":{"type":"string","format":"date-time","description":"Starttid från GET /availability"},"service_id":{"description":"Krävs om företaget har tjänster","type":"string","format":"uuid"},"customer":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"phone":{"type":"string","minLength":7,"maxLength":40,"description":"E.164 eller svenskt nummer"}},"required":["name","phone"],"additionalProperties":false},"notes":{"type":"string","maxLength":500},"notify_customer":{"description":"false stänger av bekräftelse-SMS för den här bokningen. Annars följs företagets inställning","type":"boolean"}},"required":["start","customer"],"additionalProperties":false}}}},"responses":{"201":{"description":"Skapad","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Bokningens id"},"created_at":{"type":"string","format":"date-time","description":"När bokningen skapades"},"updated_at":{"type":"string","format":"date-time","description":"När bokningen senast ändrades"},"start":{"type":"string","format":"date-time","description":"Starttid"},"duration_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["pending","confirmed","completed","cancelled","no_show","other"]},"source":{"type":"string","enum":["phone_agent","chat_widget","website","manual","api","other"]},"service_id":{"anyOf":[{"type":"string","format":"uuid","description":"Tjänst"},{"type":"null"}]},"staff_id":{"anyOf":[{"type":"string","format":"uuid","description":"Personal"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","description":"Kontakt"},{"type":"null"}]},"customer_name":{"type":["string","null"]},"customer_phone":{"type":["string","null"]},"notes":{"type":["string","null"]}},"required":["id","created_at","updated_at","start","duration_minutes","status","source","service_id","staff_id","contact_id","customer_name","customer_phone","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"invalid_request, idempotency_key_required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_in_progress, slot_unavailable, pms_managed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"idempotency_key_conflict, invalid_phone, service_required, invalid_service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookings/{id}":{"get":{"operationId":"getBooking","tags":["Bokningar"],"summary":"Hämta en bokning","x-required-scope":"bookings:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Bokningens id"},"created_at":{"type":"string","format":"date-time","description":"När bokningen skapades"},"updated_at":{"type":"string","format":"date-time","description":"När bokningen senast ändrades"},"start":{"type":"string","format":"date-time","description":"Starttid"},"duration_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["pending","confirmed","completed","cancelled","no_show","other"]},"source":{"type":"string","enum":["phone_agent","chat_widget","website","manual","api","other"]},"service_id":{"anyOf":[{"type":"string","format":"uuid","description":"Tjänst"},{"type":"null"}]},"staff_id":{"anyOf":[{"type":"string","format":"uuid","description":"Personal"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","description":"Kontakt"},{"type":"null"}]},"customer_name":{"type":["string","null"]},"customer_phone":{"type":["string","null"]},"notes":{"type":["string","null"]}},"required":["id","created_at","updated_at","start","duration_minutes","status","source","service_id","staff_id","contact_id","customer_name","customer_phone","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookings/{id}/cancel":{"post":{"operationId":"cancelBooking","tags":["Bokningar"],"summary":"Avboka en bokning","description":"Ofarligt att upprepa: en redan avbokad bokning returneras oförändrad. Inget SMS skickas till kunden.","x-required-scope":"bookings:write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":300}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Bokningens id"},"created_at":{"type":"string","format":"date-time","description":"När bokningen skapades"},"updated_at":{"type":"string","format":"date-time","description":"När bokningen senast ändrades"},"start":{"type":"string","format":"date-time","description":"Starttid"},"duration_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"status":{"type":"string","enum":["pending","confirmed","completed","cancelled","no_show","other"]},"source":{"type":"string","enum":["phone_agent","chat_widget","website","manual","api","other"]},"service_id":{"anyOf":[{"type":"string","format":"uuid","description":"Tjänst"},{"type":"null"}]},"staff_id":{"anyOf":[{"type":"string","format":"uuid","description":"Personal"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","description":"Kontakt"},{"type":"null"}]},"customer_name":{"type":["string","null"]},"customer_phone":{"type":["string","null"]},"notes":{"type":["string","null"]}},"required":["id","created_at","updated_at","start","duration_minutes","status","source","service_id","staff_id","contact_id","customer_name","customer_phone","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"invalid_request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"booking_not_cancellable, pms_managed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/availability":{"get":{"operationId":"getAvailability","tags":["Bokningar"],"summary":"Lediga tider","description":"Upp till sju dagar med lediga tider, enligt samma regler som företagets bokningssida.","x-required-scope":"bookings:read","parameters":[{"name":"service_id","in":"query","required":false,"description":"Krävs om företaget har tjänster","schema":{"type":"string","format":"uuid"}},{"name":"from","in":"query","required":false,"description":"Börja leta från denna tid. Standard är nu","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"Datum i Stockholmstid"},"slots":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string","description":"Klockslag i Stockholmstid, HH:mm"},"start":{"type":"string","format":"date-time","description":"Exakt starttid att skicka till POST /bookings"}},"required":["time","start"],"additionalProperties":false}}},"required":["date","slots"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"invalid_request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"pms_managed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"service_required, invalid_service","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts":{"get":{"operationId":"listContacts","tags":["Kontakter"],"summary":"Lista kontakter","description":"Senast ändrade först. Med updated_after sorteras listan äldst först, vilket passar stegvis synk.","x-required-scope":"contacts:read","parameters":[{"name":"limit","in":"query","required":false,"description":"Antal rader per sida, 1 till 100","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor från föregående sida","schema":{"type":"string","maxLength":500}},{"name":"updated_after","in":"query","required":false,"description":"Stegvis synk: bara kontakter ändrade efter denna tid, äldst först","schema":{"type":"string","format":"date-time"}},{"name":"phone","in":"query","required":false,"description":"Exakt telefonnummer. Svenska nummer normaliseras automatiskt","schema":{"type":"string","maxLength":40}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Kontaktens id"},"updated_at":{"type":"string","format":"date-time","description":"När kontakten senast ändrades"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"notes":{"type":["string","null"]},"total_bookings":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_call_at":{"anyOf":[{"type":"string","format":"date-time","description":"Senaste samtal"},{"type":"null"}]}},"required":["id","updated_at","name","phone","email","tags","notes","total_bookings","last_call_at"],"additionalProperties":false}},"next_cursor":{"description":"Skicka som cursor för nästa sida. null = inga fler","type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"invalid_request, invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/{id}":{"get":{"operationId":"getContact","tags":["Kontakter"],"summary":"Hämta en kontakt","x-required-scope":"contacts:read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Kontaktens id"},"updated_at":{"type":"string","format":"date-time","description":"När kontakten senast ändrades"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"notes":{"type":["string","null"]},"total_bookings":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last_call_at":{"anyOf":[{"type":"string","format":"date-time","description":"Senaste samtal"},{"type":"null"}]}},"required":["id","updated_at","name","phone","email","tags","notes","total_bookings","last_call_at"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/services":{"get":{"operationId":"listServices","tags":["Katalog"],"summary":"Lista tjänster","x-required-scope":"catalog:read","parameters":[{"name":"limit","in":"query","required":false,"description":"Antal rader per sida, 1 till 100","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor från föregående sida","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Tjänstens id"},"name":{"type":"string"},"description":{"type":["string","null"]},"duration_minutes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"price_sek":{"type":["number","null"]},"vat_rate":{"type":["number","null"]},"price_includes_vat":{"type":"boolean"},"requires_confirmation":{"type":"boolean","description":"Sant om bokningar blir pending tills företaget bekräftar"},"active":{"type":"boolean"}},"required":["id","name","description","duration_minutes","price_sek","vat_rate","price_includes_vat","requires_confirmation","active"],"additionalProperties":false}},"next_cursor":{"description":"Skicka som cursor för nästa sida. null = inga fler","type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"invalid_request, invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/staff":{"get":{"operationId":"listStaff","tags":["Katalog"],"summary":"Lista personal","x-required-scope":"catalog:read","parameters":[{"name":"limit","in":"query","required":false,"description":"Antal rader per sida, 1 till 100","schema":{"default":25,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"description":"next_cursor från föregående sida","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Personens id"},"name":{"type":"string"},"role":{"type":["string","null"]},"active":{"type":"boolean"}},"required":["id","name","role","active"],"additionalProperties":false}},"next_cursor":{"description":"Skicka som cursor för nästa sida. null = inga fler","type":["string","null"]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"invalid_request, invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"api_access_disabled, insufficient_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"internal_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API-nyckel som börjar med mnd_live_"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stabil felkod, se felkodstabellen"},"message":{"type":"string"},"request_id":{"type":"string"},"details":{}},"required":["code","message","request_id"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}},"x-error-codes":{"invalid_api_key":{"status":401,"message":"API-nyckeln saknas, är ogiltig eller har återkallats."},"api_access_disabled":{"status":403,"message":"API:t är inte aktiverat för den här organisationen."},"insufficient_scope":{"status":403,"message":"Nyckeln saknar behörighet för den här åtgärden."},"not_found":{"status":404,"message":"Resursen finns inte."},"method_not_allowed":{"status":405,"message":"Metoden stöds inte för den här sökvägen."},"invalid_request":{"status":400,"message":"Begäran är ogiltig."},"invalid_cursor":{"status":400,"message":"Ogiltig cursor. Använd next_cursor från föregående svar."},"idempotency_key_required":{"status":400,"message":"Headern Idempotency-Key krävs."},"idempotency_key_conflict":{"status":422,"message":"Idempotency-Key har redan använts med en annan begäran."},"idempotency_in_progress":{"status":409,"message":"En begäran med samma Idempotency-Key pågår redan."},"invalid_phone":{"status":422,"message":"Telefonnumret kunde inte tolkas."},"service_required":{"status":422,"message":"service_id krävs eftersom företaget har tjänster."},"invalid_service":{"status":422,"message":"Tjänsten finns inte eller är inte aktiv."},"slot_unavailable":{"status":409,"message":"Tiden går inte att boka."},"pms_managed":{"status":409,"message":"Företagets bokningar hanteras i ett journalsystem och kan inte ändras via API:t."},"booking_not_cancellable":{"status":409,"message":"Bokningen kan inte längre avbokas."},"recording_unavailable":{"status":404,"message":"Samtalet har ingen inspelning som kan hämtas."},"rate_limited":{"status":429,"message":"För många anrop. Försök igen om en stund."},"internal_error":{"status":500,"message":"Ett internt fel uppstod."}},"x-webhook-events":["call.completed","booking.created","booking.updated","booking.cancelled","booking.deleted"]}