curl --request POST \
--url https://api.example.com/api/v1/decide \
--header 'Content-Type: multipart/form-data' \
--form 'instructions=<string>' \
--form 'schema=<string>' \
--form 'file=<string>' \
--form 'url=<string>' \
--form 'url_headers=<string>' \
--form 'context=<string>' \
--form include_steps=false \
--form sync=true \
--form 'webhook_url=<string>' \
--form file.0='@example-file'import requests
url = "https://api.example.com/api/v1/decide"
files = { "file.0": ("example-file", open("example-file", "rb")) }
payload = {
"instructions": "<string>",
"schema": "<string>",
"file": "<string>",
"url": "<string>",
"url_headers": "<string>",
"context": "<string>",
"include_steps": "false",
"sync": "true",
"webhook_url": "<string>"
}
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('instructions', '<string>');
form.append('schema', '<string>');
form.append('file', '<string>');
form.append('url', '<string>');
form.append('url_headers', '<string>');
form.append('context', '<string>');
form.append('include_steps', 'false');
form.append('sync', 'true');
form.append('webhook_url', '<string>');
form.append('file.0', '{
"fileName": "example-file"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.example.com/api/v1/decide', 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/api/v1/decide",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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/api/v1/decide"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/api/v1/decide")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/decide")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"confidence": {
"destination_path": 0.92
},
"content_type": "application/pdf",
"credits_used": 5,
"data": {
"destination_path": "billing/Acme Corp/2026/Apr"
},
"filename": "invoice.pdf",
"model_used": "gpt-5.1",
"reasoning": "The invoice names Acme Corp and is dated April 2026; the instruction files by client, then year, then month, and 'billing/Acme Corp' already exists in the provided folder list.",
"sources": [
"Bill To: Acme Corp",
"Invoice Date: April 3, 2026"
],
"success": true,
"text_length": 3200,
"total_pages": 2
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}Make a Decision
Make one coherent decision about a document (or pure context), guided by explicit instructions and caller-supplied context.
Unlike /analyze — which researches each schema field independently — /decide
answers the whole schema in a single reasoning pass with tools (reading, search,
computation, vision) available on the way. Use it when the fields are facets of
one judgment: where to file a document, which branch a workflow should take,
what to rename a file.
Request parts:
instructions(required): what decision to make and what makes it correct.context(optional): JSON array of{"label": ..., "content": ...}blocks — folder listings, sibling decisions, established facts. Authoritative for the decision.schema(required): typed schema of the decision fields.file/url(optional): the document. Omit both for context-only decisions.
Response: data (schema-shaped, enforced by structured outputs), per-field
confidence, a single reasoning string for the whole decision, and sources.
Failures are errors: provider overload returns 503 with Retry-After;
provider errors return 502. A 200 always contains a real decision.
Pricing: 2 credits/page (min 5) for documents, 10 for websites, 5 for context-only.
curl --request POST \
--url https://api.example.com/api/v1/decide \
--header 'Content-Type: multipart/form-data' \
--form 'instructions=<string>' \
--form 'schema=<string>' \
--form 'file=<string>' \
--form 'url=<string>' \
--form 'url_headers=<string>' \
--form 'context=<string>' \
--form include_steps=false \
--form sync=true \
--form 'webhook_url=<string>' \
--form file.0='@example-file'import requests
url = "https://api.example.com/api/v1/decide"
files = { "file.0": ("example-file", open("example-file", "rb")) }
payload = {
"instructions": "<string>",
"schema": "<string>",
"file": "<string>",
"url": "<string>",
"url_headers": "<string>",
"context": "<string>",
"include_steps": "false",
"sync": "true",
"webhook_url": "<string>"
}
response = requests.post(url, data=payload, files=files)
print(response.text)const form = new FormData();
form.append('instructions', '<string>');
form.append('schema', '<string>');
form.append('file', '<string>');
form.append('url', '<string>');
form.append('url_headers', '<string>');
form.append('context', '<string>');
form.append('include_steps', 'false');
form.append('sync', 'true');
form.append('webhook_url', '<string>');
form.append('file.0', '{
"fileName": "example-file"
}');
const options = {method: 'POST'};
options.body = form;
fetch('https://api.example.com/api/v1/decide', 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/api/v1/decide",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data"
],
]);
$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/api/v1/decide"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
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/api/v1/decide")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/decide")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"instructions\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"schema\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url_headers\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"include_steps\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sync\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file.0\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"confidence": {
"destination_path": 0.92
},
"content_type": "application/pdf",
"credits_used": 5,
"data": {
"destination_path": "billing/Acme Corp/2026/Apr"
},
"filename": "invoice.pdf",
"model_used": "gpt-5.1",
"reasoning": "The invoice names Acme Corp and is dated April 2026; the instruction files by client, then year, then month, and 'billing/Acme Corp' already exists in the provided folder list.",
"sources": [
"Bill To: Acme Corp",
"Invoice Date: April 3, 2026"
],
"success": true,
"text_length": 3200,
"total_pages": 2
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}{
"detail": "File size exceeds maximum allowed (50MB)",
"error": "validation_error",
"success": false
}Headers
Body
What decision to make, and what makes it correct
Typed schema of the decision fields
Document to decide about
URL to fetch the document from
JSON-encoded headers for URL auth
JSON array of {"label", "content"} context blocks
Include the agent's tool-call trace
Set to false to process asynchronously. Returns a task_id to poll.
URL to POST the result to when async processing completes.
Response
Successful Response
Response for /decide — ONE coherent decision over the whole schema.
Unlike /analyze, reasoning is a single string and sources a single
list: the fields are facets of one judgment, so they share one rationale.
A failed decision is an HTTP error, never a null-with-zero-confidence.
Decision values keyed by field name
Model used for the decision
Per-field confidence scores (0.0–1.0)
Show child attributes
Show child attributes
One coherent explanation of the decision as a whole
Quotes from the document/context that support the decision
Agent tool-call trace. Empty unless include_steps=true.
Show child attributes
Show child attributes
Original filename or URL (null for context-only decisions)
Detected MIME type
Length of extracted document text (0 for context-only)
Total pages in the document (0 for non-paginated files)
Credits consumed
Schema format: always 'typed'
typed