{
    "openapi": "3.1.0",
    "info": {
        "title": "QWeb Spam Shield agent API",
        "version": "1.0.0",
        "description": "Read-only catalog and support intake for autonomous agents, plus the public commerce API backing this storefront.",
        "contact": {
            "name": "QWeb Spam Shield",
            "url": "https://qwebspamshield.com/",
            "email": "support@qwebspamshield.com"
        }
    },
    "servers": [
        {
            "url": "https://qwebspamshield.com",
            "description": "Storefront agent API"
        },
        {
            "url": "https://qweb.qwebmaster.com",
            "description": "QWeb Platform public API"
        }
    ],
    "paths": {
        "/api/agent/status": {
            "get": {
                "operationId": "getStatus",
                "summary": "Service health",
                "tags": [
                    "status"
                ],
                "responses": {
                    "200": {
                        "description": "Service is reachable"
                    }
                }
            }
        },
        "/api/agent/site": {
            "get": {
                "operationId": "getSite",
                "summary": "What this site is, and the pages worth reading",
                "tags": [
                    "site"
                ],
                "responses": {
                    "200": {
                        "description": "Site summary"
                    }
                }
            }
        },
        "/api/agent/products": {
            "get": {
                "operationId": "listProducts",
                "summary": "List products with live pricing",
                "description": "Prices are live and change. Quote from this response, not from memory.",
                "tags": [
                    "catalog"
                ],
                "responses": {
                    "200": {
                        "description": "Product list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "count": {
                                            "type": "integer"
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "slug": {
                                                        "type": "string"
                                                    },
                                                    "tagline": {
                                                        "type": "string"
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    },
                                                    "url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "buy_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                    },
                                                    "variants": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "name": {
                                                                    "type": "string",
                                                                    "description": "Human label, e.g. \"Pro (5 sites)\""
                                                                },
                                                                "slug": {
                                                                    "type": "string"
                                                                },
                                                                "attributes": {
                                                                    "type": "object",
                                                                    "description": "Machine-readable limits, e.g. {\"site_limit\":5}"
                                                                },
                                                                "prices": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "price": {
                                                                                "type": "number",
                                                                                "description": "Major units, e.g. 49.00"
                                                                            },
                                                                            "currency": {
                                                                                "type": "string",
                                                                                "description": "ISO 4217, uppercase"
                                                                            },
                                                                            "interval": {
                                                                                "type": "string",
                                                                                "enum": [
                                                                                    "day",
                                                                                    "week",
                                                                                    "month",
                                                                                    "year",
                                                                                    ""
                                                                                ]
                                                                            },
                                                                            "every": {
                                                                                "type": "integer",
                                                                                "description": "Interval multiplier. Absent means 1."
                                                                            },
                                                                            "label": {
                                                                                "type": "string"
                                                                            },
                                                                            "trial_days": {
                                                                                "type": "integer"
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/agent/contact": {
            "post": {
                "operationId": "contactSupport",
                "summary": "Open a support ticket",
                "tags": [
                    "support"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email",
                                    "subject",
                                    "message"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "subject": {
                                        "type": "string"
                                    },
                                    "message": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Ticket created"
                    }
                }
            }
        },
        "/v2/public/brand/{slug}/products": {
            "get": {
                "operationId": "listBrandProducts",
                "summary": "Platform catalog for a brand",
                "tags": [
                    "catalog"
                ],
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Product list"
                    }
                }
            }
        },
        "/checkout": {
            "get": {
                "operationId": "startCheckout",
                "summary": "Start a checkout for a plan",
                "description": "A caller that asks for JSON and does not accept HTML is answered with 402 and the payment requirements below. A browser is shown the hosted checkout page instead.",
                "tags": [
                    "commerce"
                ],
                "parameters": [
                    {
                        "name": "plan",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "x-payment-info": {
                    "intent": "session",
                    "method": "stripe",
                    "currency": "usd",
                    "amount": "4900",
                    "description": "Subscription checkout, from 49.00 USD. The exact amount depends on the plan chosen at checkout.",
                    "offers": [
                        {
                            "intent": "session",
                            "method": "stripe",
                            "currency": "usd",
                            "amount": "4900",
                            "description": "Subscription checkout, from 49.00 USD. The exact amount depends on the plan chosen at checkout."
                        }
                    ]
                },
                "responses": {
                    "200": {
                        "description": "Hosted checkout page"
                    },
                    "402": {
                        "description": "Payment required. The body carries the offers and the URL that settles them."
                    }
                }
            }
        }
    }
}