Owner Abhishek P

V1 API Bookmark Collections

Source: OpenAPI 3.1.0 spec + src/api/v1/bookmark_collections/routes.py, src/api/v1/bookmark_collections/schemas.py Tag: Bookmark Collections - CRUD for bookmark collections.

All endpoints require Bearer Token authentication. Response data is encrypted when feature flag is enabled.


POST /bookmark-collections

Summary: Create Bookmark Collection

Create a new bookmark collection for the authenticated user.

Parameters

NameInRequiredDescription
course_idqueryrequiredCourse ID this collection belongs to
x-dev-timeheaderoptionalEpoch ms (13 digits)

Request Body

{
  "name": "Important Questions",
  "description": "Questions I need to review before the exam",
  "emoji": "📌"
}
FieldTypeConstraintsDescription
namestringrequired, 1 to MAX_COLLECTION_NAME_LENGTH charsCollection name
descriptionstringoptional, max MAX_COLLECTION_DESCRIPTION_LENGTH charsDescription
emojistringrequired, exactly 1 characterSingle emoji representing the collection

Success Response

{
  "status": "success",
  "is_data_encrypted": 0,
  "data": {
    "id": "60d5ec49f1b2c72e4c8bcccc",
    "name": "Important Questions",
    "description": "Questions I need to review before the exam",
    "is_default": false,
    "course_id": 1,
    "emoji": "📌",
    "mcq_count": 0,
    "short_uid": "BC001",
    "is_deleted": false,
    "created_at": 1714400000000
  },
  "error": null,
  "app_actions": null
}
FieldDescription
is_defaulttrue only for the system-created “All Bookmarks” collection
mcq_countNumber of MCQs currently in this collection. Starts at 0
short_uidShort identifier for sharing
created_atCreation timestamp in UTC epoch ms

GET /bookmark-collections/sync

Summary: Sync Bookmark Collections

Get a paginated list of bookmark collections using cursor-based pagination.

Parameters

NameInRequiredConstraintsDescription
course_idqueryrequiredCourseEnumCourse ID to filter
limitqueryoptional1-120, default 10Number of results
next_cursorqueryoptionalbase64 stringForward pagination cursor
prev_cursorqueryoptionalbase64 stringBackward pagination cursor
x-dev-timeheaderoptional13 digitsEpoch ms

Success Response

{
  "status": "success",
  "is_data_encrypted": 0,
  "data": [
    {
      "id": "60d5ec49f1b2c72e4c8bbbbb",
      "name": "All Bookmarks",
      "description": null,
      "is_default": true,
      "course_id": 1,
      "emoji": "📚",
      "mcq_count": 47,
      "short_uid": "BC000",
      "is_deleted": false,
      "created_at": 1714300000000
    },
    {
      "id": "60d5ec49f1b2c72e4c8bcccc",
      "name": "Important Questions",
      "description": "Questions I need to review before the exam",
      "is_default": false,
      "course_id": 1,
      "emoji": "📌",
      "mcq_count": 12,
      "short_uid": "BC001",
      "is_deleted": false,
      "created_at": 1714400000000
    }
  ],
  "error": null,
  "app_actions": null,
  "pagination": {
    "next_cursor": "eyJ1cGRhdGVkX2F0IjoxNzE0NDAwMDAwMDAwLCJpZCI6IjYwZDVlYzQ5ZjFiMmM3MmU0YzhiY2NjYyJ9",
    "prev_cursor": null,
    "limit": 10,
    "has_more": false
  }
}

Note: The default “All Bookmarks” collection (is_default: true) is always present. It is auto-created on first login with a course_id.


PATCH /bookmark-collections/{collection_id}

Summary: Update Bookmark Collection

Update a bookmark collection’s name, description, or emoji.

Parameters

NameInRequiredDescription
collection_idpathrequiredCollection ID to update (ObjectId)
x-dev-timeheaderoptionalEpoch ms (13 digits)

Request Body

{
  "name": "Must Revise",
  "description": "Critical questions for final revision",
  "emoji": "🔥"
}
FieldTypeConstraintsDescription
namestringoptional, 1 to MAX charsNew name
descriptionstringoptional, max charsNew description
emojistringoptional, exactly 1 charNew emoji

All fields optional - only provided fields are updated.

Success Response

Returns updated BookmarkCollectionResponse (same shape as create response).


DELETE /bookmark-collections/{collection_id}

Summary: Delete Bookmark Collection

Delete a bookmark collection. All MCQs in the deleted collection are moved to “All Bookmarks”.

Parameters

NameInRequiredDescription
collection_idpathrequiredCollection ID to delete (ObjectId)
course_idqueryrequiredCourse ID this collection belongs to
x-dev-timeheaderoptionalEpoch ms (13 digits)

Business Logic

  1. Validates the collection exists and belongs to the authenticated user
  2. Moves all MCQ bookmarks from this collection to the default “All Bookmarks” collection
  3. Soft-deletes the collection (is_deleted=true)

Success Response

{
  "status": "success",
  "is_data_encrypted": 0,
  "data": {
    "id": "60d5ec49f1b2c72e4c8bcccc",
    "message": "Operation completed successfully."
  },
  "error": null,
  "app_actions": null
}

Error Responses

Error CodeCondition
7600Bookmark collection not found (BOOKMARK_BUCKET_NOT_FOUND)
7605Deletion failed (BOOKMARK_BUCKET_DELETION_FAILED)