> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.youratlas.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.youratlas.com/_mcp/server.

# Get chat messages

GET https://api.youratlas.com/v1/api/campaign-chat/sessions/{sessionId}/messages

Reference: https://docs.youratlas.com/api-reference/atlas-api/campaign-chat/get-chat-messages

## Authentication

- `api-key` header (required) — Your Atlas API key. Get it from the Atlas Portal under Settings > API Keys.

## Request

### Path parameters

- `sessionId` (string, required)

## Response

### 200

Successful response

- `odata.metadata` (string, optional)
- `value` (list of ChatMessage, optional)

## Errors

### 500 Internal Server Error

Internal server error

- `error` (ErrorError, optional)

## Types

### ChatMessage

A single message in a session. Uses Azure Table Storage (PascalCase) conventions. For a clean human-readable transcript, keep records where `Content` is present and `Role` is `user` or `assistant`, dropping tool turns; on channels that set it, `Channel === 'imessage'` further narrows to iMessage traffic.

- `PartitionKey` (string, optional)
- `RowKey` (string, optional) — Message id. Multi-part tool turns are suffixed `_0`, `_1`, … on a shared base id.
- `Timestamp` (datetime, optional)
- `Role` (enum, optional)
  - Allowed values: `assistant`, `user`, `system`, `tool`
- `Content` (string, optional)
- `Channel` (enum, optional) — Delivery channel. Conditional — set on real sends; absent on internal records (tool calls/results, raw inbound user messages).
  - Allowed values: `imessage`, `sms`, `rcs`, `whatsapp`
- `CreatedAt` (datetime, optional)
- `Status` (enum, optional) — `delivered` for real outbound sends. `internal` marks tool calls/results and raw inbound user messages (not customer-visible sends).
  - Allowed values: `internal`, `queued`, `sent`, `delivered`, `failed`
- `ChatPhoneNumberId` (string, optional) — Conditional — present on real sends, absent on internal records.

### ErrorError

- `message` (string, optional)
- `code` (string, optional)
- `requestId` (string, optional)

## Examples

**Response**

```json
{
  "odata.metadata": "string",
  "value": [
    {
      "PartitionKey": "string",
      "RowKey": "string",
      "Timestamp": "2024-01-15T09:30:00Z",
      "Role": "assistant",
      "Content": "string",
      "Channel": "imessage",
      "CreatedAt": "2024-01-15T09:30:00Z",
      "Status": "internal",
      "ChatPhoneNumberId": "string"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages"

headers = {"api-key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages';
const options = {method: 'GET', headers: {'api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages")
  .header("api-key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages', [
  'headers' => [
    'api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages");
var request = new RestRequest(Method.GET);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/campaign-chat/sessions/sessionId/messages")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```