{"openapi":"3.1.0","info":{"title":"Sunventory API","version":"1.0.0","description":"Read-only access to sites, bill of materials and deliveries of your Sunventory tenant. Authenticate with a tenant API key (Settings → API) as a Bearer token. All endpoints are GET; data capture stays with the Sunventory apps.","contact":{"email":"support@sunventory.de","url":"https://sunventory.de/api"}},"servers":[{"url":"https://app.sunventory.de/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Tenant API key, e.g. \"Authorization: Bearer svk_…\"."}},"schemas":{"Site":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","example":"Solarpark Havelland"},"location":{"type":"string","example":"Brandenburg"},"capacity_mwp":{"type":["number","null"],"example":137},"is_archived":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"BomPosition":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"site_id":{"type":"string","format":"uuid"},"supplier":{"type":"string","example":"Canadian Solar"},"manufacturer":{"type":["string","null"]},"product":{"type":"string","example":"PV-Modul CS7N 700 MB-T"},"specification":{"type":["string","null"]},"category":{"type":["string","null"],"example":"PV-Module"},"planned_quantity":{"type":"number","example":196000},"unit":{"type":"string","example":"Stück"},"delivered_quantity":{"type":"number","description":"Sum over confirmed deliveries."},"pending_quantity":{"type":"number","description":"Sum over captured but not yet confirmed deliveries."},"last_delivery_at":{"type":"string","format":"date","example":"2026-08-01","description":"Most recent confirmed delivery date, null when none."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Delivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"site_id":{"type":"string","format":"uuid"},"site_name":{"type":"string"},"supplier":{"type":["string","null"]},"delivery_date":{"type":"string","format":"date","example":"2026-08-01"},"slip_number":{"type":["string","null"]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["pending","confirmed"]},"confirmed_at":{"type":"string","format":"date-time","description":"Null while status is pending."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"type":"object","properties":{"product":{"type":"string"},"specification":{"type":["string","null"]},"category":{"type":["string","null"]},"supplier":{"type":"string"},"quantity":{"type":"number"},"unit":{"type":"string"},"bom_position_id":{"type":"string","format":"uuid","description":"Linked Stückliste position, null when unlinked."}}}},"photos":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["SLIP","MATERIAL"]},"original_name":{"type":"string"},"url":{"type":"string","description":"Signed, time-limited URL. Re-fetch the delivery for a fresh one."}}}}}},"Error":{"type":"object","properties":{"error":{"type":"string","example":"invalid_api_key"}}}}},"paths":{"/sites":{"get":{"summary":"List sites","responses":{"200":{"description":"All sites of the tenant, including archived ones.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Site"}}}}}}}}}},"/sites/{id}":{"get":{"summary":"Get one site","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The site.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Site"}}}},"404":{"description":"Unknown id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sites/{id}/bom":{"get":{"summary":"Bill of materials (Stückliste) with delivery progress","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"One row per planned position with delivered and pending quantities.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BomPosition"}}}}}}},"404":{"description":"Unknown id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deliveries":{"get":{"summary":"List deliveries","parameters":[{"name":"site_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"supplier","in":"query","schema":{"type":"string"},"description":"Exact supplier name."},{"name":"from","in":"query","schema":{"type":"string","format":"date","example":"2026-08-01"},"description":"Earliest delivery_date (inclusive)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","example":"2026-08-01"},"description":"Latest delivery_date (inclusive)."},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","confirmed"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":500}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Deliveries, newest first, with items and photo URLs.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}}}}}}}},"/deliveries/{id}":{"get":{"summary":"Get one delivery","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The delivery.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Delivery"}}}},"404":{"description":"Unknown id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deliveries.csv":{"get":{"summary":"Deliveries as CSV (one row per item)","description":"Same filters as /deliveries. UTF-8 with BOM, comma separated, CRLF line endings.","parameters":[{"name":"site_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"supplier","in":"query","schema":{"type":"string"},"description":"Exact supplier name."},{"name":"from","in":"query","schema":{"type":"string","format":"date","example":"2026-08-01"},"description":"Earliest delivery_date (inclusive)."},{"name":"to","in":"query","schema":{"type":"string","format":"date","example":"2026-08-01"},"description":"Latest delivery_date (inclusive)."},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","confirmed"]}}],"responses":{"200":{"description":"CSV file.","content":{"text/csv":{"schema":{"type":"string"}}}}}}}}}