{
  "openapi": "3.1.0",
  "info": {
    "title": "Aastik Agent API",
    "version": "1.0.0",
    "description": "Merchant-neutral product intelligence for AI shopping agents. Read endpoints are public; purchases always require an explicit user action on the merchant's own site."
  },
  "servers": [
    {
      "url": "https://aastik.club/api/public/agent/v1"
    },
    {
      "url": "https://aastik.club/api/public/agent/v1"
    }
  ],
  "paths": {
    "/search": {
      "get": {
        "summary": "Natural-language product search",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 300
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked, explained results with extracted constraints."
          }
        }
      },
      "post": {
        "summary": "Natural-language product search",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string"
                  }
                },
                "required": [
                  "query"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked, explained results."
          }
        }
      }
    },
    "/products": {
      "get": {
        "summary": "List catalog products",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_price",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 5000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "product_id": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "brand": {
                            "type": "string",
                            "nullable": true
                          },
                          "category": {
                            "type": "string",
                            "nullable": true
                          },
                          "price": {
                            "type": "number",
                            "nullable": true
                          },
                          "currency": {
                            "type": "string"
                          },
                          "availability": {
                            "type": "string"
                          },
                          "rating": {
                            "type": "number",
                            "nullable": true
                          },
                          "data_freshness": {
                            "type": "string",
                            "enum": [
                              "fresh",
                              "aging",
                              "stale",
                              "unknown"
                            ]
                          },
                          "last_verified_at": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "confidence": {
                            "type": "number"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/products/{id}": {
      "get": {
        "summary": "Product intelligence with provenance",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product detail"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/compare": {
      "get": {
        "summary": "Attribute comparison matrix",
        "parameters": [
          {
            "name": "ids",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated, 2-6 identifiers."
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison matrix"
          }
        }
      }
    },
    "/categories": {
      "get": {
        "summary": "Category taxonomy",
        "responses": {
          "200": {
            "description": "Categories"
          }
        }
      }
    },
    "/offers": {
      "get": {
        "summary": "Prices, availability and verification time",
        "parameters": [
          {
            "name": "product",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Offers"
          }
        }
      }
    },
    "/purchase-options": {
      "get": {
        "summary": "Normalized purchase options",
        "parameters": [
          {
            "name": "product",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Purchase options; destinations are the merchant's own canonical URLs."
          }
        }
      }
    },
    "/checkout": {
      "post": {
        "summary": "First-party checkout (not connected)",
        "responses": {
          "503": {
            "description": "No payment provider connected"
          }
        }
      }
    }
  },
  "x-rate-limit": {
    "requests": 120,
    "window_seconds": 60,
    "scope": "per_ip"
  },
  "x-authentication": {
    "required": false,
    "reserved_header": "x-api-key"
  }
}