Document EditingAPI Reference

Document Editing

The Article Edit API provides native document operation capabilities in WorkspaceLM, supporting session management, document reading, text operations, reference management, and style settings.

With the Article Edit API, you can easily achieve the following scenarios:

  • Customized Programming Calls: Directly integrate with the API by writing code, seamlessly integrating document processing capabilities into your automated workflow.
  • Deep Integration with LLM Ecosystem: Integrate powerful document editing capabilities as tools (Tool/MCP) into large language model platforms or AI Agents.
  • Lightning-Fast Operations with Third-Party Frameworks: Directly manipulate underlying documents using tools or frameworks like OpenClaw, completely avoiding unstable browser simulation solutions.

POST/article/v1/session/create

Create Session

Creates an editing session based on the document ID. The session is bound to the API Key user and is valid for 10 minutes. If an active session already exists for this docId, the existing sessionId is returned directly.

Request Headers

  • Name
    x-api-key
    Type
    string
    Required
    Required
    Description
    API Key for user authentication. See Authentication for details.

Request Body

  • Name
    docId
    Type
    string
    Required
    Required
    Description
    Document ID.

Response Body

  • Name
    sessionId
    Type
    string
    Required
    Required
    Description
    The session ID for operating on the current document. This ID expires after 10 minutes of no operation.
  • Name
    blockCount
    Type
    integer
    Required
    Required
    Description
    Number of blocks in the document.
  • Name
    reused
    Type
    boolean
    Optional
    Optional
    Description
    For the same user's same document request, the document handle will be reused.

Request

POST
/article/v1/session/create
curl -X POST https://api.easytransnote.com/article/v1/session/create \
  -H "Content-Type: application/json" \
  -H "x-api-key: $YOUR_API_KEY" \
  -d '{ "docId": "267058863981862912" }'

Response

{
  "code": 1,
  "data": {
    "sessionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "blockCount": 12,
    "reused": false
  }
}

POST/article/v1/session/destroy

Destroy Session

Actively destroys the session and releases server resources.

Request Headers

  • Name
    x-api-key
    Type
    string
    Required
    Required
    Description
    API Key for user authentication. See Authentication for details.

Request Body

  • Name
    sessionId
    Type
    string
    Required
    Required
    Description
    The session ID to destroy.

Request

POST
/article/v1/session/destroy
curl -X POST https://api.easytransnote.com/article/v1/session/destroy \
  -H "Content-Type: application/json" \
  -H "x-api-key: $YOUR_API_KEY" \
  -d '{ "sessionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }'

Response

{ "code": 1, "data": { "ok": true } }

POST/article/v1/doc/list

Get Document List

Gets all document lists for the current user.

Request Headers

  • Name
    x-api-key
    Type
    string
    Required
    Required
    Description
    API Key for user authentication. See Authentication for details.

