Kibo Reservations API Developer Guide
Inventory Overview
Understand how reservations fit into inventory management
Fulfill Items Without Sufficient Stock
Handle inventory reservations for low-stock items
Understanding Reservations in Kibo
In Kibo, a Reservation is a temporary, short-term hold on a specific quantity of a product at a specific location. It’s a key mechanism to prevent overselling during the active shopping process, especially in high-volume environments. What makes Kibo’s approach different is that a reservation is an explicit, API-managed object, not an implicit side-effect of adding an item to a cart. When a customer proceeds to checkout, your application should create a reservation for the items in their cart. This “soft-allocates” the inventory, taking it out of the available-to-sell pool for a limited time. If the customer completes the purchase, the reservation is committed; if they abandon the cart, the reservation is deleted or expires, and the inventory is automatically returned to the pool. This system provides a robust guarantee that what’s in the cart is available to be purchased.How This Domain Fits Into Kibo
The Reservations domain is the bridge between the Cart/Checkout process and the Inventory domain. It ensures data integrity for inventory during the most volatile part of the customer journey.- Inventory: A reservation reduces the
availablequantity of a product at a location but does not affect theonHandquantity. It’s a temporary promise. Only when an order is fulfilled is theonHandquantity decremented. - Checkout & Cart: The checkout flow is the primary driver for creating and managing reservations. A successful checkout should commit the reservation, while an abandoned cart should delete it.
- Orders: Once an order is placed, the associated reservation is typically committed. The
orderIdis a key piece of data stored on the reservation object itself, linking the inventory hold to the final transaction.
Prerequisites
- Kibo API credentials and basic setup
- Node.js 16+ with TypeScript
- Familiarity with REST APIs and asynchronous concepts
What You’ll Learn
After completing this guide, you’ll understand:- How Kibo uses reservations to temporarily hold inventory (based on official API specs).
- The key patterns for creating, updating, committing, and deleting reservations (verified from apidocs.kibocommerce.com).
- The common workflow for managing inventory holds during a customer checkout.
- How to avoid the most common beginner mistakes, like confusing a reservation with a final inventory transaction.
- How to read and navigate the official Commerce Inventory Reservations API documentation effectively.
Kibo Reservations Fundamentals
How Kibo Organizes Reservation Data
The system is centered on theReservation object. It’s a simple yet powerful construct:
Reservation: The core object representing the inventory hold. It is identified by a system-generatedreservationId. The most important properties are:orderId: Links the reservation to a cart or checkout object (which will later become the order).locationCode: Specifies where the inventory is being held. Inventory is always location-specific.items: An array of objects, each specifying aproductCode,quantity,lineIdandid(a unique identifier for that item within the cart/order).
Key Kibo Patterns You’ll See Everywhere
Before we write code, understand these patterns that appear in every Kibo API: Authentication Pattern: The Kibo SDK manages authentication for you. You create a singleConfiguration object containing your credentials (Client ID, Shared Secret, etc.). This object is then passed to the constructor of specific API clients (e.g., new ReservationsApi(configuration)).
Request/Response Structure:
Many reservation operations are done in bulk for efficiency. The API expects and returns a ReservationCollection object, which contains an array of individual Reservation objects.
VALIDATION_CONFLICT, which indicates that the requested quantity is not available to be reserved.
/api-overviews/openapi_reservation_overview
Common Reservation Workflows
- Standard Checkout: Create a reservation when a user enters the checkout flow. Commit the reservation on successful order placement. Delete the reservation if the user abandons the flow.
- Cart Quantity Update: Update the reservation when a user changes an item’s quantity in their cart during checkout.
- Order Cancellation: If a customer cancels an order shortly after placing it (before fulfillment), the corresponding reservation might be deleted to release the inventory immediately.
Create Reservations: The Kibo Way
When You Need This
This is the first step in the checkout process. As soon as a customer signals their intent to buy (e.g., by clicking “Proceed to Checkout”), you should create a reservation to hold the items in their cart.API Documentation Reference
Endpoint:POST /commerce/reservation
Method: POST
API Docs: /api-overviews/openapi_reservation_overview
Understanding the Kibo Approach
Kibo optimizes this operation by allowing you to reserve items for a single order at multiple locations in one API call. You provide an array ofReservation objects, and the system processes them together. The API call is synchronous—it will immediately check for available inventory and either succeed by returning the created reservation objects or fail with an VALIDATION_CONFLICT error. This gives you instant feedback to show the customer.
Code Structure Walkthrough
Step-by-Step Implementation
Step 1: Setting Up the FoundationUpdate & Delete Reservations
Update Reservations
When You Need This: If a customer changes the quantity of an item or adds/removes an item after the initial reservation has been made (e.g., on the final review step of checkout). API Documentation Reference:- Endpoint:
PUT /commerce//reservation - Method:
PUT - API Docs: Update Reservation
Reservation objects. Kibo then adjusts the inventory holds accordingly.
Delete a Reservation
When You Need This: When a customer abandons the checkout flow or their session expires. Deleting the reservation releases the held inventory back into the available-to-sell pool. API Documentation Reference:- Endpoint:
DELETE /commerce/reservation/{reservationId} - Method:
DELETE - API Docs: Delete Reservation
Multiple Real-World Examples
Example 1: The Full Checkout Reservation Workflow This example simulates the entire lifecycle of a reservation during a successful purchase.createReservationsForCart, updateReservationsForCart, and deleteReservationById functions shown in the previous sections serve as complete, runnable examples for the core CRUD operations.
Integrating Reservations with Other Kibo Domains
Reservations + Inventory Integration
This is the most direct relationship. A reservation’s entire purpose is to manipulate inventory availability. TheaddReservations call will fail if the available quantity at the specified locationCode is less than the requested quantity. Committing a reservation signals to the inventory system that this quantity is now allocated to an order and will be decremented from the onHand count upon shipment.
Reservations + Order Management (OMS)
In a sophisticated Order Management System (OMS) flow, reservations are used to determine sourcing. Before fulfilling an order, the OMS may create temporary reservations at several possible locations to find the optimal sourcing solution. Once the best location is determined, the reservation at that location is committed, and the temporary reservations at the other locations are deleted.Troubleshooting Your Reservations Implementation
Reading Kibo Error Messages
INSUFFICIENT_STOCK: The most common error. It means you cannot create or update a reservation because there is not enough available inventory.RESERVATION_NOT_FOUND: ThereservationIdyou provided todeleteReservationor another endpoint does not exist.VALIDATION_ERROR: The request body is malformed. A common cause is a missinglocationCodeor an invalidproductCode.
Common Development Issues
Issue 1: MyaddReservations call fails with an INSUFFICIENT_STOCK error, but the UI shows the item is in stock.
- Why it happens: This is a classic race condition. Between the time the customer loaded the product page and when they tried to check out, another customer (or a store associate) purchased the last item. The reservation API provides the real-time, authoritative answer on availability.
- How to fix it: Your checkout UI must gracefully handle this error. When you catch an
INSUFFICIENT_STOCKerror, you should display a clear message to the user (e.g., “An item in your cart is no longer available”) and prompt them to review their cart.
- Why it happens: This usually means your application is creating reservations but failing to delete them when a user abandons their cart. Without a
deleteReservationcall, the inventory will remain held until the reservation automatically expires (typically after a short period, like 30 minutes). - How to fix it: Ensure your application has a robust mechanism to detect an abandoned session or an explicit “Remove from Cart” action during checkout. This mechanism must trigger a call to the
deleteReservationendpoint. While Kibo’s automatic expiration is a good safety net, you should not rely on it for normal operation.

