{
  "asyncapi": "2.6.0",
  "info": {
    "title": "FabHub Outbound Webhook Events",
    "version": "1.0.0",
    "description": "Webhook POST contracts for tenant-configured endpoints. Channels with x-fabhub-delivery=outbox are signed, async deliveries via tenant_webhook_outbox. Channels with x-fabhub-emission=planned are reserved contracts with no producer yet (not emitted). Channels with x-fabhub-delivery=synthetic (webhook.test) are test-only and triggered directly — not outbox-delivered. See docs/webhooks-delivery.md and docs/developer-platform/webhook-events.md."
  },
  "defaultContentType": "application/json",
  "channels": {
    "inventory.item.created": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "inventory_item_created",
        "summary": "An inventory item was created.",
        "message": {
          "name": "inventory.item.created",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "inventory.item.created"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "item_id",
              "name",
              "item_type"
            ],
            "properties": {
              "item_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "sku": {
                "type": "string",
                "nullable": true
              },
              "item_type": {
                "type": "string",
                "enum": [
                  "product",
                  "material",
                  "combo"
                ]
              }
            }
          }
        }
      }
    },
    "inventory.item.updated": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "inventory_item_updated",
        "summary": "An inventory item was updated.",
        "message": {
          "name": "inventory.item.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "inventory.item.updated"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "item_id",
              "name",
              "item_type"
            ],
            "properties": {
              "item_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "sku": {
                "type": "string",
                "nullable": true
              },
              "item_type": {
                "type": "string",
                "enum": [
                  "product",
                  "material",
                  "combo"
                ]
              }
            }
          }
        }
      }
    },
    "order.created": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "order_created",
        "summary": "An MRP order was created.",
        "message": {
          "name": "order.created",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "order.created"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "order_id",
              "module",
              "status"
            ],
            "properties": {
              "order_id": {
                "type": "string",
                "format": "uuid"
              },
              "module": {
                "type": "string",
                "enum": [
                  "buy",
                  "sell",
                  "make",
                  "check",
                  "fix"
                ]
              },
              "order_number": {
                "type": "string",
                "nullable": true
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "open",
                  "in_progress",
                  "waiting",
                  "completed",
                  "cancelled"
                ]
              }
            }
          }
        }
      }
    },
    "order.updated": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "order_updated",
        "summary": "An MRP order was updated.",
        "message": {
          "name": "order.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "order.updated"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "order_id",
              "module",
              "status"
            ],
            "properties": {
              "order_id": {
                "type": "string",
                "format": "uuid"
              },
              "module": {
                "type": "string",
                "enum": [
                  "buy",
                  "sell",
                  "make",
                  "check",
                  "fix"
                ]
              },
              "order_number": {
                "type": "string",
                "nullable": true
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "open",
                  "in_progress",
                  "waiting",
                  "completed",
                  "cancelled"
                ]
              }
            }
          }
        }
      }
    },
    "user.invited": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "user_invited",
        "summary": "A user was invited to the organization.",
        "message": {
          "name": "user.invited",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "user.invited"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "email",
              "role",
              "invite_id"
            ],
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "role": {
                "type": "string"
              },
              "invited_by": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "invite_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      }
    },
    "bom.created": {
      "x-fabhub-delivery": "outbox",
      "x-fabhub-emission": "planned",
      "publish": {
        "operationId": "bom_created",
        "summary": "A bill of materials was created. (planned — not yet emitted)",
        "message": {
          "name": "bom.created",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "bom.created"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "bom_id"
            ],
            "properties": {
              "bom_id": {
                "type": "string",
                "format": "uuid"
              },
              "item_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      }
    },
    "bom.updated": {
      "x-fabhub-delivery": "outbox",
      "x-fabhub-emission": "planned",
      "publish": {
        "operationId": "bom_updated",
        "summary": "A bill of materials was updated. (planned — not yet emitted)",
        "message": {
          "name": "bom.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "bom.updated"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "bom_id"
            ],
            "properties": {
              "bom_id": {
                "type": "string",
                "format": "uuid"
              },
              "item_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      }
    },
    "organization.updated": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "organization_updated",
        "summary": "Organization profile or workspace metadata was updated.",
        "message": {
          "name": "organization.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "organization.updated"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "tenant_id",
              "name",
              "slug"
            ],
            "properties": {
              "tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "integration.connected": {
      "x-fabhub-delivery": "outbox",
      "publish": {
        "operationId": "integration_connected",
        "summary": "A native integration was connected for the tenant.",
        "message": {
          "name": "integration.connected",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "X-FabHub-Timestamp",
              "X-FabHub-Signature"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "integration.connected"
              },
              "X-FabHub-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-FabHub-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "integration_key",
              "connected_at",
              "connected_by_user_id"
            ],
            "properties": {
              "integration_key": {
                "type": "string"
              },
              "connected_at": {
                "type": "string",
                "format": "date-time"
              },
              "connected_by_user_id": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        }
      }
    },
    "webhook.test": {
      "x-fabhub-delivery": "synthetic",
      "x-fabhub-trigger": "POST /api/tenants/{tenantId}/webhooks/{webhookId}/test (session-authenticated Next.js route)",
      "publish": {
        "operationId": "webhook_test",
        "summary": "Synthetic connectivity check from Settings → Integrations → Webhooks (Send test). Unsigned POST; never enqueued in tenant_webhook_outbox.",
        "message": {
          "name": "webhook.test",
          "headers": {
            "type": "object",
            "required": [
              "X-FabHub-Event",
              "User-Agent"
            ],
            "properties": {
              "X-FabHub-Event": {
                "type": "string",
                "const": "webhook.test"
              },
              "User-Agent": {
                "type": "string",
                "const": "FabHub-Webhooks/1.0"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "event",
              "tenant_id",
              "webhook_id",
              "webhook_status",
              "sent_at"
            ],
            "properties": {
              "event": {
                "type": "string",
                "const": "webhook.test"
              },
              "tenant_id": {
                "type": "string",
                "format": "uuid"
              },
              "webhook_id": {
                "type": "string",
                "format": "uuid"
              },
              "webhook_status": {
                "type": "string"
              },
              "sent_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      }
    }
  }
}