Request Body

    Response Body

    • Name
      articles
      Type
      ArticleGroup[]
      Required
      Required
      Description
      List of document groups.

    Request

    POST
    /article/v1/doc/list
    curl -X POST https://api.easytransnote.com/article/v1/doc/list \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{}'
    

    Response

    {
      "code": 1,
      "data": {
        "articles": [
          {
            "group_id": 0,
            "name": "我的私人文章",
            "isCreator": true,
            "articles": [
              {
                "outer_id": "57810139419385856",
                "name": "文档标题",
                "group": 0,
                "sharePermission": {
                  "operation": true,
                  "permission": "group-only"
                },
                "children": [],
                "fileholderDeep": 0,
                "time_create": 1725683811
              }
            ],
            "time_create": 1725683811
          }
        ]
      }
    }
    

    POST/article/v1/doc/create

    Create Document

    Creates a new blank document.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      group
      Type
      integer
      Optional
      Optional
      Description
      Group id, defaults to 0, meaning creating a private article.
    • Name
      name
      Type
      string
      Optional
      Optional
      Description
      Document title.

    Response Body

    • Name
      article
      Type
      ArticleNode
      Required
      Required
      Description
      The created document object.

    Request

    POST
    /article/v1/doc/create
    curl -X POST https://api.easytransnote.com/article/v1/doc/create \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "group": 1, "name": "新文档" }'
    

    Response

    {
      "code": 1,
      "data": {
        "article": {
          "outer_id": "269073564450299904",
          "name": "新文档",
          "group": 0,
          "sharePermission": {
            "operation": true,
            "permission": "group-only"
          },
          "children": []
        },
        "group": 0
      }
    }
    

    POST/article/v1/doc/delete

    Delete Document

    Deletes the specified document.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      docId
      Type
      string
      Required
      Required
      Description
      The document ID to delete.

    Response Body

    • Name
      article
      Type
      string
      Required
      Required
      Description
      The confirmed deleted document id.

    Request

    POST
    /article/v1/doc/delete
    curl -X POST https://api.easytransnote.com/article/v1/doc/delete \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "docId": "269073564450299904" }'
    

    Response

    { "code": 1, "data": { "article": "269073564450299904" } }
    

    POST/article/v1/doc/read

    Get Document Content

    Reads the entire document's content, global styles, reference list, and version number.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.

    Response Body

    • Name
      blocks
      Type
      ElementBlockSummary[]
      Required
      Required
      Description
      A summary list of document content blocks, containing only ElementBlock global identifiers, types, and the Markdown content actually rendered by ElementBlock.
    • Name
      text
      Type
      string
      Required
      Required
      Description
      Full text in Markdown format.
    • Name
      style
      Type
      ArticleStyle
      Required
      Required
      Description
      Global styles, from the style field of the document meta block.
    • Name
      reference
      Type
      ArticleReference[]
      Required
      Required
      Description
      List of references.
    • Name
      version
      Type
      string
      Required
      Required
      Description
      Document format version number.

    Request

    POST
    /article/v1/doc/read
    curl -X POST https://api.easytransnote.com/article/v1/doc/read \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx" }'
    

    Response

    {
      "code": 1,
      "data": {
        "blocks": [
          { "id": "blk-1", "type": "title", "text": "实际渲染的 Markdown 文本" }
        ],
        "text": "# 文档标题\n\n段落内容...",
        "style": { "global": { "paperSize": "a4" } },
        "reference": [],
        "version": "1.0"
      }
    }
    

    POST/article/v1/doc/read-block

    Read Single Block

    Reads the content of the specified block by blockId and returns the calculated final display style.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Required
      Required
      Description
      Block ID.

    Response Body

    • Name
      block
      Type
      ElementBlock
      Optional
      Optional
      Description
      Raw block node data.
    • Name
      path
      Type
      number[]
      Optional
      Optional
      Description
      Path of the block in the document tree.
    • Name
      style
      Type
      ElementStyle
      Optional
      Optional
      Description
      The calculated final display style (merged global and local styles).
    • Name
      text
      Type
      string
      Optional
      Optional
      Description
      Markdown text after conversion of the current block.

    Request

    POST
    /article/v1/doc/read-block
    curl -X POST https://api.easytransnote.com/article/v1/doc/read-block \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx" }'
    

    Response

    {
      "code": 1,
      "data": {
        "block": { "id": "blk-xxx", "type": "paragraph", "children": [...], "style": {} },
        "path": [3],
        "style": { "fontSize": "14px" },
        "text": "段落内容"
      }
    }
    

    POST/article/v1/block/insert

    Insert Block

    Insert a new block at the specified position in the document. The id is automatically generated by the server.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      path
      Type
      number[]
      Required
      Required
      Description
      The path of the insertion position. For details on position paths, see Block Position Path.
    • Name
      blocks
      Type
      ElementBlock[]
      Required
      Required
      Description
      Array of block objects to insert. At least 1 is required. Currently only ElementBlock type blocks are supported.

    Response Body

    • Name
      ids
      Type
      string[]
      Optional
      Optional
      Description
      List of server-generated IDs, corresponding one-to-one with the blocks array.

    Request

    POST
    /article/v1/block/insert
    curl -X POST https://api.easytransnote.com/article/v1/block/insert \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "path": [4], "blocks": [{ "type": "paragraph", "children": [{"type": "default", "text": "新段落"}], "style": {} }] }'
    

    Response

    { "code": 1, "data": { "ids": ["new-id-1"] } }
    

    POST/article/v1/block/delete

    Delete Block

    Delete the specified block by blockId.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Required
      Required
      Description
      The ID of the block to delete. Currently only ElementBlock type blocks are supported.

    Request

    POST
    /article/v1/block/delete
    curl -X POST https://api.easytransnote.com/article/v1/block/delete \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/block/text/replace

    Replace Block Text

    Replace the content of the specified block. At least one update field must be provided.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Required
      Required
      Description
      Block ID.
    • Name
      children
      Type
      string | TextLeaf[] | ElementBlock[]
      Optional
      Optional
      Description
      New text/element content. Strings are automatically wrapped as TextLeaf; TextLeaf[] supports rich text; ElementBlock[] is used for nested structures like list and table.
    • Name
      equation
      Type
      string
      Optional
      Optional
      Description
      LaTeX formula content (equation type only).
    • Name
      code
      Type
      string
      Optional
      Optional
      Description
      Code content (code type only).
    • Name
      language
      Type
      string
      Optional
      Optional
      Description
      Code language (code type only).
    • Name
      image
      Type
      Image[]
      Optional
      Optional
      Description
      Image list (image type only).
    • Name
      author
      Type
      Author[]
      Optional
      Optional
      Description
      Author list (author type only).

    Request

    POST
    /article/v1/block/text/replace
    curl -X POST https://api.easytransnote.com/article/v1/block/text/replace \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx", "children": "新内容" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/block/text/append

    Append Block Text

    Append content to the end of the specified block's text.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Required
      Required
      Description
      Block ID.
    • Name
      text
      Type
      string | TextLeaf[]
      Required
      Required
      Description
      The text content to append.

    Request

    POST
    /article/v1/block/text/append
    curl -X POST https://api.easytransnote.com/article/v1/block/text/append \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx", "text": "追加内容" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/block/cite

    Set Citation

    Set a reference citation for a TextLeaf, or remove an existing citation.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Optional
      Optional
      Description
      Block ID (mutually exclusive with leafPath).
    • Name
      leafPath
      Type
      number[]
      Optional
      Optional
      Description
      Precisely specifies the path of the leaf.
    • Name
      cite
      Type
      string | null
      Optional
      Optional
      Description
      Citation ID. Pass null to remove the citation.

    Request

    POST
    /article/v1/block/cite
    curl -X POST https://api.easytransnote.com/article/v1/block/cite \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx", "cite": "ref-1" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/reference/add

    Add Reference

    Append a new ArticleReference to the document's reference list.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      reference
      Type
      ArticleReference
      Required
      Required
      Description
      Reference object. If id is not provided, it will be automatically generated by the server.

    Response Body

    • Name
      id
      Type
      string
      Optional
      Optional
      Description
      The ID of the newly added reference.

    Request

    POST
    /article/v1/reference/add
    curl -X POST https://api.easytransnote.com/article/v1/reference/add \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "reference": { "name": "Ref1", "tag": "[1]", "author": ["Zhang San"], "title": "A Study on AI", "journal": "Nature", "year": "2024" } }'
    

    Response

    { "code": 1, "data": { "id": "ref-xxx" } }
    

    POST/article/v1/reference/update

    Update Reference

    Partially update an existing ArticleReference by id. Only the provided fields are updated; passing null removes that field.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      reference
      Type
      ArticleReference
      Required
      Required
      Description
      Reference object. Must include the id field. A field value of null removes that field.

    Request

    POST
    /article/v1/reference/update
    curl -X POST https://api.easytransnote.com/article/v1/reference/update \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "reference": { "id": "ref-xxx", "name": "Updated" } }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/reference/delete

    Delete Reference

    Remove a reference from the reference list by id.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      referenceId
      Type
      string
      Required
      Required
      Description
      The ID of the reference to delete.

    Request

    POST
    /article/v1/reference/delete
    curl -X POST https://api.easytransnote.com/article/v1/reference/delete \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "referenceId": "ref-xxx" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/block/style

    Set Block Style

    Set the display style of a block.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Required
      Required
      Description
      Block ID.
    • Name
      style
      Type
      CssStyle
      Optional
      Optional
      Description
      Display style object.
    • Name
      indent
      Type
      boolean
      Optional
      Optional
      Description
      Paragraph indent (paragraph type only).
    • Name
      serial
      Type
      boolean
      Optional
      Optional
      Description
      Show numbering (equation and image types only).
    • Name
      isHideIndex
      Type
      boolean
      Optional
      Optional
      Description
      Hide index number (h1, h2, h3 types only).
    • Name
      textAlign
      Type
      string
      Optional
      Optional
      Description
      Text alignment (table type only): center | start | end.
    • Name
      isHideLanguage
      Type
      boolean
      Optional
      Optional
      Description
      Hide language display (code type only).
    • Name
      nameWidth
      Type
      string
      Optional
      Optional
      Description
      Property name width (label type only).
    • Name
      language
      Type
      string
      Optional
      Optional
      Description
      Abstract language (abstract type only): none | zh | en.
    • Name
      authorStyle
      Type
      AuthorElementAuthorCssStyle
      Optional
      Optional
      Description
      Author name style (author type only).
    • Name
      institutionStyle
      Type
      AuthorElementInstitutionCssStyle
      Optional
      Optional
      Description
      Institution style (author type only).
    • Name
      isTemplate
      Type
      boolean
      Optional
      Optional
      Description
      Whether this is a template component.

    Request

    POST
    /article/v1/block/style
    curl -X POST https://api.easytransnote.com/article/v1/block/style \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx", "style": { "fontSize": "16px" }, "indent": true }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/style/leaf

    Set Text Style

    Set style properties for a TextLeaf (bold, italic, underline, color, etc.).

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      blockId
      Type
      string
      Optional
      Optional
      Description
      Block ID, modifies all plain text nodes under this block. (Mutually exclusive with leafPath)
    • Name
      leafPath
      Type
      number[]
      Optional
      Optional
      Description
      Precisely specifies the path of the leaf, modifies the text node at the specific path. (Mutually exclusive with blockId)
    • Name
      bold
      Type
      boolean | null
      Optional
      Optional
      Description
      Whether to bold.
    • Name
      italic
      Type
      boolean | null
      Optional
      Optional
      Description
      Whether to italicize.
    • Name
      textDecoration
      Type
      string | null
      Optional
      Optional
      Description
      Text decoration: underline | line-through.
    • Name
      color
      Type
      string | null
      Optional
      Optional
      Description
      Text color (CSS value).

    Request

    POST
    /article/v1/style/leaf
    curl -X POST https://api.easytransnote.com/article/v1/style/leaf \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "blockId": "blk-xxx", "bold": true, "color": "#ff0000" }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    POST/article/v1/style/article

    Set Global Style

    Update the document's ArticleStyle (global component styles), supports deep merge.

    Request Headers

    • Name
      x-api-key
      Type
      string
      Required
      Required
      Description
      API Key for user authentication. See Authentication for details.

    Request Body

    • Name
      sessionId
      Type
      string
      Required
      Required
      Description
      Session ID.
    • Name
      style
      Type
      ArticleStyle
      Required
      Required
      Description
      ArticleStyle object. All fields are optional; only the provided fields are updated.

    Request

    POST
    /article/v1/style/article
    curl -X POST https://api.easytransnote.com/article/v1/style/article \
      -H "Content-Type: application/json" \
      -H "x-api-key: $YOUR_API_KEY" \
      -d '{ "sessionId": "xxx", "style": { "global": { "paperSize": "a4" }, "title": { "style": { "fontSize": "24px" } } }'
    

    Response

    { "code": 1, "data": { "ok": true } }
    

    Was this page helpful?