openapi: 3.0.0
info:
  title: PackingManager API
  version: 1.0.0
paths:
  /api/urgency:
    get:
      summary: View current GREIT order and inventory fulfillment state ("snapshot"
        planning tool)
      description: 'Returns a snapshot of all active orders in GREIT, urgency of needed
        articles, and inventory status. Use this for monitoring, visual dashboards,
        or to see what''s immediately blocking production.

        - **Urgency** helps identify what articles are needed most urgently, and which
        can wait.

        - **Overflow** will be empty (`[]`), since no projected products are simulated
        as incoming on GET.

        - **Warning for integration:** ProductCode is **case sensitive** and may be
        rewritten for special handling; always use IDs from responses for onward processing!'
      tags:
      - Advanced
      responses:
        '200':
          description: All enriched orders, product urgencies, and overflow state.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Orders:
                    description: Each active order, with all lines/status and fulfillment
                      metadata.
                    type: array
                    items:
                      type: object
                      allOf:
                      - $ref: '#/components/schemas/Order'
                      - type: object
                        properties:
                          Items:
                            type: array
                            description: List of order lines, including fulfillment/urgency
                              status.
                            items:
                              type: object
                              allOf:
                              - $ref: '#/components/schemas/ProductItem'
                              - type: object
                                properties:
                                  ExtraData:
                                    $ref: '#/components/schemas/UrgencyOrderLineExtra'
                          ExtraData:
                            $ref: '#/components/schemas/UrgencyOrderExtra'
                  Products:
                    description: Overview of products, with urgency, deficits, and
                      storage state.
                    type: array
                    items:
                      $ref: '#/components/schemas/UrgencyProductItem'
                  Overflow:
                    description: Will always be an empty list `[]` on GET; submit
                      a POST for overflow and "what-if" simulation.
                    type: array
                    items:
                      $ref: '#/components/schemas/UrgencyOverflowItem'
    post:
      summary: Simulate order urgency based on current and projected product arrivals
        ("what-if" planning tool)
      description: "This endpoint allows deep-dive planning and call-off sequence\
        \ optimization for laundry production/planning:\n- Submit a list (`ProductList`)\
        \ with articles predicted to arrive to GREIT (e.g., after the next washing\
        \ or ironing step).\n- Returns for all current orders:\n  - How many can be\
        \ fulfilled based on what's there now, and what might be fulfilled if your\
        \ prediction is correct.\n  - Product urgencies, deficiency (missing) stack\
        \ counts, and an \"overflow\" list with items not immediately required by\
        \ any open order.\n\n**Intended Use Case**: Use it to simulate different production\
        \ or delivery scenarios\u2014see which products, **by stack count (not piece\
        \ count)**, should get \"called off\" next for the smoothest workflow, to\
        \ avoid production halts/bottlenecks.\n\n**Notes:**\n- ProductCode is always\
        \ case sensitive, and may be rewritten by GREIT for special handling. Never\
        \ assume the returned ProductCode will match what you send.\n- \"Count\" means\
        \ FULL STACKS (not pieces); if unsure, check stack size per article.\n- \"\
        Overflow\" reports items from your projection not needed for any active order\u2014\
        useful for staging or deferral in ERP/WMS."
      tags:
      - Advanced
      requestBody:
        description: "Projected list of **products, by stack count,** predicted to\
          \ arrive at GREIT soon. Used for \"what-if\" simulation of near-future fulfillment\
          \ status. ProductList **must** be included\u2014empty to simulate nothing\
          \ arriving, or filled for your planned batch."
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - ProductList
              properties:
                ProductList:
                  type: array
                  description: List of full stacks per ProductCode expected to arrive.
                    ProductCode is case sensitive and must match what GREIT is currently
                    configured to recognize. If ProductCode is invalid or missing,
                    a 400 error will be thrown with an explanatory message.
                  items:
                    type: object
                    required:
                    - ProductCode
                    - Count
                    properties:
                      ProductCode:
                        type: string
                        description: "Product code (SKU). Warning: codes may be changed\
                          \ or normalized by GREIT for special handling\u2014track\
                          \ codes as returned."
                        example: '1155'
                      Count:
                        type: integer
                        description: Number of **full stacks** projected to arrive
                          (not piece count!). Zero marks delivered instantly; negative
                          is clamped to zero.
                        example: 5
      responses:
        '200':
          description: All enriched orders, urgency scores by product, and "overflow"
            inventory (items you plan to deliver that are not needed for any current
            order). Overflow will be empty if all products are required, or filled
            with per-product counts you can delay delivery of.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Orders:
                    description: Each active order, with all lines/status and fulfillment
                      metadata.
                    type: array
                    items:
                      type: object
                      allOf:
                      - $ref: '#/components/schemas/Order'
                      - type: object
                        properties:
                          Items:
                            type: array
                            description: All order lines (with fulfillment status
                              for actual and projected inventory).
                            items:
                              type: object
                              allOf:
                              - $ref: '#/components/schemas/ProductItem'
                              - type: object
                                properties:
                                  ExtraData:
                                    $ref: '#/components/schemas/UrgencyOrderLineExtra'
                          ExtraData:
                            $ref: '#/components/schemas/UrgencyOrderExtra'
                  Products:
                    description: Product summary, with urgency (priority), deficiency
                      (missing for current demand), and storage status.
                    type: array
                    items:
                      $ref: '#/components/schemas/UrgencyProductItem'
                  Overflow:
                    description: List of items in your provided ProductList not needed
                      for current open orders. Any product or stack count here means
                      you can deprioritize/delay these (they aren't needed for immediate
                      production).
                    type: array
                    items:
                      $ref: '#/components/schemas/UrgencyOverflowItem'
  /api/orders:
    post:
      summary: Add new orders to the system. Do not restart already completed orders.
      description: 'Upload a list of orders to the system.

        **Behavior:** **Upsert:** If an OrderID already exists and is not yet processed
        or in progress, it will be updated. **Append:** New OrderIDs are added to
        the queue. **Ignore:** If an OrderID corresponds to a completed order, this
        request is ignored for that specific order (unless PUT is used).

        **Product Logic:** It is allowed to repeat the same product code multiple
        times within an order (e.g., to represent different physical carts or specific
        loading sequences).'
      tags:
      - Orders
      requestBody:
        description: The order list
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Order'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  OrdersRead:
                    description: How many orders were read successfully.
                    example: 531
                    type: integer
                  Errors:
                    description: An array of objects that contains all errors encountered
                      during parsing. If this object is not empty, some orders may
                      not have been imported.
                    type: array
                    items:
                      type: object
                      properties:
                        OrderId:
                          description: the orderId where the error occurred.
                          type: string
                          example: ABC123
                        Error:
                          description: An error string outputted from the parsing
                            logic, describing the error.
                          type: string
                          example: Missing 'Products' array from the order
                type: object
          description: Partial success or success
    put:
      summary: Add new orders to the system. Restart already completed orders.
      description: 'This endpoint will clear the status of completed orders. It is
        useful for recycling order IDs or "reviving" an order that has been completed.
        Warning: It is not possible to edit orders when they are in progress. Upload
        a list of orders to the system. The system will output the items in the order
        they appear. It is allowed to repeat the same product code multiple times
        within an order to organize the way a cart is packed.'
      tags:
      - Orders
      requestBody:
        description: The order list
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Order'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  OrdersRead:
                    description: How many orders were read successfully.
                    example: 531
                    type: integer
                  Errors:
                    description: An array of objects that contains all errors encountered
                      during parsing. If this object is not empty, some orders may
                      not have been imported.
                    type: array
                    items:
                      type: object
                      properties:
                        OrderId:
                          description: the orderId where the error occurred.
                          type: string
                          example: ABC123
                        Error:
                          description: An error string outputted from the parsing
                            logic, describing the error.
                          type: string
                          example: Missing 'Products' array from the order
                type: object
          description: Partial success or success
    get:
      summary: View orders for a specific section.
      description: Returns the list of orders currently active in the specified section.
        The system calculates availability (EnoughInStorage, EnoughInPlan) based on
        the current inventory and injects this into the ExtraData of the returned
        orders and products.
      tags:
      - Orders
      parameters:
      - in: query
        name: Section
        schema:
          type: string
        required: true
        example: A
        description: '"The section to get the orders and inventory from. Case sensitive.
          Big systems use multiple sections. Small systems use only section ''A''."
          Ommision will result in a bad request.'
      responses:
        '200':
          description: A list of orders with calculated status.
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/Order'
                  - type: object
                    properties:
                      Status:
                        type: string
                        example: Assigned
                        description: The current status of the order. One of Unassigned,
                          Assigned, Sent, Packed.
                      Confirmed:
                        type: boolean
                        example: true
                        description: Whether the order has been confirmed. A confirmed
                          order cannot be edited.
                      ExtraData:
                        description: Extra data about the order. Both data received
                          when the orders were uploaded as well as additional information
                          about the storage state.
                        type: object
                        properties:
                          EnoughInStorage:
                            description: Whether there are enough products in storage
                              for processing the previous orders, plus this order.
                              If products are missing from previous orders, but they
                              are not part of this order, EnoughInStorage can be true.
                            type: boolean
                            example: false
                          EnoughInPlan:
                            description: Whether there is enough available storage
                              such that it is possible to introduce the products and
                              process this order. False means that some orders must
                              be processed before it is even possible to allocate
                              storage space for this order.
                            type: boolean
                            example: true
                          EnoughInPlanForAny:
                            description: Whether any product can be fed to the system.
                              False indicates that it is guaranteed safe to edit the
                              order without any consequences for the storage allocation.
                            type: boolean
                            example: true
                      Products:
                        description: The products in the order, enriched with status
                          information.
                        type: array
                        items:
                          allOf:
                          - $ref: '#/components/schemas/ProductItem'
                          - type: object
                            properties:
                              Planned:
                                type: integer
                                description: The number of stacks that is planned
                                  for delivery. Reflects the count when uploading
                                  the orders.
                                example: 12
                              Consumed:
                                type: integer
                                description: The number of stacks currently consumed
                                  from inventory (ie. it is physically on the way
                                  to the operator).
                                example: 10
                              Delivered:
                                type: integer
                                description: The number of stacks successfully delivered
                                  to the operator on the packingstation.
                                example: 9
                              Skipped:
                                type: integer
                                description: The number of stacks that has been skipped
                                  from packing. Could be due to insufficient stock.
                                example: 2
                              Done:
                                type: boolean
                                description: Whether this line is fully complete.
                                example: false
                              ManuallyAdded:
                                description: A manual adjustment done by the operator
                                  on the packingstation. Can be negative if a stack
                                  was taken away.
                                type: integer
                                example: -1
                              ExtraData:
                                description: Extra data about the products. Both the
                                  data received by the system when the order was uploaded,
                                  as well as information about the storage state.
                                type: object
                                properties:
                                  EnoughInStorage:
                                    description: Whether there are enough products
                                      in storage for all previous orders with this
                                      product plus this product
                                    type: boolean
                                    example: false
                                  EnoughInPlan:
                                    description: Whether there is enough available
                                      storage such that it is possible to introduce
                                      the products.
                                    type: boolean
                                    example: true
  /api/subscription:
    get:
      summary: View subscriptions
      description: View a list of subscriptions on the system
      tags:
      - Subscription
      responses:
        '200':
          description: Returns a list of all currently registered subscriptions (webhooks)
            in the system, including the callback URL, registered events, and security
            token (if present).
          content:
            application/json:
              schema:
                type: object
                properties:
                  Documentation:
                    type: string
                    description: Static string to let you know that the endpoint is
                      working.
                    example: Use this endpoint to register any urls that GREIT should
                      call when certain events happen
                  RegisteredCallbacks:
                    type: array
                    description: List of all registered subscriptions.
                    items:
                      $ref: '#/components/schemas/Subscription'
    put:
      summary: Register or update a subscription to events (webhooks)
      description: "## Webhook Delivery & Reliability\n- **Guaranteed delivery:**\
        \ GREIT stores every callback and keeps retrying until your service responds\
        \ with **any** status.\n- **Durability:** No callbacks are lost, even across\
        \ GREIT restarts or temporary network outages.\n- **Automatic expiry:** If\
        \ your service is unreachable (network/DNS errors) for **over 72 hours**,\
        \ your subscription will be removed.\n- **Idempotence/Duplicates:** Your endpoint\
        \ *may* receive the same event more than once.\n- **Recommended workflow:**\
        \ Re-register your subscription at service (re)start or periodically to ensure\
        \ continuity.\n\nRegister your service to receive HTTP POST callbacks to a\
        \ given URL for one or more named events. Each subscription includes your\
        \ callback URL, a list of event names, and an optional security token (sent\
        \ as a Bearer token in callback requests). Subscribing the same combination\
        \ of URL and events is idempotent\u2014will not create duplicates. To update\
        \ your `SecurityToken` or keep a subscription alive, simply re-register. To\
        \ remove, either respond to a callback with HTTP 410 Gone, or use the DELETE\
        \ endpoint. See the callbacks documentation for event types."
      tags:
      - Subscription
      requestBody:
        description: The subscription object defining what to receive and where.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Subscription'
      responses:
        '201':
          description: Subscription created or updated successfully.
          content:
            application/json:
              schema:
                properties:
                  Message:
                    description: An informational message about the command
                    example: OK. Updated subscriptions to 1 event(s).
                    type: string
                type: object
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                properties:
                  Error:
                    description: Description of the error
                    example: Missing 'MessageId' from request
                    type: string
        '500':
          content:
            application/json:
              schema:
                properties:
                  Error:
                    description: Error message.
                    example: Failed to store subscriptions in database
                    type: string
                type: object
          description: Internal error
      callbacks:
        OrderStarted:
          $ref: '#/components/callbacks/OrderStarted'
        OrderDone:
          $ref: '#/components/callbacks/OrderDone'
        PrepackedOrderDone:
          $ref: '#/components/callbacks/PrepackedOrderDone'
        ItemReceived:
          $ref: '#/components/callbacks/ItemReceived'
        ItemStored:
          $ref: '#/components/callbacks/ItemStored'
        ItemPacked:
          $ref: '#/components/callbacks/ItemPacked'
        ItemRejected:
          $ref: '#/components/callbacks/ItemRejected'
    delete:
      summary: Unregister (delete) a subscription for events (webhooks)
      description: 'Remove a previously registered webhook subscription for one or
        more events.


        - Provide the same URL you registered, and optionally a list of events to
        remove.

        - If Events is omitted or an empty array, **all** subscriptions for the given
        URL will be deleted.

        - If Events is provided, only the specified event subscriptions will be removed
        for that URL.

        - Deleting a non-existent subscription or event is safe (no error, no effect).

        - Successful response is always returned if the request was well-formed, regardless
        of whether anything was actually deleted.'
      tags:
      - Subscription
      requestBody:
        description: The target subscription, identified by URL and (optionally) event(s)
          to remove.
        content:
          application/json:
            schema:
              type: object
              required:
              - URL
              properties:
                URL:
                  type: string
                  description: The exact subscriber URL to be removed.
                  example: https://your.service/callback
                Events:
                  type: array
                  items:
                    type: string
                  description: (Optional) List of event names to remove for this URL.
                    Omit or pass empty array to remove all.
                  example:
                  - OrderStarted
      responses:
        '200':
          description: Successfully removed the subscription(s).
          content:
            application/json:
              schema:
                properties:
                  Status:
                    description: Informational status string.
                    example: OK
                    type: string
        '400':
          description: Bad request (e.g., missing URL or wrong type)
          content:
            application/json:
              schema:
                properties:
                  Status:
                    description: Error message.
                    example: One or more events were not formatted as string
                    type: string
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                properties:
                  Status:
                    description: Error message.
                    example: Failed to delete callback
                    type: string
                type: object
