{
  "openapi": "3.1.1",
  "info": {
    "title": "FlowPrime router",
    "description": "Webhook routing for a FlowPrime organization: routes, delivery, replay and logs. Tenant is resolved from the {org} subdomain or the X-Org-Slug header.",
    "version": "2.2.0-afc9f87"
  },
  "servers": [
    {
      "url": "https://{org}.router.fastflow.tech",
      "description": "Tenant host. The org slug is also accepted as the X-Org-Slug header.",
      "variables": {
        "org": {
          "default": "your-org",
          "description": "Your FlowPrime organization slug"
        }
      }
    }
  ],
  "paths": {
    "/webhook/{tenantId}": {
      "post": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/webhook/{tenantId}/flowprime": {
      "post": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/webhook/{tenantId}/github": {
      "post": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/databases": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/live": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/health/ready": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/login": {
      "get": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "returnUrl",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "login_hint",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "prompt",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/callback": {
      "get": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/my-accounts": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/switch-account": {
      "post": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/auth/logout": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/routes": {
      "get": {
        "tags": [
          "Router"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name",
                  "matchField",
                  "matchValue",
                  "destinationUrl",
                  "destinationSecret",
                  "priority"
                ],
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "matchField": {
                    "type": "string"
                  },
                  "matchValue": {
                    "type": "string"
                  },
                  "destinationUrl": {
                    "type": "string"
                  },
                  "destinationSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "priority": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "format": "int32"
                  },
                  "active": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "Router"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name",
                  "matchField",
                  "matchValue",
                  "destinationUrl",
                  "destinationSecret",
                  "priority"
                ],
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "matchField": {
                    "type": "string"
                  },
                  "matchValue": {
                    "type": "string"
                  },
                  "destinationUrl": {
                    "type": "string"
                  },
                  "destinationSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "priority": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "format": "int32"
                  },
                  "active": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/routes/{routeId}": {
      "put": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "routeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name",
                  "matchField",
                  "matchValue",
                  "destinationUrl",
                  "destinationSecret",
                  "priority",
                  "active"
                ],
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "matchField": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "matchValue": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "destinationUrl": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "destinationSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "priority": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "format": "int32"
                  },
                  "active": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "routeId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name",
                  "matchField",
                  "matchValue",
                  "destinationUrl",
                  "destinationSecret",
                  "priority",
                  "active"
                ],
                "type": "object",
                "properties": {
                  "name": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "matchField": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "matchValue": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "destinationUrl": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "destinationSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "priority": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "format": "int32"
                  },
                  "active": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/logs": {
      "get": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          {
            "name": "eventType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "eventIdSearch",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/logs/{eventId}": {
      "get": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "eventId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/stats": {
      "get": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/test": {
      "post": {
        "tags": [
          "Router"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "payload"
                ],
                "type": "object",
                "properties": {
                  "payload": { },
                  "eventType": {
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/replay/{logId}": {
      "post": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "logId",
            "in": "path",
            "required": true,
            "schema": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/admin/logs/{eventId}/status": {
      "get": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "eventId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/superadmin/tenants": {
      "get": {
        "tags": [
          "Router"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "id",
                  "name",
                  "stripeWebhookSecret",
                  "gitHubWebhookSecret"
                ],
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "stripeWebhookSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "gitHubWebhookSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "Router"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "id",
                  "name",
                  "stripeWebhookSecret",
                  "gitHubWebhookSecret"
                ],
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "stripeWebhookSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "gitHubWebhookSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/superadmin/tenants/{tenantId}": {
      "put": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/superadmin/tenants/{tenantId}/flowprime-events": {
      "put": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/superadmin/tenants/{tenantId}/routes": {
      "post": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "required": [
                  "name",
                  "matchField",
                  "matchValue",
                  "destinationUrl",
                  "destinationSecret",
                  "priority"
                ],
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "matchField": {
                    "type": "string"
                  },
                  "matchValue": {
                    "type": "string"
                  },
                  "destinationUrl": {
                    "type": "string"
                  },
                  "destinationSecret": {
                    "type": [
                      "null",
                      "string"
                    ]
                  },
                  "priority": {
                    "pattern": "^-?(?:0|[1-9]\\d*)$",
                    "type": [
                      "null",
                      "integer",
                      "string"
                    ],
                    "format": "int32"
                  },
                  "active": {
                    "type": [
                      "null",
                      "boolean"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/provision": {
      "post": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/activate": {
      "post": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/deactivate": {
      "post": {
        "tags": [
          "Router"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/tenants/{orgSlug}": {
      "delete": {
        "tags": [
          "Router"
        ],
        "parameters": [
          {
            "name": "orgSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Router"
    }
  ]
}