Create Inventory Document catalog.document.add

Scope: catalog

Who can execute the method: a user with "Create and edit" permission for the required document type

The method catalog.document.add creates a new inventory document.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
object

Document fields (detailed description)

Parameter fields

Required parameters are marked with *

Name
type

Description

docType*
char

Document type. Possible values:

  • A — receipt,
  • S — write-off,
  • M — transfer between warehouses,
  • R — return,
  • D — disposal.

Current document types can be obtained using the method catalog.enum.getStoreDocumentTypes

currency*
crm_currency.CURRENCY

Document currency in ISO 4217 format, for example USD. The value cannot be changed after creation.

To get a list of currencies with codes, use the method crm.currency.list

responsibleId*
user.id

Identifier of the responsible person

siteId
char

Site code to which the document relates. Default is s1.

This parameter is relevant for on-premise Bitrix, for cloud Bitrix the standard value is s1

dateDocument
datetime

Document date in ISO 8601 format

title
string

Document title

commentary
char

Document commentary

total
double

Total amount for the document items. The value is calculated automatically after processing but can be set manually

docNumber
string

Internal document number. If not provided, it is generated automatically

createdBy
user.id

Identifier of the user who created the document. An administrator can specify any value; by default, it is filled with the current user

To fill in supplier data, use the method catalog.documentcontractor.add.
To fill in product data, use the method catalog.document.element.add.

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"docType":"A","currency":"USD","responsibleId":29,"docNumber":"IN-00042","title":"Receipt from Supplier-1","commentary":"Planned warehouse replenishment"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/catalog.document.add
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"docType":"A","currency":"USD","responsibleId":29,"docNumber":"IN-00042","title":"Receipt from Supplier-1","commentary":"Planned warehouse replenishment"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/catalog.document.add
        
try
        {
            const response = await $b24.callMethod(
                'catalog.document.add',
                {
                    fields: {
                        docType: 'A',
                        currency: 'USD',
                        responsibleId: 29,
                        docNumber: 'IN-00042',
                        title: 'Receipt from Supplier-1',
                        commentary: 'Planned warehouse replenishment',
                    }
                }
            );
            
            const result = response.getData().result;
            console.log('Created element with ID:', result);
            
            processResult(result);
        }
        catch( error )
        {
            console.error('Error:', error);
        }
        
try {
        $response = $b24Service
            ->core
            ->call(
                'catalog.document.add',
                [
                    'fields' => [
                        'docType' => 'A',
                        'currency' => 'USD',
                        'responsibleId' => 29,
                        'docNumber' => 'IN-00042',
                        'title' => 'Receipt from Supplier-1',
                        'commentary' => 'Planned warehouse replenishment'
                    ]
                ]
            );
        
        $result = $response
            ->getResponseData()
            ->getResult();
        
        echo 'Success: ' . print_r($result, true);
        processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error adding product row: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'catalog.document.add',
            {
                fields: {
                    docType: 'A',
                    currency: 'USD',
                    responsibleId: 29,
                    docNumber: 'IN-00042',
                    title: 'Receipt from Supplier-1',
                    commentary: 'Planned warehouse replenishment'
                }
            },
            function(result)
            {
                if (result.error())
                    console.error(result.error());
                else
                    console.log(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'catalog.document.add',
            [
                'fields' => [
                    'docType' => 'A',
                    'currency' => 'USD',
                    'responsibleId' => 29,
                    'docNumber' => 'IN-00042',
                    'title' => 'Receipt from Supplier-1',
                    'commentary' => 'Planned warehouse replenishment'
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP code: 200

{
            "result": {
                "document": {
                    "commentary": "Planned warehouse replenishment",
                    "createdBy": 29,
                    "currency": "USD",
                    "dateCreate": "2025-10-30T11:19:38+02:00",
                    "dateDocument": null,
                    "dateModify": "2025-10-30T11:19:38+02:00",
                    "dateStatus": "2025-10-30T11:19:38+02:00",
                    "docNumber": "IN-00042",
                    "docType": "A",
                    "id": 11,
                    "modifiedBy": 29,
                    "responsibleId": 29,
                    "siteId": "s1",
                    "status": "N",
                    "statusBy": null,
                    "title": "Receipt from Supplier-1",
                    "total": null
                }
            },
            "time": {
                "start": 1761805178,
                "finish": 1761805178.991429,
                "duration": 0.9914290904998779,
                "processing": 0,
                "date_start": "2025-10-30T09:19:38+02:00",
                "date_finish": "2025-10-30T09:19:38+02:00",
                "operating_reset_at": 1761805778,
                "operating": 0.2595658302307129
            }
        }
        

The document is created with status N — draft. To process the document, use the method catalog.document.conduct or catalog.document.conductList.

Returned Data

Name
type

Description

result
object

Root element of the response

document
catalog_document

Object with data of the created document

time
time

Information about the request execution time

Error Handling

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

HTTP code: 400

{
            "error": "0",
            "error_description": "DOC_TYPE isn't available"
        }
        

Possible Error Codes

Code

Description

Value

0

Insufficient permissions to save the document

The user does not have permission to create the required document type

0

DOC_TYPE isn't available

An invalid document type was provided

0

Inventory accounting is not available on your plan

Inventory accounting is not available on your plan

0

-

Other internal errors when adding the document

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