Conversations
Get message
Poll for the status and content of a specific message.
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",
"created_at": "2026-04-12T18:45:12.000Z",
"updated_at": "2026-04-12T18:47:03.000Z"
}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.