{"openapi":"3.0.3","info":{"title":"Customers API","version":"1.0.0","description":"Customer master data of the ORD playground shop. The customer `id` is the join key used by the Orders OData service and the Order Events."},"servers":[{"url":"https://customers-ord.zazukoians.org/api/v1"}],"tags":[{"name":"Customers"}],"paths":{"/customers":{"get":{"tags":["Customers"],"operationId":"listCustomers","summary":"List and search customers","parameters":[{"name":"q","in":"query","description":"Full-text search in name, email and company","schema":{"type":"string"}},{"name":"email","in":"query","description":"Exact e-mail match","schema":{"type":"string","format":"email"}},{"name":"country","in":"query","description":"ISO 3166-1 alpha-2 country code","schema":{"type":"string","example":"CH"}},{"name":"segment","in":"query","schema":{"$ref":"#/components/schemas/Segment"}},{"name":"ids","in":"query","description":"Comma-separated list of customer IDs","schema":{"type":"string","example":"C001,C004"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"A page of customers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPage"}}}}}},"post":{"tags":["Customers"],"operationId":"createCustomer","summary":"Register a new customer (kept in memory only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewCustomer"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/Error"}}}},"/customers/{customerId}":{"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string","example":"C001"}}],"get":{"tags":["Customers"],"operationId":"getCustomer","summary":"Get a single customer","responses":{"200":{"description":"The customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/countries":{"get":{"tags":["Customers"],"operationId":"listCountries","summary":"Customer count per country","responses":{"200":{"description":"Countries","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"customers":{"type":"integer"}}}}}}}}}}},"components":{"schemas":{"Segment":{"type":"string","enum":["consumer","smb","enterprise"]},"Address":{"type":"object","required":["street","postalCode","city","country"],"properties":{"street":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"country":{"type":"string","description":"ISO 3166-1 alpha-2","example":"CH"}}},"Customer":{"type":"object","required":["id","name","email","segment","address"],"properties":{"id":{"type":"string","example":"C001","description":"Customer ID, referenced by orders (`CustomerID`) and events (`customerId`)."},"name":{"type":"string","example":"Anna Keller"},"email":{"type":"string","format":"email","example":"anna.keller@example.ch"},"segment":{"$ref":"#/components/schemas/Segment"},"company":{"type":"string","nullable":true,"example":"Keller Engineering AG"},"address":{"$ref":"#/components/schemas/Address"},"createdAt":{"type":"string","format":"date-time"}}},"NewCustomer":{"type":"object","required":["name","email","address"],"properties":{"name":{"type":"string","example":"Anna Keller"},"email":{"type":"string","format":"email","example":"anna.keller@example.ch"},"segment":{"$ref":"#/components/schemas/Segment"},"company":{"type":"string","nullable":true,"example":"Keller Engineering AG"},"address":{"$ref":"#/components/schemas/Address"}}},"CustomerPage":{"type":"object","properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}}},"Error":{"type":"object","properties":{"error":{"type":"string"}}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}