{"openapi":"3.1.0","info":{"title":"Pegasus WooCommerce Agent API","version":"1.0.0","description":"Public product discovery and isolated WooCommerce customer/order operations for AI agents. Write credentials are accepted only by this API and are never returned."},"servers":[{"url":"http://api.pegasus.le-celadon.ma"}],"paths":{"/wp/products":{"get":{"operationId":"searchProducts","summary":"Search purchasable WooCommerce products","security":[],"parameters":[{"name":"search","in":"query","schema":{"type":"string","maxLength":100}},{"name":"category","in":"query","schema":{"type":"integer","minimum":1}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Product page"},"429":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wp/products/{id}":{"get":{"operationId":"getProduct","summary":"Get one WooCommerce product","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Product"},"404":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wp/categories":{"get":{"operationId":"listProductCategories","summary":"List WooCommerce product categories","security":[],"responses":{"200":{"description":"Category list"},"429":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wp/customers/resolve":{"post":{"operationId":"resolveCustomer","summary":"Find or create a WooCommerce customer","security":[{"WpAgentKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerResolveRequest"}}}},"responses":{"200":{"description":"Existing customer"},"201":{"description":"Customer created"},"400":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wp/orders":{"post":{"operationId":"createOrder","summary":"Create a pending order and return its native WooCommerce payment link","security":[{"WpAgentKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}}},"responses":{"200":{"description":"Idempotent replay","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResult"}}}},"201":{"description":"Order created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResult"}}}},"400":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wp/orders/{id}":{"get":{"operationId":"getOrderStatus","summary":"Get a sanitized order status","security":[{"WpAgentKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Order status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResult"}}}},"404":{"description":"Request rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"WpAgentKey":{"type":"apiKey","in":"header","name":"X-Pegasus-WP-Key","description":"Dedicated credential accepted only by /wp write endpoints. It is never returned by the API."}},"schemas":{"Address":{"type":"object","required":["first_name","email","phone"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"address_1":{"type":"string"},"address_2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string","description":"WooCommerce Morocco state code, for example MA001"},"postcode":{"type":"string"},"country":{"type":"string","default":"MA"}}},"CustomerResolveRequest":{"type":"object","required":["customer"],"properties":{"create":{"type":"boolean","default":false},"customer":{"$ref":"#/components/schemas/Address"}}},"LineItem":{"type":"object","required":["product_id","quantity"],"properties":{"product_id":{"type":"integer","minimum":1},"variation_id":{"type":"integer","minimum":1},"quantity":{"type":"integer","minimum":1,"maximum":99}}},"CreateOrderRequest":{"type":"object","required":["billing","line_items"],"properties":{"create_customer":{"type":"boolean","default":false},"customer":{"$ref":"#/components/schemas/Address"},"billing":{"$ref":"#/components/schemas/Address"},"shipping":{"$ref":"#/components/schemas/Address"},"customer_note":{"type":"string","maxLength":1000},"line_items":{"type":"array","minItems":1,"maxItems":50,"items":{"$ref":"#/components/schemas/LineItem"}}}},"OrderResult":{"type":"object","properties":{"order_id":{"type":"integer"},"order_number":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"total":{"type":"string"},"payment_url":{"type":"string","format":"uri"},"created_at":{"type":"string"},"replayed":{"type":"boolean"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}