Api Reference
The Availability API provides endpoints for checking Available to Promise (ATP) inventory across locations, channels, lots, and bins.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
All requests require authentication. Include your API key in the Authorization header:
1Authorization: Bearer YOUR_API_KEYSee Authentication for details.
1https://app.betterdata.co/api/inventory/availabilityGET /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):
1{2 "type": "stockLines",3 "count": 5,4 "totals": {5 "totalOnHand": 1000,6 "totalAvailable": 850,7 "totalOnHold": 50,8 "totalPicked": 100,9 "totalRecalled": 0,10 "totalExpired": 011 },12 "data": [13 {14 "id": "item_123",15 "productMasterId": "prod_123",16 "locationId": "loc_123",17 "lotId": "lot_123",18 "binId": "bin_123",19 "qtyOnHand": 200,20 "qtyAvailable": 150,21 "qtyOnHold": 25,22 "qtyPicked": 25,23 "qtyRecalled": 0,24 "qtyExpired": 025 }26 ]27}Response (Summary):
1{2 "type": "summary",3 "data": {4 "productMasterId": "prod_123",5 "locationId": "loc_123",6 "totalOnHand": 1000,7 "totalAvailable": 850,8 "totalOnHold": 50,9 "totalPicked": 100,10 "stockLines": [11 {12 "id": "item_123",13 "qtyOnHand": 200,14 "qtyAvailable": 15015 }16 ]17 }18}POST /api/inventory/availability/check
Check availability for multiple items at once. Useful for order processing or allocation checks.
Request Body:
1{2 "items": [3 {4 "sku": "SKU-123",5 "locationId": "loc_123",6 "quantity": 1007 },8 {9 "sku": "SKU-456",10 "locationId": "loc_123",11 "quantity": 5012 }13 ]14}Response:
1{2 "results": [3 {4 "sku": "SKU-123",5 "locationId": "loc_123",6 "requestedQuantity": 100,7 "availableQuantity": 150,8 "isAvailable": true9 },10 {11 "sku": "SKU-456",12 "locationId": "loc_123",13 "requestedQuantity": 50,14 "availableQuantity": 30,15 "isAvailable": false16 }17 ]18}1curl -X GET "https://app.betterdata.co/api/inventory/availability?productMasterId=prod_123&locationId=loc_123" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json"1curl -X GET "https://app.betterdata.co/api/inventory/availability?productMasterId=prod_123&locationId=loc_123&summary=true&includeStockLines=true" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json"1curl -X POST "https://app.betterdata.co/api/inventory/availability/check" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "items": [6 {7 "sku": "SKU-123",8 "locationId": "loc_123",9 "quantity": 10010 }11 ]12 }'1{2 "error": "Unauthorized"3}Cause: Missing or invalid API key.
Solution: Include a valid API key in the Authorization header.
1{2 "error": "Invalid request data"3}Cause: Invalid request body or query parameters.
Solution: Verify all required fields are present and correctly formatted.
Availability checks require inventory.read permission. All availability data is scoped to your organization.
