{
  "openapi": "3.1.0",
  "info": {
    "title": "Ecom 29 API",
    "version": "v2.9",
    "description": "Ecom 29 provides a robust REST API for managing online stores, product catalogs, orders, customer relationships, inventory, and payment processing.",
    "contact": {
      "name": "Azeosoft Web Technologies",
      "url": "https://azeosoft.com"
    }
  },
  "servers": [
    {
      "url": "https://api.ecom29.azeosoft.com/v2",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Authenticate requests using API keys or OAuth2 tokens."
    },
    {
      "name": "Products",
      "description": "Manage product catalog, inventory, and variants."
    },
    {
      "name": "Orders",
      "description": "Manage customer orders and order fulfillment."
    },
    {
      "name": "Customers",
      "description": "Manage customer profiles and relationships."
    },
    {
      "name": "Inventory",
      "description": "Track and manage stock levels and warehouse operations."
    },
    {
      "name": "Payments",
      "description": "Process payments and manage transactions."
    }
  ],
  "paths": {
    "/auth/login": {
      "post": {
        "operationId": "e-auth-login",
        "summary": "Login and obtain access token",
        "description": "Authenticate a user with email and password. Returns a JWT access token valid for 24 hours.",
        "tags": [
          "Authentication"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Login successful",
            "content": {
              "application/json": {
                "example": {
                  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
                  "expires_in": 86400,
                  "token_type": "Bearer"
                }
              }
            }
          },
          "401": {
            "description": "Invalid credentials",
            "content": {
              "application/json": {
                "example": {
                  "error": "INVALID_CREDENTIALS",
                  "message": "Email or password is incorrect."
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "User credentials",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "email": "admin@store.com",
                "password": "securepassword"
              }
            }
          }
        }
      }
    },
    "/auth/register": {
      "post": {
        "operationId": "e-auth-register",
        "summary": "Create a new store account",
        "description": "Register a new store with email, password, and store name.",
        "tags": [
          "Authentication"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Store created",
            "content": {
              "application/json": {
                "example": {
                  "store_id": "store_98765",
                  "email": "owner@mystore.com",
                  "store_name": "My Amazing Store",
                  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Store registration data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "email": "owner@mystore.com",
                "password": "securepassword",
                "store_name": "My Amazing Store"
              }
            }
          }
        }
      }
    },
    "/products": {
      "post": {
        "operationId": "e-product-create",
        "summary": "Create a new product",
        "description": "Add a new product to the store with name, description, price, and inventory details.",
        "tags": [
          "Products"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Product created",
            "content": {
              "application/json": {
                "example": {
                  "product_id": "prod_55555",
                  "name": "Wireless Headphones",
                  "price": 199.99,
                  "sku": "WH-001",
                  "stock": 50,
                  "created_at": "2026-03-30T08:15:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Product data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "Wireless Headphones",
                "description": "Premium noise-cancelling headphones",
                "price": 199.99,
                "sku": "WH-001",
                "stock": 50,
                "category": "Electronics"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "e-product-list",
        "summary": "List all products",
        "description": "Retrieve a paginated list of all products with optional filtering.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Filter by category",
            "schema": {
              "type": "string"
            },
            "example": "Electronics"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results (default 50)",
            "schema": {
              "type": "integer"
            },
            "example": "100"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Pagination offset",
            "schema": {
              "type": "integer"
            },
            "example": "0"
          }
        ],
        "responses": {
          "200": {
            "description": "Products retrieved",
            "content": {
              "application/json": {
                "example": {
                  "products": [
                    {
                      "product_id": "prod_55555",
                      "name": "Wireless Headphones",
                      "price": 199.99,
                      "stock": 50
                    }
                  ],
                  "total_count": 150
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/products/{product_id}": {
      "get": {
        "operationId": "e-product-get",
        "summary": "Get product details",
        "description": "Retrieve detailed information about a specific product.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "Product ID",
            "schema": {
              "type": "string"
            },
            "example": "prod_55555"
          }
        ],
        "responses": {
          "200": {
            "description": "Product details retrieved",
            "content": {
              "application/json": {
                "example": {
                  "product_id": "prod_55555",
                  "name": "Wireless Headphones",
                  "description": "Premium noise-cancelling headphones",
                  "price": 199.99,
                  "stock": 50,
                  "rating": 4.8,
                  "reviews_count": 247
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      },
      "put": {
        "operationId": "e-product-update",
        "summary": "Update product details",
        "description": "Update product information, pricing, or inventory.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "Product ID",
            "schema": {
              "type": "string"
            },
            "example": "prod_55555"
          }
        ],
        "responses": {
          "200": {
            "description": "Product updated",
            "content": {
              "application/json": {
                "example": {
                  "product_id": "prod_55555",
                  "price": 179.99,
                  "stock": 45,
                  "updated_at": "2026-03-30T09:30:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Updated product data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "price": 179.99,
                "stock": 45
              }
            }
          }
        }
      }
    },
    "/orders": {
      "post": {
        "operationId": "e-order-create",
        "summary": "Create a new order",
        "description": "Create a new order with customer information, items, and shipping details.",
        "tags": [
          "Orders"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Order created",
            "content": {
              "application/json": {
                "example": {
                  "order_id": "ord_33333",
                  "customer_id": "cust_77777",
                  "status": "pending",
                  "total": 199.99,
                  "created_at": "2026-03-30T10:00:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Order data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "customer_id": "cust_77777",
                "items": [
                  {
                    "product_id": "prod_55555",
                    "quantity": 1,
                    "price": 199.99
                  }
                ],
                "shipping_address": {
                  "street": "123 Main St",
                  "city": "New York",
                  "zip": "10001"
                },
                "total": 199.99
              }
            }
          }
        }
      },
      "get": {
        "operationId": "e-order-list",
        "summary": "List all orders",
        "description": "Retrieve orders with optional filtering by status or date range.",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter by status (pending, processing, shipped, delivered)",
            "schema": {
              "type": "string"
            },
            "example": "shipped"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results",
            "schema": {
              "type": "integer"
            },
            "example": "50"
          }
        ],
        "responses": {
          "200": {
            "description": "Orders retrieved",
            "content": {
              "application/json": {
                "example": {
                  "orders": [
                    {
                      "order_id": "ord_33333",
                      "customer_id": "cust_77777",
                      "total": 199.99,
                      "status": "shipped"
                    }
                  ],
                  "total_count": 1250
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/orders/{order_id}": {
      "get": {
        "operationId": "e-order-get",
        "summary": "Get order details",
        "description": "Retrieve full details of a specific order including items and tracking.",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "description": "Order ID",
            "schema": {
              "type": "string"
            },
            "example": "ord_33333"
          }
        ],
        "responses": {
          "200": {
            "description": "Order retrieved",
            "content": {
              "application/json": {
                "example": {
                  "order_id": "ord_33333",
                  "customer_id": "cust_77777",
                  "items": [
                    {
                      "product_id": "prod_55555",
                      "name": "Wireless Headphones",
                      "quantity": 1,
                      "price": 199.99
                    }
                  ],
                  "status": "shipped",
                  "tracking_number": "TRK123456"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/customers": {
      "post": {
        "operationId": "e-customer-create",
        "summary": "Create a new customer",
        "description": "Add a new customer to your store.",
        "tags": [
          "Customers"
        ],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Customer created",
            "content": {
              "application/json": {
                "example": {
                  "customer_id": "cust_77777",
                  "email": "customer@example.com",
                  "first_name": "Alice",
                  "last_name": "Johnson",
                  "created_at": "2026-03-30T11:15:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Customer data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "email": "customer@example.com",
                "first_name": "Alice",
                "last_name": "Johnson",
                "phone": "+1234567890"
              }
            }
          }
        }
      },
      "get": {
        "operationId": "e-customer-list",
        "summary": "List all customers",
        "description": "Retrieve a list of all customers with pagination.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results",
            "schema": {
              "type": "integer"
            },
            "example": "100"
          }
        ],
        "responses": {
          "200": {
            "description": "Customers retrieved",
            "content": {
              "application/json": {
                "example": {
                  "customers": [
                    {
                      "customer_id": "cust_77777",
                      "email": "customer@example.com",
                      "first_name": "Alice"
                    }
                  ],
                  "total_count": 5000
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/inventory/{product_id}": {
      "get": {
        "operationId": "e-inventory-check",
        "summary": "Check product stock levels",
        "description": "Retrieve real-time inventory levels for a product.",
        "tags": [
          "Inventory"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "Product ID",
            "schema": {
              "type": "string"
            },
            "example": "prod_55555"
          }
        ],
        "responses": {
          "200": {
            "description": "Inventory retrieved",
            "content": {
              "application/json": {
                "example": {
                  "product_id": "prod_55555",
                  "sku": "WH-001",
                  "total_stock": 50,
                  "available": 45,
                  "reserved": 5,
                  "reorder_level": 10
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    },
    "/inventory/{product_id}/adjust": {
      "post": {
        "operationId": "e-inventory-adjust",
        "summary": "Adjust inventory levels",
        "description": "Manually adjust stock levels for returns, damages, or corrections.",
        "tags": [
          "Inventory"
        ],
        "parameters": [
          {
            "name": "product_id",
            "in": "path",
            "required": true,
            "description": "Product ID",
            "schema": {
              "type": "string"
            },
            "example": "prod_55555"
          }
        ],
        "responses": {
          "200": {
            "description": "Inventory adjusted",
            "content": {
              "application/json": {
                "example": {
                  "product_id": "prod_55555",
                  "previous_stock": 50,
                  "new_stock": 45,
                  "adjusted_at": "2026-03-30T12:30:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Inventory adjustment",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "quantity": -5,
                "reason": "damage",
                "notes": "Found 5 defective units during inspection"
              }
            }
          }
        }
      }
    },
    "/payments/process": {
      "post": {
        "operationId": "e-payment-process",
        "summary": "Process a payment",
        "description": "Process a payment for an order using credit card or other payment methods.",
        "tags": [
          "Payments"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Payment processed",
            "content": {
              "application/json": {
                "example": {
                  "transaction_id": "txn_44444",
                  "order_id": "ord_33333",
                  "status": "success",
                  "amount": 199.99,
                  "processed_at": "2026-03-30T13:00:00Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "description": "Payment data",
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "order_id": "ord_33333",
                "amount": 199.99,
                "currency": "USD",
                "payment_method": "credit_card",
                "card": {
                  "number": "4242424242424242",
                  "exp_month": 12,
                  "exp_year": 2027,
                  "cvc": "123"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
