# List messages

Returns all messages for a single conversation.





Returns all messages for a single conversation.

```http
GET /api/public/v1/conversations/{job_id}/messages
```

## Example [#example]

<Tabs items="[&#x22;bash&#x22;, &#x22;TypeScript&#x22;, &#x22;Ruby&#x22;, &#x22;Python&#x22;, &#x22;Go&#x22;]">
  <Tab value="bash">
    ```bash
    curl -X GET https://api.nairi.ai/api/public/v1/conversations/JOB_ID/messages \
      -H "Authorization: Bearer $NAIRI_API_KEY"
    ```
  </Tab>

  <Tab value="TypeScript">
    ```ts
    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 }>;
    };
    ```
  </Tab>

  <Tab value="Ruby">
    ```ruby
    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)
    ```
  </Tab>

  <Tab value="Python">
    ```python
    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()
    ```
  </Tab>

  <Tab value="Go">
    ```go
    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)
    }
    ```
  </Tab>
</Tabs>

## Response [#response]

```json
{
  "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"
    }
  ]
}
```

<Callout type="info">
  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](/api/conversations/message-reference).
</Callout>

## Response with a system error message [#response-with-a-system-error-message]

When an agent encounters an error, a `system` message is appended:

```json
{
  "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"
    }
  ]
}
```
