curl --request POST \
--url https://api.ionworks.com/protocols/generate \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"current_protocol": "<string>",
"clarifications": [
{
"question": "<string>",
"answer": "<string>"
}
],
"cell_specification_id": "<string>",
"skip_existing": false,
"allow_inputs": false
}
'import requests
url = "https://api.ionworks.com/protocols/generate"
payload = {
"prompt": "<string>",
"current_protocol": "<string>",
"clarifications": [
{
"question": "<string>",
"answer": "<string>"
}
],
"cell_specification_id": "<string>",
"skip_existing": False,
"allow_inputs": False
}
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({
prompt: '<string>',
current_protocol: '<string>',
clarifications: [{question: '<string>', answer: '<string>'}],
cell_specification_id: '<string>',
skip_existing: false,
allow_inputs: false
})
};
fetch('https://api.ionworks.com/protocols/generate', 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.ionworks.com/protocols/generate",
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([
'prompt' => '<string>',
'current_protocol' => '<string>',
'clarifications' => [
[
'question' => '<string>',
'answer' => '<string>'
]
],
'cell_specification_id' => '<string>',
'skip_existing' => false,
'allow_inputs' => false
]),
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.ionworks.com/protocols/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\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.ionworks.com/protocols/generate")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/protocols/generate")
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 \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\n}"
response = http.request(request)
puts response.read_body{
"protocol_yaml": "",
"name": "",
"explanation": "",
"assumptions": [
"<string>"
],
"questions": [
{
"question": "<string>",
"why": "",
"options": [
"<string>"
]
}
],
"matches": {
"template_ids": [
"<string>"
],
"note": ""
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Generate Protocol Endpoint
Generate a UCP protocol from a natural-language description.
When the description leaves a value undecided that would change what runs
on the channel, the response carries questions and no protocol. Answer
them and call again with the full clarifications history.
Any protocol that is returned has already passed the same validation as
POST /protocols/validate and contains no unresolved input["..."]
references, so it can be saved as an experiment template directly.
Parameters
body : GenerateProtocolRequest The natural-language prompt, any answers already given, and an optional existing protocol to edit rather than replace.
Returns
GenerateProtocolResponse Either the generated YAML with a suggested name, an explanation, and the assumptions made — or the questions needed to write it.
Raises
ExternalServiceError If the model could not produce a valid protocol.
curl --request POST \
--url https://api.ionworks.com/protocols/generate \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"current_protocol": "<string>",
"clarifications": [
{
"question": "<string>",
"answer": "<string>"
}
],
"cell_specification_id": "<string>",
"skip_existing": false,
"allow_inputs": false
}
'import requests
url = "https://api.ionworks.com/protocols/generate"
payload = {
"prompt": "<string>",
"current_protocol": "<string>",
"clarifications": [
{
"question": "<string>",
"answer": "<string>"
}
],
"cell_specification_id": "<string>",
"skip_existing": False,
"allow_inputs": False
}
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({
prompt: '<string>',
current_protocol: '<string>',
clarifications: [{question: '<string>', answer: '<string>'}],
cell_specification_id: '<string>',
skip_existing: false,
allow_inputs: false
})
};
fetch('https://api.ionworks.com/protocols/generate', 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.ionworks.com/protocols/generate",
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([
'prompt' => '<string>',
'current_protocol' => '<string>',
'clarifications' => [
[
'question' => '<string>',
'answer' => '<string>'
]
],
'cell_specification_id' => '<string>',
'skip_existing' => false,
'allow_inputs' => false
]),
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.ionworks.com/protocols/generate"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\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.ionworks.com/protocols/generate")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ionworks.com/protocols/generate")
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 \"prompt\": \"<string>\",\n \"current_protocol\": \"<string>\",\n \"clarifications\": [\n {\n \"question\": \"<string>\",\n \"answer\": \"<string>\"\n }\n ],\n \"cell_specification_id\": \"<string>\",\n \"skip_existing\": false,\n \"allow_inputs\": false\n}"
response = http.request(request)
puts response.read_body{
"protocol_yaml": "",
"name": "",
"explanation": "",
"assumptions": [
"<string>"
],
"questions": [
{
"question": "<string>",
"why": "",
"options": [
"<string>"
]
}
],
"matches": {
"template_ids": [
"<string>"
],
"note": ""
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
Request body for generating a protocol from natural language.
Response
Successful Response
A protocol, the questions needed to write one, or an existing match.
Exactly one branch is populated. Callers should check questions and
matches before reading protocol_yaml — both leave it empty.
Was this page helpful?