Conversations
List messages
Returns all messages for a single conversation.
Returns all messages for a single conversation.
GET /api/public/v1/conversations/{job_id}/messagesExample
curl -X GET https://api.nairi.ai/api/public/v1/conversations/JOB_ID/messages \
-H "Authorization: Bearer $NAIRI_API_KEY"const res = await fetch(
`https://api.nairi.ai/api/public/v1/conversations/${jobId}/messages`,
{
headers: {
Authorization: `Bearer ${process.env.NAIRI_API_KEY}`,
},
},
);
const data = (await res.json()) as {
messages: Array<{ id: string; role: string; content: string; status: string }>;
};require "net/http"
require "json"
require "uri"
uri = URI("https://api.nairi.ai/api/public/v1/conversations/#{job_id}/messages")
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) }
data = JSON.parse(res.body)import os
import requests
res = requests.get(
f"https://api.nairi.ai/api/public/v1/conversations/{job_id}/messages",
headers={"Authorization": f"Bearer {os.environ['NAIRI_API_KEY']}"},
)
data = res.json()package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
jobID := os.Getenv("JOB_ID")
req, _ := http.NewRequest(
"GET",
"https://api.nairi.ai/api/public/v1/conversations/"+jobID+"/messages",
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 data map[string]any
json.Unmarshal(raw, &data)
fmt.Println(data)
}Response
{
"messages": [
{
"id": "cmsg_01KRK1V475HBTME8QJQMAPWK16",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "Your task description",
"role": "user",
"status": "completed",
"created_at": "2026-04-12T18:45:12.000Z",
"updated_at": "2026-04-12T18:45:12.000Z"
},
{
"id": "cmsg_01KRK1WBPN3GSE0VWYTH4ZPN3R",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "Task completed successfully.",
"role": "assistant",
"status": "completed",
"created_at": "2026-04-12T18:47:03.000Z",
"updated_at": "2026-04-12T18:47:03.000Z"
}
]
}In addition to user, assistant, and system messages, this endpoint may also return progress messages whose content is a JSON envelope describing the agent's intermediate state (text deltas, tool calls, etc.). Most integrators can safely ignore these. See Message reference.
Response with a system error message
When an agent encounters an error, a system message is appended:
{
"messages": [
{
"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"
},
{
"id": "cmsg_01KRK1XDKE3MSPRTNDXCXTQK8K",
"job_id": "job_01KRK1V46BXS73CSNK2VR35NPJ",
"content": "nairid encountered error: unexpected error occurred",
"role": "system",
"status": "completed",
"created_at": "2026-04-12T18:45:30.000Z",
"updated_at": "2026-04-12T18:45:30.000Z"
}
]
}