curl --request POST \
--url https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"goal": "<string>"
}
'import requests
url = "https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/"
payload = { "goal": "<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({goal: '<string>'})
};
fetch('https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/', 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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/",
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([
'goal' => '<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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/"
payload := strings.NewReader("{\n \"goal\": \"<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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"goal\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/")
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 \"goal\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"issues": [
{
"input": "<string>",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Draft a whole cadence from a goal, streaming the work
The streaming form of the draft: the same replacement of the graph with AI-drafted steps, sent as Server-Sent Events. The first frame is turn, carrying the generation_id a Stop is sent to; then a step frame for each thing the drafter actually did (read_context, read_documents when the workspace has any, plan, write_steps, finish), each with its measured duration; then one result frame with the sequence as the plain route returns it, sent once the graph is saved.
Failures arrive as an error frame, because the stream has already answered 200: reason limit or paused when the workspace’s daily AI Assistant allowance refused the draft, not_found and locked for what the plain route answers 404 and 423 to, stopped when the caller stopped it, and no reason for anything else. Counts against the allowance; a stopped or failed draft gives its turn back.
Closing the connection does not stop the draft; the Stop route does.
curl --request POST \
--url https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"goal": "<string>"
}
'import requests
url = "https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/"
payload = { "goal": "<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({goal: '<string>'})
};
fetch('https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/', 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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/",
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([
'goal' => '<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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/"
payload := strings.NewReader("{\n \"goal\": \"<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.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"goal\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getoneprofile.ai/sequences/{sequence_id}/generate-campaign/stream/")
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 \"goal\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>",
"issues": [
{
"input": "<string>",
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
§CMP-14. One line describing what the campaign is for.
3 - 1000Response
A stream of Server-Sent Events; the final result frame's data is the sequence with its drafted graph.
The response is of type string.
Was this page helpful?