---
title: "Transfer între locații | Documentație | Inventory by R&D Copilot"
description: "Mută stoc dintr-o locație în alta, ca două mișcări legate, din ce este disponibil la sursă."
canonical: "https://inventory.rdcopilot.com/ro/docs/guides/transfer-between-locations/"
language: ro
updated: 2026-11-22
---

# Transfer între locații

Mută stoc dintr-o locație în alta, ca două mișcări legate, din ce este disponibil la sursă.

Un transfer scoate stoc dintr-o locație și îl pune în alta într-un singur pas. Este pentru locații ale aceleiași companii; stocul nu se mută între companii.

## Trimite un transfer

O linie indică articolul, cele două locații și cantitatea, cu revizia fiecărui sold: `fromExpectedRevision` și `toExpectedRevision`. Sursa și destinația trebuie să fie diferite.

curl

```bash
curl -X POST "$RDC_BASE_URL/inventory/v1/transfers" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "bcd30db5-25d9-4143-b54f-c253778d63c4",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:33:00Z",
  "source": {
    "service": "erp",
    "documentId": "2bd25099-3b4b-4a8a-9f3a-beb62ca79072",
    "documentType": "stock-transfer",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
  },
  "lines": [
    {
      "productId": "109ebad9-6627-4ac3-817e-f81ad628676b",
      "fromLocationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "toLocationId": "b1d64d52-293e-4057-b4c8-123609bc9a38",
      "quantity": "20",
      "fromExpectedRevision": 4,
      "toExpectedRevision": 4
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/inventory/v1/transfers`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "bcd30db5-25d9-4143-b54f-c253778d63c4",
    "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
    "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
    "occurredAt": "2026-11-23T07:33:00Z",
    "source": {
      "service": "erp",
      "documentId": "2bd25099-3b4b-4a8a-9f3a-beb62ca79072",
      "documentType": "stock-transfer",
      "documentRevision": 1
    },
    "actor": {
      "serviceId": "brumar-erp",
      "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
    },
    "lines": [
      {
        "productId": "109ebad9-6627-4ac3-817e-f81ad628676b",
        "fromLocationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
        "toLocationId": "b1d64d52-293e-4057-b4c8-123609bc9a38",
        "quantity": "20",
        "fromExpectedRevision": 4,
        "toExpectedRevision": 4
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/inventory/v1/transfers',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'bcd30db5-25d9-4143-b54f-c253778d63c4',
        'customerOrgId': '690fa0e3-547f-4f93-96b7-824475cc3d7c',
        'legalCompanyId': 'd84ba982-ca9a-4e91-9566-21bd23f7227b',
        'occurredAt': '2026-11-23T07:33:00Z',
        'source': {
            'service': 'erp',
            'documentId': '2bd25099-3b4b-4a8a-9f3a-beb62ca79072',
            'documentType': 'stock-transfer',
            'documentRevision': 1,
        },
        'actor': {
            'serviceId': 'brumar-erp',
            'userId': '376a64f7-268a-4f79-808e-0d89162055ac',
        },
        'lines': [
            {
                'productId': '109ebad9-6627-4ac3-817e-f81ad628676b',
                'fromLocationId': 'b006344d-2fae-4970-bb6f-c32877084b4f',
                'toLocationId': 'b1d64d52-293e-4057-b4c8-123609bc9a38',
                'quantity': '20',
                'fromExpectedRevision': 4,
                'toExpectedRevision': 4,
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "bcd30db5-25d9-4143-b54f-c253778d63c4",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:33:00Z",
  "source": {
    "service": "erp",
    "documentId": "2bd25099-3b4b-4a8a-9f3a-beb62ca79072",
    "documentType": "stock-transfer",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
  },
  "lines": [
    {
      "productId": "109ebad9-6627-4ac3-817e-f81ad628676b",
      "fromLocationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "toLocationId": "b1d64d52-293e-4057-b4c8-123609bc9a38",
      "quantity": "20",
      "fromExpectedRevision": 4,
      "toExpectedRevision": 4
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/inventory/v1/transfers');
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#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/inventory/v1/transfers");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "bcd30db5-25d9-4143-b54f-c253778d63c4",
  "customerOrgId": "690fa0e3-547f-4f93-96b7-824475cc3d7c",
  "legalCompanyId": "d84ba982-ca9a-4e91-9566-21bd23f7227b",
  "occurredAt": "2026-11-23T07:33:00Z",
  "source": {
    "service": "erp",
    "documentId": "2bd25099-3b4b-4a8a-9f3a-beb62ca79072",
    "documentType": "stock-transfer",
    "documentRevision": 1
  },
  "actor": {
    "serviceId": "brumar-erp",
    "userId": "376a64f7-268a-4f79-808e-0d89162055ac"
  },
  "lines": [
    {
      "productId": "109ebad9-6627-4ac3-817e-f81ad628676b",
      "fromLocationId": "b006344d-2fae-4970-bb6f-c32877084b4f",
      "toLocationId": "b1d64d52-293e-4057-b4c8-123609bc9a38",
      "quantity": "20",
      "fromExpectedRevision": 4,
      "toExpectedRevision": 4
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 202

```json
{
  "operationId": "bcd30db5-25d9-4143-b54f-c253778d63c4",
  "status": "completed",
  "aggregateRevision": 5,
  "movementIds": [
    "6c5e91a6-ee64-4652-8768-44120551279d",
    "cec159cc-3aa3-498f-ae0a-efdb5d0cfe49"
  ]
}
```

## Două mișcări, un grup

Fiecare linie înregistrează două mișcări: mai întâi sursa, cu `onHandDelta` negativ, apoi destinația. Ambele poartă același `transferGroupId`. Le citești din fișa de stoc a articolului.

## Refuzuri

| Cod de stare | Cod | De ce |
| --- | --- | --- |
| `422` | `insufficient_available_stock` | Cantitatea nu este disponibilă la sursă. Stocul rezervat nu poate fi mutat. |
| `409` | `revision_conflict` | Unul dintre solduri s-a schimbat de când l-ai citit. |
| `400` | `invalid_request` | Cele două locații sunt aceleași sau același articol și aceeași locație apar de două ori în comandă. |
| `403` | `forbidden` | O locație nu este configurată pentru companie sau tokenul nu o acoperă. |

## Anulează un transfer

Un transfer se stornează cu ambele lui mișcări într-o singură comandă de stornare, fiecare linie cu revizia propriului sold. Dacă indici doar una, comanda este refuzată cu un 422 și `transfer_reversal_needs_both_movements`. Stornarea este refuzată dacă stocul a plecat între timp din destinație.
