Back to KB
Difficulty
Intermediate
Read Time
4 min

User Bookmarks API

By Codcompass TeamΒ·Β·4 min read

User Bookmarks API

Overview

The /api/user/bookmarks endpoint provides a centralized interface for authenticated users to manage their saved articles. It supports four core operations: checking the bookmark status of a specific article, retrieving a complete list of saved content, creating new bookmarks, and removing existing ones. This endpoint is essential for building personalized reading lists, tracking research, and maintaining user engagement within the platform.

The endpoint relies on session-based authentication to ensure strict data isolation. Each operation validates the active user session before interacting with the database, guaranteeing that users can only access or modify their own bookmarks. The underlying implementation uses Prisma ORM for type-safe database queries and Next.js App Router route handlers for efficient request processing.

Endpoint Reference

PropertyValue
Base URLhttps://api.codcompass.com
Path/api/user/bookmarks
HTTP MethodsGET, POST, DELETE
AuthenticationRequired (User Session Cookie)
Content Typeapplication/json (POST requests)
Dynamic Renderingforce-dynamic (bypasses static caching)

Request Format

All requests must include a valid session cookie in the Cookie header. The platform resolves the authenticated user ID from this cookie using internal session utilities. Missing or expired sessions will result in a 401 Unauthorized response.

Query Parameters

ParameterTypeRequiredMethodsDescription
articleIdstringConditionalGET, DELETEUnique identi

πŸŽ‰ Mid-Year Sale β€” Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register β€” Start Free Trial

7-day free trial Β· Cancel anytime Β· 30-day money-back

Sources

  • β€’ api-reference