{
  "openapi": "3.1.0",
  "info": {
    "title": "Enduranlar Products API",
    "version": "1.0.0",
    "description": "Token-protected REST access to the enduranlar.com product catalog — the same tools the public MCP server exposes (search, product detail with nutrition facts, categories, paged listing) plus cart generation. Prices in TRY; stock as availability only."
  },
  "servers": [
    {
      "url": "https://api.enduranlar.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer endu_…"
      },
      "queryToken": {
        "type": "apiKey",
        "in": "query",
        "name": "token"
      }
    }
  },
  "paths": {
    "/v1/search_products": {
      "get": {
        "operationId": "search_products",
        "summary": "Ürün ara",
        "description": "Search the enduranlar.com product catalog by free text (name, description, SKU, barcode). Returns compact summaries with price, availability, box↔single relations (a box and its single unit are the same product in different packaging) and flavor variants (same product in other flavors). Use get_product for full detail.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "description": "Free-text search, e.g. 'elektrolit' or 'jel'",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "inStockOnly",
            "in": "query",
            "required": false,
            "description": "Only products with stock on hand",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Filter by exact category (see list_categories)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max results (default 20)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      },
      "post": {
        "operationId": "search_products_post",
        "summary": "Ürün ara",
        "description": "Search the enduranlar.com product catalog by free text (name, description, SKU, barcode). Returns compact summaries with price, availability, box↔single relations (a box and its single unit are the same product in different packaging) and flavor variants (same product in other flavors). Use get_product for full detail.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Free-text search, e.g. 'elektrolit' or 'jel'"
                  },
                  "inStockOnly": {
                    "type": "boolean",
                    "description": "Only products with stock on hand"
                  },
                  "category": {
                    "type": "string",
                    "description": "Filter by exact category (see list_categories)"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "Max results (default 20)"
                  }
                },
                "required": [
                  "query"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      }
    },
    "/v1/get_product": {
      "get": {
        "operationId": "get_product",
        "summary": "Ürün detayı",
        "description": "Full product detail by id or SKU: structured nutrition facts per serving, description (usage/serving info), per-platform listings with prices and availability, box↔single relations (same product, different packaging) and flavor variants (same product in other flavors).",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "Product id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sku",
            "in": "query",
            "required": false,
            "description": "SKU as an alternative to id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      },
      "post": {
        "operationId": "get_product_post",
        "summary": "Ürün detayı",
        "description": "Full product detail by id or SKU: structured nutrition facts per serving, description (usage/serving info), per-platform listings with prices and availability, box↔single relations (same product, different packaging) and flavor variants (same product in other flavors).",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "integer",
                    "description": "Product id"
                  },
                  "sku": {
                    "type": "string",
                    "description": "SKU as an alternative to id"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      }
    },
    "/v1/list_categories": {
      "get": {
        "operationId": "list_categories",
        "summary": "Kategorileri listele",
        "description": "All product categories with product counts and in-stock counts.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      },
      "post": {
        "operationId": "list_categories_post",
        "summary": "Kategorileri listele",
        "description": "All product categories with product counts and in-stock counts.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      }
    },
    "/v1/list_products": {
      "get": {
        "operationId": "list_products",
        "summary": "Ürünleri listele",
        "description": "Paged catalog listing (50 per page), optionally filtered by category and/or brand.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (default 1)",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "brand",
            "in": "query",
            "required": false,
            "description": "Exact brand/vendor",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inStockOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      },
      "post": {
        "operationId": "list_products_post",
        "summary": "Ürünleri listele",
        "description": "Paged catalog listing (50 per page), optionally filtered by category and/or brand.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Page number (default 1)"
                  },
                  "category": {
                    "type": "string"
                  },
                  "brand": {
                    "type": "string",
                    "description": "Exact brand/vendor"
                  },
                  "inStockOnly": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      }
    },
    "/v1/create_cart": {
      "post": {
        "operationId": "create_cart_post",
        "summary": "Sepet oluştur",
        "description": "Build an enduranlar.com cart from products (by id or SKU) and quantities. Returns `cartUrl` — a permalink that opens the store with exactly these items (it replaces whatever was in the customer's cart) — plus `addToCart`, the Shopify /cart/add payload that merges the items into an existing cart, the resolved lines with prices and availability, and any items that could not be resolved.",
        "tags": [
          "catalog"
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "queryToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "productId": {
                          "type": "integer",
                          "description": "Product id (from search/list)"
                        },
                        "sku": {
                          "type": "string",
                          "description": "SKU as an alternative to productId"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 99,
                          "description": "Units (default 1)"
                        }
                      },
                      "additionalProperties": false
                    },
                    "minItems": 1,
                    "maxItems": 50,
                    "description": "Products and quantities"
                  }
                },
                "required": [
                  "items"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool result (same JSON as the MCP tool)"
          },
          "400": {
            "description": "Validation error — `error.details` lists the issues"
          },
          "401": {
            "description": "Missing, unknown or revoked token"
          },
          "404": {
            "description": "Not found"
          },
          "429": {
            "description": "Rate limit exceeded (per token, per minute)"
          }
        }
      }
    }
  }
}