> ## 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.

# 列出卡组复习卡

> 列出卡组里的复习卡。每项返回复习卡本身、该卡对应的背面卡片，以及背面卡片是否存在（见 `sourceAlive` 字段）。

传学习集的标识进来会返回 `422 NOT_A_DECK`，反过来则返回 `IS_A_DECK`。




## OpenAPI

````yaml /openapi/plugin-api.yaml get /decks/{deckid}/cards
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:
  /decks/{deckid}/cards:
    get:
      tags:
        - 学习集与卡组
      summary: 列出卡组复习卡
      description: |
        列出卡组里的复习卡。每项返回复习卡本身、该卡对应的背面卡片，以及背面卡片是否存在（见 `sourceAlive` 字段）。

        传学习集的标识进来会返回 `422 NOT_A_DECK`，反过来则返回 `IS_A_DECK`。
      operationId: getDecksDeckidCards
      parameters:
        - $ref: '#/components/parameters/Deckid'
      responses:
        '200':
          description: 复习卡清单。可能还有未列出的字段。
          content:
            application/json:
              schema:
                type: object
                properties:
                  cardCount:
                    type: integer
                  bridgeApiVersion:
                    type: string
                  title:
                    type: string
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        modifiedAt:
                          type: string
                        sourceAlive:
                          type: boolean
                        title:
                          type: string
                        sourceNoteId:
                          type: string
                        cardNoteId:
                          type: string
                      required:
                        - modifiedAt
                        - sourceAlive
                        - title
                        - sourceNoteId
                        - cardNoteId
                  deckId:
                    type: string
                  cards:
                    type: array
                    items:
                      $ref: '#/components/schemas/DeckCardEntry'
                    description: ⚠️
              examples:
                assembled:
                  summary: 构造示例，未实测
                  value:
                    cards:
                      - cardNoteId: 1D797495-9138-40E5-9938-8143878F76E0
                        sourceNoteId: B9F3696A-AF8A-43B2-A8A2-2791717F1695
                        sourceAlive: true
                        title: 光合作用
                measured:
                  summary: 实测于 2026-10-07，App 0.91
                  value:
                    cardCount: 9
                    bridgeApiVersion: '0.91'
                    title: The Quiet Case for Walkable Streets
                    items:
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 137226A6-920E-4F21-AF74-A0858BC547C3
                        cardNoteId: 1647F4FD-BA21-405D-8229-C9B0E8811C38
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: E3FBABD9-A3FA-4334-B86C-9900FF0D33CC
                        cardNoteId: 5CA86364-D290-42B6-8530-FDCED5598D71
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 732476FF-4F7A-42EC-8F42-71C0B6BDA91D
                        cardNoteId: 1C96C9B2-B521-40AA-A37B-17E793D426DB
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 564C041B-7771-444E-B909-C59AA30327E7
                        cardNoteId: 3C754488-2C54-4CE8-9815-E29FA8A177ED
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: E215719E-A108-44AE-A287-0A2CA6F89153
                        cardNoteId: 8E68A287-D820-4D0F-8A11-1E735CB7F1AA
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 4B7B59E7-A933-4BDE-8808-23D922B0CE73
                        cardNoteId: F0B499C9-5D8B-49CE-82B7-E074C18A0C7E
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: D9BCBAC6-6C3D-45BE-B698-BE7EDA23136A
                        cardNoteId: 61990B9D-4EE5-43E5-9071-14932B4D8C0B
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 45F0EE7B-F443-4DEB-AABC-360969DD9AC5
                        cardNoteId: C4D3F9D1-6B87-42FF-8A2E-4A9061FFA2DF
                      - modifiedAt: '2026-09-09T10:55:09Z'
                        sourceAlive: true
                        title: ''
                        sourceNoteId: 32D27A0A-B87F-4C82-8290-15A6813B3CC8
                        cardNoteId: B86CD41E-188C-4A41-89DD-794E22EF44E1
                    deckId: 52E0B76E-7290-4D56-95DF-3C90C1DC7E6B
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
      x-codeSamples:
        - lang: javascript
          label: 列出卡组里的复习卡
          source: |
            const r = await mn.api('/decks/' + deckId + '/cards');
            if (r.error) { mn.log(r.error.code); return; }
            const alive = r.cards.filter(c => c.sourceAlive).length;
            mn.log(alive + '/' + r.cards.length);
components:
  parameters:
    Deckid:
      name: deckid
      in: path
      required: true
      description: 复习卡组的 id。取自 `GET /decks`。卡组与学习集是两种对象，id 不通用。
      schema:
        type: string
  schemas:
    DeckCardEntry:
      type: object
      properties:
        cardNoteId:
          type: string
        sourceNoteId:
          type: string
          description: >-
            背面该卡。该卡与 `POST /notes/batch-get` 里 `flashcard` 为真的项靠 `evernoteid`
            对应。
        sourceAlive:
          type: boolean
          description: 为 `false` 表示背面卡片已被删除或隐藏，复习时背面是空的。
        title:
          type: string
    ErrorEnvelope:
      type: object
      description: >-
        失败时的 Response Body。MarginNote 将其当作正常 Response Body 返回，因此落在 resolve 里而不是
        reject 里。
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: 错误码。判断写入是否发生看该字段，不看 HTTP 状态码。
        message:
          type: string
          description: 人可读的说明。文案随 MarginNote 的版本变化，不要用该字段做分支判断。
        retryable:
          type: boolean
          description: >-
            是否明确可以稍后再试。只有外部调用的响应带该字段，面板本地调用的响应只有 `code` 与
            `message`。该布尔值表达不了结果未定，这类情况按各接口的说明处理，例如手写会话族看响应里的
            `layerLeaseUnresolved`。
        details:
          type: object
          description: >-
            附加事实。例如 `SCAN_BUSY` 带 `retryAfterSeconds`，`HASHTAG_ROUTE_REQUIRED` 带
            `writeRoute`。
          additionalProperties: true
  responses:
    UnprocessableEntity:
      description: 字段合法但组合不成立，例如缺少 `confirm`、序号越界、或写入顺序违反约定。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            confirmRequired:
              summary: 没有带 confirm
              value:
                error:
                  code: CONFIRM_REQUIRED
                  message: 本次调用会改动数据，需要带 confirm。
            invalidOrder:
              summary: 写入顺序不成立
              value:
                error:
                  code: INVALID_ORDER
                  message: deleteComment 必须排在 removeHashtags 之前。

````

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