---
title: "List a session's messages"
method: GET
path: "/sessions/{id}/messages"
tags: ["Sessions"]
---

# List a session's messages

`GET /sessions/{id}/messages`

## Request

- Base URL: `https://api.parley.so/v1`
- URL: `https://api.parley.so/v1/sessions/{id}/messages`
- Auth: HTTP bearer

List the messages in a session, newest first by default: what was sent to the assistant and its replies. A message sent while the assistant is working shows up once the assistant reads it. For the latest reply, pass role=assistant and limit=1; pass sort=createdAt to read the conversation from the start.

## Path parameters

- `id` string, required: The session ID.

## Query parameters

- `role` 'user' | 'assistant': Only messages with this role.
- `sort` 'createdAt' | '-createdAt': Sort order: a field name, prefixed with - for descending. Pass createdAt to read the conversation from its first message. Defaults to -createdAt.
- `cursor` string: Opaque cursor from nextCursor. Pass the same filters and sort. Omit for the first page.
- `limit` integer: Maximum number of items to return.

## Response `200`

OK

- object
  - `data` object[], required
    - `id` string, required: The message ID.
    - `role` 'user' | 'assistant', required: user: a message sent to the session. assistant: a reply from Parley's assistant. More roles will be added, so skip any role you do not recognize.
    - `content` string, required: The message, as markdown.
    - `createdAt` string, date-time, required: When the message was sent.
  - `nextCursor` string, nullable, required: Cursor for the next page, or null on the last page.

## Other responses

- `400`: The request was invalid. VALIDATION_FAILED, INVALID_CURSOR.
- `401`: Missing or invalid credentials. UNAUTHORIZED.
- `403`: You don't have permission. FORBIDDEN.
- `404`: Not found. NOT_FOUND.
- `429`: Too many requests, or a usage limit was reached. TOO_MANY_REQUESTS.

---

[API](https://skmtc.dev/parley/apis/parley-api.md) - [All operations](https://skmtc.dev/parley/apis/parley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/parley/apis/parley-api/revisions/6b78aeee07bc?raw)
