Retrieve Current Document Text note.document.content.get

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: note

Who can execute the method: a user with access to the Knowledge base module and "View" permission for the document's knowledge base

This method belongs to REST 3.0. The call specifics and response format of the new API version are described in the REST 3.0 overview.

The note.document.content.get method retrieves the current document text in Markdown and the blocks that Markdown cannot fully represent.

Unlike note.document.get, this method reads the current state of the collaborative editor without lag. The old values passed to note.document.content.edit are compared against this exact text.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
integer

Document identifier.

The identifier can be obtained using the note.document.tree.list method

Code Examples

How to Use Examples in Documentation

The new API call differs by adding the /api/ segment to the request URL:

https://{installation_address}/rest/api/{user_id}/{webhook_token}/note.document.content.get

curl -X POST \
        -H "Content-Type: application/json" \
        -d '{"id":42}' \
        https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/note.document.content.get
        
curl -X POST \
        -H "Content-Type: application/json" \
        -d '{"id":42,"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/api/note.document.content.get
        
import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        try {
          const response = await $b24.actions.v3.call.make({
            method: 'note.document.content.get',
            params: { id: 42 },
            requestId: Text.getUuidRfc4122()
          })
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            console.info(response.getData()!.result)
          }
        } catch (error) {
          console.error(error)
        }
        
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function getContent() {
            try {
              const $b24 = await B24Js.initializeB24Frame()
              const response = await $b24.actions.v3.call.make({
                method: 'note.document.content.get',
                params: { id: 42 },
                requestId: B24Js.Text.getUuidRfc4122()
              })
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
              console.info(response.getData().result)
            } catch (error) {
              console.error(error)
            }
          }
          document.addEventListener('DOMContentLoaded', getContent)
        </script>
        

There is no ready-made wrapper for this method in b24pysdk yet, and it is not included in the SDK's REST 3.0 method list. Add the method to Config().api_v3_methods and call it via bitrix_token.call_method with prefer_version=3.

from b24pysdk import Config
        from b24pysdk.errors import BitrixSDKException
        from b24pysdk.errors.v3 import BitrixAPIError
        
        method = "note.document.content.get"
        Config().configure(api_v3_methods=Config().api_v3_methods | {method})
        
        try:
            response = bitrix_token.call_method(
                api_method=method,
                params={
                    "id": 42,
                },
                prefer_version=3,
            )
            item = response["result"]["item"]
            print(item["markdown"], item["lossless"])
        except BitrixAPIError as error:
            print(f"code: {error.code}", f"message: {error.error.message}", sep="\n")
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        

The SDK does not yet support calls to the /rest/api/ address. Use direct HTTP requests, for example, via curl or fetch.

The JS API does not yet support calls to the /rest/api/ address. Use direct HTTP requests, for example, via fetch.

CRest does not yet support calls to the /rest/api/ address. Use direct HTTP requests, for example, via curl.

The SDK does not yet support calls to the /rest/api/ address. Use a direct HTTP request.

Response Handling

HTTP status: 200

{
            "result": {
                "item": {
                    "id": 42,
                    "markdown": "# Chapter 1\n\nDocument text",
                    "lossless": true,
                    "opaqueBlocks": []
                }
            },
            "time": {
                "start": 1795591363,
                "finish": 1795591363.867149,
                "duration": 0.8671491146087644,
                "processing": 0,
                "date_start": "2026-11-25T10:22:43+03:00",
                "date_finish": "2026-11-25T10:22:43+03:00",
                "operating_reset_at": 1795591920,
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

item
object

Current document content. Object structure description

time
time

Information about the request execution time

Item Object

Name
type

Description

id
integer

Document identifier

markdown
string

Current document text in Markdown

lossless
boolean

true if Markdown fully represents the document content; false if there are ambiguous blocks in opaqueBlocks

opaqueBlocks
array

Array of blocks that Markdown cannot fully represent. Object structure description

OpaqueBlocks Object

Each array element contains the following fields.

Name
type

Description

index
integer

Block position among the document's top-level blocks, starting from 0

nodeType
string

Editor block type

excerpt
string

First 200 characters of the block's Markdown representation with whitespace collapsed

reasons
array

Reasons why the block cannot be represented in Markdown without loss.

For example: NODE_OUTSIDE_CORE, LOSSY_ATTR, ROUNDTRIP_MISMATCH.

Additional details may be specified after a colon

Error Handling

HTTP status: 409

{
            "error": {
                "code": "NOTE_CONTENT_FORMAT_UNSUPPORTED",
                "message": "The article content is stored in a legacy format that this method does not support. Use note.document.get to get the text."
            }
        }
        

Name
type

Description

error.code
string

String error code. Use it to identify the type of exception

error.message
string

Text description of the error

error.validation
array

Array with error details. Present only in data validation errors BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION

error.validation[].field
string

Name of the field where the validation error occurred

error.validation[].message
string

Description of the error related to the specified field

Possible Error Codes

HTTP Status

Code

Description

409

NOTE_CONTENT_FORMAT_UNSUPPORTED

The document content is stored in a legacy format that the method does not support. Retrieve the text using note.document.get

409

NOTE_CONTENT_TOO_LARGE

The current document content on the server is too large for the method to process. Open the document in the editor and repeat the call

400

NOTE_CONTENT_MARKDOWN_TOO_COMPLEX

Parsing the document content exceeds the allowed processing budget

409

NOTE_CONTENT_UNREADABLE

The current state of the document could not be read

400

BITRIX_REST_V3_EXCEPTION_ENTITYNOTFOUNDEXCEPTION

The document does not exist, the user cannot view it, or a template or a knowledge base system document was specified

The method retrieves the text of both archived documents and documents in the Recycle Bin if the user can view them.

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

503

BITRIX_REST_V3_EXCEPTION_LIMITER_QUERYTIMELIMITEXCEPTION
Request canceled: query time limit exceeded

The SQL query inside the method ran longer than the SQL query time limit. The Retry-After header contains the limit in seconds

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block lasts 5 minutes, after which the accumulated execution time of the method is counted from zero

429

BITRIX_REST_V3_EXCEPTION_RATELIMITEXCEPTION
Request was blocked because the limit was exceeded

The same block in REST 3.0 methods. The Retry-After header contains the remaining block time in seconds

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

403

FEATURE_NOT_AVAILABLE_ON_CURRENT_PLAN
This feature is not available on your current plan.

The Bitrix24 Market application is blocked because the number of installed applications exceeds the plan limit. Events are not delivered to such an application. Applications exempt from the limit are not blocked

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning