{
  "openapi": "3.1.0",
  "info": {
    "title": "Ospree Webhooks API",
    "description": "API for managing webhooks within the Ospree platform.",
    "contact": {
      "name": "Ospree",
      "url": "https://www.ospree.io/",
      "email": "support@ospree.io"
    },
    "version": "2.0.0",
    "x-ospree-baseline": {
      "legacy_repo": "webhook-management-service",
      "legacy_ref": "main",
      "legacy_sha": "c985a217dbf2765a23c8938d191a7488a556b165",
      "rendered_by": "scripts/export_openapi.py @ chore/openapi-gitbook-migration (blob bdb39ae1f7eaad4111fb17111090ac8b1e9e59f5)",
      "api_prefix": "/api/v2",
      "surface": "/api/v2/ only \u2014 see scripts/legacy_baseline.py",
      "adr": "ADR-0035"
    }
  },
  "paths": {
    "/api/v2/webhooks": {
      "get": {
        "tags": [
          "Webhook Management"
        ],
        "summary": "List Webhooks",
        "operationId": "list_webhooks_api_v2_webhooks_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_List_WebhookConfigurationView__"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Webhook Management"
        ],
        "summary": "Configure Webhook",
        "operationId": "configure_webhook_api_v2_webhooks_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfigureWebhookRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_WebhookConfiguration_"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v2/webhooks/event_types": {
      "get": {
        "tags": [
          "Webhook Management"
        ],
        "summary": "List Webhook Event Types",
        "operationId": "list_webhook_event_types_api_v2_webhooks_event_types_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_List_WebhookEventTypeResponse__"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/api/v2/webhooks/{id}": {
      "delete": {
        "tags": [
          "Webhook Management"
        ],
        "summary": "Delete Webhook",
        "operationId": "delete_webhook_api_v2_webhooks__id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_bool_"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/webhooks/requests": {
      "get": {
        "tags": [
          "Webhook Requests"
        ],
        "summary": "List Webhook Requests",
        "description": "List webhook requests for a business.",
        "operationId": "list_webhook_requests_api_v2_webhooks_requests_get",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Type"
            }
          },
          {
            "name": "event_name",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Name"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "title": "Page"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 10,
              "title": "Size"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_Page_WebhookRequestResponse__"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/webhooks/requests/{request_id}": {
      "post": {
        "tags": [
          "Webhook Requests"
        ],
        "summary": "Retry Webhook Request",
        "description": "Get a specific webhook request by ID.",
        "operationId": "retry_webhook_request_api_v2_webhooks_requests__request_id__post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Request Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiSuccessResponse_WebhookRequestResponse_"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiSuccessResponse_List_WebhookConfigurationView__": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WebhookConfigurationView"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[List[WebhookConfigurationView]]"
      },
      "ApiSuccessResponse_List_WebhookEventTypeResponse__": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/WebhookEventTypeResponse"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[List[WebhookEventTypeResponse]]"
      },
      "ApiSuccessResponse_Page_WebhookRequestResponse__": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Page_WebhookRequestResponse_"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[Page[WebhookRequestResponse]]"
      },
      "ApiSuccessResponse_WebhookConfiguration_": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookConfiguration"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[WebhookConfiguration]"
      },
      "ApiSuccessResponse_WebhookRequestResponse_": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookRequestResponse"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[WebhookRequestResponse]"
      },
      "ApiSuccessResponse_bool_": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "success"
          },
          "data": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data"
          }
        },
        "type": "object",
        "title": "ApiSuccessResponse[bool]"
      },
      "ConfigureWebhookRequest": {
        "properties": {
          "webhook_url": {
            "type": "string",
            "title": "Webhook Url"
          },
          "event_names": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Names"
          },
          "ip_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip Allowlist"
          },
          "event_type": {
            "type": "integer",
            "title": "Event Type"
          }
        },
        "type": "object",
        "required": [
          "webhook_url",
          "event_type"
        ],
        "title": "ConfigureWebhookRequest",
        "example": {
          "event_names": [
            "event1",
            "event2"
          ],
          "event_type": 1,
          "ip_allowlist": [
            "00.00.00.xx",
            "00.00.00.xx"
          ],
          "webhook_url": "http://example.com/webhook"
        }
      },
      "Page_WebhookRequestResponse_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/WebhookRequestResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Total"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Page"
          },
          "size": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Size"
          },
          "pages": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Pages"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "page",
          "size"
        ],
        "title": "Page[WebhookRequestResponse]"
      },
      "WebhookConfiguration": {
        "properties": {
          "webhook_url": {
            "type": "string",
            "title": "Webhook Url"
          },
          "event_names": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Names"
          },
          "ip_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip Allowlist"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "event_type": {
            "type": "integer",
            "title": "Event Type"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "title": "Business Id"
          },
          "created_by": {
            "type": "string",
            "format": "uuid",
            "title": "Created By"
          },
          "created": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created"
          },
          "modified_by": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Modified By"
          },
          "last_modified": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Modified"
          },
          "webhook_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Secret"
          }
        },
        "type": "object",
        "required": [
          "webhook_url",
          "id",
          "event_type",
          "business_id",
          "created_by"
        ],
        "title": "WebhookConfiguration"
      },
      "WebhookConfigurationView": {
        "properties": {
          "webhook_url": {
            "type": "string",
            "title": "Webhook Url"
          },
          "event_names": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Names"
          },
          "ip_allowlist": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ip Allowlist"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "title": "Business Id"
          },
          "event_type": {
            "type": "string",
            "title": "Event Type"
          },
          "modified_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Modified By"
          },
          "last_modified": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Modified"
          },
          "webhook_desc": {
            "type": "string",
            "title": "Webhook Desc"
          },
          "webhook_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Secret"
          }
        },
        "type": "object",
        "required": [
          "webhook_url",
          "id",
          "business_id",
          "event_type",
          "webhook_desc"
        ],
        "title": "WebhookConfigurationView"
      },
      "WebhookEventTypeResponse": {
        "properties": {
          "event_type_name": {
            "type": "string",
            "title": "Event Type Name"
          },
          "event_type_id": {
            "type": "string",
            "title": "Event Type Id"
          }
        },
        "type": "object",
        "required": [
          "event_type_name",
          "event_type_id"
        ],
        "title": "WebhookEventTypeResponse",
        "example": {
          "event_type_id": "1",
          "event_type_name": "travel_rule"
        }
      },
      "WebhookRequestResponse": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "webhook_url": {
            "type": "string",
            "title": "Webhook Url"
          },
          "event_type": {
            "type": "string",
            "title": "Event Type"
          },
          "event_name": {
            "type": "string",
            "title": "Event Name"
          },
          "status": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "request_payload": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Request Payload"
          },
          "error_details": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "title": "Error Details"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          }
        },
        "type": "object",
        "required": [
          "id",
          "webhook_url",
          "event_type",
          "event_name",
          "timestamp"
        ],
        "title": "WebhookRequestResponse"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
