Get the text of the agreement userconsent.agreement.text

Scope: userconsent

Who can execute the method: any user

The method userconsent.agreement.text returns the text of the agreement.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
integer

Identifier of the agreement.

The identifier can be obtained using the method userconsent.agreement.list

replace
object

Array of replacements for text substitution. Available keys:

  • button_caption — text of the confirmation button
  • fields — list of form fields

The list of available fields is described below

Substitution is performed only for standard agreements created based on templates. For custom agreements with arbitrary HTML text, the parameter is ignored

Parameter fields

Name
type

Description

COMPANY_NAME
text

Company name

COMPANY_ADDRESS
text

Company address

PURPOSES
text

Purpose of data processing

THIRD_PARTIES
text

Third parties to whom data is transferred

EMAIL
string

Email address

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":19,"replace":{"button_caption":"I agree","fields":{"COMPANY_NAME":"Example Ltd.","COMPANY_ADDRESS":"New York, Example St., 1","PURPOSES":"Processing personal data to improve service","THIRD_PARTIES":"Company partners for analytics","EMAIL":"info@example.com"}}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/userconsent.agreement.text
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":19,"replace":{"button_caption":"I agree","fields":{"COMPANY_NAME":"Example Ltd.","COMPANY_ADDRESS":"New York, Example St., 1","PURPOSES":"Processing personal data to improve service","THIRD_PARTIES":"Company partners for analytics","EMAIL":"info@example.com"}},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/userconsent.agreement.text
        
try {
            const response = await $b24.callMethod(
                'userconsent.agreement.text',
                {
                    id: 19,
                    replace: {
                        button_caption: 'I agree',
                        fields: {
                            COMPANY_NAME: 'Example Ltd.',
                            COMPANY_ADDRESS: 'New York, Example St., 1',
                            PURPOSES: 'Processing personal data to improve service',
                            THIRD_PARTIES: 'Company partners for analytics',
                            EMAIL: 'info@example.com'
                        }
                    }
                }
            );
        
            const result = response.getData().result;
            console.log('Result:', result);
            processResult(result);
        } catch (error) {
            console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'userconsent.agreement.text',
                    [
                        'id' => 19,
                        'replace' => [
                            'button_caption' => 'I agree',
                            'fields' => [
                                'COMPANY_NAME' => 'Example Ltd.',
                                'COMPANY_ADDRESS' => 'New York, Example St., 1',
                                'PURPOSES' => 'Processing personal data to improve service',
                                'THIRD_PARTIES' => 'Company partners for analytics',
                                'EMAIL' => 'info@example.com'
                            ]
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error: ' . $e->getMessage();
        }
        
BX24.callMethod(
        'userconsent.agreement.text',
            {
                id: 19,
                replace: {
                    button_caption: "I agree",
                    fields: {
                        COMPANY_NAME: "Example Ltd.",
                        COMPANY_ADDRESS: "New York, Example St., 1",
                        PURPOSES: "Processing personal data to improve service",
                        THIRD_PARTIES: "Company partners for analytics",
                        EMAIL: "info@example.com"
                    }
                }
            },
            function(result) {
                if(result.error()) {
                    console.error(result.error());
                } else {
                    console.log(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'userconsent.agreement.text',
            [
                'id' => 19,
                'replace' => [
                    'button_caption' => 'I agree',
                    'fields' => [
                        'COMPANY_NAME' => 'Example Ltd.',
                        'COMPANY_ADDRESS' => 'New York, Example St., 1',
                        'PURPOSES' => 'Processing personal data to improve service',
                        'THIRD_PARTIES' => 'Company partners for analytics',
                        'EMAIL' => 'info@example.com'
                    ]
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP Status: 200

{
        "result": {
            "LABEL": "By clicking the 'I agree' button, I consent to the processing of my personal data in accordance with Federal Law No. 152-FZ of July 27, 2006 'On Personal Data', under the conditions and for the purposes defined in the Consent to the processing of personal data",
            "TEXT": "Consent to the processing of personal data\n\nHereby, in accordance with Federal Law No. 152-FZ 'On Personal Data' of July 27, 2006, I freely, of my own will and in my interest express my unconditional consent to the processing of my personal data, registered in accordance with the legislation of the USA at the address: \n (hereinafter referred to as the Operator).\n1. Consent is given for the processing of one, several, or all categories of personal data, which are not special or biometric, provided by me, which may include:\n\n- Example Ltd.;\n- New York, Example St., 1;\n- Processing personal data to improve service;\n- Company partners for analytics;\n- info@example.com.\n\n2. The Operator may perform the following actions: collection; recording; systematization; accumulation; storage; clarification (updating, modification); extraction; use; blocking; deletion; destruction. \n\n3. Methods of processing: both using automation tools and without their use.\n\n4. Purpose of processing: providing me with services/work, including sending notifications regarding the services/work provided, preparing and sending responses to my requests, sending me information about events/products/services/work of the Operator.\n\n5. Since the Operator may process my personal data using the software 'QuickBooks and other similar platforms', I give my consent to the Operator to carry out the corresponding assignment to Example Ltd., (OGRN 5077746476209), registered at the address: 109544, New York, Enthusiast Blvd., 2, floor 13, room 8-19.\n\n6. This consent is valid until revoked by sending a corresponding notification to the email address test@example.com or by sending it to the address.\n\n7. In case I revoke my consent to the processing of personal data, the Operator has the right to continue processing personal data without my consent if there are grounds provided by Federal Law No. 152-FZ 'On Personal Data' of July 27, 2006."
        },
        "time": {
            "start": 1760611223,
            "finish": 1760611223.240694,
            "duration": 0.2406940460205078,
            "processing": 0,
            "date_start": "2025-10-16T13:40:23+02:00",
            "date_finish": "2025-10-16T13:40:23+02:00",
            "operating_reset_at": 1760611823,
            "operating": 0
        }
        }
        

Returned Data

Name
type

Description

result
array

Root element of the response

LABEL
string

Title of the agreement

TEXT
string

Text of the agreement

time
time

Information about the request execution time

Error Handling

HTTP Status: 400

{
            "error":"400",
            "error_description":"Parameter `Agreement ID` required."
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Possible Error Codes

Status

Code

Description

Value

400

ERROR_ARGUMENT

Parameter Agreement ID required

Parameter id not provided

400

ERROR_ARGUMENT

Agreement with id 999 not found

Agreement with the specified id not found

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

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

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

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

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

Continue Learning