{
  "asyncapi": "2.6.0",
  "info": {
    "title": "instaClaim Outbound Webhook Events",
    "version": "1.0.0",
    "description": "Webhook POST contracts for tenant-configured endpoints. Outbox channels are signed async deliveries via tenant_webhook_outbox. Channels with x-instaclaim-emission=planned are reserved contracts with no producer yet. Synthetic channels are test-only and are not outbox-delivered."
  },
  "defaultContentType": "application/json",
  "channels": {
    "claim_project.created": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "claim_project_created",
        "summary": "A claim project was created.",
        "message": {
          "name": "claim_project.created",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "claim_project.created"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "project_id",
              "name",
              "period_start",
              "period_end",
              "status"
            ],
            "properties": {
              "project_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "period_start": {
                "type": "string",
                "format": "date"
              },
              "period_end": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "active",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "claim_project.updated": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "claim_project_updated",
        "summary": "A claim project was updated.",
        "message": {
          "name": "claim_project.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "claim_project.updated"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "project_id",
              "name",
              "period_start",
              "period_end",
              "status"
            ],
            "properties": {
              "project_id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "period_start": {
                "type": "string",
                "format": "date"
              },
              "period_end": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "active",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "expense_category.created": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "expense_category_created",
        "summary": "A claim expense category was created.",
        "message": {
          "name": "expense_category.created",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "expense_category.created"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "category_id",
              "code",
              "name",
              "status"
            ],
            "properties": {
              "category_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "expense_category.updated": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "expense_category_updated",
        "summary": "A claim expense category was updated.",
        "message": {
          "name": "expense_category.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "expense_category.updated"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "category_id",
              "code",
              "name",
              "status"
            ],
            "properties": {
              "category_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "code": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "report_configuration.created": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "report_configuration_created",
        "summary": "A claim report configuration was created.",
        "message": {
          "name": "report_configuration.created",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "report_configuration.created"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "report_configuration_id",
              "name",
              "period_start",
              "period_end",
              "status"
            ],
            "properties": {
              "report_configuration_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "name": {
                "type": "string"
              },
              "period_start": {
                "type": "string",
                "format": "date"
              },
              "period_end": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "ready",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "report_configuration.updated": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "report_configuration_updated",
        "summary": "A claim report configuration was updated.",
        "message": {
          "name": "report_configuration.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "report_configuration.updated"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "report_configuration_id",
              "name",
              "period_start",
              "period_end",
              "status"
            ],
            "properties": {
              "report_configuration_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "name": {
                "type": "string"
              },
              "period_start": {
                "type": "string",
                "format": "date"
              },
              "period_end": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "ready",
                  "archived"
                ]
              }
            }
          }
        }
      }
    },
    "claim_report.queued": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "claim_report_queued",
        "summary": "A claim report generation run was queued.",
        "message": {
          "name": "claim_report.queued",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "claim_report.queued"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "claim_report_id",
              "status"
            ],
            "properties": {
              "claim_report_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "report_configuration_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "status": {
                "type": "string",
                "const": "queued"
              }
            }
          }
        }
      }
    },
    "claim_report.succeeded": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "claim_report_succeeded",
        "summary": "A claim report generation run succeeded.",
        "message": {
          "name": "claim_report.succeeded",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "claim_report.succeeded"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "claim_report_id",
              "status",
              "generated_at"
            ],
            "properties": {
              "claim_report_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "report_configuration_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "status": {
                "type": "string",
                "const": "succeeded"
              },
              "generated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      }
    },
    "claim_report.failed": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "claim_report_failed",
        "summary": "A claim report generation run failed.",
        "message": {
          "name": "claim_report.failed",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "claim_report.failed"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "claim_report_id",
              "status"
            ],
            "properties": {
              "claim_report_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "report_configuration_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "status": {
                "type": "string",
                "const": "failed"
              },
              "error_message": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      }
    },
    "bank_statement.redaction_queued": {
      "x-instaclaim-delivery": "outbox",
      "x-instaclaim-emission": "planned",
      "publish": {
        "operationId": "bank_statement_redaction_queued",
        "summary": "A bank statement redaction job was queued. (planned; not yet emitted)",
        "message": {
          "name": "bank_statement.redaction_queued",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "bank_statement.redaction_queued"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "bank_statement_id",
              "redaction_status"
            ],
            "properties": {
              "bank_statement_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "redaction_status": {
                "type": "string",
                "const": "queued"
              },
              "redaction_provider": {
                "type": "string",
                "enum": [
                  "azure",
                  "manual",
                  "none"
                ]
              }
            }
          }
        }
      }
    },
    "bank_statement.redaction_succeeded": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "bank_statement_redaction_succeeded",
        "summary": "A bank statement redaction job succeeded.",
        "message": {
          "name": "bank_statement.redaction_succeeded",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "bank_statement.redaction_succeeded"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "bank_statement_id",
              "redaction_status"
            ],
            "properties": {
              "bank_statement_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "redaction_status": {
                "type": "string",
                "const": "succeeded"
              },
              "redaction_provider": {
                "type": "string",
                "enum": [
                  "azure",
                  "manual",
                  "none"
                ]
              }
            }
          }
        }
      }
    },
    "bank_statement.redaction_failed": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "bank_statement_redaction_failed",
        "summary": "A bank statement redaction job failed.",
        "message": {
          "name": "bank_statement.redaction_failed",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "bank_statement.redaction_failed"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-Signature": {
                "type": "string",
                "description": "v1=<hex> HMAC-SHA256"
              }
            }
          },
          "payload": {
            "type": "object",
            "required": [
              "bank_statement_id",
              "redaction_status"
            ],
            "properties": {
              "bank_statement_id": {
                "type": "string",
                "format": "uuid"
              },
              "project_id": {
                "type": "string",
                "format": "uuid",
                "nullable": true
              },
              "redaction_status": {
                "type": "string",
                "const": "failed"
              },
              "redaction_provider": {
                "type": "string",
                "enum": [
                  "azure",
                  "manual",
                  "none"
                ]
              },
              "error_message": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      }
    },
    "user.invited": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "user_invited",
        "summary": "A user was invited to the organization.",
        "message": {
          "name": "user.invited",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "user.invited"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-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"
              }
            }
          }
        }
      }
    },
    "organization.updated": {
      "x-instaclaim-delivery": "outbox",
      "publish": {
        "operationId": "organization_updated",
        "summary": "Organization profile or workspace metadata was updated.",
        "message": {
          "name": "organization.updated",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "organization.updated"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-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-instaclaim-delivery": "outbox",
      "x-instaclaim-emission": "planned",
      "publish": {
        "operationId": "integration_connected",
        "summary": "A native integration was connected for the tenant through a verified provider adapter.",
        "message": {
          "name": "integration.connected",
          "headers": {
            "type": "object",
            "required": [
              "X-InstaClaim-Event",
              "X-InstaClaim-Timestamp",
              "X-InstaClaim-Signature"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "integration.connected"
              },
              "X-InstaClaim-Timestamp": {
                "type": "string",
                "description": "Unix epoch seconds"
              },
              "X-InstaClaim-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-instaclaim-delivery": "synthetic",
      "x-instaclaim-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-InstaClaim-Event",
              "User-Agent"
            ],
            "properties": {
              "X-InstaClaim-Event": {
                "type": "string",
                "const": "webhook.test"
              },
              "User-Agent": {
                "type": "string",
                "const": "instaClaim-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"
              }
            }
          }
        }
      }
    }
  }
}
