> ## Documentation Index
> Fetch the complete documentation index at: https://dev.marginnote.com.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取能力清单

> 返回 MarginNote 实际注册的全部路由，以及各主题的上限与语义。

读该接口可取得各项上限与取值枚举，例如标签操作的取值、元数据的取值范围、
手写会话的上限。Request Body 的写法未收录，见 `GET /guide`。




## OpenAPI

````yaml /openapi/plugin-api.yaml get /capabilities
openapi: 3.1.0
info:
  title: 场景插件 API
  summary: 场景插件在网页面板里可以调用的接口。
  description: >
    场景插件的面板是一个网页。页面里向 `/bridge/v1` 发请求，就能读写 MarginNote 里的数据。

    请求由 MarginNote 处理，与外部命令行工具共用同一套处理代码。外部工具要带令牌，面板不必带。

    面板页面从 `mnpanel://panel/index.html` 加载，因此 `fetch('/bridge/v1' + path)`
    属于同源请求。


    面板调用受这些条件约束：


    - 请求不带令牌，本文件也不声明安全方案。

    - 页面能调用哪些接口，取决于两份名单。模板里的 `plugins` 名单和沉浸态决定面板能不能建好，
      网页面板白名单决定页面能调哪些接口。不在白名单里的请求返回 `403`，
      错误码为 `IN_PROCESS_NOT_ALLOWED`。
    - `GET /capabilities` 里的 `requiresMax` 只约束外部 Agent。面板的请求在 MarginNote 进程内处理，
      不受令牌、订阅状态与跨设备批准的限制，能否调用只看该路径是否在白名单内。
    - 写操作里的 `addon`，MarginNote 会改写为当前面板所属插件的 id；`confirm` 由 MarginNote 补上。
      页面填的值不会生效。

    用 `mn.api(path, opts)` 读取数据。该方法始终将 Response Body 按 JSON 解析，相当于

    `fetch('/bridge/v1' + path, opts).then(r => r.json())`。


    响应的内容不是 JSON 的接口，改用 `fetch`：


    - `GET /guide` 返回 Markdown 正文。

    - `GET /notes/{noteid}/render` 返回卡片长图或 PDF。

    - `GET /documents/{bookmd5}/pages/{index}/content/{contentId}` 返回图片。

    - `GET /bundles/{bundleId}/files` 带 `?path=` 时返回该文件的原始字节。


    调用失败时 Promise 不会进入 reject。MarginNote 把错误对象

    `{"error":{"code":"…","message":"…"}}` 当作 Response Body 返回，因此结果落在 resolve 里。

    判断调用结果看响应里是否带 `error`，写操作另看响应里的 `persisted`。


    接口清单、各项上限与 Request Body 结构随 MarginNote 的版本变化，运行时以 `GET /capabilities` 与

    `GET /guide` 返回的内容为准。
  version: '0.91'
servers: []
security: []
tags:
  - name: 能力与状态
    description: 读取 MarginNote 的能力、版本与当前上下文。调用其他接口之前先读这组。
  - name: 卡片与摘录
    description: 卡片的读取与写入、摘录的创建、批注、标签、元数据与留白。
  - name: 手写会话
    description: 手写层、作答纸、练习准备清单与会话记录的读取与提交。
  - name: 学习集与卡组
    description: 学习集结构、脑图树、子脑图、色板、快照与复习卡组。
  - name: 文档与页面
    description: 文档目录、页文本、页内注释面、摘录清单与同步诊断。
  - name: 导出与 Anki
    description: 文档导出计划、导出文件、Anki 导出能力、作业与产物。
  - name: 查找
    description: 跨库搜索、文件夹列表与学习集列表。
  - name: 界面与模板
    description: 读取当前界面状态与沉浸模板。
  - name: 插件辅助
    description: 面板辅助脚本、已配对设备与本机 helper 信息。
  - name: 任务包与同步诊断
    description: 拆书任务包与旧 CloudKit 同步诊断。
