API Docs/Reference/Count Saved Posts
API Reference

Count Saved Posts

Get the total count of bookmarks for the authenticated user.

GEThttps://api.linkedmash.com/v1/bookmarks/count

GET /v1/bookmarks/count returns how many saved posts match a filter, without transferring the posts themselves. It accepts the same filter set as GET /v1/bookmarks, so you can size a query before you page through it — useful for progress bars, sync planning, or deciding whether a nightly job has anything to do.

The response echoes an applied_filters object alongside the count. That is deliberate: a count with no record of what it counted is easy to misread, and echoing the resolved filters lets a caller assert that the number covers what it thinks it covers.

Example request

Authenticate with a bearer token in the Authorization header. Create a key on the API page in your LinkedMash settings and export it as LINKEDMASH_API_KEY before running this.

curl
curl "https://api.linkedmash.com/v1/bookmarks/count?media_type=video&posted_from=2026-01-01T00%3A00%3A00Z" \
  -H "Authorization: Bearer $LINKEDMASH_API_KEY"

Header parameters

AuthorizationstringRequired

Your secret API key. Should be provided as a Bearer token.

Query parameters

Combine these parameters to narrow your results.

is_unread_onlybooleanOptional

Count only unread posts. Defaults to false — read and unread are both counted unless you set this to true.

hide_archivedbooleanOptional

Exclude archived posts. Defaults to true, matching GET /v1/bookmarks so list and count always agree.

media_typestringOptional

Filter by media type. Must be one of image, video or pdf; any other value returns 400. Paid plans.

authorstringOptional

Filter by author name.

tagstringOptional

Filter by tag.

posted_fromdate-timeOptional

Filter bookmarks posted after this date/time (ISO 8601 format).

posted_todate-timeOptional

Filter bookmarks posted before this date/time (ISO 8601 format).

bookmarked_fromdate-timeOptional

Filter bookmarks created after this date/time (ISO 8601 format).

bookmarked_todate-timeOptional

Filter bookmarks created before this date/time (ISO 8601 format).

qstringOptional

Search query to filter bookmarks by title or content.

commentstringOptional

Filter by comment: 'only' returns just saved comments, 'exclude' returns only top-level posts (excludes comments). Paid plans.

Response

{
  "status": true,
  "data": {
    "count": 123
  }
}

Response fields

Every response is wrapped in the same envelope: a status flag and a data payload, with meta present where there is pagination or a plan limit to report.

statusboolean

true on success. Every LinkedMash API response carries this envelope flag alongside data, so a client can branch on it without re-reading the HTTP status.

data.countinteger

Number of saved posts matching the filters. Not capped, and not affected by subscription state.

data.applied_filtersobject

The filters that were actually resolved and applied. Filters you did not send are omitted rather than echoed as null, so this is a reliable record of what the number covers.

Using a count to drive a sync

Counting is cheap and listing is not, which makes this the right first call in almost any batch job.

1

Count before you page

Run the count with exactly the query string you intend to send to GET /v1/bookmarks. Because the two routes share defaults, the number you get is the number of posts you will page through.

2

Assert on applied_filters

The response echoes the filters it resolved. Compare it against what you sent — a filter missing from the echo was not applied, and a count that covers more than you meant is worse than an error.

3

Decide the execution path

Under a few hundred, page inline. Over that, hand the job to a background worker. The count is what lets you make that decision before committing a request budget.

4

Use it as a change detector

Storing the count per filter and re-running it on a schedule is the cheapest way to notice that a library has grown, without paging anything.

Behaviour and limits

Defaults match the list endpoint exactly

is_unread_only defaults to false and hide_archived defaults to true, the same as GET /v1/bookmarks. Count and list therefore always agree for the same query string, which was not true of an earlier version of this route.

The full filter set is honoured

media_type, author, tag, posted_from, posted_to, bookmarked_from, bookmarked_to, q and comment are all applied, not just the read/archive flags. Filters you did not send are omitted from applied_filters rather than echoed as null.

No plan gate, no pagination

Counting is not subscription-gated and returns a single integer, so there is no cursor and no free-tier cap to work around.

Validation runs before the count

media_type outside image / video / pdf, or comment outside only / exclude, returns 400 rather than a count of zero — so a 200 with count: 0 genuinely means the library has no matches.

Errors

Failures carry the same envelope as a success, with the reason in message and a stable machine-readable code where the status alone is ambiguous — several distinct conditions share a 402.

Status
Meaning
400Bad Request
Invalid media_type or an invalid comment value.
401Unauthorized
The Authorization header is missing or the key is not a valid LinkedMash API key. Create or rotate keys on the API page in your LinkedMash settings.
500Server Error
Something failed on our side. The body carries message "Failed to count bookmarks". Retry once; if it persists the request is not the problem.