{
  "openapi": "3.1.0",
  "info": {
    "title": "ApoWarenkorb Public Agent API",
    "version": "1.1.0",
    "description": "Schreibgeschützte öffentliche API für Produktsuche, Produktdetails, Anbieterangebote, Kategorien und die Reiseapotheke-Checkliste. Stabile 404-Fehler, ETag-Unterstützung und kanonische HTML-/Markdown-Links erleichtern die Nutzung durch Agenten. Preise, Versandkosten und Verfügbarkeit vor dem Kauf beim Anbieter prüfen."
  },
  "servers": [
    {
      "url": "https://www.apowarenkorb.de"
    }
  ],
  "tags": [
    {
      "name": "Products"
    },
    {
      "name": "Categories"
    },
    {
      "name": "Travel"
    },
    {
      "name": "System"
    }
  ],
  "paths": {
    "/api/v1/search": {
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "searchProducts",
        "summary": "Öffentliche Produkte suchen",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suchergebnisse",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/RateLimit"
          }
        }
      }
    },
    "/api/v1/products/{id}": {
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "getProduct",
        "summary": "Produkt und Anbieterangebote abrufen",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Produktdetails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/products/pzn/{pzn}": {
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "getProductByPzn",
        "summary": "Produkt über PZN abrufen",
        "parameters": [
          {
            "name": "pzn",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{5,8}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Produktdetails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/products/ean/{ean}": {
      "get": {
        "tags": [
          "Products"
        ],
        "operationId": "getProductByEan",
        "summary": "Produkt über EAN oder GTIN abrufen",
        "parameters": [
          {
            "name": "ean",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{8,14}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Produktdetails",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductResponse"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/categories/{slug}": {
      "get": {
        "tags": [
          "Categories"
        ],
        "operationId": "getCategoryProducts",
        "summary": "Kategorie und Produkte abrufen",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Kategorie",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/travel-checklist": {
      "get": {
        "tags": [
          "Travel"
        ],
        "operationId": "getTravelChecklist",
        "summary": "Reiseapotheke-Checkliste abrufen",
        "responses": {
          "200": {
            "description": "Checkliste",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/health": {
      "get": {
        "tags": [
          "System"
        ],
        "operationId": "getHealth",
        "summary": "Verfügbarkeit der Agentenschicht prüfen",
        "responses": {
          "200": {
            "description": "System erreichbar",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "503": {
            "description": "System eingeschränkt"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SearchResult": {
        "type": "object",
        "required": [
          "id",
          "title",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "product_id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "pzn": {
            "type": "string"
          },
          "ean": {
            "type": "string"
          },
          "manufacturer": {
            "type": "string"
          },
          "item_price_from": {
            "type": [
              "number",
              "null"
            ]
          },
          "provider_count": {
            "type": "integer"
          }
        }
      },
      "Offer": {
        "type": "object",
        "required": [
          "offer_id",
          "provider",
          "currency",
          "action_url"
        ],
        "properties": {
          "offer_id": {
            "type": "integer"
          },
          "provider": {
            "type": "string"
          },
          "provider_domain": {
            "type": "string"
          },
          "item_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "shipping_cost": {
            "type": [
              "number",
              "null"
            ]
          },
          "shipping_cost_text": {
            "type": "string"
          },
          "total_price": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "availability": {
            "type": "string"
          },
          "checked_at": {
            "type": "string"
          },
          "action_url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "title",
          "url",
          "offers"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown_url": {
            "type": "string",
            "format": "uri"
          },
          "pzn": {
            "type": "string"
          },
          "ean": {
            "type": "string"
          },
          "manufacturer": {
            "type": "string"
          },
          "brand": {
            "type": "string"
          },
          "pack": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "image": {
            "type": "string"
          },
          "item_price_from": {
            "type": [
              "number",
              "null"
            ]
          },
          "total_price_from": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "provider_count": {
            "type": "integer"
          },
          "offers_checked_at": {
            "type": "string"
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Offer"
            }
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "meta": {
            "type": "object"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          },
          "links": {
            "type": "object"
          }
        }
      },
      "ProductResponse": {
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string"
          },
          "generated_at": {
            "type": "string"
          },
          "meta": {
            "type": "object"
          },
          "data": {
            "$ref": "#/components/schemas/Product"
          },
          "links": {
            "type": "object"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Nicht gefunden",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ValidationError": {
        "description": "Ungültige Eingabe",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimit": {
        "description": "Rate-Limit erreicht",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
