Skip to main content
POST
/
apis
/
request
/
workflow
/
run
cURL
curl --request POST \
--url https://api.nfig.ai/apis/request/run/workflows \
--header 'api-key: <api-key>' \
--header 'content-type: application/json' \
--data '{
  "workflowId": "<workflowId>"
}'
import requests

url = "https://api.nfig.ai/apis/request/run/workflows"
headers = {
"api-key": "<api-key>",
"content-type": "application/json"
}
payload = {
"workflowId": "<workflowId>"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
const url = 'https://api.nfig.ai/apis/request/run/workflows';
const headers = {
'api-key': '<api-key>',
'content-type': 'application/json'
};
const payload = {
workflowId: '<workflowId>'
};

fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$url = "https://api.nfig.ai/apis/request/run/workflows";
$headers = array(
"api-key: <api-key>",
"content-type: application/json"
);
$payload = array(
"workflowId" => "<workflowId>"
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
package main

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)

func main() {
url := "https://api.nfig.ai/apis/request/run/workflows"
payload := map[string]string{
"workflowId": "<workflowId>",
}

jsonPayload, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
req.Header.Set("api-key", "<api-key>")
req.Header.Set("content-type", "application/json")

client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class WorkflowRequest {
public static void main(String[] args) {
try {
URL url = new URL("https://api.nfig.ai/apis/request/run/workflows");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("api-key", "<api-key>");
conn.setRequestProperty("content-type", "application/json");
conn.setDoOutput(true);

String jsonInput = "{\"workflowId\":\"<workflowId>\"}";
try(OutputStream os = conn.getOutputStream()) {
byte[] input = jsonInput.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}

int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
conn.disconnect();
} catch(Exception e) {
e.printStackTrace();
}
}
}
require 'uri'
require 'net/http'

url = URI("https://api.nfig.ai/apis/request/workflow/run")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workflowId\": \"<string>\",\n \"proxy\": false,\n \"variables\": {\n \"var1\": \"<value>\",\n \"var2\": \"<value>\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "sessionId": "<string>",
  "previewUrl": "<string>"
}

Authorizations

api-key
string
header
required

Body

application/json
workflowId
string
required

workflow id for initiating a run

proxy
boolean
default:false

Turn on proxy for workflow session

variables
object

An object with dynamic keys and values

Example:
{ "var1": "<value>", "var2": "<value>" }

Response

200 - application/json

Success Response

sessionId
string
required

Workflow session id

previewUrl
string
required

Live preview url for the workflow session