{
  "openapi": "3.1.0",
  "info": {
    "title": "Velcorr Merchant API",
    "version": "2026-10-12",
    "description": "Merchant-created scoped API keys and signed outbound webhooks. Money is returned as decimal strings with currency. No order creation or payment operations in this version."
  },
  "servers": [
    {
      "url": "https://velcorr.com/api/v1"
    }
  ],
  "paths": {
    "/products": {
      "get": {
        "description": "Read products and inventory, exact decimal amounts as strings.",
        "security": [
          {
            "MerchantApiKey": []
          }
        ],
        "x-required-scope": "products:read",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "query",
            "name": "updated_after",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-scoped data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "market": {
                      "anyOf": [
                        {
                          "type": "object",
                          "required": [
                            "currency",
                            "selling_country",
                            "revision"
                          ],
                          "properties": {
                            "currency": {
                              "type": "string"
                            },
                            "selling_country": {
                              "type": "string"
                            },
                            "revision": {
                              "type": "integer"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until a rate-limit retry."
              }
            }
          },
          "503": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "listProducts"
      },
      "post": {
        "operationId": "createProduct",
        "summary": "Create one merchant product atomically with initial inventory",
        "description": "Requires products:create; defaults to draft. Same Idempotency-Key and semantic payload on the same API key return the original 201 result. Changed payload returns 409. Read market context from GET /products with products:read. Store-specific creation limit 20/minute. Max JSON body 65,536 bytes; read deadline 5s. Images are managed through the existing dashboard. Idempotency records last for the lifetime of the API key.",
        "x-required-scope": "products:create",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]{16,128}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductCreate"
              },
              "example": {
                "name": "جهاز عناية",
                "price": "499.95",
                "currency": "EGP",
                "market_revision": 0,
                "stock": 10,
                "status": "draft"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created or safe replay of original result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCreated"
                }
              }
            }
          },
          "400": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Stable error code: invalid_product / invalid_currency_precision / invalid_idempotency_key / unauthorized / insufficient_scope / market_conflict / idempotency_conflict / product_conflict / body_timeout / body_too_large / unsupported_content_type / rate_limited / unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "get": {
        "description": "Read orders. Respect sensitive_data_restricted; wallet masking applies.",
        "security": [
          {
            "MerchantApiKey": []
          }
        ],
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-scoped data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until a rate-limit retry."
              }
            }
          },
          "503": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "listOrders"
      }
    },
    "/orders/{orderId}": {
      "get": {
        "description": "Read one order in the key’s store.",
        "security": [
          {
            "MerchantApiKey": []
          }
        ],
        "x-required-scope": "orders:read",
        "parameters": [
          {
            "in": "path",
            "name": "orderId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-scoped data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until a rate-limit retry."
              }
            }
          },
          "503": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "getOrder"
      }
    },
    "/orders/{orderId}/status": {
      "patch": {
        "description": "Optimistic state transition; repeated target state is safe. Preserves money snapshots and canonical inventory rules.",
        "security": [
          {
            "MerchantApiKey": []
          }
        ],
        "x-required-scope": "orders:status",
        "parameters": [
          {
            "in": "path",
            "name": "orderId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant-scoped data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "id",
                        "status"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "confirmed",
                            "processing",
                            "ready_to_ship",
                            "shipped",
                            "delivered",
                            "collected",
                            "failed_delivery",
                            "returning",
                            "returned",
                            "cancelled"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "Seconds until a rate-limit retry."
              }
            }
          },
          "503": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "408": {
            "description": "Error response; no provider internals or secrets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "status",
                  "expected_status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "confirmed",
                      "processing",
                      "ready_to_ship",
                      "shipped",
                      "delivered",
                      "collected",
                      "failed_delivery",
                      "returning",
                      "returned",
                      "cancelled"
                    ]
                  },
                  "expected_status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "confirmed",
                      "processing",
                      "ready_to_ship",
                      "shipped",
                      "delivered",
                      "collected",
                      "failed_delivery",
                      "returning",
                      "returned",
                      "cancelled"
                    ]
                  }
                }
              }
            }
          }
        },
        "operationId": "updateOrderStatus"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "MerchantApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Created by store owner. Sent only in Authorization; never in query strings."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "request_id"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "Money": {
        "type": "string",
        "pattern": "^\\d+(\\.\\d+)?$",
        "description": "Exact decimal amount, never a JSON floating-point value."
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "description",
          "sku",
          "status",
          "price",
          "currency",
          "stock",
          "updated_at",
          "images",
          "variants"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sku": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "stock": {
            "type": "integer",
            "minimum": 0
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url",
                "alt"
              ],
              "properties": {
                "url": {
                  "type": "string"
                },
                "alt": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "variants": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "sku",
                "price",
                "stock"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                },
                "sku": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "price": {
                  "$ref": "#/components/schemas/Money"
                },
                "stock": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        }
      },
      "Order": {
        "type": "object",
        "required": [
          "id",
          "number",
          "status",
          "currency",
          "selling_country",
          "subtotal",
          "shipping_fee",
          "total",
          "payment_method",
          "created_at",
          "sensitive_data_restricted",
          "customer",
          "notes",
          "items"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "number": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "processing",
              "ready_to_ship",
              "shipped",
              "delivered",
              "collected",
              "failed_delivery",
              "returning",
              "returned",
              "cancelled"
            ]
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "selling_country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "subtotal": {
            "$ref": "#/components/schemas/Money"
          },
          "shipping_fee": {
            "$ref": "#/components/schemas/Money"
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "payment_method": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "sensitive_data_restricted": {
            "type": "boolean"
          },
          "customer": {
            "type": "object",
            "required": [
              "name",
              "phone",
              "address",
              "region",
              "region_code",
              "city",
              "district"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "region": {
                "type": "string"
              },
              "region_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "district": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "product_id",
                "variant_id",
                "name",
                "variant_name",
                "quantity",
                "unit_price",
                "total"
              ],
              "properties": {
                "product_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "variant_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "variant_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1
                },
                "unit_price": {
                  "$ref": "#/components/schemas/Money"
                },
                "total": {
                  "$ref": "#/components/schemas/Money"
                }
              }
            }
          }
        }
      },
      "ProductCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "price",
          "currency",
          "market_revision"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 200
          },
          "description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 5000
              },
              {
                "type": "null"
              }
            ]
          },
          "price": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^(0|[1-9]\\d{0,7})(\\.\\d{1,3})?$",
            "description": "Decimal string within store currency precision, at most 10,000,000. No exponents or numeric JSON amounts."
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "market_revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "stock": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000,
            "default": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active",
              "archived"
            ],
            "default": "draft"
          },
          "sku": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          },
          "slug": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "seo_title": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 70
              },
              {
                "type": "null"
              }
            ]
          },
          "seo_description": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 170
              },
              {
                "type": "null"
              }
            ]
          },
          "compare_at_price": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 32,
                "pattern": "^(0|[1-9]\\d{0,7})(\\.\\d{1,3})?$",
                "description": "Decimal string within store currency precision, at most 10,000,000. No exponents or numeric JSON amounts."
              },
              {
                "type": "null"
              }
            ]
          },
          "cost": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 32,
                "pattern": "^(0|[1-9]\\d{0,7})(\\.\\d{1,3})?$",
                "description": "Decimal string within store currency precision, at most 10,000,000. No exponents or numeric JSON amounts."
              },
              {
                "type": "null"
              }
            ]
          },
          "category_ids": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "variants": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "name",
                "options"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "options": {
                  "type": "object",
                  "maxProperties": 10,
                  "additionalProperties": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "sku": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 64
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "price": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 32,
                      "pattern": "^(0|[1-9]\\d{0,7})(\\.\\d{1,3})?$",
                      "description": "Decimal string within store currency precision, at most 10,000,000. No exponents or numeric JSON amounts."
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "stock": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1000000,
                  "default": 0
                }
              }
            }
          },
          "product_content": {
            "anyOf": [
              {
                "type": "object",
                "description": "Velcorr structured product-content v1; server validates all nested blocks. See product content documentation."
              },
              {
                "type": "null"
              }
            ]
          },
          "buy_now_label": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 30
              },
              {
                "type": "null"
              }
            ]
          },
          "free_shipping": {
            "type": "boolean"
          },
          "direct_checkout": {
            "type": "boolean"
          },
          "sticky_buy_button": {
            "type": "boolean"
          },
          "show_related_products": {
            "type": "boolean"
          }
        }
      },
      "ProductCreated": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "status",
              "price",
              "currency",
              "stock"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "slug": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string"
              },
              "price": {
                "type": "string",
                "maxLength": 32,
                "pattern": "^(0|[1-9]\\d{0,7})(\\.\\d{1,3})?$",
                "description": "Decimal string within store currency precision, at most 10,000,000. No exponents or numeric JSON amounts."
              },
              "currency": {
                "type": "string"
              },
              "stock": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000,
                "default": 0
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "order_event": {
      "post": {
        "description": "Signed raw JSON, immutable event ID. At-least-once delivery, no arrival-order guarantee; verify HMAC and deduplicate event IDs. No customer PII in notification. Retention 30 days.",
        "parameters": [
          {
            "in": "header",
            "name": "X-Velcorr-Event-Id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Velcorr-Timestamp",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Velcorr-Signature",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "type",
                  "api_version",
                  "created_at",
                  "store_id",
                  "data"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "order.created",
                      "order.status_changed",
                      "integration.test"
                    ]
                  },
                  "api_version": {
                    "const": "2026-10-12"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "store_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "data": {
                    "type": "object",
                    "description": "order_id plus immutable event fields, or a test message. Fetch sensitive order fields from the authorized API."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver has durably recorded the event; duplicate events may still arrive."
          }
        }
      }
    }
  }
}
