Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sam-shervin/space7/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Returns a paginated list of messages posted in a given space. Results can be sorted by most recent or most appreciated.
Endpoint
GET /api/messages/:spaceId
Request
Path parameters
The unique identifier of the space to fetch messages from.
Query parameters
Sort order for messages. Accepted values: "recent" or "most_appreciated". Defaults to "recent".
Page number for pagination. Defaults to 1.
Number of messages to return per page. Defaults to 50.
Response
Returns a MessagesResponse object.
Array of message objects.
Unique identifier for the message.
Identifier of the space the message belongs to.
Identifier of the user who sent the message.
Text content of the message.
URL of the attached media file, or null if no media.
media_type
image | video | audio | null
Type of attached media, or null if no media.
Number of words in the message content.
Profile information of the message sender.
Array of likes on the message. Each like contains id (number) and user_id (string).
Total number of appreciations (likes) the message has received.
ISO 8601 timestamp of when the message was created.
Total number of messages in the space.
Total number of pages available.
Example
import { fetchWithAuth } from "./fetchWithAuth";
const getMessages = async (
spaceId: string,
options: { sort?: "recent" | "most_appreciated"; page?: number; limit?: number } = {},
) => {
const sort = options.sort ?? "recent";
const page = options.page ?? 1;
const limit = options.limit ?? 50;
const query = `?sort=${sort}&page=${page}&limit=${limit}`;
const res = await fetchWithAuth(`/api/messages/${spaceId}${query}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
const data = await res.json();
if (!res.ok) {
throw new Error(data.error || "Failed to fetch messages");
}
return data; // MessagesResponse
};