# Obtener un movimiento de inventario

Permiso requerido: inventory:read.

GET `/public/v1/inventory/movements/{id}`

Permiso `inventory:read` · Inventario

## Parámetros

### Parámetros de ruta

| Nombre | Tipo          | Requerido | Descripción |
| ------ | ------------- | --------- | ----------- |
| `id`   | string (uuid) | Sí        | —           |

## Ejemplo de petición

**curl**

```sh
curl "https://api.posdata.so/public/v1/inventory/movements/3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d" \
  -H "Authorization: Bearer $POSDATA_API_KEY"
```

**Node.js**

```js
const res = await fetch('https://api.posdata.so/public/v1/inventory/movements/3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d', {
  headers: {
    Authorization: `Bearer ${process.env.POSDATA_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (${data.error.request_id})`);
```

**Python**

```python
import os

import requests

res = requests.get(
    "https://api.posdata.so/public/v1/inventory/movements/3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
    headers={
        "Authorization": f"Bearer {os.environ['POSDATA_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{data['error']['code']}: {data['error']['message']} ({data['error']['request_id']})")
```

**PHP**

```php
<?php
$ch = curl_init('https://api.posdata.so/public/v1/inventory/movements/3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('POSDATA_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException("{$data['error']['code']}: {$data['error']['message']} ({$data['error']['request_id']})");
}
```

## Respuesta

`200` OK: un objeto [StockMovement](https://developers.posdata.so/referencia/objetos/#obj-stockmovement).

| Campo          | Tipo                  | Requerido | Descripción                                                                                                                                                                                                                                                                                                                                                                                         |
| -------------- | --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `object`       | `"stock_movement"`    | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `id`           | string (uuid)         | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `product_id`   | string (uuid)         | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `variant_id`   | string (uuid) \| null | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `warehouse_id` | string (uuid) \| null | Sí        | null si el movimiento llegó antes que su bodega.                                                                                                                                                                                                                                                                                                                                                    |
| `type`         | string                | Sí        | Tipo de movimiento tal como lo registró la caja.                                                                                                                                                                                                                                                                                                                                                    |
| `quantity`     | number                | Sí        | Cantidad en la unidad base del producto (puede ser fraccionaria).                                                                                                                                                                                                                                                                                                                                   |
| `reason`       | string \| null        | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `reference`    | string \| null        | Sí        | Referencia libre del movimiento.                                                                                                                                                                                                                                                                                                                                                                    |
| `unit_cost`    | number \| null        | Sí        | Costo por unidad base al momento del movimiento.                                                                                                                                                                                                                                                                                                                                                    |
| `reason_code`  | string \| null        | No        | Motivo catalogado de un ajuste: shrinkage, damage, expired, theft, internal_use, supplier_return, found, correction, other o transfer_shortage. `null` si el movimiento no es un ajuste con motivo.                                                                                                                                                                                                 |
| `origin_type`  | string \| null        | Sí        | sale, purchase, purchase_return (goods given back to a supplier), adjustment, recipe_explosion, reversal (a voided purchase or the restock of an annulled sale), transfer (goods moving between two warehouses of the same business: an `out` at the origin when it is dispatched, an `in` at the destination when it is received or at the origin when it is returned; it never changes the cost). |
| `sale_id`      | string (uuid) \| null | Sí        | La venta que causó el movimiento, si aplica.                                                                                                                                                                                                                                                                                                                                                        |
| `created_at`   | string (date-time)    | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |
| `updated_at`   | string (date-time)    | Sí        | —                                                                                                                                                                                                                                                                                                                                                                                                   |

```json
{
  "object": "stock_movement",
  "id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "product_id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "variant_id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "warehouse_id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "type": "texto",
  "quantity": 5,
  "reason": "texto",
  "reference": "texto",
  "unit_cost": 1,
  "reason_code": "texto",
  "origin_type": "texto",
  "sale_id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "created_at": "2026-09-28T15:04:05.000Z",
  "updated_at": "2026-09-28T15:04:05.000Z"
}
```

## Errores

Todo error responde con un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error) y un `request_id`. Ramifica por `error.code`, nunca por el mensaje.

### 400Petición inválida (VALIDATION_ERROR, INVALID_JSON, INVALID_CURSOR).

**Respuesta 400**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

VALIDATION_ERRORINVALID_JSONINVALID_CURSOR

### 401Sin API key válida (UNAUTHENTICATED, INVALID_API_KEY, API_KEY_REVOKED, API_KEY_EXPIRED, API_KEY_WRONG_ENVIRONMENT, ACCOUNT_INACTIVE).

**Respuesta 401**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

UNAUTHENTICATEDINVALID_API_KEYAPI_KEY_REVOKEDAPI_KEY_EXPIREDAPI_KEY_WRONG_ENVIRONMENTACCOUNT_INACTIVE

### 403Sin permiso (PLAN_REQUIRED, INSUFFICIENT_SCOPE, BROWSER_REQUESTS_NOT_ALLOWED).

**Respuesta 403**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

PLAN_REQUIREDINSUFFICIENT_SCOPEBROWSER_REQUESTS_NOT_ALLOWED

### 404No existe en esta cuenta (NOT_FOUND).

**Respuesta 404**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

NOT_FOUND

### 429Límite de peticiones (RATE_LIMITED). Respeta Retry-After.

**Respuesta 429**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

RATE_LIMITED

### 500Error interno (INTERNAL_ERROR). Reintenta y comparte el request_id si persiste.

**Respuesta 500**

Cuerpo: un objeto [Error](https://developers.posdata.so/referencia/objetos/#obj-error). Qué significa cada código y qué hacer: [Errores](https://developers.posdata.so/errores/).

INTERNAL_ERROR

---

Fuente: https://developers.posdata.so/referencia/operations/getstockmovement/ · Índice para agentes: https://developers.posdata.so/llms.txt
