curl --request POST \
--url https://api.runflow.io/v1/models/{owner}/{slug}/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
{}
],
"metadata": {},
"callback_url": "<string>"
}
'import requests
url = "https://api.runflow.io/v1/models/{owner}/{slug}/batches"
payload = {
"input": [{}],
"metadata": {},
"callback_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: [{}], metadata: {}, callback_url: '<string>'})
};
fetch('https://api.runflow.io/v1/models/{owner}/{slug}/batches', 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.runflow.io/v1/models/{owner}/{slug}/batches",
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([
'input' => [
[
]
],
'metadata' => [
],
'callback_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.runflow.io/v1/models/{owner}/{slug}/batches"
payload := strings.NewReader("{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.runflow.io/v1/models/{owner}/{slug}/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runflow.io/v1/models/{owner}/{slug}/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target_type": "<string>",
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status_code": "<string>",
"items_total": 123,
"items_succeeded": 123,
"items_failed": 123,
"items_cancelled": 123,
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_index": 123,
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status_code": "<string>",
"client_ref": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"output": {},
"cost": "<string>",
"metadata": {},
"callback_url": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}Create and dispatch a batch
Create a Batch + N child Run rows + thin batch_items junction rows.
Only binding-capable (template-backed) models support batches today — per-provider-only models return 422 on this route.
Idempotency: customers may send an Idempotency-Key request
header. Handling lives in the global IdempotencyMiddleware
(core/middleware/idempotency.py) — not this route. Same key +
same body replays the cached 201 (same batch_id, no second
batch); same key + different body returns 409 CONFLICT; absent
header falls through to first-write-wins.
curl --request POST \
--url https://api.runflow.io/v1/models/{owner}/{slug}/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": [
{}
],
"metadata": {},
"callback_url": "<string>"
}
'import requests
url = "https://api.runflow.io/v1/models/{owner}/{slug}/batches"
payload = {
"input": [{}],
"metadata": {},
"callback_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: [{}], metadata: {}, callback_url: '<string>'})
};
fetch('https://api.runflow.io/v1/models/{owner}/{slug}/batches', 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.runflow.io/v1/models/{owner}/{slug}/batches",
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([
'input' => [
[
]
],
'metadata' => [
],
'callback_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.runflow.io/v1/models/{owner}/{slug}/batches"
payload := strings.NewReader("{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.runflow.io/v1/models/{owner}/{slug}/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runflow.io/v1/models/{owner}/{slug}/batches")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n {}\n ],\n \"metadata\": {},\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target_type": "<string>",
"target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status_code": "<string>",
"items_total": 123,
"items_succeeded": 123,
"items_failed": 123,
"items_cancelled": 123,
"items": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence_index": 123,
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status_code": "<string>",
"client_ref": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"output": {},
"cost": "<string>",
"metadata": {},
"callback_url": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z"
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}{
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
POST body for creating a batch.
input is an array of per-item objects. Each item is validated
independently against the target model's ModelInput declarations.
Each item may carry an optional client_ref (≤255 chars, stripped
before model validation); the model's own input shape fills the rest.
Response
Successful Response
POST /batches response — batch fields + items handle list.
Shape matches the customer contract (docs/api/contracts/
batch-endpoint-api-surface.md "Response shape" section). Distinct from
Batch.FullValidator which exposes additional internal fields for
admin callers.
Show child attributes
Show child attributes
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$