Fetch Collection Entities
curl --request GET \
--url https://api.sublay.io/v8/:projectId/collections/:collectionId/entities \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v8/:projectId/collections/:collectionId/entities"
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/v8/:projectId/collections/:collectionId/entities', 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/v8/:projectId/collections/:collectionId/entities",
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/v8/:projectId/collections/:collectionId/entities"
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/v8/:projectId/collections/:collectionId/entities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/collections/:collectionId/entities")
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{
"data": [
{}
],
"pagination": {
"page": 123,
"pageSize": 123,
"totalPages": 123,
"totalItems": 123,
"hasMore": true
}
}Collection Endpoints
Fetch Collection Entities
Get paginated entities saved in a collection
Fetch Collection Entities
curl --request GET \
--url https://api.sublay.io/v8/:projectId/collections/:collectionId/entities \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sublay.io/v8/:projectId/collections/:collectionId/entities"
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/v8/:projectId/collections/:collectionId/entities', 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/v8/:projectId/collections/:collectionId/entities",
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/v8/:projectId/collections/:collectionId/entities"
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/v8/:projectId/collections/:collectionId/entities")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/v8/:projectId/collections/:collectionId/entities")
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{
"data": [
{}
],
"pagination": {
"page": 123,
"pageSize": 123,
"totalPages": 123,
"totalItems": 123,
"hasMore": true
}
}Returns a paginated list of entities saved in the specified collection. The collection must belong to the authenticated user.
Path Parameters
string
required
The ID of the collection to fetch entities from.
Query Parameters
number
Page number (1-indexed). Default:
1.number
Number of entities per page. Default:
20."new" | "top" | "hot" | "added"
Sort mode. Default:
"new".new— by when the entity was createdadded— by when the entity was saved to this collectiontop— by reaction count (usesortByReactionto choose which reaction)hot— by computed engagement score (decays over time)
top and hot are broken by newest entity first.string
default:"upvote"
When
sortBy=top, which reaction type to rank by. One of upvote, downvote, like, love, wow, sad, angry, funny. Only accepted with sortBy=top; sending it with any other sort returns 400 collection/invalid-query."asc" | "desc"
Sort direction. Default:
"desc".string
Associations to include. Pass it as one comma-separated value (
include=user,space) or as repeated params (include=user&include=space). Values:user— the author’s user profilespace— the space the entity belongs totopComments— the entity’s best top-level comments, as full Comment objects (see Top comments)files— uploaded file/image attachmentsgrants— the reputation-grant summary for the entity
saved isn’t accepted here (400 collection/invalid-query): every entity returned by this endpoint already has isSaved: true.number
default:"1"
With
include=topComments: how many top comments per entity. A whole number of at least 1 — 0, a negative number or a non-integer value returns 400 collection/invalid-query. Maximum 5 — larger values are treated as 5.string
default:"upvote"
With
include=topComments: the reaction whose raw count ranks the top comments (ties newest first). One of upvote, downvote, like, love, wow, sad, angry, funny.include values are case-insensitive. An unknown value returns 400 collection/invalid-query, as does sending topCommentsLimit or topCommentsSortByReaction without include=topComments. topComments lists real content only — deleted, removed and block-edged comments are left out — and is [] when nothing qualifies. A collection keeps an entity saved before its author blocked the requesting user; on such an entity topComments is always [].
Response
Entity[]
The page of entity objects. Each entity includes
isSaved: true.object
Error Responses
Invalid include — 400
Invalid include — 400
Returned with code
collection/invalid-query for an unknown include value, when topCommentsLimit is below 1 or not a whole number, or when topCommentsLimit / topCommentsSortByReaction is sent without include=topComments.{ "error": "include: Unknown include `comments`. Allowed: user, space, topComments, files, grants.", "code": "collection/invalid-query" }
Renamed include — 400
Renamed include — 400
include=topComment is rejected with a pointer to its replacement.{
"error": "`include=topComment` was renamed to `topComments` (with `topCommentsLimit` / `topCommentsSortByReaction`).",
"code": "collection/unsupported-param",
"param": "include"
}
Invalid Query — 400
Invalid Query — 400
Returned when a query parameter is invalid, including
sortByReaction sent without sortBy=top.{ "error": "sortByReaction: sortByReaction is only supported with sortBy=top", "code": "collection/invalid-query" }
Collection Not Found — 404
Collection Not Found — 404
{ "error": "Collection not found", "code": "collection/not-found" }
Server Error — 500
Server Error — 500
{ "error": "Internal server error.", "code": "collection/server-error" }

