Fetch Conversation Preview
curl --request GET \
--url https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview', 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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview",
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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview"
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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview")
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{
"unreadCount": 123,
"memberCount": 123,
"lastMessage": {},
"mutedUntil": {},
"mutedForever": true,
"otherMembers": [
{}
]
}Chat — Conversations
Fetch Conversation Preview
Fetch one conversation in the same shape as a single List Conversations row
Fetch Conversation Preview
curl --request GET \
--url https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview', 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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview",
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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview"
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.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v7/:projectId/chat/conversations/:conversationId/preview")
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{
"unreadCount": 123,
"memberCount": 123,
"lastMessage": {},
"mutedUntil": {},
"mutedForever": true,
"otherMembers": [
{}
]
}Returns a single
Requires authentication. Acting-user-scoped: an end-user token (
ConversationPreview — the same shape as one element of List Conversations. Use it to load a conversation the client does not already hold: one that was paginated out of the list, or one that was just created.
Both this endpoint and the list are served by the same underlying query, so the two shapes stay identical.
This is distinct from Fetch Conversation, which returns a different shape — the conversation plus
currentMember and memberCount. Reach for this endpoint when you are inserting a row into a conversation list, and for Fetch Conversation when you are opening a conversation.Authorization: Bearer <accessToken>) reads its own view of the conversation. A service/master key acts on behalf of a named user via the optional query userId — a service key without userId is rejected, and an end-user token may not name a different user. Requires the chat bundle.
Membership is enforced by the query itself. A conversation the caller is not a member of, and a conversation that does not exist, both return 404 — no lastMessage, otherMembers or unreadCount is exposed in either case.
Path Parameters
string
required
UUID of the conversation to fetch.
Query Parameters
string
The acting user whose view of the conversation is returned. Service/master keys only — a service key must pass it (there is no implicit session user); an end-user token infers it from the auth token and may not name a different user.
Response
Returns a Conversation extended with the following fields.number
Number of unread messages in this conversation for the acting user.
number
Number of currently active members.
ChatMessage | null
The most recent visible message in the conversation, with its
content truncated to 100 characters and its files populated. Deleted and moderated-away messages are excluded, so this is null when the conversation has no visible messages — including a group or space conversation whose only messages have since been removed.string | null
ISO timestamp until which the acting user has muted this conversation.
null when the conversation is not muted, and also when it is muted forever.boolean
Whether the acting user has muted this conversation indefinitely. A forever mute returns
mutedForever: true with mutedUntil: null — the far-future storage sentinel is never exposed as a date. Read the boolean; never string-match a date.object[]
Up to 5 active members other than the acting user, each with public user fields (
id, name, username, avatar). Populated for direct and group conversations only — a DM or group has no name, so the counterparty is how a client renders the title and avatar. Capped at 5; use memberCount for the full group total. Always an empty array ([]) for space conversations, which carry their own name. Ordered by member join time.Error Responses
Invalid Parameters — 400
Invalid Parameters — 400
{ "error": "Invalid path parameters.", "code": "chat/invalid-params" }
Invalid Query — 400
Invalid Query — 400
{ "error": "Invalid query parameters.", "code": "chat/invalid-query" }
Not Found — 404
Not Found — 404
Returned both when the conversation does not exist and when the acting user is not a member of it.
{ "error": "Conversation not found.", "code": "chat/not-found" }
Server Error — 500
Server Error — 500
{
"error": "Internal server error.",
"code": "chat/server-error"
}

