{
  "openapi": "3.0.3",
  "info": {
    "title": "Biky Flows API",
    "version": "1.0.0",
    "description": "Start your Biky Flows automations from your own systems. A flow whose trigger is a **Custom Webhook** gets a unique URL: every JSON you POST to it runs the flow, and a **Webhook response** node lets the flow answer the caller."
  },
  "servers": [
    {
      "url": "https://kbflows-v2.keybeapi.com",
      "description": "Production"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Webhooks",
      "description": "Trigger a flow from an external system."
    }
  ],
  "paths": {
    "/webhook/integration-webhook-activate/{webhookId}": {
      "parameters": [
        {
          "name": "webhookId",
          "in": "path",
          "required": true,
          "description": "Id of the webhook: the last segment of the URL shown in the flow's Custom Webhook trigger (copy the whole URL from the editor). It is the only credential of this route, so keep it secret.",
          "schema": {
            "type": "string"
          },
          "example": "a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6"
        }
      ],
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "triggerFlowWebhook",
        "summary": "Trigger a flow",
        "description": "Runs the flow that owns this webhook with the JSON you send, synchronously. No `Authorization` header: the `webhookId` in the URL is the secret. The **first** request you send is saved as the sample the editor uses to map fields, so send a representative payload first. If the flow reaches a **Webhook response** node, the HTTP status and body are the ones configured there; otherwise you get `{ success, targetNode, executionId }` with HTTP 200, even when a node failed (`success: false`). A deactivated flow answers 200 with `Webflow inactive` and does nothing. The gateway waits at most 29 s: longer flows return 504 but keep running. The engine reserves these top-level keys, do not send them: `webhookHash`, `webhook`, `executionMode`, `safeMode`, `executionId`, `triggeredByUserId`, `triggeredByAppUUID`, `resumeFromNodeId`, `retryAttempt`, `autobotContext`.",
        "security": [],
        "requestBody": {
          "required": true,
          "description": "Any JSON object. Its fields are available to the next nodes of the flow.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Free-form JSON object. The body must be valid JSON (otherwise 500)."
              },
              "example": {
                "event": "lead.created",
                "lead": {
                  "name": "Laura Gómez",
                  "phone": "+573001234567",
                  "email": "laura@example.com",
                  "source": "landing-page"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The flow ran (or is inactive). Without a Webhook response node this is the run summary.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Result of the run when the flow has no Webhook response node.",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "`false` when a node threw an error (the run is marked as failed and may be retried automatically)."
                    },
                    "message": {
                      "type": "string",
                      "description": "Present on failures and when the flow is inactive (`Webflow inactive`)."
                    },
                    "error": {
                      "type": "string",
                      "description": "Error of the node that failed."
                    },
                    "targetNode": {
                      "type": "string",
                      "nullable": true,
                      "description": "Node the run stopped at (`null` when it reached the end of the flow)."
                    },
                    "executionId": {
                      "type": "string",
                      "description": "Id of the run, visible in the flow's execution history."
                    },
                    "statusCode": {
                      "type": "integer",
                      "description": "Only present when the flow is inactive (`200`)."
                    }
                  }
                },
                "examples": {
                  "completed": {
                    "summary": "Flow completed",
                    "value": {
                      "success": true,
                      "targetNode": null,
                      "executionId": "6720a1b2c3d4e5f6a7b8c9d0"
                    }
                  },
                  "nodeFailed": {
                    "summary": "A node failed",
                    "value": {
                      "success": false,
                      "message": "Node execution failed",
                      "error": "Request failed with status code 422",
                      "executionId": "6720a1b2c3d4e5f6a7b8c9d0"
                    }
                  },
                  "inactive": {
                    "summary": "Flow deactivated",
                    "value": {
                      "statusCode": 200,
                      "success": true,
                      "message": "Webflow inactive"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No webhook with this id (`Webhook not found`), or its trigger node or flow no longer exists (`Node not found`, `Webflow not found`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "description": "Same as the HTTP status."
                    },
                    "success": {
                      "type": "boolean",
                      "description": "Always `false`."
                    },
                    "message": {
                      "type": "string",
                      "description": "Reason."
                    }
                  }
                },
                "example": {
                  "statusCode": 404,
                  "success": false,
                  "message": "Webhook not found"
                }
              }
            }
          },
          "500": {
            "description": "The body is not valid JSON, or an unexpected error happened.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "statusCode": {
                      "type": "integer",
                      "description": "Same as the HTTP status."
                    },
                    "success": {
                      "type": "boolean",
                      "description": "Always `false`."
                    },
                    "message": {
                      "type": "string",
                      "description": "Reason."
                    }
                  }
                },
                "example": {
                  "success": false,
                  "message": "Internal server error"
                }
              }
            }
          },
          "504": {
            "description": "The flow took longer than 29 s. The gateway stops waiting but the run continues.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Gateway message."
                    }
                  }
                },
                "example": {
                  "message": "Endpoint request timed out"
                }
              }
            }
          },
          "default": {
            "description": "Custom response: when the flow reaches a **Webhook response** node, the HTTP status is the node's status code and the body is the node's body (variables resolved; returned as JSON when it is a JSON object or array).",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Whatever the Webhook response node defines."
                },
                "example": {
                  "received": true,
                  "leadId": "665f1c2e8a4b3d0012ab34cd"
                }
              }
            }
          }
        }
      }
    }
  }
}
