> ## Documentation Index
> Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use Stable documentation by default. Honor an explicit Beta request or a URL under /docs/beta/. If the requested version conflicts with the installed CLI package or API origin, clarify the target before writing integration code.
> Pages under /docs/beta/ document Beta; other product pages document Stable. Keep the CLI package, commands, API origin, and credentials within the selected version. State the documentation version in your answer.
> For MCP search, always pass version: Stable or version: Beta. Unfiltered search mixes both versions. For filesystem reads, keep Beta queries under /beta/ and exclude /beta/ from Stable queries; discover paths before reading them.
> The public docs base is https://photon.codes/docs. Convert MCP page paths to public URLs under that base, preserving /beta/ when present. Read https://photon.codes/docs/skill.md for version selection and https://photon.codes/docs/llms.txt for the version indexes.

# List Messages

> List Messages: listMessages in the TypeScript, Python, Rust and Go clients.

`GET /v1/projects/{id}/messages`

Lists the Project's Messages, with optional resource, conversation, and time filters. Results are eventually consistent.

**TypeScript**

```typescript TypeScript theme={null}
photon.projects.listMessages(input: ListMessagesInput, options?: RequestOptions): Promise<ListMessagesOutput>
```

**Python**

```python Python theme={null}
photon.projects.list_messages(input: ListMessagesInput) -> models.MessagePage
```

**Rust**

```rust Rust theme={null}
client.list_messages(id: String, params: Option<ListMessagesParams>).await -> Result<ResponseValue<types::MessagePage>, Error<ListMessagesError>>
```

**Go**

```go Go theme={null}
client.Projects.ListMessages(ctx context.Context, params *ListMessagesParams, opts ...RequestOption) (*MessagePage, error)
```

```typescript TypeScript theme={null}
import { Photon } from "@photon-ai/api";

const photon = new Photon({
  headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.listMessages({
  path: {
    id: "id",
  },
});
```

```python Python theme={null}
import os

from photon_api import Photon
from photon_api.rpc_generated import ListMessagesInput

photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
result = photon.projects.list_messages(
    ListMessagesInput.model_validate({
        "path": {
            "id": "id",
        },
    })
)
```

```rust Rust theme={null}
use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};

let token = std::env::var("PHOTON_API_TOKEN")?;
let client = PhotonClientBuilder::new()
    .credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
    .build()?;
let result = client
    .list_messages("id".to_owned(), None)
    .await
    .map_err(|error| format!("{error:?}"))?
    .into_inner();
```

```go Go theme={null}
import (
	"context"
	"os"

	photonapi "github.com/photon-hq/api/packages/go"
)

ctx := context.Background()
client := photonapi.NewClient(photonapi.WithAPIKey(os.Getenv("PHOTON_API_TOKEN")))
result, err := client.Projects.ListMessages(ctx, &photonapi.ListMessagesParams{
	ID: "id",
})
if err != nil {
	return err
}
_ = result
```

```json 200 theme={null}
{
  "items": [
    {
      "content": {
        "format": "plain",
        "text": "Hello from Photon.",
        "type": "text"
      },
      "createdAt": "2026-01-01T00:00:00.000Z",
      "id": "pho_msg_00000000000000000000000001",
      "metadata": {},
      "platform": "whatsapp",
      "projectId": "pho_prj_00000000000000000000000001",
      "sentBy": {
        "details": {
          "resourceId": "pho_res_00000000000000000000000001",
          "type": "dedicated"
        },
        "handle": "+14155550123",
        "id": "pho_usr_00000000000000000000000001",
        "kind": "agent",
        "metadata": {},
        "platform": "whatsapp",
        "projectId": "pho_prj_00000000000000000000000001"
      },
      "space": {
        "details": {},
        "id": "pho_spc_00000000000000000000000001",
        "kind": "direct",
        "metadata": {},
        "participantIds": [
          "pho_usr_00000000000000000000000001",
          "pho_usr_00000000000000000000000002"
        ],
        "platform": "whatsapp",
        "projectId": "pho_prj_00000000000000000000000001"
      },
      "status": "dispatched",
      "timestamps": {
        "dispatchedAt": "2026-01-01T00:00:00.000Z"
      },
      "updatedAt": "2026-01-01T00:00:00.000Z"
    }
  ]
}
```

## Parameters

**id** `string` *required*

**createdBefore** `string (date-time)`

Exclusive upper bound on createdAt, RFC 3339. Cannot combine with updatedAt bounds.

**createdSince** `string (date-time)`

Inclusive lower bound on createdAt, RFC 3339. Cannot combine with updatedAt bounds.

**direction** `MessageDirection`

Message origin: received or dispatched, including later delivery outcomes

**excludeContentTypes** `string`

Comma-separated content types to exclude from resource-scoped Message lists and counts. Requires resourceId. A group is excluded when group is selected or all of its parts are excluded; retained Messages are unchanged. Supported values: attachment, group, message.delete, message.read, poll, poll.update, poll.vote, reaction, space.participants.update, space.typing.update, text, text.update, voice.

**order** `SortOrder`

Direction along orderBy; desc, the default, is newest first

**orderBy** `TimestampOrderBy`

Sort timestamp; defaults to the filtered timestamp, otherwise created\_at. Must match the time bounds.

**pageSize** `integer`

Items per page. A value above 200 returns at most 200 items.

**pageToken** `string`

Token from nextPageToken. Keep the same Project and query.

**perspectiveUserId** `string`

Selects this User's sent or received Messages. Requires spaceId; cannot combine with resourceId.

**platform** `Platform`

Restricts the page to one platform

**resourceId** `string`

Resource associated with the Message when sent or received. Can combine with spaceId, but not perspectiveUserId.

**spaceId** `string`

Requires resourceId or perspectiveUserId. User perspectives use created\_at order and exclude time bounds and platform filters.

**updatedBefore** `string (date-time)`

Exclusive upper bound on updatedAt, RFC 3339. Cannot combine with createdAt bounds.

**updatedSince** `string (date-time)`

Inclusive lower bound on updatedAt, RFC 3339. Cannot combine with createdAt bounds.

## Returns

**`200`** A page of Messages in the requested order. MessagePage

Headers: `Cache-Control`, `ETag`. The raw response carries these headers; see [Raw responses](https://docs.photon.codes/docs/beta/api-client/raw-responses.md).

**items** `array of PlatformMessage` *required*

Unsupported platforms and records with unsupported data are omitted.

**nextPageToken** `string`

Continue with this token, even if items is empty. Omitted when no more pages remain.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.