Skip to content
Docs
API 1.0.0 · 22 Nov 2026

Search the docs

    Română

    Count and adjust

    Set a balance to what was counted: the movement carries the difference and the history shows when it happened.

    On this page

    Romanian accounting law requires a general inventory of assets, debts and equity at least once during the financial year. A count in Inventory is how the result reaches the ledger: you send what was counted and the ledger works out the difference.

    Send a count

    A line holds the item, the location, countedQuantity and the revision you read. Read the revision just before the count is posted: any movement after it makes the count stale.

    curl

    curl -X POST "$RDC_BASE_URL/inventory/v1/counts" \
      -H "Authorization: Bearer $RDC_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "operationId": "28c671aa-ac3c-42f9-8f8d-b10b6a841893",
      "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
      "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
      "occurredAt": "2026-11-23T07:47:00Z",
      "source": {
        "service": "erp",
        "documentId": "6ca66dfa-592c-42b8-a3c8-306c333ac0c1",
        "documentType": "stock-count",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
      },
      "lines": [
        {
          "productId": "6ab0e654-0031-4eef-8a67-ac3fa8378fe1",
          "locationId": "8c8dcdb9-531e-496f-8f12-aadf9acd1eef",
          "countedQuantity": "77.5",
          "expectedRevision": 4
        }
      ]
    }'

    JavaScript

    const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/counts`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.RDC_TOKEN}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        "operationId": "28c671aa-ac3c-42f9-8f8d-b10b6a841893",
        "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
        "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
        "occurredAt": "2026-11-23T07:47:00Z",
        "source": {
          "service": "erp",
          "documentId": "6ca66dfa-592c-42b8-a3c8-306c333ac0c1",
          "documentType": "stock-count",
          "documentRevision": 1
        },
        "actor": {
          "serviceId": "brumar-erp",
          "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
        },
        "lines": [
          {
            "productId": "6ab0e654-0031-4eef-8a67-ac3fa8378fe1",
            "locationId": "8c8dcdb9-531e-496f-8f12-aadf9acd1eef",
            "countedQuantity": "77.5",
            "expectedRevision": 4
          }
        ]
      }),
    });
    const result = await response.json();

    Python

    import os
    import requests
    
    response = requests.request(
        'POST',
        f'{os.environ["RDC_BASE_URL"]}/inventory/v1/counts',
        headers={
            'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
        },
        json={
            'operationId': '28c671aa-ac3c-42f9-8f8d-b10b6a841893',
            'customerOrgId': '690fa0e3-547f-4f93-96b7-824475cc3d7c',
            'legalCompanyId': 'd84ba982-ca9a-4e91-9566-21bd23f7227b',
            'occurredAt': '2026-11-23T07:47:00Z',
            'source': {
                'service': 'erp',
                'documentId': '6ca66dfa-592c-42b8-a3c8-306c333ac0c1',
                'documentType': 'stock-count',
                'documentRevision': 1,
            },
            'actor': {
                'serviceId': 'brumar-erp',
                'userId': '376a64f7-268a-4f79-808e-0d89162055ac',
            },
            'lines': [
                {
                    'productId': '6ab0e654-0031-4eef-8a67-ac3fa8378fe1',
                    'locationId': '8c8dcdb9-531e-496f-8f12-aadf9acd1eef',
                    'countedQuantity': '77.5',
                    'expectedRevision': 4,
                },
            ],
        },
    )
    result = response.json()

    PHP

    <?php
    
    $body = <<<'JSON'
    {
      "operationId": "28c671aa-ac3c-42f9-8f8d-b10b6a841893",
      "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
      "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
      "occurredAt": "2026-11-23T07:47:00Z",
      "source": {
        "service": "erp",
        "documentId": "6ca66dfa-592c-42b8-a3c8-306c333ac0c1",
        "documentType": "stock-count",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
      },
      "lines": [
        {
          "productId": "6ab0e654-0031-4eef-8a67-ac3fa8378fe1",
          "locationId": "8c8dcdb9-531e-496f-8f12-aadf9acd1eef",
          "countedQuantity": "77.5",
          "expectedRevision": 4
        }
      ]
    }
    JSON;
    
    $curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/counts');
    curl_setopt_array($curl, [
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => [
            'Authorization: Bearer ' . getenv('RDC_TOKEN'),
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS => $body,
    ]);
    $result = json_decode(curl_exec($curl), true);
    curl_close($curl);

    C#

    using System.Net.Http.Headers;
    
    var client = new HttpClient();
    var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/counts");
    request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
    request.Content = new StringContent("""
    {
      "operationId": "28c671aa-ac3c-42f9-8f8d-b10b6a841893",
      "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
      "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
      "occurredAt": "2026-11-23T07:47:00Z",
      "source": {
        "service": "erp",
        "documentId": "6ca66dfa-592c-42b8-a3c8-306c333ac0c1",
        "documentType": "stock-count",
        "documentRevision": 1
      },
      "actor": {
        "serviceId": "brumar-erp",
        "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
      },
      "lines": [
        {
          "productId": "6ab0e654-0031-4eef-8a67-ac3fa8378fe1",
          "locationId": "8c8dcdb9-531e-496f-8f12-aadf9acd1eef",
          "countedQuantity": "77.5",
          "expectedRevision": 4
        }
      ]
    }
    """, System.Text.Encoding.UTF8, "application/json");
    var response = await client.SendAsync(request);
    var result = await response.Content.ReadAsStringAsync();

    Response 202

    {
      "operationId": "28c671aa-ac3c-42f9-8f8d-b10b6a841893",
      "status": "completed",
      "aggregateRevision": 5,
      "movementIds": [
        "aca7413f-e78f-4193-bca7-0d31e2a0adf7"
      ]
    }

    The movement holds the difference in onHandDelta: negative when less was found than the ledger held, positive when more. A count that finds no difference is still recorded, as a movement with a delta of zero, so the stock card shows that the count was made.

    Rules

    • The counted quantity cannot be below what is reserved at the location. The answer is a 422 with insufficient_available_stock. Release or reverse the reservations first, or count again.
    • An item and a location appear once in a count command.
    • Quantities can be fractions: 78.5 kg is exact.

    In your accounts

    The result of an inventory is recorded in the accounts under the accounting rules that apply. Inventory records the quantity difference as a movement and holds no value: your accounting system books the difference.

    Undo a count

    A count entered on the wrong balance is reversed like any movement. See Reverse a movement.