paths:
  /capabilities:
    get:
      tags:
        - 能力与状态
      summary: 获取能力清单
      description: |
        返回 MarginNote 实际注册的全部路由，以及各主题的上限与语义。

        读该接口可取得各项上限与取值枚举，例如标签操作的取值、元数据的取值范围、
        手写会话的上限。Request Body 的写法未收录，见 `GET /guide`。
      operationId: getCapabilities
      responses:
        '200':
          description: 路由清单与各项上限。示例摘自真机实录，只保留开头部分。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CapabilitiesResponse'
              examples:
                recorded:
                  summary: 真机实录（MarginNote 0.61，2026-09-18 录制）；实录只保留开头部分
                  value:
                    routes:
                      - path: /status
                        method: GET
                        requiresMax: false
                      - path: /capabilities
                        method: GET
                        requiresMax: false
                      - path: /sync/legacy/status
                        method: GET
                        requiresMax: false
                    legacySync:
                      databaseAndDocumentsCompleteIndependently: true
                      databaseCarries:
                        - study_set_structure
                        - mind_map_cards
                        - excerpts
                        - handwriting
                        - blank_pages
                        - fold_and_layout_state
                        - book_configuration
                      documentHashVerification:
                        default: false
                        expensive: true
                        externalFileProvidersAreNotReopened: true
                        query: verifyHash=1
                      documentLaneCarries:
                        - original_document_bytes
                      documentStatusRoute: /documents/{id}/sync-status
                      eventsRoute: >-
                        /sync/legacy/events?afterSequence={sequence}&limit={1..200}
                      inventoryAffectsNormalSyncStatus: false
                      inventoryAllowsCellularAccess: false
                      inventoryAuthoritative: false
                      inventoryMayConsumeCloudKitQuota: true
                      inventoryObserveOnly: true
                      inventoryReturnsRecordIdentifiers: false
                      inventoryRoute: /sync/legacy/inventory
                      inventoryServerResultConsistency: eventually_consistent_query
                      inventoryUsesSyncQueue: false
                      lanes:
                        - cloudkit
                        - documents
                      recheckDirectlyEditsUserContent: false
                      recheckMayApplyPendingRemoteChanges: true
                      recheckRoute: /sync/legacy/recheck
                      statusRoute: /sync/legacy/status
                    accessPolicy:
                      readOnlyRequiresMax: false
                      routeField: requiresMax
                      setupNavigationAndTemporaryExportRequireMax: false
                      userDataStillRequiresBearerToken: true
                      writeRequiresMax: true
                    anchorModes:
                      - page_text
                      - block
                    noteMetadata:
                      maxNoteIds: 200
                      patchFields:
                        fillIndex:
                          scope: >-
                            source_annotation_style_not_mind_map_card_transparency
                          values:
                            - -1
                            - 0
                            - 1
                            - 2
                          semantics:
                            - fillIndex: -1
                              id: legacy_adaptive
                              regionSelection: outline_only
                              textSelection: fill_and_underline
                            - fillIndex: 0
                              id: fill_and_stroke
                              regionSelection: fill_and_outline
                              textSelection: fill_and_underline
                            - fillIndex: 1
                              id: fill_only
                              regionSelection: fill_only
                              textSelection: fill_only
                            - fillIndex: 2
                              id: stroke_only
                              regionSelection: outline_only
                              textSelection: underline_only
                        colorIndex:
                          max: 15
                          min: 0
                      palette:
                        colorIndexRange:
                          - 0
                          - 15
                        count: 16
                        representations:
                          - hex
                          - rgba
                        route: /study-sets/{id}/note-palette
                    reviewDeckCards:
                      contentSelectorField: questionContentId
                      contentSelectorSemantics: copies_exact_native_part_into_review_card_front
                      contentSelectorSource: POST /notes/batch-get parts[].contentId
                      customTextAndContentSelectorMutuallyExclusive: true
                      customTextField: question
                      questionModes:
                        - automatic
                        - custom_text
                        - content_part
                      requiresConfirm: true
                      route: /decks/{id}/cards
                    routeCount: 87
                    noteCopy:
                      target: existing_parent_card
                      modes:
                        - reference
                        - clone
                      semantics:
                        clone:
                          contentSynchronized: false
                          description: >-
                            Creates independent cards and remaps links within
                            the cloned branch.
                        reference:
                          contentSynchronized: true
                          description: >-
                            Creates MarginNote reference cards that stay
                            synchronized with their source cards.
                      scope: selected_roots_and_all_mind_map_descendants
                      requiresConfirm: true
                      route: /notes/copy
                      maxSourceRoots: 50
                    bridgeApiVersion: '0.61'
                    presets:
                      - book-breakdown
                      - source-structure
                      - exam-general
                      - dictionary
                    guideVersion: '0.61'
                    apiFingerprint: 17b754d41172
                    guide:
                      sha256: >-
                        c58ca54dfa21245e25cd863c5cbc2084f94d69c188e15f22fa86bbfd4809512a
                      refreshPolicy: fetch_at_session_start_when_version_or_sha256_differs
                      rotatesToken: false
                      usesExistingBearer: true
                      installRequired: false
                      version: '0.61'
                      route: /guide
                    noteTitles:
                      preview: display_title_or_first_text
                      previewTextLimitUTF16: 64
                      previewTruncationMarker: …
                      previewTruncationMarkerExcludedFromLimit: true
                      routes:
                        - GET /study-sets/{id}/tree
                        - POST /notes/batch-get
                      title: full_display_title_without_body_fallback
                      untitledValue: ''
                    guideHash: >-
                      c58ca54dfa21245e25cd863c5cbc2084f94d69c188e15f22fa86bbfd4809512a
                    noteHashtags:
                      ancestors: derived_not_materialized
                      caseSensitive: false
                      doNotUseForWriting: /notes/{id}/text
                      hierarchySeparator: /
                      inlineTextEncodingSupported: false
                      maxHashtags: 100
                      maxNoteIds: 200
                      operations:
                        - add
                        - remove
                        - replace
                      readFields:
                        - hashtags
                        - hashtagPaths
                      recursiveRemoveFlag: includeDescendants
                      removeDefault: exact_full_path
                      storedValue: one_complete_leaf_path
                      textEditMisuseError: HASHTAG_ROUTE_REQUIRED
                      treeRoute: /study-sets/{id}/hashtags
                      writeRoute: /notes/hashtags
                measured:
                  summary: 实测于 2026-10-07，App 0.91
                  value:
                    routes:
                      - path: /status
                        method: GET
                        requiresMax: false
                      - path: /capabilities
                        method: GET
                        requiresMax: false
                      - path: /anki/capabilities
                        method: GET
                        requiresMax: false
                      - path: /anki/uploads
                        method: POST
                        requiresMax: false
                      - path: /anki/jobs
                        method: POST
                        requiresMax: false
                      - path: /anki/jobs/{id}
                        method: GET
                        requiresMax: false
                      - path: /anki/jobs/{id}/files
                        method: GET
                        requiresMax: false
                      - path: /anki/jobs/{id}/cancel
                        method: POST
                        requiresMax: false
                      - path: /anki/jobs/{id}/discard
                        method: POST
                        requiresMax: false
                      - path: /anki/uploads/{id}/discard
                        method: POST
                        requiresMax: false
                      - path: /writing/capabilities
                        method: GET
                        requiresMax: false
                      - path: /writing/resolve
                        method: POST
                        requiresMax: false
                      - path: /writing/content
                        method: POST
                        requiresMax: false
                      - path: /writing/windows
                        method: GET
                        requiresMax: false
                      - path: /writing/context
                        method: POST
                        requiresMax: false
                      - path: /writing/pencil-commit
                        method: POST
                        requiresMax: false
                      - path: /writing/pencil-result
                        method: POST
                        requiresMax: false
                      - path: /writing/pencil-document-commit
                        method: POST
                        requiresMax: false
                      - path: /writing/plan-read
                        method: POST
                        requiresMax: false
                      - path: /writing/layer-leases
                        method: POST
                        requiresMax: false
                      - path: /writing/layer-compact
                        method: POST
                        requiresMax: false
                      - path: /writing/session-reset
                        method: POST
                        requiresMax: false
                      - path: /writing/session-read
                        method: POST
                        requiresMax: false
                      - path: /writing/session-preview
                        method: POST
                        requiresMax: false
                      - path: /writing/session-create
                        method: POST
                        requiresMax: false
                      - path: /writing/session-reserve
                        method: POST
                        requiresMax: false
                      - path: /writing/session-cancel
                        method: POST
                        requiresMax: false
                      - path: /writing/session-reconcile
                        method: POST
                        requiresMax: false
                      - path: /writing/session-pause
                        method: POST
                        requiresMax: false
                      - path: /writing/session-resume
                        method: POST
                        requiresMax: false
                      - path: /writing/session-finish
                        method: POST
                        requiresMax: false
                      - path: /writing/session-assess
                        method: POST
                        requiresMax: false
                      - path: /writing/focus-enter
                        method: POST
                        requiresMax: false
                      - path: /writing/blank-prepare
                        method: POST
                        requiresMax: false
                      - path: /writing/blank-enter
                        method: POST
                        requiresMax: false
                      - path: /writing/focus-begin
                        method: POST
                        requiresMax: false
                      - path: /writing/blank-begin
                        method: POST
                        requiresMax: false
                      - path: /writing/layer-restore
                        method: POST
                        requiresMax: false
                      - path: /writing/session-focus-begin
                        method: POST
                        requiresMax: false
                      - path: /writing/session-blank-begin
                        method: POST
                        requiresMax: false
                      - path: /writing/session-layer-restore
                        method: POST
                        requiresMax: false
                      - path: /writing/session-focus-enter
                        method: POST
                        requiresMax: false
                      - path: /writing/session-blank-enter
                        method: POST
                        requiresMax: false
                      - path: /writing/session-exit
                        method: POST
                        requiresMax: false
                      - path: /writing/transition-result
                        method: POST
                        requiresMax: false
                      - path: /writing/plan-save
                        method: POST
                        requiresMax: false
                      - path: /sync/legacy/status
                        method: GET
                        requiresMax: false
                      - path: /sync/legacy/events
                        method: GET
                        requiresMax: false
                      - path: /sync/legacy/recheck
                        method: POST
                        requiresMax: false
                      - path: /sync/legacy/inventory
                        method: POST
                        requiresMax: false
                      - path: /sync/legacy/export
                        method: POST
                        requiresMax: false
                      - path: /guide
                        method: GET
                        requiresMax: false
                      - path: /skill
                        method: GET
                        requiresMax: false
                      - path: /skill/refresh.sh
                        method: GET
                        requiresMax: false
                      - path: /skill/refresh.ps1
                        method: GET
                        requiresMax: false
                      - path: /library/study-sets
                        method: POST
                        requiresMax: true
                      - path: /library/study-sets
                        method: GET
                        requiresMax: false
                      - path: /library/documents/{id}/delete
                        method: POST
                        requiresMax: true
                      - path: /library/documents/upload
                        method: POST
                        requiresMax: true
                      - path: /library/folders
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/merge-branch
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/fold-into-sub-map
                        method: POST
                        requiresMax: true
                      - path: /documents/{id}/locate
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/sub-maps
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/focus
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/open
                        method: POST
                        requiresMax: false
                      - path: /decks/{id}/open
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/documents/{id}/delete
                        method: POST
                        requiresMax: true
                      - path: /context
                        method: GET
                        requiresMax: false
                      - path: /immersive/template
                        method: GET
                        requiresMax: false
                      - path: /immersive/templates
                        method: GET
                        requiresMax: false
                      - path: /immersive/templates/activate
                        method: POST
                        requiresMax: true
                      - path: /ui-state
                        method: GET
                        requiresMax: false
                      - path: /ui-state/apply
                        method: POST
                        requiresMax: true
                      - path: /decks
                        method: POST
                        requiresMax: true
                      - path: /study-sets/{id}/export
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/review-deck
                        method: POST
                        requiresMax: true
                      - path: /study-sets/{id}/immersive
                        method: POST
                        requiresMax: true
                      - path: /notes/addon-values
                        method: POST
                        requiresMax: true
                      - path: /decks
                        method: GET
                        requiresMax: false
                      - path: /decks/{id}/cards
                        method: GET
                        requiresMax: false
                      - path: /decks/{id}/cards
                        method: POST
                        requiresMax: true
                      - path: /study-sets/{id}/documents
                        method: POST
                        requiresMax: true
                      - path: /study-sets/{id}/documents
                        method: GET
                        requiresMax: false
                      - path: /study-sets/{id}/tree
                        method: GET
                        requiresMax: false
                      - path: /study-sets/{id}/mindmap-print/preview
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/mindmap-print/export
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/hashtags
                        method: GET
                        requiresMax: false
                      - path: /study-sets/{id}/note-palette
                        method: GET
                        requiresMax: false
                      - path: /study-sets/{id}/notebooks
                        method: GET
                        requiresMax: false
                      - path: /notes/batch-get
                        method: POST
                        requiresMax: false
                      - path: /notes/hashtags
                        method: POST
                        requiresMax: true
                      - path: /notes/metadata
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/addon-commands
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/addon-command
                        method: POST
                        requiresMax: true
                      - path: /documents/{id}/excerpts
                        method: GET
                        requiresMax: false
                      - path: /excerpts
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/content/{id}
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/image-occlusions
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/render
                        method: GET
                        requiresMax: false
                      - path: /search
                        method: GET
                        requiresMax: false
                      - path: /notes/move
                        method: POST
                        requiresMax: true
                      - path: /notes/copy
                        method: POST
                        requiresMax: true
                      - path: /install/code
                        method: POST
                        requiresMax: false
                      - path: /install
                        method: GET
                        requiresMax: false
                      - path: /mcp
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/delete
                        method: POST
                        requiresMax: true
                      - path: /notes/fold
                        method: POST
                        requiresMax: true
                      - path: /notes/delete
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/title
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/text
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/comments
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/comments
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/comments/fold
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/annotation-editor
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/practice-verdict
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/edits
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/comments/{index}
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/comments/{index}/delete
                        method: POST
                        requiresMax: true
                      - path: /notes/{id}/blank-bands
                        method: GET
                        requiresMax: false
                      - path: /notes/{id}/blank-bands
                        method: POST
                        requiresMax: true
                      - path: /blank-bands/{id}
                        method: POST
                        requiresMax: true
                      - path: /blank-bands/{id}/focus
                        method: POST
                        requiresMax: false
                      - path: /study-sets/{id}/snapshots
                        method: POST
                        requiresMax: true
                      - path: /study-sets/{id}/snapshots
                        method: GET
                        requiresMax: false
                      - path: /snapshots/{id}/restore
                        method: POST
                        requiresMax: true
                      - path: /documents/{id}/outline
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/sync-status
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/export-plan
                        method: POST
                        requiresMax: false
                      - path: /document-export-plans/{id}
                        method: GET
                        requiresMax: false
                      - path: /document-export-plans/{id}/cancel
                        method: POST
                        requiresMax: false
                      - path: /document-export-plans/{id}/discard
                        method: POST
                        requiresMax: false
                      - path: /document-exports/{id}/file
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/export
                        method: POST
                        requiresMax: false
                      - path: /documents/{id}/pages
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/pages/{index}/parts
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/pages/{index}/content/{id}
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/toc-candidates
                        method: GET
                        requiresMax: false
                      - path: /documents/{id}/toc
                        method: POST
                        requiresMax: true
                      - path: /bundles/prepare
                        method: POST
                        requiresMax: false
                      - path: /bundles
                        method: GET
                        requiresMax: false
                      - path: /bundles/{id}/files
                        method: GET
                        requiresMax: false
                      - path: /bundles/{id}/submit
                        method: POST
                        requiresMax: true
                      - path: /bundles/{id}/focus
                        method: POST
                        requiresMax: false
                      - path: /bundles/{id}/discard
                        method: POST
                        requiresMax: false
                    legacySync:
                      databaseAndDocumentsCompleteIndependently: true
                      databaseCarries:
                        - study_set_structure
                        - mind_map_cards
                        - excerpts
                        - handwriting
                        - blank_pages
                        - fold_and_layout_state
                        - book_configuration
                      documentHashVerification:
                        default: false
                        expensive: true
                        externalFileProvidersAreNotReopened: true
                        query: verifyHash=1
                      documentLaneCarries:
                        - original_document_bytes
                      documentStatusRoute: /documents/{id}/sync-status
                      eventsRoute: >-
                        /sync/legacy/events?afterSequence={sequence}&limit={1..200}
                      exportRoute: /sync/legacy/export
                      inventoryAffectsNormalSyncStatus: false
                      inventoryAllowsCellularAccess: false
                      inventoryAuthoritative: false
                      inventoryMayConsumeCloudKitQuota: true
                      inventoryObserveOnly: true
                      inventoryReturnsRecordIdentifiers: false
                      inventoryRoute: /sync/legacy/inventory
                      inventoryServerResultConsistency: eventually_consistent_query
                      inventoryUsesSyncQueue: false
                      lanes:
                        - cloudkit
                        - documents
                      recheckDirectlyEditsUserContent: false
                      recheckMayApplyPendingRemoteChanges: true
                      recheckRoute: /sync/legacy/recheck
                      statusRoute: /sync/legacy/status
                    accessPolicy:
                      readOnlyRequiresMax: false
                      routeField: requiresMax
                      setupNavigationAndTemporaryExportRequireMax: false
                      userDataStillRequiresBearerToken: true
                      writeRequiresMax: true
                    documentExport:
                      format: pdf
                      output: filePath+exportId+downloadPath
                      includeRelatedBlankPages:
                        default: true
                        semantics: >-
                          blank_pages_attached_to_selected_real_pages_are_exported_implicitly
                      selectedPageNos: real_pdf_pages_only_omit_for_all_pages
                      selectorInput: selectedPageNos
                      downloadRoute: /document-exports/{id}/file
                      sessionScopedDownloads: true
                      requiresConfirm: false
                      retainedDownloads: 16
                      route: /documents/{id}/export
                      planning:
                        blankInventory: shared-native-export-scope
                        cancelRoute: /document-export-plans/{id}/cancel
                        delivery: in-app-shared-js
                        discardRoute: /document-export-plans/{id}/discard
                        excludesClosedBlanks: true
                        execution: POST /documents/{id}/export with planId
                        limits:
                          activeJobs: 1
                          coverageWork: 10000000
                          expandedPageEntries: 10000
                          outputBytes: 4194304
                          requestBytes: 32768
                          retainedJobs: 8
                          scanPages: 1000
                          selectors: 100
                          timeoutSeconds: 120
                          tocEntries: 5000
                          treeNodes: 50000
                        modifiesLibrary: false
                        requiresHelperInstall: false
                        schema: mn.exportPlan.v0
                        selectors:
                          - all
                          - current
                          - pageRange
                          - toc
                          - annotated
                          - exclude
                          - clear
                        sessionScoped: true
                        startRoute: /documents/{id}/export-plan
                        statusRoute: /document-export-plans/{id}
                        version: 2
                    noteEdits:
                      atomic: true
                      maxOps: 32
                      ops:
                        - deleteComment
                        - setTitle
                        - appendComment
                        - removeHashtags
                        - setAddonValues
                      order: sequential; deleteComment must precede removeHashtags
                      requiresConfirm: true
                      route: /notes/{id}/edits
                      syncReviewOption: >-
                        same rule as the excerpt-time auto-add; same undo step;
                        best effort
                      undoSteps: 1
                    ankiExport:
                      limits:
                        retainedUploads: 8
                        masksPerImage: 200
                        ocrCandidates: 2000
                        archiveExpandedBytes: 268435456
                        imageEdge: 8192
                        requestBytes: 33554432
                        retainedJobs: 16
                        uploadBytes: 67108864
                        imagePixels: 16000000
                        archiveEntries: 10000
                        imageBytes: 16777216
                        activeJobs: 1
                        notesPerJob: 2000
                      requiresHelperInstall: false
                      guideRoute: /guide
                      contractVersion: 2
                      unsupported:
                        - collection.anki21b/zstd
                        - ZIP64
                        - cloze-note-type-template
                        - review-history-export
                        - automatic-Anki-import
                      jobRoute: /anki/jobs
                      sources:
                        - deckId
                        - ir
                        - semantic+templateId
                        - imageOcclusion
                        - proposalJobId
                      downloadRoute: /anki/jobs/{id}/files?name={artifactName}
                      previewExecutesInApp: false
                      modifiesMarginNoteLibrary: false
                      sessionScopedArtifacts: true
                      delivery: in-app
                      operations:
                        - export
                        - preview
                        - verify
                        - inspect
                        - template-inspect
                        - occlusion-scan
                        - occlusion-select
                      uploadTransport: authenticated-http-raw-apkg
                      uploadRoute: /anki/uploads
                      core:
                        semanticIRSchemaVersions:
                          - 1
                        exportIRSchemaVersions:
                          - 1
                        contentModes:
                          - rich-html
                          - markdown
                        semanticFields:
                          - title
                          - question
                          - answer
                          - notes
                          - sourceLink
                          - sourceID
                          - outline
                          - parentLinks
                          - childLinks
                          - tags
                          - questionMarkdown
                          - answerMarkdown
                          - notesMarkdown
                          - sourceLinkMarkdown
                          - outlineMarkdown
                          - imageOcclusionCount
                          - parentLinksMarkdown
                          - childLinksMarkdown
                          - colorIndex
                        interfaceVersion: 1
                        productVersion: 0.2.0
                        hierarchyDepths:
                          - none
                          - first
                          - recursive
                        features:
                          - card-flags
                          - external-apkg-template
                          - folding-outline
                          - interactive-image-occlusion
                          - markdown
                          - nested-decks
                          - rich-html
                          - semantic-snapshot
                          - source-links
                          - stable-identities
                        flagMapSchemaVersions:
                          - 1
                        fieldMapSchemaVersions:
                          - 1
                      imageOcclusion:
                        transport: inline-base64-in-job-json
                        maskWriteRoute: /notes/{id}/image-occlusions
                        formats:
                          - PNG
                          - JPEG
                        coordinateSpace: normalized-top-left-upright
                        selectionSource: proposalJobId
                        cardMode: one-card-all-masks
                        scanWritesMasks: false
                        scanSources:
                          - noteId+optional-contentId
                          - imageOcclusion-with-empty-masks
                        exifOrientationApplied: true
                        ocr: on-device-Vision-text-only
                        selectionModes:
                          - candidateIDs
                          - exact-terms
                    bundleSubmit:
                      supportsWithBlank: true
                      excerptModes:
                        - child
                        - link
                    anchorModes:
                      - page_text
                      - block
                    noteMetadata:
                      maxNoteIds: 200
                      patchFields:
                        fillIndex:
                          scope: >-
                            source_annotation_style_not_mind_map_card_transparency
                          values:
                            - -1
                            - 0
                            - 1
                            - 2
                          semantics:
                            - fillIndex: -1
                              id: legacy_adaptive
                              regionSelection: outline_only
                              textSelection: fill_and_underline
                            - fillIndex: 0
                              id: fill_and_stroke
                              regionSelection: fill_and_outline
                              textSelection: fill_and_underline
                            - fillIndex: 1
                              id: fill_only
                              regionSelection: fill_only
                              textSelection: fill_only
                            - fillIndex: 2
                              id: stroke_only
                              regionSelection: outline_only
                              textSelection: underline_only
                        colorIndex:
                          max: 15
                          min: 0
                      palette:
                        colorIndexRange:
                          - 0
                          - 15
                        count: 16
                        representations:
                          - hex
                          - rgba
                        route: /study-sets/{id}/note-palette
                    reviewDeckCards:
                      contentSelectorField: questionContentId
                      contentSelectorSemantics: copies_exact_native_part_into_review_card_front
                      contentSelectorSource: POST /notes/batch-get parts[].contentId
                      customTextAndContentSelectorMutuallyExclusive: true
                      customTextField: question
                      questionModes:
                        - automatic
                        - custom_text
                        - content_part
                      requiresConfirm: true
                      route: /decks/{id}/cards
                    routeCount: 145
                    noteCopy:
                      target: existing_parent_card
                      modes:
                        - reference
                        - clone
                      semantics:
                        clone:
                          contentSynchronized: false
                          description: >-
                            Creates independent cards and remaps links within
                            the cloned branch.
                        reference:
                          contentSynchronized: true
                          description: >-
                            Creates MarginNote reference cards that stay
                            synchronized with their source cards.
                      scope: selected_roots_and_all_mind_map_descendants
                      requiresConfirm: true
                      route: /notes/copy
                      maxSourceRoots: 50
                    bridgeApiVersion: '0.91'
                    presets:
                      - book-breakdown
                      - source-structure
                      - exam-general
                      - dictionary
                    guideVersion: '0.91'
                    cardAnnotation:
                      editableDrawing: true
                      editorRoute: /notes/{id}/annotation-editor
                      embeddedInCardEditor: true
                      explicitUI: true
                      extendDownward: true
                      imageBacked: true
                      pdfRequired: false
                      requiresRevision: true
                      saveInEditor: true
                      sharedCardPalette: true
                      tapToReedit: true
                      textBoxes: false
                      zoom: true
                    commentFolding:
                      maxTargets: 200
                      persistent: true
                      readRoute: /notes/{id}/comments
                      requiresRevision: true
                      selectors:
                        - index
                        - ownerNoteId+commentId
                      supportsDryRun: true
                      uiApplied: true
                      uiExclusions:
                        - flashcard-question
                        - review-outline
                        - mindmap-recall
                        - content-editing
                        - document-margin-annotation
                      uiSurfaces:
                        - card-viewer
                        - comment-manager
                        - mindmap
                        - outline
                        - document-card
                        - review-card-source
                      writeRoute: /notes/{id}/comments/fold
                    bundlePrepare:
                      cardStyle:
                        defaultFillIndexes:
                          - -1
                          - 0
                          - 1
                          - 2
                        fillIndexSemantics:
                          - fillIndex: -1
                            id: legacy_adaptive
                            regionSelection: outline_only
                            textSelection: fill_and_underline
                          - fillIndex: 0
                            id: fill_and_stroke
                            regionSelection: fill_and_outline
                            textSelection: fill_and_underline
                          - fillIndex: 1
                            id: fill_only
                            regionSelection: fill_only
                            textSelection: fill_only
                          - fillIndex: 2
                            id: stroke_only
                            regionSelection: outline_only
                            textSelection: underline_only
                        paletteRoute: /study-sets/{id}/note-palette
                        perCardMarker: '''[style: colorIndex=0 fillIndex=2]'''
                        fillIndexScope: source_annotation_style_not_mind_map_card_transparency
                        colorIndexRange:
                          - 0
                          - 15
                    guide:
                      sha256: >-
                        43463f3690bf9d9ef78111e33cb77df6261fdba0a67f4cb6a81cc06c8d3403b2
                      refreshPolicy: fetch_at_session_start_when_version_or_sha256_differs
                      rotatesToken: false
                      usesExistingBearer: true
                      installRequired: false
                      version: '0.91'
                      route: /guide
                    apiFingerprint: d165ea64cae5
                    noteTitles:
                      preview: display_title_or_first_text
                      previewTextLimitUTF16: 64
                      previewTruncationMarker: …
                      previewTruncationMarkerExcludedFromLimit: true
                      routes:
                        - GET /study-sets/{id}/tree
                        - POST /notes/batch-get
                      title: full_display_title_without_body_fallback
                      untitledValue: ''
                    guideHash: >-
                      43463f3690bf9d9ef78111e33cb77df6261fdba0a67f4cb6a81cc06c8d3403b2
                    mindMapPrint:
                      schema: mn.mindMapPrintPlan.v0
                      nativeRenderer: true
                      modes:
                        - keepStructure
                        - classic
                        - cardFlow
                      previewRoute: /study-sets/{id}/mindmap-print/preview
                      scope:
                        - whole
                        - branch
                      output: filePath
                      densityValue:
                        classicCompatibleAt: 0.995
                        max: 1
                        min: 0
                      requiresConfirm: false
                      requiresMax: false
                      exportRoute: /study-sets/{id}/mindmap-print/export
                    noteHashtags:
                      ancestors: derived_not_materialized
                      caseSensitive: false
                      doNotUseForWriting: /notes/{id}/text
                      hierarchySeparator: /
                      inlineTextEncodingSupported: false
                      maxHashtags: 100
                      maxNoteIds: 200
                      operations:
                        - add
                        - remove
                        - replace
                      readFields:
                        - hashtags
                        - hashtagPaths
                      recursiveRemoveFlag: includeDescendants
                      removeDefault: exact_full_path
                      storedValue: one_complete_leaf_path
                      textEditMisuseError: HASHTAG_ROUTE_REQUIRED
                      treeRoute: /study-sets/{id}/hashtags
                      writeRoute: /notes/hashtags
                    skill:
                      sha256: >-
                        315db09b91ec8414a12a6d486d38e7634d70b6027a5a49d50fbb688b944a3453
                      rotatesToken: false
                      backsUpReplacedFiles: true
                      bootstrapVersion: 1
                      refreshShRoute: /skill/refresh.sh
                      refreshPowerShellRoute: /skill/refresh.ps1
                      refreshScope: existing_mn_bridge_skill_files_only
                      usesExistingBearer: true
                      guidePolicy: fetch_runtime_guide_each_session
                      route: /skill
                    writing:
                      carriers:
                        - blank
                        - focus
                      confirmsWritable: false
                      contentInventory: true
                      documentPencilCommit:
                        canSwitch: false
                        inputFrozen: false
                        requiresConfirm: true
                        result: /writing/pencil-result
                        submit: /writing/pencil-document-commit
                        targetFrom: >-
                          context.surfaces[].state.visiblePages[].continuousCommitTarget|pagedCommitTarget
                        writers:
                          - continuous
                          - paged
                      flush: false
                      focusTransition:
                        changesLayer: false
                        createsAttempt: false
                        result: /writing/transition-result
                        savesCurrentPencil: true
                        submit: /writing/focus-enter
                      includesUnsavedCanvas: false
                      limits:
                        layerIds: 32
                        parts: 2048
                        rows: 256
                      liveWindowContext: true
                      managedLayerTrial:
                        blankBegin: /writing/blank-begin
                        canSwitch: false
                        compact: /writing/layer-compact
                        confirmsPersistedLayer: true
                        createsAttempt: false
                        focusBegin: /writing/focus-begin
                        leaseStorage: device-local
                        read: /writing/layer-leases
                        ready: false
                        restore: /writing/layer-restore
                        result: /writing/transition-result
                      managedLayers: false
                      ownedBlankEntry:
                        changesLayer: false
                        createsAttempt: false
                        opensOwnedBlank: true
                        result: /writing/transition-result
                        submit: /writing/blank-enter
                      ownedBlankPreparation:
                        changesLayer: false
                        createsAttempt: false
                        opensAnswerSpace: false
                        result: /writing/transition-result
                        submit: /writing/blank-prepare
                      pencilCommit:
                        canSwitch: false
                        carriers:
                          - focus
                        inputFrozen: false
                        operationRecord: process-local
                        requiresConfirm: true
                        result: /writing/pencil-result
                        submit: /writing/pencil-commit
                      pencilInputGate:
                        grantsCallerLease: false
                        maximumSeconds: 15
                        programmaticNavigationBlocked: false
                        scope: application-ui-only
                      practiceOnCurrentLayer:
                        blankEnter: /writing/session-blank-enter
                        changesLayer: false
                        createsAttempt: false
                        exit: /writing/session-exit
                        focusEnter: /writing/session-focus-enter
                        restoresOnExit: false
                        result: /writing/transition-result
                        takesLease: false
                      practicePlan:
                        maxQuestions: 20
                        read: /writing/plan-read
                        save: /writing/plan-save
                        startsWriting: false
                        storage: device-local
                      practiceSessionRecord:
                        assess: /writing/session-assess
                        blankBegin: /writing/session-blank-begin
                        canCreate: true
                        canSwitch: false
                        cancel: /writing/session-cancel
                        create: /writing/session-create
                        finish: /writing/session-finish
                        focusBegin: /writing/session-focus-begin
                        pause: /writing/session-pause
                        preview: /writing/session-preview
                        read: /writing/session-read
                        ready: false
                        reconcile: /writing/session-reconcile
                        reserve: /writing/session-reserve
                        restore: /writing/session-layer-restore
                        result: /writing/transition-result
                        resume: /writing/session-resume
                        storage: device-local
                      prepare: false
                      resolve: true
                      routes:
                        content: /writing/content
                        context: /writing/context
                        resolve: /writing/resolve
                        windows: /writing/windows
                      schemaVersion: 1
                      sessionContext: false
                      snapshot: false
                      stage: persisted-inspection
                      switch: false
                      windowEnumeration: true
                    imageOcclusions:
                      concurrencyGuards:
                        - expectedSourceFingerprint
                        - expectedMaskFingerprint
                      coordinateSpace: normalized_top_left
                      createsReviewCards: false
                      existingReviewCardsUpdateAutomatically: false
                      maxMasks: 200
                      minMasksByOperation:
                        add: 1
                        replace: 0
                      nativeStorage: highlight_pic.maskRects
                      operations:
                        - add
                        - replace
                      requiresConfirm: true
                      requiresDryRun: true
                      route: /notes/{id}/image-occlusions
                      source: existing_image_excerpt_note
                      supportsEmptyReplace: true
      x-codeSamples:
        - lang: javascript
          label: 判断 MarginNote 是否注册了该接口
          source: |
            const caps = await mn.api('/capabilities');
            const has = caps.routes.some(r => r.path === '/notes/{id}/edits');
            mn.log(caps.bridgeApiVersion, caps.apiFingerprint, caps.routeCount);
