{
  "openapi": "3.1.0",
  "info": {
    "title": "Storlio Commerce API",
    "version": "1.0.0",
    "description": "Store-scoped server integration. See commerce-api-v1.md for reconciliation, webhook signatures, retry semantics, deployment and supported product limits."
  },
  "servers": [
    {
      "url": "https://backend.storlio.ng/api/commerce/v1"
    }
  ],
  "security": [
    {
      "serverKey": []
    }
  ],
  "paths": {
    "/products": {
      "get": {
        "operationId": "get__products",
        "summary": "Export store products",
        "x-required-scope": "products:read",
        "parameters": [
          {
            "name": "perPage",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "externalId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "post": {
        "operationId": "post__products",
        "summary": "Create, link or upsert a product",
        "x-required-scope": "products:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductUpsert"
              }
            }
          }
        }
      }
    },
    "/products/{product}": {
      "get": {
        "operationId": "get__products_product_",
        "summary": "Read product and current version",
        "x-required-scope": "products:read",
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "patch": {
        "operationId": "patch__products_product_",
        "summary": "Update a product with expectedVersion",
        "x-required-scope": "products:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductUpdate"
              }
            }
          }
        }
      }
    },
    "/inventory/{product}": {
      "get": {
        "operationId": "get__inventory_product_",
        "summary": "Read current stock and version",
        "x-required-scope": "inventory:read",
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Inventory"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      },
      "put": {
        "operationId": "put__inventory_product_",
        "summary": "Replace reconciled stock with expectedVersion",
        "x-required-scope": "inventory:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Inventory"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InventoryWrite"
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "get__orders",
        "summary": "Read paginated store-only order summaries",
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "perPage",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "nextCursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/orders/{order}": {
      "get": {
        "operationId": "get__orders_order_",
        "summary": "Read a store-only order summary",
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "name": "order",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/checkout-links": {
      "post": {
        "operationId": "post__checkout_links",
        "summary": "Create a one-hour checkout handoff",
        "x-required-scope": "checkout:write",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckoutWrite"
              }
            }
          }
        }
      }
    },
    "/checkout-links/{token}/resolve": {
      "get": {
        "operationId": "get__checkout_links_token_resolve",
        "summary": "Public checkout preview; revalidates products and stock",
        "x-required-scope": null,
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9]{48}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "storeName": {
                      "type": "string"
                    },
                    "valid": {
                      "const": true
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "securitySchemes": {
      "serverKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "stc_ server API key"
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{8,120}$"
        },
        "description": "Reuse only for an identical retry. Changed requests need a new key."
      }
    },
    "responses": {
      "Error": {
        "description": "Request rejected",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "ProductUpsert": {
        "type": "object",
        "required": [
          "title",
          "description",
          "price",
          "currency",
          "cover"
        ],
        "properties": {
          "externalId": {
            "type": "string",
            "maxLength": 160
          },
          "productId": {
            "type": "integer",
            "minimum": 1
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 1
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 20000
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          },
          "currency": {
            "const": "NGN"
          },
          "visible": {
            "type": "boolean",
            "default": false
          },
          "cover": {
            "type": "object",
            "required": [
              "kind",
              "url"
            ],
            "properties": {
              "kind": {
                "const": "image"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            }
          },
          "gallery": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "required": [
                "kind",
                "url"
              ],
              "properties": {
                "kind": {
                  "const": "image"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://"
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "variants": {
            "type": "array",
            "maxItems": 3,
            "description": "At most 200 combinations. Stock fields are prohibited here.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "values"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 80
                },
                "values": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "valueConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                },
                "combinationConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                }
              }
            }
          },
          "variantIds": {
            "type": "object",
            "maxProperties": 200,
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            },
            "description": "External variation IDs to Storlio variation keys."
          }
        },
        "description": "An existing mapped product requires expectedVersion. productId links an existing store product."
      },
      "ProductUpdate": {
        "type": "object",
        "required": [
          "expectedVersion"
        ],
        "properties": {
          "externalId": {
            "type": "string",
            "maxLength": 160
          },
          "productId": {
            "type": "integer",
            "minimum": 1
          },
          "expectedVersion": {
            "type": "integer",
            "minimum": 1
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 20000
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          },
          "currency": {
            "const": "NGN"
          },
          "visible": {
            "type": "boolean",
            "default": false
          },
          "cover": {
            "type": "object",
            "required": [
              "kind",
              "url"
            ],
            "properties": {
              "kind": {
                "const": "image"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            }
          },
          "gallery": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "required": [
                "kind",
                "url"
              ],
              "properties": {
                "kind": {
                  "const": "image"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://"
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "variants": {
            "type": "array",
            "maxItems": 3,
            "description": "At most 200 combinations. Stock fields are prohibited here.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "values"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 80
                },
                "values": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "valueConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                },
                "combinationConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                }
              }
            }
          },
          "variantIds": {
            "type": "object",
            "maxProperties": 200,
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            },
            "description": "External variation IDs to Storlio variation keys."
          }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 20000
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          },
          "currency": {
            "const": "NGN"
          },
          "visible": {
            "type": "boolean",
            "default": false
          },
          "cover": {
            "type": "object",
            "required": [
              "kind",
              "url"
            ],
            "properties": {
              "kind": {
                "const": "image"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              }
            }
          },
          "gallery": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "object",
              "required": [
                "kind",
                "url"
              ],
              "properties": {
                "kind": {
                  "const": "image"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://"
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 120
          },
          "variants": {
            "type": "array",
            "maxItems": 3,
            "description": "At most 200 combinations. Stock fields are prohibited here.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "values"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "maxLength": 80
                },
                "values": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 20,
                  "items": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "valueConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                },
                "combinationConfig": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "sku": {
                        "type": "string",
                        "maxLength": 100
                      }
                    }
                  }
                }
              }
            }
          },
          "variantIds": {
            "type": [
              "object",
              "array"
            ],
            "maxProperties": 200,
            "additionalProperties": {
              "type": "string",
              "maxLength": 500
            },
            "description": "External variation IDs to Storlio variation keys.",
            "maxItems": 0
          },
          "id": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "productType": {
            "type": "string"
          },
          "listingType": {
            "type": "string"
          },
          "moderationStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "inStock": {
            "type": "boolean"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "slug": {
            "type": "string"
          },
          "shipping": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          }
        }
      },
      "InventoryWrite": {
        "type": "object",
        "required": [
          "expectedVersion",
          "quantity"
        ],
        "properties": {
          "expectedVersion": {
            "type": "integer",
            "minimum": 0
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000000
          },
          "variantStock": {
            "type": "object",
            "maxProperties": 200,
            "additionalProperties": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000000
            }
          }
        }
      },
      "Inventory": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string"
          },
          "inventoryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer",
            "minimum": 0
          },
          "tracked": {
            "type": "boolean"
          },
          "quantity": {
            "type": [
              "integer",
              "null"
            ]
          },
          "variantStock": {
            "type": [
              "object",
              "array"
            ],
            "additionalProperties": {
              "type": "integer",
              "minimum": 0
            },
            "maxItems": 0
          },
          "variantKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "paymentStatus": {
            "type": "string"
          },
          "deliveryStatus": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "itemsTotal": {
            "type": "number"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "productId": {
                  "type": "string"
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer"
                },
                "unitPrice": {
                  "type": "number"
                },
                "options": {
                  "type": [
                    "object",
                    "array"
                  ],
                  "maxItems": 0
                }
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CheckoutWrite": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 30,
            "items": {
              "type": "object",
              "required": [
                "productId",
                "quantity"
              ],
              "properties": {
                "productId": {
                  "type": "string"
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1000
                },
                "options": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string",
                    "maxLength": 100
                  }
                }
              }
            }
          }
        }
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "type",
          "apiVersion",
          "storeId",
          "occurredAt",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "enum": [
              "product.created",
              "product.updated",
              "product.deleted",
              "inventory.updated",
              "order.created",
              "order.updated"
            ]
          },
          "apiVersion": {
            "const": "v1"
          },
          "storeId": {
            "type": "string"
          },
          "originConnectionId": {
            "type": [
              "integer",
              "null"
            ]
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object"
          }
        }
      }
    }
  },
  "x-scopes": {
    "products:read": "Read products",
    "products:write": "Create/update standard physical products",
    "inventory:read": "Read inventory",
    "inventory:write": "Update inventory",
    "checkout:write": "Create hosted checkout links",
    "orders:read": "Read store-scoped order summaries"
  }
}
