Skip to main content
GET
/
api
/
chats
Get all user chats via API key
curl --request GET \
  --url https://api.leanmcp.com/api/chats \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.leanmcp.com/api/chats"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.leanmcp.com/api/chats', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.leanmcp.com/api/chats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.leanmcp.com/api/chats"

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

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.leanmcp.com/api/chats")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.leanmcp.com/api/chats")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
[
  {
    "id": "c1a83d84-7154-464c-bd19-a9f10e0a067f",
    "title": "Help with TypeScript",
    "messageCount": 8,
    "createdAt": "2025-06-16T19:30:00.000Z",
    "lastMessageAt": "2025-06-16T20:15:00.000Z",
    "modelUsed": "claude-3-sonnet",
    "summary": "Discussion about TypeScript best practices",
    "metadata": "Discussion about TypeScript best practices"
  }
]

Authorizations

Authorization
string
header
required

Enter your LeanMCP API key

Response

200 - application/json

Chat list retrieved successfully

id
string
required

Chat unique identifier

Example:

"c1a83d84-7154-464c-bd19-a9f10e0a067f"

title
string
required

Chat title

Example:

"Help with TypeScript"

messageCount
number
required

Number of messages in the chat

Example:

8

createdAt
string
required

When the chat was created

Example:

"2025-06-16T19:30:00.000Z"

lastMessageAt
string

Timestamp of the last message

Example:

"2025-06-16T20:15:00.000Z"

modelUsed
string

Model used in this chat

Example:

"claude-3-sonnet"

summary
string

Chat summary

Example:

"Discussion about TypeScript best practices"

metadata
object

Chat metadata

Example:

"Discussion about TypeScript best practices"