Create a new flow
This endpoint allows to create new flows. The template should be a valid template_name or template_id (from GET /templates). Parameters allow to control the flow execution (details about the parameters are provided in GET /templates as well). Additional data is optional and can be used to store user-specific information. Inputs are optional and allow to directly upload input files (e.g., images) to the flow. Important: when inputs are provided the flow will start automatically.
Endpoint
POSThttps://flows.generio.ai/flows
Request Body
Schema
{
"additional": {}
}
- template (string)
- parameters (any)
- additional (any): Optional additional user data that is stored with flow.
- inputs (any): Optional list of input files, each with file_data and optional additional information.
Code Examples
Copy and run these examples in your terminal or code editor.Make sure to replace YOUR_TOKEN with your actual authentication token.
- cURL
- wget
- Python
- JavaScript
- PHP
curl -X POST "https://flows.generio.ai/flows" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"additional": {}
}'
wget --method=POST \
--header="Authorization: Bearer YOUR_TOKEN" \
--header="Content-Type: application/json" \
--body-data='{
"additional": {}
}' \
"https://flows.generio.ai/flows" -O -
import requests
url = "https://flows.generio.ai/flows"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
}
payload = {
"additional": {}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://flows.generio.ai/flows";
const payload = {
"additional": {}
};
fetch(url, {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
<?php
$url = "https://flows.generio.ai/flows";
$jsonData = <<<'JSON'
{
"additional": {}
}
JSON;
$data = json_decode($jsonData, true);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_TOKEN",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);