Inventory Availability API
The Availability API provides endpoints for checking Available to Promise (ATP) inventory across locations, channels, lots, and bins.
Scope: Tenant-scoped; requires authenticated org context
Availability: Not available in SuperAdmin
Authentication
All requests require authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
See Authentication for details.
Base URL
https://app.betterdata.co/api/inventory/availability
Endpoints
Get Availability
GET /api/inventory/availability
Get inventory availability with optional filters. Returns either stock lines or an aggregated summary.
Query Parameters:
| Parameter | Type | Required | Description |
|---|
locationId | string | No | Filter by location |
productMasterId | string | No | Filter by product |
productId | string | No | Filter by legacy product (deprecated) |
lotId | string | No | Filter by lot |
binId | string | No | Filter by bin |
includeExpired | boolean | No | Include expired stock (default: false) |
includeRecalled | boolean | No | Include recalled stock (default: false) |
includeOnHold | boolean | No | Include held stock (default: false) |
summary | boolean | No | Return aggregated summary instead of stock lines (default: false) |
includeStockLines | boolean | No | Include stock lines when summary=true (default: false) |
Response (Stock Lines):
{
"type": "stockLines",
"count": 5,
"totals": {
"totalOnHand": 1000,
"totalAvailable": 850,
"totalOnHold": 50,
"totalPicked": 100,
"totalRecalled": 0,
"totalExpired": 0
},
"data": [
{
"id": "item_123",
"productMasterId": "prod_123",
"locationId": "loc_123",
"lotId": "lot_123",
"binId": "bin_123",
"qtyOnHand": 200,
"qtyAvailable": 150,
"qtyOnHold": 25,
"qtyPicked": 25,
"qtyRecalled": 0,
"qtyExpired": 0
}
]
}
Response (Summary):
{
"type": "summary",
"data": {
"productMasterId": "prod_123",
"locationId": "loc_123",
"totalOnHand": 1000,
"totalAvailable": 850,
"totalOnHold": 50,
"totalPicked": 100,
"stockLines": [
{
"id": "item_123",
"qtyOnHand": 200,
"qtyAvailable": 150
}
]
}
}
Batch Availability Check
POST /api/inventory/availability/check
Check availability for multiple items at once. Useful for order processing or allocation checks.
Request Body:
{
"items": [
{
"sku": "SKU-123",
"locationId": "loc_123",
"quantity": 100
},
{
"sku": "SKU-456",
"locationId": "loc_123",
"quantity": 50
}
]
}
Response:
{
"results": [
{
"sku": "SKU-123",
"locationId": "loc_123",
"requestedQuantity": 100,
"availableQuantity": 150,
"isAvailable": true
},
{
"sku": "SKU-456",
"locationId": "loc_123",
"requestedQuantity": 50,
"availableQuantity": 30,
"isAvailable": false
}
]
}
Example Requests
Get Availability for a Product
curl -X GET "https://app.betterdata.co/api/inventory/availability?productMasterId=prod_123&locationId=loc_123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Get Aggregated Summary
curl -X GET "https://app.betterdata.co/api/inventory/availability?productMasterId=prod_123&locationId=loc_123&summary=true&includeStockLines=true" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
Batch Check Availability
curl -X POST "https://app.betterdata.co/api/inventory/availability/check" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"sku": "SKU-123",
"locationId": "loc_123",
"quantity": 100
}
]
}'
Common Errors
401 Unauthorized
{
"error": "Unauthorized"
}
Cause: Missing or invalid API key.
Solution: Include a valid API key in the Authorization header.
400 Bad Request
{
"error": "Invalid request data"
}
Cause: Invalid request body or query parameters.
Solution: Verify all required fields are present and correctly formatted.
Related Pages
Permissions & Roles
Availability checks require inventory.read permission. All availability data is scoped to your organization.