components:
  schemas:
    CapabilitiesResponse:
      type: object
      description: 路由清单与各项上限。字段比此处列出的多，另有若干按主题分组的对象，分别说明标签操作、元数据级别、手写会话、同步诊断各自的上限与语义。
      properties:
        bridgeApiVersion:
          type: string
        routeCount:
          type: number
        apiFingerprint:
          type: string
        routes:
          type: array
          items:
            $ref: '#/components/schemas/RouteDescriptor'
        presets:
          type: array
          items:
            type: string
          description: 拆书任务包可用的预设。
        anchorModes:
          type: array
          items:
            type: string
          description: 拆书任务包可用的定位方式。
        guideVersion:
          type: string
        guideHash:
          type: string
        guide:
          $ref: '#/components/schemas/GuideInfo'
      additionalProperties: true
    RouteDescriptor:
      type: object
      required:
        - method
        - path
      properties:
        method:
          type: string
          description: 方法。
        path:
          type: string
          description: 路径模板。
        requiresMax:
          type: boolean
          description: 只约束外部 Agent。面板跳过该项。
    GuideInfo:
      type: object
      description: 运行规程的元信息。
      properties:
        version:
          type: string
        sha256:
          type: string
          description: 规程正文的哈希。
        route:
          type: string
        refreshPolicy:
          type: string
          description: MarginNote 建议的抓取时机。
        usesExistingBearer:
          type: boolean
        installRequired:
          type: boolean
        rotatesToken:
          type: boolean

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.