Skip to main content
POST
/
deployments
/
{id}
/
create_flow_run
/
bulk
Bulk Create Flow Runs From Deployment
curl --request POST \
  --url https://api.example.com/deployments/{id}/create_flow_run/bulk \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "state": {
      "name": "<string>",
      "message": "<string>",
      "data": "<unknown>",
      "state_details": {
        "flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "child_flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "scheduled_time": "2023-11-07T05:31:56Z",
        "cache_key": "<string>",
        "cache_expiration": "2023-11-07T05:31:56Z",
        "deferred": false,
        "untrackable_result": false,
        "pause_timeout": "2023-11-07T05:31:56Z",
        "pause_reschedule": false,
        "pause_key": "<string>",
        "run_input_keyset": {},
        "refresh_cache": true,
        "retriable": true,
        "transition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "task_parameters_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "traceparent": "<string>",
        "deployment_concurrency_lease_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      }
    },
    "name": "<string>",
    "parameters": {},
    "enforce_parameter_schema": true,
    "context": {},
    "infrastructure_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "empirical_policy": {
      "max_retries": 0,
      "retry_delay_seconds": 0,
      "retries": 123,
      "retry_delay": 123,
      "pause_keys": [
        "<string>"
      ],
      "resuming": false
    },
    "tags": [
      "<string>"
    ],
    "idempotency_key": "<string>",
    "labels": {
      "key": "value1",
      "key2": 42
    },
    "parent_task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "work_queue_name": "<string>",
    "job_variables": {}
  }
]
'
import requests

url = "https://api.example.com/deployments/{id}/create_flow_run/bulk"

payload = [
{
"state": {
"name": "<string>",
"message": "<string>",
"data": "<unknown>",
"state_details": {
"flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"child_flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"scheduled_time": "2023-11-07T05:31:56Z",
"cache_key": "<string>",
"cache_expiration": "2023-11-07T05:31:56Z",
"deferred": False,
"untrackable_result": False,
"pause_timeout": "2023-11-07T05:31:56Z",
"pause_reschedule": False,
"pause_key": "<string>",
"run_input_keyset": {},
"refresh_cache": True,
"retriable": True,
"transition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"task_parameters_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"traceparent": "<string>",
"deployment_concurrency_lease_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
},
"name": "<string>",
"parameters": {},
"enforce_parameter_schema": True,
"context": {},
"infrastructure_document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"empirical_policy": {
"max_retries": 0,
"retry_delay_seconds": 0,
"retries": 123,
"retry_delay": 123,
"pause_keys": ["<string>"],
"resuming": False
},
"tags": ["<string>"],
"idempotency_key": "<string>",
"labels": {
"key": "value1",
"key2": 42
},
"parent_task_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"work_queue_name": "<string>",
"job_variables": {}
}
]
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{
state: {
name: '<string>',
message: '<string>',
data: '<unknown>',
state_details: {
flow_run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
task_run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
child_flow_run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
scheduled_time: '2023-11-07T05:31:56Z',
cache_key: '<string>',
cache_expiration: '2023-11-07T05:31:56Z',
deferred: false,
untrackable_result: false,
pause_timeout: '2023-11-07T05:31:56Z',
pause_reschedule: false,
pause_key: '<string>',
run_input_keyset: {},
refresh_cache: true,
retriable: true,
transition_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
task_parameters_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
traceparent: '<string>',
deployment_concurrency_lease_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
},
name: '<string>',
parameters: {},
enforce_parameter_schema: true,
context: {},
infrastructure_document_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
empirical_policy: {
max_retries: 0,
retry_delay_seconds: 0,
retries: 123,
retry_delay: 123,
pause_keys: ['<string>'],
resuming: false
},
tags: ['<string>'],
idempotency_key: '<string>',
labels: {key: 'value1', key2: 42},
parent_task_run_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
work_queue_name: '<string>',
job_variables: {}
}
])
};

