{
  "openapi": "3.0.0",
  "info": {
    "title": "Hystruct API",
    "version": "1.0.0"
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    },
    "schemas": {}
  },
  "paths": {
    "/v1/workflows/{workflowId}/data": {
      "get": {
        "summary": "Get all workflow data",
        "description": "Get all of the data for a specific workflow",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflowId",
            "required": true,
            "description": "workflow ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Successful response",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unauthorized",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No workflow found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "No workflow found",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/workflows/{workflowId}/queue": {
      "post": {
        "summary": "Create new job",
        "description": "Create and queue a new job to run for the workflow",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "workflowId",
            "required": true,
            "description": "workflow ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Successful response",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - perhaps because there is already a job queued",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request - perhaps because there is already a job queued",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No workflow found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "No workflow found",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/webhooks/list": {
      "get": {
        "summary": "List all webhooks",
        "description": "Show all webhooks for a team",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Successful response",
                  "type": "object",
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "events": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No workflow found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "No workflow found",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/webhooks/subscribe": {
      "post": {
        "summary": "Subscribe new webhook",
        "description": "Create and subscribe a new webhook",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["workflowId", "webhookUrl", "events"],
                "properties": {
                  "workflowId": {
                    "type": "string",
                    "description": "workflow ID"
                  },
                  "webhookUrl": {
                    "type": "string",
                    "description": "Webhook URL"
                  },
                  "events": {
                    "type": "array",
                    "description": "The events to subscribe to"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Successful response",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No workflow found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "No workflow found",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/integrations/webhooks/unsubscribe": {
      "delete": {
        "summary": "Unsubscribe webhook",
        "description": "Unsubscribe an existing webhook",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "webhookId",
            "required": true,
            "description": "webhook id"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Successful response",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - perhaps because there is already a job queued",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Bad request - perhaps because there is already a job queued",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No workflow found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "No workflow found",
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.hystruct.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "externalDocs": {
    "url": "https://docs.hystruct.com",
    "description": "Documentation"
  }
}
