{"openapi":"3.1.0","info":{"title":"Loomivo Partner API","version":"1.1.0","description":"For billing, POS, booking and clinic software. Add your customers' businesses (with the owner's consent), keep items, prices, stock and hours in sync, receive bookings and orders by webhook, answer them, and open the owner's Loomivo dashboard with one click. Guide: https://loomivoai.com/partners/guide"},"servers":[{"url":"https://loomivoai.com/partner/v1"}],"security":[{"partnerKey":[]}],"components":{"securitySchemes":{"partnerKey":{"type":"http","scheme":"bearer","description":"Your partner key: lvp_test_… (sandbox businesses only) or lvp_live_… (after approval). Keep it on your server."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","example":"bad_input"},"message":{"type":"string","example":"items.0.name: Too small"}}},"Item":{"type":"object","required":["name"],"properties":{"external_id":{"type":"string","maxLength":80,"description":"Your own item id. Recommended: stock and orders match it even after a rename.","example":"BV-1042"},"name":{"type":"string","minLength":2,"maxLength":120,"example":"Lobster masala"},"kind":{"type":"string","enum":["product","service"],"default":"product"},"price":{"type":"number","minimum":0,"description":"What the customer pays, in the business's currency.","example":1200},"currency":{"type":"string","pattern":"^[A-Z]{3}$","description":"Default: the business's country currency.","example":"INR"},"category":{"type":"string","maxLength":40,"description":"Menu section or group.","example":"Seafood"},"stock":{"type":"integer","minimum":0,"description":"How many are left. Leave out if not counted; 0 = sold out.","example":4},"in_stock":{"type":"boolean","default":true,"description":"false hides the item for now."},"duration_min":{"type":"integer","minimum":1,"maximum":1440,"description":"Services: how long one booking takes.","example":30},"unit":{"type":"string","maxLength":40,"description":"What the price is for: per kg, per 500 g, per litre, per pack, each, per dozen, per bag, per plate… Services: per visit, starting price, per hour, per session, per night, per month. Stock counts in this unit.","example":"per kg"}}},"Hour":{"type":"object","required":["day_of_week","opens","closes"],"properties":{"day_of_week":{"type":"integer","minimum":0,"maximum":6,"description":"0 = Sunday … 6 = Saturday"},"opens":{"type":"string","example":"11:00"},"closes":{"type":"string","example":"22:30"}}},"NewShop":{"type":"object","required":["consent","owner_email","name","category","country","city","phone","address"],"properties":{"consent":{"type":"boolean","const":true,"description":"true only after the owner ticked the box to show their business to AI assistants through Loomivo."},"owner_email":{"type":"string","format":"email","description":"The owner's email: their Loomivo login."},"name":{"type":"string","example":"Sea Shell Restaurant"},"category":{"type":"string","enum":["clinic_physio","clinic_dental","clinic_general","salon_spa","real_estate","restaurant_cafe","shop_retail","tutor_coaching","home_services","hotel_homestay","professional_services","garden_landscaping","event_venue","auto_services","gym_fitness","pharmacy","travel_agency","other"]},"country":{"type":"string","pattern":"^[A-Z]{2}$","example":"IN"},"city":{"type":"string","example":"Karaikal"},"phone":{"type":"string","example":"+91 98765 43210"},"address":{"type":"object","required":["street","city","region","postal_code"],"properties":{"street":{"type":"string"},"locality":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"}}},"description":{"type":"string","minLength":20,"maxLength":1200},"items":{"type":"array","maxItems":200,"items":{"$ref":"#/components/schemas/Item"}},"hours":{"type":"array","maxItems":21,"items":{"$ref":"#/components/schemas/Hour"}}}},"Shop":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"sandbox":{"type":"boolean"},"status":{"type":"string","enum":["saved","live"],"description":"saved: listed, requests arrive locked until the owner picks a plan. live: shown to AI with booking."},"ai_score":{"type":["integer","null"]},"profile_url":{"type":["string","null"]},"go_live_url":{"type":["string","null"]},"items":{"type":"integer"},"hours":{"type":"integer"}}},"Request":{"type":"object","description":"A booking, order or quote (also the webhook's data).","properties":{"ref":{"type":"string"},"kind":{"type":"string","enum":["book","order","quote"]},"status":{"type":"string","enum":["new","confirmed","declined","cancelled","locked","expired"]},"slot":{"type":["string","null"],"description":"Bookings: start, YYYY-MM-DDTHH:MM, business local time"},"ends":{"type":["string","null"]},"party_size":{"type":["integer","null"]},"staff_id":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"offer_id":{"type":"string"},"external_id":{"type":"string"},"name":{"type":"string"},"qty":{"type":"integer"},"price":{"type":["number","null"]},"currency":{"type":"string"},"minutes":{"type":"integer"}}}},"fulfilment":{"type":["string","null"],"enum":["pickup","delivery",null]},"address":{"type":["string","null"]},"details":{"type":["string","null"]},"note":{"type":["string","null"]},"customer":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":["string","null"]}}},"source":{"type":"string","enum":["ai_agent","web"]},"created_at":{"type":"string","format":"date-time"}}}}},"paths":{"/shops":{"post":{"operationId":"addShop","summary":"Add a business (with the owner's consent)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewShop"}}}},"responses":{"201":{"description":"Added","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Shop"}}}},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}},"get":{"operationId":"listShops","summary":"Your businesses","responses":{"200":{"description":"Your businesses","content":{"application/json":{"schema":{"type":"object","properties":{"shops":{"type":"array","items":{"$ref":"#/components/schemas/Shop"}}}}}}}}}},"/shops/{id}":{"get":{"operationId":"getShop","summary":"Status (saved / live), AI score, counts","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"responses":{"200":{"description":"The business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Shop"}}}},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}},"delete":{"operationId":"removeShop","summary":"The owner turned it off: remove the business from Loomivo","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"responses":{"200":{"description":"{ id, removed: true }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/items":{"put":{"operationId":"replaceItems","summary":"Send the full list of products and services (same external_id keeps the same item; items left out are hidden)","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/Item"}}}},"example":{"items":[{"external_id":"BV-1042","name":"Lobster masala","price":1200,"category":"Seafood","stock":4}]}}}},"responses":{"200":{"description":"{ id, items }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/stock":{"patch":{"operationId":"updateStock","summary":"Stock only, after every sale or refill (by external_id, or name)","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","maxItems":500,"items":{"type":"object","required":["stock"],"properties":{"external_id":{"type":"string"},"name":{"type":"string"},"stock":{"type":["integer","null"],"minimum":0,"description":"0 = sold out; null = not counted"}}}}}},"example":{"items":[{"external_id":"BV-1042","stock":3}]}}}},"responses":{"200":{"description":"{ id, updated, unknown? }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/hours":{"put":{"operationId":"replaceHours","summary":"Opening hours (the full week)","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hours"],"properties":{"hours":{"type":"array","items":{"$ref":"#/components/schemas/Hour"}}}}}}},"responses":{"200":{"description":"{ id, hours }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/requests":{"get":{"operationId":"listRequests","summary":"Bookings, orders and quotes for a business (newest first; a backup to the webhook)","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"responses":{"200":{"description":"{ requests: Request[] }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/requests/{ref}/decide":{"post":{"operationId":"decideRequest","summary":"Accept, decline, or cancel a confirmed request","parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["decision"],"properties":{"decision":{"type":"string","enum":["confirmed","declined","cancelled"]},"note":{"type":"string","maxLength":300},"price":{"type":"number","description":"Quotes: the price"}}},"example":{"decision":"confirmed","note":"Ready at 8 pm"}}}},"responses":{"200":{"description":"The request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Request"}}}},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/login-link":{"post":{"operationId":"ownerLoginLink","summary":"One-click login to the owner's Loomivo dashboard or plans (one use, 5 minutes)","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","enum":["dashboard","plans"],"default":"dashboard"}}}}}},"responses":{"200":{"description":"{ url, expires_in: 300 }"},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}},"/shops/{id}/test-request":{"post":{"operationId":"sendTestRequest","summary":"Sandbox (test key only): a test order with the business's items, sent to your webhook","parameters":[{"name":"id","in":"path","required":true,"description":"The business's Loomivo id (returned by POST /shops).","schema":{"type":"string"},"example":"sea-shell-restaurant-karaikal"}],"responses":{"201":{"description":"The test request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Request"}}}},"400":{"description":"Error: { error, message } says what to fix","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or wrong partner key"},"404":{"description":"No business with this id for your key"},"429":{"description":"Rate limit (6,000 calls an hour per partner)"}}}}},"webhooks":{"requestCreated":{"post":{"summary":"request.created: a new booking, order or quote (status new, or confirmed when the owner chose instant confirmation)","parameters":[{"name":"loomivo-event","in":"header","schema":{"type":"string"}},{"name":"loomivo-delivery","in":"header","description":"Same id when retried","schema":{"type":"string"}},{"name":"loomivo-signature","in":"header","description":"sha256= HMAC-SHA256 of the raw body with your webhook secret","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","const":"request.created"},"created_at":{"type":"string"},"shop":{"type":"string"},"data":{"$ref":"#/components/schemas/Request"}}}}}},"responses":{"200":{"description":"Answer 2xx within 5 seconds; otherwise Loomivo retries after 1, 5, 30, 120 and 360 minutes"}}}},"requestDecided":{"post":{"summary":"request.decided: accepted, declined or cancelled","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","const":"request.decided"},"shop":{"type":"string"},"data":{"$ref":"#/components/schemas/Request"}}}}}},"responses":{"200":{"description":"OK"}}}},"shopWentLive":{"post":{"summary":"shop.went_live: the owner chose a plan; the business is shown to AI with booking","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","const":"shop.went_live"},"shop":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}}}}}