fetch('https://api.example.com/deployments/{id}/create_flow_run/bulk', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/deployments/{id}/create_flow_run/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'state' => [
'name' => '<string>',
'message' => '<string>',
'data' => '<unknown>',
'state_details' => [
'flow_run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'task_run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'child_flow_run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'scheduled_time' => '2023-11-07T05:31:56Z',
'cache_key' => '<string>',
'cache_expiration' => '2023-11-07T05:31:56Z',
'deferred' => false,
'untrackable_result' => false,
'pause_timeout' => '2023-11-07T05:31:56Z',
'pause_reschedule' => false,
'pause_key' => '<string>',
'run_input_keyset' => [

],
'refresh_cache' => true,
'retriable' => true,
'transition_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'task_parameters_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'traceparent' => '<string>',
'deployment_concurrency_lease_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'name' => '<string>',
'parameters' => [

],
'enforce_parameter_schema' => true,
'context' => [

],
'infrastructure_document_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'empirical_policy' => [
'max_retries' => 0,
'retry_delay_seconds' => 0,
'retries' => 123,
'retry_delay' => 123,
'pause_keys' => [
'<string>'
],
'resuming' => false
],
'tags' => [
'<string>'
],
'idempotency_key' => '<string>',
'labels' => [
'key' => 'value1',
'key2' => 42
],
'parent_task_run_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'work_queue_name' => '<string>',
'job_variables' => [

]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/deployments/{id}/create_flow_run/bulk"

payload := strings.NewReader("[\n {\n \"state\": {\n \"name\": \"<string>\",\n \"message\": \"<string>\",\n \"data\": \"<unknown>\",\n \"state_details\": {\n \"flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"child_flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduled_time\": \"2023-11-07T05:31:56Z\",\n \"cache_key\": \"<string>\",\n \"cache_expiration\": \"2023-11-07T05:31:56Z\",\n \"deferred\": false,\n \"untrackable_result\": false,\n \"pause_timeout\": \"2023-11-07T05:31:56Z\",\n \"pause_reschedule\": false,\n \"pause_key\": \"<string>\",\n \"run_input_keyset\": {},\n \"refresh_cache\": true,\n \"retriable\": true,\n \"transition_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_parameters_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"traceparent\": \"<string>\",\n \"deployment_concurrency_lease_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n },\n \"name\": \"<string>\",\n \"parameters\": {},\n \"enforce_parameter_schema\": true,\n \"context\": {},\n \"infrastructure_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"empirical_policy\": {\n \"max_retries\": 0,\n \"retry_delay_seconds\": 0,\n \"retries\": 123,\n \"retry_delay\": 123,\n \"pause_keys\": [\n \"<string>\"\n ],\n \"resuming\": false\n },\n \"tags\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"labels\": {\n \"key\": \"value1\",\n \"key2\": 42\n },\n \"parent_task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"work_queue_name\": \"<string>\",\n \"job_variables\": {}\n }\n]")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/deployments/{id}/create_flow_run/bulk")
.header("Content-Type", "application/json")
.body("[\n {\n \"state\": {\n \"name\": \"<string>\",\n \"message\": \"<string>\",\n \"data\": \"<unknown>\",\n \"state_details\": {\n \"flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"child_flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduled_time\": \"2023-11-07T05:31:56Z\",\n \"cache_key\": \"<string>\",\n \"cache_expiration\": \"2023-11-07T05:31:56Z\",\n \"deferred\": false,\n \"untrackable_result\": false,\n \"pause_timeout\": \"2023-11-07T05:31:56Z\",\n \"pause_reschedule\": false,\n \"pause_key\": \"<string>\",\n \"run_input_keyset\": {},\n \"refresh_cache\": true,\n \"retriable\": true,\n \"transition_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_parameters_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"traceparent\": \"<string>\",\n \"deployment_concurrency_lease_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n },\n \"name\": \"<string>\",\n \"parameters\": {},\n \"enforce_parameter_schema\": true,\n \"context\": {},\n \"infrastructure_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"empirical_policy\": {\n \"max_retries\": 0,\n \"retry_delay_seconds\": 0,\n \"retries\": 123,\n \"retry_delay\": 123,\n \"pause_keys\": [\n \"<string>\"\n ],\n \"resuming\": false\n },\n \"tags\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"labels\": {\n \"key\": \"value1\",\n \"key2\": 42\n },\n \"parent_task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"work_queue_name\": \"<string>\",\n \"job_variables\": {}\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/deployments/{id}/create_flow_run/bulk")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"state\": {\n \"name\": \"<string>\",\n \"message\": \"<string>\",\n \"data\": \"<unknown>\",\n \"state_details\": {\n \"flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"child_flow_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"scheduled_time\": \"2023-11-07T05:31:56Z\",\n \"cache_key\": \"<string>\",\n \"cache_expiration\": \"2023-11-07T05:31:56Z\",\n \"deferred\": false,\n \"untrackable_result\": false,\n \"pause_timeout\": \"2023-11-07T05:31:56Z\",\n \"pause_reschedule\": false,\n \"pause_key\": \"<string>\",\n \"run_input_keyset\": {},\n \"refresh_cache\": true,\n \"retriable\": true,\n \"transition_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"task_parameters_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"traceparent\": \"<string>\",\n \"deployment_concurrency_lease_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n },\n \"name\": \"<string>\",\n \"parameters\": {},\n \"enforce_parameter_schema\": true,\n \"context\": {},\n \"infrastructure_document_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"empirical_policy\": {\n \"max_retries\": 0,\n \"retry_delay_seconds\": 0,\n \"retries\": 123,\n \"retry_delay\": 123,\n \"pause_keys\": [\n \"<string>\"\n ],\n \"resuming\": false\n },\n \"tags\": [\n \"<string>\"\n ],\n \"idempotency_key\": \"<string>\",\n \"labels\": {\n \"key\": \"value1\",\n \"key2\": 42\n },\n \"parent_task_run_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"work_queue_name\": \"<string>\",\n \"job_variables\": {}\n }\n]"

response = http.request(request)
puts response.read_body
{
  "results": [
    {
      "flow_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "error": "<string>"
    }
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Headers

x-prefect-api-version
string

Path Parameters

id
string<uuid>
required

The deployment id

Body

application/json
state
StateCreate · object | null

The state of the flow run to create

name
string

The name of the flow run. Defaults to a random slug if not specified.

Example:

"my-flow-run"

parameters
Parameters · object
enforce_parameter_schema
boolean | null

Whether or not to enforce the parameter schema on this run.

context
Context · object
infrastructure_document_id
string<uuid> | null
empirical_policy
FlowRunPolicy · object

The empirical policy for the flow run.

tags
string[]

A list of tags for the flow run.

Example:
["tag-1", "tag-2"]
idempotency_key
string | null

An optional idempotency key. If a flow run with the same idempotency key has already been created, the existing flow run will be returned.

labels
Labels · object | null

A dictionary of key-value labels. Values can be strings, numbers, or booleans.

Example:
{ "key": "value1", "key2": 42 }
parent_task_run_id
string<uuid> | null
work_queue_name
string | null
job_variables
Job Variables · object

Response

Successful Response

Response from bulk flow run creation.

results
FlowRunCreateResult · object[]