components:
  schemas:
    UrgencyProductItem:
      type: object
      properties:
        ProductCode:
          description: Product code (SKU) as recognized by GREIT. **Case sensitive.**
            May not always match external ERP codes due to GREIT product code normalization
            or rewriting.
          type: string
          example: '1155'
        ProductDescription:
          description: Human-readable product description.
          type: string
          example: Small grey bath towels with logo
        Urgency:
          description: Numeric urgency score for the product (lower = more urgent,
            higher = product can wait a bit). Scores close to 0 mean some orders are
            waiting for or will soon be waiting for this article. Zero indicates GREIT
            is currently unable to pack any order lines using this product.
          type: integer
          example: 8
        StacksDeficient:
          description: Number of stacks (not pieces!) missing to fulfill all open
            orders for this article.
          type: integer
          example: 3
        SumStacksOrdered:
          description: Sum (total) of stacks (not pieces) currently ordered for this
            product.
          type: integer
          example: 20
        TotalStacksStored:
          description: Number of full stacks currently available in GREIT storage
            (not including projected arrivals).
          type: integer
          example: 7
    UrgencyOrderLineExtra:
      type: object
      properties:
        EnoughInStorage:
          description: True if enough stacks are present in GREIT right now to fulfill
            this line, considering all prior orders. False means a shortfall exists
            (see details in StacksDeficient).
          type: boolean
          example: false
        EnoughInProductList:
          description: True if, with the **provided projected inventory** (the "ProductList"
            from request), this order line could be fulfilled.
          type: boolean
          example: true
    UrgencyOrderExtra:
      type: object
      properties:
        EnoughInStorage:
          description: True if every line in the order can be fulfilled by GREIT storage
            (all prior, competing orders considered).
          type: boolean
          example: false
        EnoughInProductList:
          description: True if every line in the order can be fulfilled, given the
            **projected inventory** (see ProductList).
          type: boolean
          example: true
        EnoughInProductListForAny:
          description: True if at least one non-manual order line could be fulfilled
            after arrival of projected inventory.
          type: boolean
          example: true
    UrgencyOverflowItem:
      type: object
      properties:
        ProductCode:
          description: Product code (SKU) as provided in input. These are items from
            your ProductList that are not needed for current open orders (i.e. "overflow").
          type: string
          example: '1155'
        Count:
          description: Number of stacks for this product available in overflow.
          type: integer
          example: 4
    ProductItem:
      type: object
      required:
      - ProductCode
      - Count
      properties:
        ProductCode:
          description: 'The ProductCode (SKU) in use when the system receives the
            item. This code must match what the system receives externally. (Usually
            from a conveyor system). Consult the laundry process map for accurate
            ProductCodes. The product code is usually a number for compatibility with
            old equipment. GREIT handles any string and is case sensitive.

            Note: The GREIT system will sometimes overwrite these product codes for
            special behavior. This includes rewriting the product code to "Reject",
            "NotValid", or prepending an emoji.'
          example: '1155'
          type: string
        Count:
          description: 'The count of **FULL STACKS** that the system should deliver.
            Warning: This is NOT the piece count. If a stack is 10 items, and you
            send 5 here, the system delivers 50 items. A value of 0 will be marked
            as delivered instantly. Negative values are clamped to 0.'
          example: 10
          type: integer
        ProductDescription:
          description: A human readable string describing the product. Will be displayed
            when packing the line. No length limit. The packingstation will display
            the description on one line and add scrollbars as needed. Special characters
            (eg. kanji, emoji) are supported.
          example: Small grey bath towels with logo
          type: string
        Manual:
          description: If true, the line will appear blue on the packing station,
            and no articles will be packed. No storage is allocated. Defaults to false
            if omitted.
          example: false
          type: boolean
        ExtraData:
          description: Echoed output messages (size code, internal IDs, etc). It is
            possible to add any data from this object directly on the packingstation.
          type: object
    Order:
      type: object
      description: An order to be packed by the system. The system is designed such
        that one order corresponds to one cart (or trolley, or cage) but it is not
        strictly required. Two orders in one cart can be done with the JointStation
        field, while one order spanning multiple carts can be hacked by adding a manual
        product with the description of the next cart as a separator in the product
        list.
      required:
      - OrderId
      - Products
      properties:
        OrderId:
          description: Unique Identifier. Max 30 chars. Avoid using a value like "Empty01"
            - "Empty99", as they are auto-generated when evicting items from the system.
            The system remembers previous orders for two weeks.
          example: 2026-02-10 HIL 3F C 7/14
          type: string
        CustomerNumber:
          description: The customer ID.
          example: HIL-1582
          type: string
        CustomerName:
          description: The customer name for display.
          example: Hilberts Hotel, 124 Laundry Way
          type: string
        Location:
          description: Delivery location or route information. Displayed on packing
            station.
          example: Loading bay 24
          type: string
        JointStation:
          description: 'Station grouping ID. Orders with the exact same JointStation
            string will be routed to the same physical packing station. The typical
            use case for this is when two orders need to be packed into the same physical
            cart.

            Please keep orders with the same JointStation co-located in the list,
            as all required stacks will be reserved when the first order is started.
            Exclude, Leave empty, or add the orderId (or any other unique value) for
            standard order processing.'
          example: ABC12
          type: string
        Section:
          description: 'Case sensitive. Standard small systems use "A". Multi-section
            system uses "A", "B", "C", etc. Each section will store items and process
            an order list independently. Using an invalid section will add an error
            and skip the order.

            Exclude to use the default section'
          example: A
          type: string
        Note:
          description: A free text note to be displayed to the operator on the packingstation.
            Newlines (\n) are supported and will be rendered on the packingstation.
            No length limit, scroll bars will appear if the line is too long without
            line breaks.
          example: "Hilberts Hotel has recently expanded their selection of rooms.\n\
            \ Note this order has double duvet covers and sheets instead of singles.\n\
            \n Please double-check the quality of the towels,\n as there has been\
            \ recent issues on the folder."
          type: string
        Products:
          description: Max 100 elements per order. Excess is truncated. List of products
            to pack. If empty, the order will still appear on the packing station,
            but be ready for completion instantly.
          type: array
          items:
            $ref: '#/components/schemas/ProductItem'
        ExtraData:
          description: Extra data received on upload.
          type: object
    Subscription:
      type: object
      description: A subscription (webhook registration) tells GREIT which events
        to notify your service about. When a subscribed event occurs, GREIT sends
        a callback POST request to your given URL, including any specified security
        token.
      properties:
        Events:
          description: List of event names to receive. See the API documentation or
            "Callbacks" tab for supported events. You may subscribe to multiple events
            at once, or make multiple requests for separate events.
          items:
            type: string
            example: OrderStarted
            description: One of the available events. See the callbacks tab above
              for the list of supported events.
          type: array
        SecurityToken:
          description: 'An optional (can be omitted) bearer token which will be sent
            in the Authorization header in the callback messages when each event occur.
            Will be sent in the header as "Authorization: Berarer <your bearer token
            here>" Unsafe over HTTP.'
          example: <your bearer token here>
          type: string
        URL:
          description: The HTTP(S) URL to receive event callbacks (post requests).
            Must be accessible by GREIT.
          example: http://www.example.com/eventHandler/v1?test=true&event=Chip
          type: string
      required:
      - URL
      - Events
    SubscriptionCallbackBody:
      type: object
      properties:
        SecurityToken:
          type: string
          description: The security token that was sent when subscribing (if any).
            It is also included as a bearer token in the header, but some systems
            does not have access to the header so it is also here in the body.
          example: your token goes here
        Timestamp:
          type: string
          description: ISO 8601 timestamp of when the event was fired.
          example: '2013-02-28T21:10:58.245+02:30'
        MessageId:
          type: string
          description: An id included for identifying this message for debugging and
            tracing purposes. The current format is based on a timestamp, but could
            change to a UUID or incrementing integer.
          example: 2022-03-05 10:31:13.220 - 155821
    ItemData:
      type: object
      description: An item contains the data associated with the object that is being
        tracked on the conveyors.
      properties:
        Id:
          type: string
          description: The id of the item when it is being tracked on a conveyor.
            This is a unique ID for an item. Ids may occationally reset if the system
            is emptied completely or if there is a software update. The current format
            is a 64 bit integer, but could change to a UUID or similar in the future.
          example: 293194
        ProductCode:
          description: The ProductCode (SKU) in use when the system receives the item.
            This code must match what the system receives externally. (Usually from
            a conveyor system). Consult the laundry process map for accurate ProductCodes.
          example: '1155'
          type: string
        ProductDescription:
          description: A human readable string describing the product. Will be displayed
            when packing the line.
          example: Small grey bath towels with logo
          type: string
        Location:
          description: Where the item was located in the system when the event triggered.
            One of Inlet Level X, ShuttleX LaneY, Outlet Level X
          type: string
          example: Shuttle3 Lane17
        PieceCount:
          description: How many pieces were in the stack when it was received. The
            system will reject stacks based on the PieceCount vs ExpectedPieceCount
          type: integer
          example: 10
        ExpectedPieceCount:
          description: How many pieces are expected to be the stack.
          type: integer
          example: 10
  callbacks:
    OrderStarted:
      '{$request.body#/URL}':
        post:
          summary: An order has been started.
          description: This event is sent when an order has been started by GREIT.
            After this message, it is no longer possible to modify the order.
          requestBody:
            description: Contains the details about the order that has been started.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/Order'
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - type: object
                    properties:
                      PackingStation:
                        description: Which packing station has processed the order.
                          Packing station IDs are or the form <section><level> so
                          usually 'A1', 'A2', 'B2', etc
                        type: string
                        example: A1
                      Products:
                        description: List of processed elements
                        type: array
                        items:
                          type: object
                          properties:
                            Planned:
                              description: The number of stacks that is planned for
                                delivery. Reflects the count when uploading the orders.
                              type: integer
                              example: 12
                            Skipped:
                              description: The number of stacks that has been skipped
                                from packing. Could be due to insufficient stock.
                              type: integer
                              example: 2
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    OrderDone:
      '{$request.body#/URL}':
        post:
          summary: An order has been processed.
          description: This event is sent when an order has been completed by GREIT
            and the operator has pressed the checkmark on the packing station.
          requestBody:
            description: Contains the details about the order that has been completed.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/Order'
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - type: object
                    properties:
                      PackingStation:
                        description: Which packings tation has processed the order.
                          Packing station IDs are or the form <section><level> so
                          usually 'A1', 'A2', 'B2', etc
                        type: string
                        example: A1
                      Products:
                        description: List of processed elements
                        type: array
                        items:
                          type: object
                          properties:
                            Planned:
                              description: The number of stacks that is planned for
                                delivery. Reflects the count when uploading the orders.
                              type: integer
                              example: 12
                            Delivered:
                              description: The number of stacks successfully delivered
                                to the operator on the packing station.
                              type: integer
                              example: 10
                            Skipped:
                              description: The number of stacks that has been skipped
                                from packing. Could be due to insufficient stock.
                              type: integer
                              example: 2
                            ManuallyAdded:
                              description: A manual adjustment done by the operator
                                on the packing station. Can be negative if a stack
                                was taken away.
                              type: integer
                              example: -1
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    PrepackedOrderDone:
      '{$request.body#/URL}':
        post:
          summary: An order has been fully packed before it reached GREIT.
          description: This event is sent when an order has been completed on the
            prepacking station. The prepacking station is an extra station that allows
            packing orders from stock elsewhere in the laundry.
          requestBody:
            description: Contains the details about the order that has been completed.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - type: object
                    properties:
                      Products:
                        description: List of processed elements
                        type: array
                        items:
                          type: object
                          properties:
                            ProductCode:
                              description: The ProductCode (SKU) in use when the system
                                receives the item. This code must match what the system
                                receives externally. (Usually from a conveyor system).
                                Consult the laundry process map for accurate ProductCodes.
                              type: integer
                              example: 12
                            Delivered:
                              description: The number of stacks that has been packed.
                              type: integer
                              example: 10
                      OrderId:
                        description: Unique Identifier. Max 30 chars. Avoid using
                          a value like "Empty01" - "Empty99", as they are auto-generated
                          when evicting items from the system.
                        type: string
                        example: 2026-02-10 HIL 3F C 7/14
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    ItemReceived:
      '{$request.body#/URL}':
        post:
          summary: An item has been received by GREIT.
          description: This event is sent when an item has been received by GREIT.
            Either directly after receiving when fed by an external conveyor, or as
            soon as the product code is identified when manually fed.
          requestBody:
            description: Contains the stack info
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - $ref: '#/components/schemas/ItemData'
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    ItemStored:
      '{$request.body#/URL}':
        post:
          summary: An item has been added to storage.
          description: This event is sent when an item has been stored on a lane.
          requestBody:
            description: Contains the stack info.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - $ref: '#/components/schemas/ItemData'
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    ItemPacked:
      '{$request.body#/URL}':
        post:
          summary: An item has been packed to an order
          description: This event is sent when an item arrives at a packing station.
            Or, in the event that it was lost after delivery to the outlet (ie. it
            slides too far, falls off the conveyor, or gets stuck).
          requestBody:
            description: Contains the stack info.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - $ref: '#/components/schemas/ItemData'
                  - type: object
                    properties:
                      OrderId:
                        description: Unique Identifier. Max 30 chars. Avoid using
                          a value like "Empty01" - "Empty99", as they are auto-generated
                          when evicting items from the system.
                        type: string
                        example: 2026-02-10 HIL 3F C 7/14
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
    ItemRejected:
      '{$request.body#/URL}':
        post:
          summary: An item has been rejected by the system
          description: This event is sent when an item arrives is deleted from the
            system for any reason other than being packed to an order.
          requestBody:
            description: Contains the stack info.
            content:
              application/json:
                schema:
                  allOf:
                  - $ref: '#/components/schemas/SubscriptionCallbackBody'
                  - $ref: '#/components/schemas/ItemData'
                  - type: object
                    properties:
                      RejectType:
                        description: A reason for the item being rejected. This reason
                          is a machine-readible category of rejects.
                        type: string
                        example: IncompleteStack
                      RejectReason:
                        description: A reason for the item being rejected. This reason
                          is human-readible and will be displayed on the screen where
                          the item exits the sytem. It will generally add more context
                          to the RejectType
                        type: string
                        example: 'Incomplete stack. PieceCount: 1 expected: 12'
          responses:
            '200':
              description: Successful operation. No body required.
            '410':
              description: Unregister the callback to this URL. No future messages
                will be sent.
tags:
- name: Advanced
  description: Advanced tools for process planners, automation engineers, and super-users.
    This endpoint reveals the urgency and inventory fulfillment state for GREIT order
    lines and product flows. It is intended for detailed optimization, "what-if" inventory
    simulation, and production call-off planning.
- name: Orders
  description: Add and view orders in the system
- name: Subscription
  description: 'Manage and get different informational messages from the system via
    webhooks.


    See PUT -> callbacks for available events to subscribe to.'
