{
  "openapi": "3.1.0",
  "info": {
    "title": "Rologi Motion - callbacks",
    "version": "0.0.1",
    "description": "Rologi Motion 0.0.1 customer integration: tasks, bin state, product registration, station controls and typed events. Task mode must be enabled for this workflow.",
    "x-source-commit": "be5dcee037b7e6515d474fd44333cce631be8508",
    "x-partner-version": "1.0.0",
    "x-status": "development",
    "x-documentation-scope": "warehouse-integration"
  },
  "paths": {
    "/api/event": {
      "post": {
        "operationId": "receiveEvent",
        "summary": "Receive a typed station or task event",
        "description": "Configured WCS receiver. Rologi Motion sends committed task, operation, verified source-release and station observations independently of supplier callback acknowledgement. Acknowledge with 2xx and deduplicate metadata.messageId. Delivery retries preserve the complete envelope. Receiver credentials are configured separately from inbound caller credentials.",
        "x-runtime-status": "opt-in-task-execution",
        "parameters": [
          {
            "name": "Ras-Site",
            "in": "header",
            "required": true,
            "description": "Supply exactly one nonempty value authorized for this integration.",
            "schema": {
              "type": "string"
            },
            "example": "WAREHOUSE-01"
          },
          {
            "name": "Ras-Station",
            "in": "header",
            "required": true,
            "description": "Supply exactly one nonempty value authorized for this integration.",
            "schema": {
              "type": "string"
            },
            "example": "ARM-01"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WcsNotificationMessage"
              },
              "example": {
                "metadata": {
                  "messageId": "RP-EVENT-401",
                  "createdAt": "2026-10-21T09:00:10Z"
                },
                "data": {
                  "type": "OPERATION_STATE_CHANGED",
                  "taskId": "TASK-200",
                  "operationId": "OP-1",
                  "state": "COMPLETED",
                  "result": {
                    "outcome": "SUCCESS",
                    "requested": 1,
                    "unit": "PIECE",
                    "picked": 1,
                    "placed": 1,
                    "dropped": 0,
                    "sourceBin": {
                      "empty": false,
                      "quantityRemaining": 18
                    },
                    "targetBin": {
                      "full": true
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receiver durably accepted the event. Delivery and retry policy remains part of the runtime implementation."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Acknowledgement": {
        "type": "object",
        "properties": {
          "data": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "AddProductRequest": {
        "type": "object",
        "properties": {
          "articleId": {
            "type": "string"
          },
          "articleName": {
            "type": "string"
          },
          "weightGrams": {
            "type": "number"
          }
        },
        "required": [
          "articleId",
          "articleName",
          "weightGrams"
        ]
      },
      "DeleteProductRequest": {
        "type": "object",
        "properties": {
          "articleId": {
            "type": "string"
          }
        },
        "required": [
          "articleId"
        ]
      },
      "SetCellStatusRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "OPERATIONAL",
              "PAUSED"
            ]
          }
        },
        "required": [
          "status"
        ]
      },
      "CellError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "",
              "SOURCE_BIN_EMPTY",
              "INSUFFICIENT_ITEMS_IN_SOURCE_LOCATION",
              "ITEM_NOT_PICKABLE",
              "PICK_FAILED",
              "INCOMPATIBLE_ITEM",
              "UNKNOWN_AREA",
              "PLACE_FAILURE",
              "TARGET_BIN_FULL",
              "OBJECT_NOT_FITTING",
              "ITEM_STICKING_OUT_BIN",
              "GHOST_PICK",
              "DOUBLE_PICK",
              "ITEM_DROPPED_SAFE",
              "ITEM_DROPPED_UNSAFE",
              "ITEM_DROPPED_RECOVERABLE",
              "BARCODE_SCAN_FAILURE",
              "BARCODE_NOT_COMPARED",
              "BARCODE_NOT_MATCHED",
              "INTERNAL_ERROR",
              "DOOR_OPEN",
              "EMERGENCY_STOP",
              "CAPTO_UNAVAILABLE",
              "ROBOT_FAILURE",
              "CAMERA_FAILURE",
              "LOW_AIR_PRESSURE",
              "GRIPPER_FAILURE",
              "ENGINE_RESTART",
              "MAX_RETRIES_REACHED",
              "STOP_REQUESTED",
              "REQUEST_CANCELLED"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "CellStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "OPERATIONAL",
              "FAULT",
              "PAUSED",
              "STOPPED",
              "EMERGENCY",
              "DOOR_OPEN",
              "VISUAL_CONFIRMATION",
              "HUMAN_INTERVENTION",
              "MAINTENANCE"
            ]
          },
          "error": {
            "$ref": "#/components/schemas/CellError"
          }
        },
        "required": [
          "status"
        ]
      },
      "MessageMetadata": {
        "type": "object",
        "required": [
          "messageId",
          "createdAt"
        ],
        "properties": {
          "messageId": {
            "type": "string",
            "description": "Stable logical-message identity. Preserve it and the complete payload across delivery retries."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "UTC time when the sender first created this message; preserved across retries."
          }
        }
      },
      "TaskSubmission": {
        "type": "object",
        "required": [
          "orderRef",
          "sourceSelectionStrategy",
          "target",
          "operation"
        ],
        "properties": {
          "orderRef": {
            "type": "string"
          },
          "sourceSelectionStrategy": {
            "$ref": "#/components/schemas/SourceSelectionStrategy"
          },
          "target": {
            "$ref": "#/components/schemas/TaskBin"
          },
          "operation": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskOperation"
            },
            "minItems": 1
          }
        },
        "description": "Required contributions into one target. Array order does not control execution; each operation contributes its own quantity.",
        "example": {
          "orderRef": "ORDER-900",
          "sourceSelectionStrategy": "READINESS",
          "target": {
            "portId": "TARGET-1",
            "binId": "900",
            "state": "READY"
          },
          "operation": [
            {
              "operationId": "OP-1",
              "productId": "SKU-42",
              "quantity": {
                "amount": 1,
                "unit": "PIECE"
              },
              "source": {
                "portId": "SOURCE-1",
                "binId": "101",
                "state": "NOT_READY"
              }
            },
            {
              "operationId": "OP-2",
              "productId": "SKU-99",
              "quantity": {
                "amount": 2,
                "unit": "PIECE"
              },
              "source": {
                "portId": "SOURCE-2",
                "binId": "202",
                "state": "NOT_READY"
              }
            }
          ]
        }
      },
      "TaskOperation": {
        "type": "object",
        "required": [
          "operationId",
          "productId",
          "quantity",
          "source"
        ],
        "properties": {
          "operationId": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "quantity": {
            "$ref": "#/components/schemas/TaskQuantity"
          },
          "source": {
            "$ref": "#/components/schemas/TaskBin"
          },
          "priority": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 1
              },
              {
                "type": "null"
              }
            ],
            "description": "Required and unique for PRIORITY. Lower values are prepared first; omitted for READINESS."
          }
        },
        "example": {
          "operationId": "OP-1",
          "productId": "SKU-42",
          "quantity": {
            "amount": 1,
            "unit": "PIECE"
          },
          "source": {
            "portId": "SOURCE-1",
            "binId": "101",
            "state": "NOT_READY"
          }
        }
      },
      "TaskQuantity": {
        "type": "object",
        "required": [
          "amount",
          "unit"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "unit": {
            "type": "string",
            "enum": [
              "PIECE"
            ],
            "description": "Initial task execution supports PIECE quantities."
          }
        },
        "example": {
          "amount": 1,
          "unit": "PIECE"
        }
      },
      "TaskView": {
        "type": "object",
        "required": [
          "taskId",
          "state",
          "operation"
        ],
        "properties": {
          "taskId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/TaskState"
          },
          "operation": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskOperationResult"
            }
          },
          "activeOperationId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancellationRequested": {
            "type": "boolean",
            "default": false,
            "description": "Cancellation was requested; active work may still finish."
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Reason that execution stopped or requires reconciliation."
          },
          "executionFinished": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "New responses/events report whether Motion will prepare further physical work for this task. True frees execution but accounting can still require review. Absent in older payloads means unknown."
          }
        }
      },
      "TaskOperationResult": {
        "type": "object",
        "required": [
          "operationId",
          "state"
        ],
        "properties": {
          "operationId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/OperationState"
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OperationResult"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "OperationResult": {
        "type": "object",
        "required": [
          "outcome",
          "requested",
          "unit"
        ],
        "properties": {
          "outcome": {
            "$ref": "#/components/schemas/OperationOutcome"
          },
          "requested": {
            "type": "number"
          },
          "unit": {
            "type": "string"
          },
          "picked": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "placed": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "dropped": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "errorDescription": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceBin": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SourceBinObservation"
              },
              {
                "type": "null"
              }
            ]
          },
          "targetBin": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TargetBinObservation"
              },
              {
                "type": "null"
              }
            ]
          },
          "validationIssues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResultValidationIssue"
            },
            "description": "Omitted when empty. A counting warning can accompany success; invalid execution quantities produce UNKNOWN with INVALID_ARM_RESULT."
          }
        },
        "description": "Observed quantities are optional. An omitted quantity is unknown; an observed zero is zero."
      },
      "TaskStateChanged": {
        "type": "object",
        "required": [
          "type",
          "taskId",
          "state",
          "operation"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "TASK_STATE_CHANGED"
            ]
          },
          "taskId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/TaskState"
          },
          "operation": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskOperationResult"
            }
          },
          "cancellationRequested": {
            "type": "boolean",
            "default": false,
            "description": "Cancellation was requested; active work may still finish."
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Reason that execution stopped or requires reconciliation."
          },
          "executionFinished": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "New responses/events report whether Motion will prepare further physical work for this task. True frees execution but accounting can still require review. Absent in older payloads means unknown."
          }
        }
      },
      "OperationStateChanged": {
        "type": "object",
        "required": [
          "type",
          "taskId",
          "operationId",
          "state"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "OPERATION_STATE_CHANGED"
            ]
          },
          "taskId": {
            "type": "string"
          },
          "operationId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/OperationState"
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OperationResult"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "StationStateChanged": {
        "type": "object",
        "required": [
          "type",
          "state",
          "observedAt"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "STATION_STATE_CHANGED"
            ]
          },
          "state": {
            "type": "string"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          },
          "reasonCode": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "sequence": {
            "anyOf": [
              {
                "type": "integer",
                "format": "int64"
              },
              {
                "type": "null"
              }
            ],
            "description": "Local receipt sequence, not a supplier generation sequence. Absent in older messages."
          }
        }
      },
      "TaskBin": {
        "type": "object",
        "required": [
          "portId",
          "binId",
          "state"
        ],
        "properties": {
          "portId": {
            "type": "string"
          },
          "binId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/BinReadiness",
            "description": "READY can establish an already-present bin, including a target reused across tasks. NOT_READY does not clear port occupancy."
          }
        },
        "example": {
          "portId": "TARGET-1",
          "binId": "900",
          "state": "READY"
        }
      },
      "BinStateReport": {
        "type": "object",
        "required": [
          "portId",
          "binId",
          "state"
        ],
        "properties": {
          "portId": {
            "type": "string"
          },
          "binId": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/BinState",
            "description": "READY identifies the current bin. ABSENT identifies the bin that left; binId remains required."
          }
        }
      },
      "PortBinState": {
        "type": "object",
        "required": [
          "portId",
          "binId",
          "state",
          "observedAt"
        ],
        "properties": {
          "portId": {
            "type": "string"
          },
          "binId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "$ref": "#/components/schemas/BinState"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BinReleased": {
        "type": "object",
        "required": [
          "type",
          "taskId",
          "operationId",
          "role",
          "portId",
          "binId"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "BIN_RELEASED"
            ]
          },
          "taskId": {
            "type": "string"
          },
          "operationId": {
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/BinRole"
          },
          "portId": {
            "type": "string"
          },
          "binId": {
            "type": "string"
          }
        }
      },
      "TaskState": {
        "type": "string",
        "enum": [
          "ACCEPTED",
          "IN_PROGRESS",
          "RECONCILIATION_REQUIRED",
          "COMPLETED",
          "CANCELLATION_REQUESTED",
          "CANCELLED",
          "FAILED"
        ]
      },
      "OperationState": {
        "type": "string",
        "enum": [
          "PLANNED",
          "SUBMISSION_PENDING",
          "SUBMISSION_UNKNOWN",
          "WAITING_FOR_SOURCE",
          "WAITING_FOR_TARGET",
          "COMPLETED",
          "REJECTED",
          "NOT_EXECUTED",
          "CANCELLATION_REQUESTED",
          "IN_PROGRESS"
        ]
      },
      "OperationOutcome": {
        "type": "string",
        "enum": [
          "SUCCESS",
          "PARTIAL",
          "FAILED",
          "UNKNOWN"
        ]
      },
      "SourceSelectionStrategy": {
        "type": "string",
        "enum": [
          "READINESS",
          "PRIORITY"
        ]
      },
      "BinReadiness": {
        "type": "string",
        "enum": [
          "NOT_READY",
          "READY"
        ]
      },
      "BinState": {
        "type": "string",
        "enum": [
          "ABSENT",
          "READY"
        ]
      },
      "BinRole": {
        "type": "string",
        "enum": [
          "SOURCE"
        ]
      },
      "WcsNotification": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/TaskStateChanged"
          },
          {
            "$ref": "#/components/schemas/OperationStateChanged"
          },
          {
            "$ref": "#/components/schemas/BinReleased"
          },
          {
            "$ref": "#/components/schemas/StationStateChanged"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "TASK_STATE_CHANGED": "#/components/schemas/TaskStateChanged",
            "OPERATION_STATE_CHANGED": "#/components/schemas/OperationStateChanged",
            "BIN_RELEASED": "#/components/schemas/BinReleased",
            "STATION_STATE_CHANGED": "#/components/schemas/StationStateChanged"
          }
        }
      },
      "TaskSubmissionMessage": {
        "type": "object",
        "required": [
          "metadata",
          "data"
        ],
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/MessageMetadata"
          },
          "data": {
            "$ref": "#/components/schemas/TaskSubmission"
          }
        },
        "example": {
          "metadata": {
            "messageId": "WCS-MSG-TASK-200",
            "createdAt": "2026-10-21T09:00:00.000Z"
          },
          "data": {
            "orderRef": "ORDER-900",
            "sourceSelectionStrategy": "READINESS",
            "target": {
              "portId": "TARGET-1",
              "binId": "900",
              "state": "READY"
            },
            "operation": [
              {
                "operationId": "OP-1",
                "productId": "SKU-42",
                "quantity": {
                  "amount": 1,
                  "unit": "PIECE"
                },
                "source": {
                  "portId": "SOURCE-1",
                  "binId": "101",
                  "state": "NOT_READY"
                }
              },
              {
                "operationId": "OP-2",
                "productId": "SKU-99",
                "quantity": {
                  "amount": 2,
                  "unit": "PIECE"
                },
                "source": {
                  "portId": "SOURCE-2",
                  "binId": "202",
                  "state": "NOT_READY"
                }
              }
            ]
          }
        }
      },
      "BinStateMessage": {
        "type": "object",
        "required": [
          "metadata",
          "data"
        ],
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/MessageMetadata"
          },
          "data": {
            "$ref": "#/components/schemas/BinStateReport"
          }
        }
      },
      "WcsNotificationMessage": {
        "type": "object",
        "required": [
          "metadata",
          "data"
        ],
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/MessageMetadata"
          },
          "data": {
            "$ref": "#/components/schemas/WcsNotification"
          }
        }
      },
      "TaskCancellation": {
        "type": "object",
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 1000
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": []
      },
      "TaskCancellationMessage": {
        "type": "object",
        "required": [
          "metadata",
          "data"
        ],
        "properties": {
          "metadata": {
            "$ref": "#/components/schemas/MessageMetadata"
          },
          "data": {
            "$ref": "#/components/schemas/TaskCancellation"
          }
        },
        "example": {
          "metadata": {
            "messageId": "WCS-CANCEL-TASK-200",
            "createdAt": "2026-10-22T12:00:00.000Z"
          },
          "data": {
            "reason": "Order withdrawn"
          }
        }
      },
      "SourceBinObservation": {
        "type": "object",
        "description": "Validated source-bin observations after an operation. Missing or invalid quantities are unknown; these do not grant movement permission.",
        "required": [],
        "properties": {
          "empty": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the station reported the source empty. False is an observed value."
          },
          "quantityRemaining": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Nonnegative remaining quantity in the operation unit. Negative reports, including -1, are omitted and audited; your WCS owns inventory reconciliation."
          }
        }
      },
      "TargetBinObservation": {
        "type": "object",
        "description": "Target-bin observation reported after the operation. Fullness does not grant movement permission.",
        "required": [],
        "properties": {
          "full": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Whether the station reported the target full. False is an observed value."
          }
        }
      },
      "ResultValidationCode": {
        "type": "string",
        "enum": [
          "NEGATIVE_EXECUTION_QUANTITY",
          "PLACED_EXCEEDS_REQUESTED",
          "ACCOUNTED_EXCEEDS_PICKED",
          "NEGATIVE_SOURCE_REMAINING"
        ],
        "description": "NEGATIVE_SOURCE_REMAINING is a counting warning only. Other codes invalidate the execution quantities and require reconciliation."
      },
      "ResultValidationIssue": {
        "type": "object",
        "required": [
          "code",
          "fields"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ResultValidationCode"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Affected fields in the operation result."
          }
        },
        "description": "A reported quantity was excluded from trusted results. The original station report remains available for investigation."
      }
    }
  }
}
