curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"text": "Also add a test for the redaction.",
"answers": [
{
"question_index": 0,
"selected_label": "Both call sites",
"selected_labels": [
"Redis",
"MongoDB"
],
"custom_text": "Only the retry path"
}
],
"approve": true,
"input_request_id": "<string>",
"author": "Dana"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages"
payload = {
"text": "Also add a test for the redaction.",
"answers": [
{
"question_index": 0,
"selected_label": "Both call sites",
"selected_labels": ["Redis", "MongoDB"],
"custom_text": "Only the retry path"
}
],
"approve": True,
"input_request_id": "<string>",
"author": "Dana"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Also add a test for the redaction.',
answers: [
{
question_index: 0,
selected_label: 'Both call sites',
selected_labels: ['Redis', 'MongoDB'],
custom_text: 'Only the retry path'
}
],
approve: true,
input_request_id: '<string>',
author: 'Dana'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/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([
'text' => 'Also add a test for the redaction.',
'answers' => [
[
'question_index' => 0,
'selected_label' => 'Both call sites',
'selected_labels' => [
'Redis',
'MongoDB'
],
'custom_text' => 'Only the retry path'
]
],
'approve' => true,
'input_request_id' => '<string>',
'author' => 'Dana'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages"
payload := strings.NewReader("{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}"
response = http.request(request)
puts response.read_body{
"id": "6820f3a4e7b91d003c45a1f9",
"state": "pending",
"session": {
"id": "6820f3a4e7b91d003c45a1f2",
"state": "running",
"message_id": "ca00e880-1111-4444-aaaa-ccddeeff0011",
"repository_full_name": "acme/project",
"branch_id": "6820f3a4e7b91d003c45a1f3",
"branch_name": "codex/session-6820f3a4e7b91d003c45a1f2",
"session_url": "https://app.base44.com/apps/6820f3a4e7b91d003c45a1f2/editor/preview",
"pull_request": {
"number": 123,
"url": "https://github.com/acme/project/pull/123"
},
"error_code": "execution_failed",
"launch_key": "flag-cleanup-123",
"client_reference": "release-task-123",
"input_request_id": "ca00e880-1111-4444-aaaa-ccddeeff0011",
"outcome": "pull_request",
"summary": "Removed the retired flag and kept the enabled behavior."
},
"error_code": null
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}Send a message to a coding session
Send a message, an answer or an approval to a coding session. While the session works, the message is folded into its current turn; while it waits for input, text or answers answers the open question and approve answers an approval request; after it completes, fails or is cancelled, the message starts a follow-up turn on the same branch and its pull request updates. The request returns before delivery: poll the session for progress. Only the session’s own user can send messages; set author to attribute text to someone else in a shared conversation. Send input_request_id with an answer so a session that has moved on refuses it with input_request_changed, also when the session moved on before delivery. Requires an Idempotency-Key; retries with the same key and body return the same input. Starts paid work like a launch. Limited to 30 requests per minute per user.
curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"text": "Also add a test for the redaction.",
"answers": [
{
"question_index": 0,
"selected_label": "Both call sites",
"selected_labels": [
"Redis",
"MongoDB"
],
"custom_text": "Only the retry path"
}
],
"approve": true,
"input_request_id": "<string>",
"author": "Dana"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages"
payload = {
"text": "Also add a test for the redaction.",
"answers": [
{
"question_index": 0,
"selected_label": "Both call sites",
"selected_labels": ["Redis", "MongoDB"],
"custom_text": "Only the retry path"
}
],
"approve": True,
"input_request_id": "<string>",
"author": "Dana"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'Also add a test for the redaction.',
answers: [
{
question_index: 0,
selected_label: 'Both call sites',
selected_labels: ['Redis', 'MongoDB'],
custom_text: 'Only the retry path'
}
],
approve: true,
input_request_id: '<string>',
author: 'Dana'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/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([
'text' => 'Also add a test for the redaction.',
'answers' => [
[
'question_index' => 0,
'selected_label' => 'Both call sites',
'selected_labels' => [
'Redis',
'MongoDB'
],
'custom_text' => 'Only the retry path'
]
],
'approve' => true,
'input_request_id' => '<string>',
'author' => 'Dana'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages"
payload := strings.NewReader("{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/imported/sessions/{session_id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Also add a test for the redaction.\",\n \"answers\": [\n {\n \"question_index\": 0,\n \"selected_label\": \"Both call sites\",\n \"selected_labels\": [\n \"Redis\",\n \"MongoDB\"\n ],\n \"custom_text\": \"Only the retry path\"\n }\n ],\n \"approve\": true,\n \"input_request_id\": \"<string>\",\n \"author\": \"Dana\"\n}"
response = http.request(request)
puts response.read_body{
"id": "6820f3a4e7b91d003c45a1f9",
"state": "pending",
"session": {
"id": "6820f3a4e7b91d003c45a1f2",
"state": "running",
"message_id": "ca00e880-1111-4444-aaaa-ccddeeff0011",
"repository_full_name": "acme/project",
"branch_id": "6820f3a4e7b91d003c45a1f3",
"branch_name": "codex/session-6820f3a4e7b91d003c45a1f2",
"session_url": "https://app.base44.com/apps/6820f3a4e7b91d003c45a1f2/editor/preview",
"pull_request": {
"number": 123,
"url": "https://github.com/acme/project/pull/123"
},
"error_code": "execution_failed",
"launch_key": "flag-cleanup-123",
"client_reference": "release-task-123",
"input_request_id": "ca00e880-1111-4444-aaaa-ccddeeff0011",
"outcome": "pull_request",
"summary": "Removed the retired flag and kept the enabled behavior."
},
"error_code": null
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "App not found",
"details": {}
}
}Authorizations
Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.
Headers
A unique key for this message. Retrying with the same key and body returns the same input instead of delivering it twice; a different body with the same key returns idempotency_conflict.
1 - 200^[A-Za-z0-9_.:-]+$"thread-reply-1715000000.0001"
Path Parameters
The session's identifier.
^[a-f0-9]{24}$"6820f3a4e7b91d003c45a1f2"
Body
A message for the session. While it works, the message is folded into the current turn; while it waits for input, it answers the open question; after it finishes, it starts a follow-up turn on the same branch.
1 - 20000"Also add a test for the redaction."
Structured answers to the open question, by question index. Requires input_request_id.
1 - 10 elementsShow child attributes
Show child attributes
Approve (true) or decline (false) the open approval request. Requires input_request_id.
The input_request_id from Get a coding session's open question. A session that has moved on refuses the input with input_request_changed.
1 - 100Who wrote the message, when it isn't the session's own user, for example a teammate in a shared thread. The text is attributed to them.
1 - 100"Dana"
Response
Successful Response
The input's identifier.
"6820f3a4e7b91d003c45a1f9"
pending until the session takes the input.
pending, delivered, failed "pending"
Show child attributes
Show child attributes
Why a failed input wasn't delivered, for example input_request_changed, session_busy, cancelled or delivery_interrupted; null otherwise.
null
Was this page helpful?