Send a message to the assistant
curl --request POST \
--url https://sapi.withsutro.com/projects/{projectId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-sutro-api-client: <api-key>' \
--data '
{
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
'import requests
url = "https://sapi.withsutro.com/projects/{projectId}/messages"
payload = { "content": [
{
"type": "text",
"text": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"x-sutro-api-client": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-sutro-api-client': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({content: [{type: 'text', text: '<string>'}]})
};
fetch('https://sapi.withsutro.com/projects/{projectId}/messages', 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://sapi.withsutro.com/projects/{projectId}/messages",
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([
'content' => [
[
'type' => 'text',
'text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-sutro-api-client: <api-key>"
],
]);
$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://sapi.withsutro.com/projects/{projectId}/messages"
payload := strings.NewReader("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-sutro-api-client", "<api-key>")
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://sapi.withsutro.com/projects/{projectId}/messages")
.header("Authorization", "Bearer <token>")
.header("x-sutro-api-client", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sapi.withsutro.com/projects/{projectId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-sutro-api-client"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messageId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued"
}ai-assistant
Send a message to the assistant
Sends a user message to the assistant, which will process it asynchronously and may trigger changes to the application. The user message is stored in the conversation history. The response includes a job ID for tracking the processing status. The components that can be modified (frontend, backend, or both) are determined by the project’s components configuration set at project creation. This cannot be overridden.
Send a message to the assistant
curl --request POST \
--url https://sapi.withsutro.com/projects/{projectId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-sutro-api-client: <api-key>' \
--data '
{
"content": [
{
"type": "text",
"text": "<string>"
}
]
}
'import requests
url = "https://sapi.withsutro.com/projects/{projectId}/messages"
payload = { "content": [
{
"type": "text",
"text": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"x-sutro-api-client": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-sutro-api-client': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({content: [{type: 'text', text: '<string>'}]})
};
fetch('https://sapi.withsutro.com/projects/{projectId}/messages', 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://sapi.withsutro.com/projects/{projectId}/messages",
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([
'content' => [
[
'type' => 'text',
'text' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-sutro-api-client: <api-key>"
],
]);
$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://sapi.withsutro.com/projects/{projectId}/messages"
payload := strings.NewReader("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-sutro-api-client", "<api-key>")
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://sapi.withsutro.com/projects/{projectId}/messages")
.header("Authorization", "Bearer <token>")
.header("x-sutro-api-client", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sapi.withsutro.com/projects/{projectId}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-sutro-api-client"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messageId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued"
}Authorizations
Builder authentication and authorization
A unique identifier for the API Client making a request
Path Parameters
Body
application/json
The user message to send
Array of message parts containing the user's message
Show child attributes
Show child attributes
Was this page helpful?
⌘I