curl --request POST \
--url https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"fresh": false
}'import requests
url = "https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start"
payload = { "fresh": False }
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({fresh: false})
};
fetch('https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start', 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.myustadia.com/api/v1/presets/{preset_id}/assistant/start",
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([
'fresh' => false
]),
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.myustadia.com/api/v1/presets/{preset_id}/assistant/start"
payload := strings.NewReader("{\n \"fresh\": false\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.myustadia.com/api/v1/presets/{preset_id}/assistant/start")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fresh\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start")
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 \"fresh\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Preset Assistant Start
Open the preset’s ONE profile conversation, or resume it if one is already open.
Issue #237: identical get-or-create contract as the course endpoint (see
its docstring), keyed on this preset instead of a course. The first call
(or the first after the previous session closed) creates a session: 201,
resumed: false. A call while one is still open resumes it: 200,
resumed: true, with the current question, coverage, progress and draft,
a “let’s pick up where we left off” message, and a refreshed idle
timeout. language switches the conversation’s language on a resume when
supplied and different; omitting it keeps the session’s own.
fresh: true closes every open session for this preset (billing their last
seconds through the same close path finish() uses) and opens a genuinely new
one; it is refused with 409 turn_in_flight while a turn is still running.
A resumed session touches neither the daily session cap nor the quota floor
gate. Sandbox keys always create (resumed: false), see the course
endpoint’s docstring.
curl --request POST \
--url https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"fresh": false
}'import requests
url = "https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start"
payload = { "fresh": False }
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({fresh: false})
};
fetch('https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start', 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.myustadia.com/api/v1/presets/{preset_id}/assistant/start",
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([
'fresh' => false
]),
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.myustadia.com/api/v1/presets/{preset_id}/assistant/start"
payload := strings.NewReader("{\n \"fresh\": false\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.myustadia.com/api/v1/presets/{preset_id}/assistant/start")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fresh\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.myustadia.com/api/v1/presets/{preset_id}/assistant/start")
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 \"fresh\": false\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
The conversation's language ('fr', 'en', 'darija', 'es'; 'fr' when omitted on a create). On a RESUME, supplying a different supported language SWITCHES the conversation to it; omitting the field keeps the session's own language. Two consequences of switching, both deliberate: it is refused with 409 turn_in_flight while a turn is running (the running turn already answers in the old language), and it can invalidate a voice surface -- a session whose language is not voice-enabled cannot mint a voice ticket, so switching to one strands any voice client on that conversation. Send it only when the user really changed language.
Issue #237: /start returns the SAME open session for this subject by default (resumed: true). Set fresh=true to close it and start a brand-new conversation instead (resumed: false). No effect when no session is open, and no effect at all on a sandbox key (sk_test_ always creates). Refused with 409 turn_in_flight while a turn is still running on the conversation.
Response
RESUMED: an open conversation for this preset already existed and is returned as it stands (resumed: true). 201 means a new one was created.