Skip to content

stock_reference/movement_created

Overview

PropertyValue
Webhook typestock_reference/movement_created
Kafka topicstock-reference.movement-created
DirectionPlatform → Your endpoint

Description

Fired when a stock movement is confirmed on a stock reference. Stock movements record every change to inventory quantities — inbound receipts, outbound fulfillments, warehouse adjustments, and returns.

Trigger Conditions

  • A delivery order fulfillment increments or decrements stock
  • A goods reception (inbound) adds stock to a warehouse location
  • A warehouse inventory adjustment is applied
  • A return adds stock back to a location

Message Envelope

json
{
  "header": {
    "organizationId": "org_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "messageId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "webhookId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "type": "stock_reference/movement_created",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": { ... }
}

The body field contains a movement object with the parent stock reference nested.

Note on organizationId resolution: This event uses an organizationIdAccessor pattern — the organizationId is read from data.stockReference.organizationId, not from the top-level payload. This means the webhook subscription is matched via the nested stockReference object.

Body — Property Table

Root Object

FieldTypeNullableDescription
stockReferenceStockReferenceNoThe parent stock reference (see StockReference table)
movementStockMovementNoThe movement that was recorded (see StockMovement table)

StockReference Object

FieldTypeNullableDescription
idstring (uuid)NoUnique stock reference identifier
organizationIdstring (uuid)NoOrganization that owns this stock reference
locationIdstring (uuid)YesWarehouse location
productVariantIdstring (uuid)NoAssociated product variant
referencestringNoInternal reference code
skustringNoStock keeping unit
statusenumNoDRAFT, VALID, ON_HOLD, INVALID
modelenumNoPRODUCT or BUNDLE
physicalQuantityintegerNoTotal physical quantity after the movement
usableQuantityintegerNoAvailable quantity after the movement
reservedQuantityintegerNoReserved quantity
criticalThresholdintegerNoAlert threshold
createdAtstring (ISO 8601)NoCreation timestamp
updatedAtstring (ISO 8601)NoLast update timestamp

StockMovement Object

FieldTypeNullableDescription
idstring (uuid)NoUnique movement identifier
stockReferenceIdstring (uuid)NoParent stock reference ID
datestring (ISO 8601)NoDate when the movement occurred
quantityintegerNoRequested movement quantity
executedQuantityintegerNoActually executed quantity (may differ from quantity in partial fulfillments)
natureenumNoMovement nature: ORDER, RETURN, RECEPTION, WAREHOUSE_INVENTORY, SHOP_INVENTORY
typeenumNoDirection: INCREMENT (stock in) or DECREMENT (stock out)
quantityTypeenumNoWhich quantity bucket was affected: RESERVED, AVAILABLE, PHYSICAL
statusenumNoMovement status: PENDING, CONFIRMED, CANCELED
objectTypeenumYesSource object type: DELIVERY_ORDER, RECEPTION, RESERVATION
objectIdstringYesID of the source object (e.g., delivery order ID)
messagestringYesFree-text comment on the movement
metaobjectYesArbitrary metadata (JSON)
sourcestringYesSource identifier (stored as source_id)
batchNumberstringYesBatch or lot number for traceability
limitUsageDatestring (ISO 8601)YesExpiry / best-before date for the batch

Full JSON Payload Sample

json
{
  "header": {
    "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "messageId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "webhookId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "type": "stock_reference/movement_created",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": {
    "stockReference": {
      "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "locationId": "e5f6a7b8-c9d0-1234-efab-345678901234",
      "productVariantId": "f6a7b8c9-d0e1-2345-fabc-456789012345",
      "reference": "REF-TSHIRT-WHITE-M",
      "sku": "TSHIRT-WHITE-M",
      "status": "VALID",
      "model": "PRODUCT",
      "physicalQuantity": 148,
      "usableQuantity": 138,
      "reservedQuantity": 10,
      "criticalThreshold": 5,
      "lastSnapshotAt": "2024-03-15T08:00:00.000Z",
      "lastSnapshotValue": 150,
      "createdAt": "2024-03-10T09:00:00.000Z",
      "updatedAt": "2024-03-15T10:23:45.000Z"
    },
    "movement": {
      "id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
      "stockReferenceId": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "date": "2024-03-15T10:23:45.000Z",
      "quantity": 2,
      "executedQuantity": 2,
      "nature": "ORDER",
      "type": "DECREMENT",
      "quantityType": "PHYSICAL",
      "status": "CONFIRMED",
      "objectType": "DELIVERY_ORDER",
      "objectId": "b8c9d0e1-f2a3-4567-bcde-678901234567",
      "message": null,
      "meta": null,
      "source": null,
      "batchNumber": null,
      "limitUsageDate": null
    }
  }
}

Notes

  • This event uses organizationIdAccessor: (data) => data.stockReference.organizationId. Webhook subscriptions are matched using stockReference.organizationId, not a top-level organizationId field.
  • executedQuantity may be less than quantity when only partial fulfillment was possible.
  • The stockReference quantities in the payload reflect the state after the movement was applied.

HappyColis API Documentation