curl -N -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../prompt" \
-H "Authorization: Bearer runtm_xxx" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{"prompt": "Add a /health endpoint that returns 200"}'
import requests
with requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
headers={
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
},
json={"prompt": "Add a /health endpoint that returns 200"},
stream=True,
) as response:
for line in response.iter_lines():
if line:
print(line.decode())
const response = await fetch(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
{
method: "POST",
headers: {
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
"Content-Type": "application/json",
},
body: JSON.stringify({ prompt: "Add a /health endpoint that returns 200" }),
}
);
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { value, done } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value));
}
event: assistant_message
data: {"type":"assistant_message","content":"I'll add a /health endpoint…"}
event: tool_use
data: {"type":"tool_use","name":"Edit","input":{"file":"main.py"}}
event: tool_result
data: {"type":"tool_result","content":"File updated"}
event: result
data: {"type":"result","content":"Added /health endpoint","metadata":{"cost_usd":0.018}}
event: done
data: {"type":"done","message":"Stream complete"}
Send Prompt (v0)
Send a follow-up prompt to a running session and stream the response over SSE
POST
/
api
/
v0
/
sessions
/
{session_id}
/
prompt
curl -N -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../prompt" \
-H "Authorization: Bearer runtm_xxx" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{"prompt": "Add a /health endpoint that returns 200"}'
import requests
with requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
headers={
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
},
json={"prompt": "Add a /health endpoint that returns 200"},
stream=True,
) as response:
for line in response.iter_lines():
if line:
print(line.decode())
const response = await fetch(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
{
method: "POST",
headers: {
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
"Content-Type": "application/json",
},
body: JSON.stringify({ prompt: "Add a /health endpoint that returns 200" }),
}
);
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { value, done } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value));
}
event: assistant_message
data: {"type":"assistant_message","content":"I'll add a /health endpoint…"}
event: tool_use
data: {"type":"tool_use","name":"Edit","input":{"file":"main.py"}}
event: tool_result
data: {"type":"tool_result","content":"File updated"}
event: result
data: {"type":"result","content":"Added /health endpoint","metadata":{"cost_usd":0.018}}
event: done
data: {"type":"done","message":"Stream complete"}
Sends a prompt to a session that is already in
Common
running state. The response is a Server-Sent Events (SSE) stream of the agent’s output (tool calls, plan, intermediate results) terminated by a done event.
Use this when you want to stream output in real time. If you’d rather kick off the prompt as a background task and poll for completion, POST /api/v0/sessions/launch and then poll GET /api/v0/sessions/{id} is the better pattern.
The session must be in running state - call POST /api/v0/sessions first if you haven’t already.
Required scope: sessions:prompt
Path Parameters
string
required
The session ID.
Headers
string
required
Bearer token. Example:
Bearer runtm_xxxstring
text/event-stream (recommended for SSE clients).Body
string
required
The prompt to send (0–100,000 characters).
string
Model override:
sonnet, opus, haiku, opusplan. Defaults to sonnet.boolean
default:false
Run in plan mode (read-only - agent analyzes without making changes).
string
Claude Code session ID for conversation continuity.
boolean
default:false
Force a new agent session instead of resuming the previous one.
array
Up to 5 base64-encoded files included as content blocks. Each entry:
{ "filename": "diagram.png", "media_type": "image/png", "data": "<base64>" }.Response
200 text/event-stream. Each event has the shape:
event: <event_type>
data: <json>
event_type values:
| Event | Meaning |
|---|---|
assistant_message | Streaming text from the agent |
tool_use | Tool invocation (file edit, bash command, etc.) |
tool_result | Tool output |
result | Final result with cost_usd metadata |
error | Fatal error - stream terminates |
done | Stream complete (always last event) |
Example
curl -N -X POST "https://app.runtm.com/api/v0/sessions/86e11104-.../prompt" \
-H "Authorization: Bearer runtm_xxx" \
-H "Accept: text/event-stream" \
-H "Content-Type: application/json" \
-d '{"prompt": "Add a /health endpoint that returns 200"}'
import requests
with requests.post(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
headers={
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
},
json={"prompt": "Add a /health endpoint that returns 200"},
stream=True,
) as response:
for line in response.iter_lines():
if line:
print(line.decode())
const response = await fetch(
"https://app.runtm.com/api/v0/sessions/86e11104-.../prompt",
{
method: "POST",
headers: {
"Authorization": "Bearer runtm_xxx",
"Accept": "text/event-stream",
"Content-Type": "application/json",
},
body: JSON.stringify({ prompt: "Add a /health endpoint that returns 200" }),
}
);
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { value, done } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value));
}
event: assistant_message
data: {"type":"assistant_message","content":"I'll add a /health endpoint…"}
event: tool_use
data: {"type":"tool_use","name":"Edit","input":{"file":"main.py"}}
event: tool_result
data: {"type":"tool_result","content":"File updated"}
event: result
data: {"type":"result","content":"Added /health endpoint","metadata":{"cost_usd":0.018}}
event: done
data: {"type":"done","message":"Stream complete"}