Get message
Poll for the status and content of a specific message in a Nairi conversation. Returns the role, body, and current state — useful while an agent runs.
Poll for the status and content of a specific message.
GET /api/public/v1/messages/{message_id}Example
curl -X GET https://api.nairi.ai/api/public/v1/messages/MESSAGE_ID \
-H "Authorization: Bearer $NAIRI_API_KEY"const res = await fetch(
`https://api.nairi.ai/api/public/v1/messages/${messageId}`,
{
headers: {
Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
},
},
);
const message = (await res.json()) as {
id: string;
status: string;
content: string;
};require "net/http"
require "json"
require "uri"
uri = URI("https://api.nairi.ai/api/public/v1/messages/#{message_id}")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV['NAIRI_API_KEY']}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |h| h.request(req) }
message = JSON.parse(res.body)import os
import requests
res = requests.get(
f"https://api.nairi.ai/api/public/v1/messages/{message_id}",
headers={"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}"},
)
message = res.json()package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
messageID := os.Getenv("MESSAGE_ID")
req, _ := http.NewRequest(
"GET",
"https://api.nairi.ai/api/public/v1/messages/"+messageID,
nil,
)
req.Header.Set("Authorization", "Bearer "+os.Getenv("NAIRI_API_KEY"))
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
raw, _ := io.ReadAll(res.Body)
var message map[string]any
json.Unmarshal(raw, &message)
fmt.Println(message)
}Responses
Queued or pending. The agent is still processing:
{
"id": "cmsg_01KRK1V475HBTME8QJQMAPWK16",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "Your task description",
"role": "user",
"status": "pending",
"created_at": "2026-04-12T18:45:12.000Z",
"updated_at": "2026-04-12T18:45:12.000Z"
}Completed. The agent returned a response:
{
"id": "cmsg_01KRK1WBPN3GSE0VWYTH4ZPN3R",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "README.md created with quickstart instructions.",
"role": "assistant",
"status": "completed",
"cost_usd": 0.0231840000,
"input_tokens": 1842,
"output_tokens": 318,
"cache_read_tokens": 24517,
"cache_write_tokens": 1842,
"model": "claude-opus-4-7",
"created_at": "2026-04-12T18:45:12.000Z",
"updated_at": "2026-04-12T18:47:03.000Z"
}The cost_usd, *_tokens, and model fields are present on assistant messages when the agent reports usage data (Claude Code and OpenCode harnesses do; Cursor does not). See Cost and token usage for field semantics.
Failed. The message could not be processed:
{
"id": "cmsg_01KRK1V475HBTME8QJQMAPWK16",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "Your task description",
"role": "user",
"status": "failed",
"created_at": "2026-04-12T18:45:12.000Z",
"updated_at": "2026-04-12T18:45:30.000Z"
}When a message fails, look for a sibling role: "system" message on the same job_id for details. See List messages.
Continue
Append another user message to an existing Nairi conversation. The agent picks it up in-thread and continues from the prior context. Returns a new message ID.
List messages
Returns the full ordered list of messages — both user and agent — for a single Nairi conversation by ID, with status and content fields included.