---
title: "List sessions for a user"
method: GET
path: "/v1/{appId}/users/{userId}/sessions"
tags: ["User presence"]
deprecated: true
---

# List sessions for a user

`GET /v1/{appId}/users/{userId}/sessions`

## Request

- Base URL: `https://api.talkjs.com`
- URL: `https://api.talkjs.com/v1/{appId}/users/{userId}/sessions`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
- TypeScript: <https://skmtc.dev/talkjs/apis/talkjs-api/docs/v1/:appId/users/:userId/sessions/get.ts> (a function with typed inputs; its response is checked against the schema)

> **Deprecated.**

Lists all sessions for a specific user.

If you create a TalkJS session on every page, then a user can have multiple session objects: one for the TalkJS background session, and one for each TalkJS UI that's in focus.

### Examples

User `alice` is offline:

```js
// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[]
```

User `alice` is logged into your site, but doesn't have a TalkJS UI in focus:

```js
// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[
  {
    "isTyping": false,
    "currentConversationId": null
  }
]
```

User `alice` is logged into your site, has a TalkJS UI in focus and is currently typing a message in conversation `1234`:

```js
// request:
GET https://api.talkjs.com/v1/YOUR_APP_ID/users/alice/sessions

// response:
[
  {
    "isTyping": false,
    "currentConversationId": null
  },
  {
    "isTyping": true,
    "currentConversationId": "1234"
  }
]
```

## Path parameters

- `appId` string, required
- `userId` string, required

## Response `200`

Sessions for a user listed successfully.

- object[]: An array with sessions that a user is part of.
  - `isTyping` boolean: Indicates whether the user is currently typing a message in this session.
  - `currentConversationId` string, nullable: A unique identifier of a conversation.

## Other responses

- `400`: Bad request
- `401`: Authorization information is missing or invalid.
- `404`: Resource not found
- `429`: Too many requests
- `500`: Internal server error

---

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