Skip to main content
POST
https://api.zenflow.com.ar
/
api
/
v1
/
stock
/
adjustment
Crear Ajuste de Stock
curl --request POST \
  --url https://api.zenflow.com.ar/api/v1/stock/adjustment \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "product_id": 123,
  "sku": "<string>",
  "location_id": "<string>",
  "adjustment_quantity": 123,
  "reason": "<string>"
}
'

Crear Ajuste de Stock

Crea un ajuste de stock agregando o removiendo una cantidad.
Requiere scope write:stock.

Solicitud

POST /api/v1/stock/adjustment

Parámetros del Body

product_id
integer
ID del producto (o usar sku)
sku
string
SKU del producto (alternativa a product_id)
location_id
string
required
ID de la ubicación
adjustment_quantity
number
required
Cantidad a agregar (positivo) o remover (negativo)
reason
string
Razón del ajuste

Ejemplos

Agregar Stock

curl -X POST "https://api.zenflow.com.ar/api/v1/stock/adjustment" \
  -H "X-API-Key: zenflow_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 100,
    "location_id": "LOC-A1",
    "adjustment_quantity": 25,
    "reason": "Recibido de proveedor"
  }'

Respuesta

{
  "success": true,
  "data": {
    "type": "addition",
    "quantity_adjusted": 25,
    "stock": {
      "product_id": 100,
      "location_id": "LOC-A1",
      "previous_quantity": 50,
      "new_quantity": 75
    }
  }
}

Remover Stock

curl -X POST "https://api.zenflow.com.ar/api/v1/stock/adjustment" \
  -H "X-API-Key: zenflow_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "sku": "SKU-001",
    "location_id": "LOC-A1",
    "adjustment_quantity": -10,
    "reason": "Items dañados removidos"
  }'

Respuesta

{
  "success": true,
  "data": {
    "type": "removal",
    "quantity_adjusted": -10,
    "stock": {
      "product_id": 100,
      "location_id": "LOC-A1",
      "previous_quantity": 75,
      "new_quantity": 65
    }
  }
}

Respuestas de Error

400 Cantidad Cero

{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "adjustment_quantity no puede ser cero"
  }
}

400 Stock Insuficiente

{
  "success": false,
  "error": {
    "code": "adjustment_error",
    "message": "Stock insuficiente. Disponible: 5, Solicitado: 10"
  }
}

404 Producto No Encontrado

{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Producto no encontrado"
  }
}