curl --request POST \
--url https://api.myustadia.com/api/v1/courses/{course_id}/assistant/start \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"fresh": false
}'import requests
url = "https://api.myustadia.com/api/v1/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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": {}
}
]
}Course Assistant Start
Open the course’s ONE conversation, or resume it if one is already open.
Issue #237: every surface that talks to this course — the chat page-load,
a voice ticket mint, a second browser tab — calls this same endpoint, and
it now returns the SAME session for as long as one stays open, instead of
minting a new, disjoint conversation on every call. The first call ever
(or the first call after the previous session closed) creates one: 201,
resumed: false. Every call while a session is still open resumes it
instead: 200, resumed: true, with the CURRENT state — question,
coverage, progress, draft_items, turn_count, and the digest /
suggestion fields when the course has documents — exactly as GET
/ would report it, never the stale values from whenever the
session was first created. message on a resume is a short “let’s pick up
where we left off” line, not the first-time opener.
Resuming also EXTENDS the conversation’s life: a session is expired after 30 idle minutes, and a resume counts as activity.
language is optional. On a create it sets the conversation’s language
(default fr); on a resume, supplying a different supported language
switches the conversation to it, and omitting it keeps the session’s own.
Set fresh: true to deliberately abandon the open conversation and start
over: every open session for this course is closed (their last seconds of
spend are billed through the same close path finish() uses) and a brand-new
one is created: 201, resumed: false. fresh has no effect when no session
is currently open — it just creates the first one, like a plain call. It is
refused with 409 turn_in_flight while a turn is still running on the
conversation: retry the reset once that turn returns.
A resumed session (the 200 path) touches NEITHER the daily session cap NOR the account’s quota floor gate: reading an existing conversation is never billed or capped as opening a new one.
Sandbox keys (sk_test_) diverge here on purpose: /start ALWAYS creates
(201, resumed: false) and fresh is accepted but has no effect, because a
sandbox session has no course or preset to be the one conversation OF.
curl --request POST \
--url https://api.myustadia.com/api/v1/courses/{course_id}/assistant/start \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"fresh": false
}'import requests
url = "https://api.myustadia.com/api/v1/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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/courses/{course_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 course already existed and is returned as it stands (resumed: true). 201 means a new one was created.