Post a follow-up user message to an existing session.
POST /rest/v1/sessions/{session_id}/messages
Posts a follow-up user message to an existing session and starts a new agent turn. The response returns a fresh chat_thread_id — use it to build the polling URL for the assistant’s reply.
Follow-ups can be sent at any time, including while the agent is still working on a previous turn. They will interrupt the in-flight turn.
const followup = await fetch( `https://api.blocks.team/rest/v1/sessions/${sessionId}/messages`, { method: "POST", headers: { Authorization: `ApiKey ${process.env.BLOCKS_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ message: "Cool — now tell me one about cuttlefish." }), },).then((r) => r.json());// Poll followup._links.final_message.href to receive the assistant's reply.
import os, requestsfollowup = requests.post( f"https://api.blocks.team/rest/v1/sessions/{session_id}/messages", headers={ "Authorization": f"ApiKey {os.environ['BLOCKS_API_KEY']}", "Content-Type": "application/json", }, json={"message": "Cool — now tell me one about cuttlefish."},).json()# Poll followup["_links"]["final_message"]["href"] to receive the assistant's reply.
curl -X POST "https://api.blocks.team/rest/v1/sessions/$SESSION_ID/messages" \ -H "Authorization: ApiKey $BLOCKS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"message": "Cool — now tell me one about cuttlefish."}'
import java.net.URI;import java.net.http.*;HttpResponse<String> res = HttpClient.newHttpClient().send( HttpRequest.newBuilder(URI.create( "https://api.blocks.team/rest/v1/sessions/" + sessionId + "/messages")) .header("Authorization", "ApiKey " + System.getenv("BLOCKS_API_KEY")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString( "{\"message\":\"Cool — now tell me one about cuttlefish.\"}")) .build(), HttpResponse.BodyHandlers.ofString());
require "net/http"require "json"followup = JSON.parse(Net::HTTP.post( URI("https://api.blocks.team/rest/v1/sessions/#{session_id}/messages"), JSON.generate({ message: "Cool — now tell me one about cuttlefish." }), { "Authorization" => "ApiKey #{ENV['BLOCKS_API_KEY']}", "Content-Type" => "application/json", },).body)
body, _ := json.Marshal(map[string]string{ "message": "Cool — now tell me one about cuttlefish.",})req, _ := http.NewRequest("POST", "https://api.blocks.team/rest/v1/sessions/"+sessionID+"/messages", bytes.NewReader(body))req.Header.Set("Authorization", "ApiKey "+os.Getenv("BLOCKS_API_KEY"))req.Header.Set("Content-Type", "application/json")res, _ := http.DefaultClient.Do(req)
The new thread created for this turn. Prefer _links.final_message.href for polling — this field is exposed for cases where you need the thread ID directly.