info:
  name: Sync Progress with Bookmarks
  type: http
  seq: 2

http:
  method: POST
  url: '{{base_url}}/api/sync/kobo/markup'
  auth: inherit
  headers:
    - key: Content-Type
      value: application/json
    - key: x-kobo-device
      value: '{"DeviceId":"{{kobo_device_id}}","Model":"Kobo Clara"}'
  body:
    type: json
    json:
      ReadingSync:
        - ContentId: book-uuid
          PercentRead: 42.3
          EntitlementId: entitlement-id
          RemainingTimeMinutes: 138
          FirstReadTime: '2026-01-25T10:00:00Z'
          LastModified: '2026-01-30T20:00:00Z'
      BookmarkSync:
        - ContentId: book-uuid
          BookmarkText: highlighted text passage
          BookmarkType: annotation
          BookmarkTitle: Chapter 3

docs: |-
  ## Sync Progress with Bookmarks

  Synchronizes reading progress and highlights/annotations from Kobo device.

  **Method:** POST

  **Endpoint:** /api/sync/kobo/markup

  **Authentication:** Bearer token

  **Headers:**
  - `Authorization`: Bearer {{kobo_device_token}}
  - `x-kobo-device`: Device information JSON

  **Request Body:**
  - `ReadingSync` (array): Progress items (see Sync Reading Progress)
  - `BookmarkSync` (array): Highlights and annotations
    - `ContentId` (string): Book UUID
    - `BookmarkText` (string): Highlighted text or note content
    - `BookmarkType` (string): Type of bookmark
      - `annotation`: Highlighted text
      - `note`: Personal note
      - `bookmark`: Location bookmark
    - `BookmarkTitle` (string): Reference (e.g., chapter name)
    - `ChapterID` (string, optional): Chapter identifier
    - `DateCreated` (string, optional): Creation timestamp

  **Response:**
  - `progress_synced` (integer): Progress items synced
  - `bookmarks_synced` (integer): Bookmark items synced
  - `conflicts_resolved` (integer): Number of conflicts auto-resolved
  - `timestamp` (string): Sync timestamp
  - `details` (object): Sync breakdown by type

  **Status Codes:**
  - 200: Successful sync
  - 401: Unauthorized
  - 400: Invalid data

  **Kobo Highlight Features:**
  - 5 highlight colors (yellow, green, blue, pink, orange)
  - Chapter-based organization
  - Linked to reading progress
  - Appears in Kobo "Notebook" view
  - Can be exported from device
  - Syncs across all user devices

  **Annotation Sync:**
  - Highlight text preserved exactly
  - Color mapped to system colors
  - Chapter reference maintained
  - Location data converted to standard format
  - Notes attached to highlights synced separately
