Skip to main content

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:
ParameterTypeRequiredDescription
locationIdstringNoFilter by location
productMasterIdstringNoFilter by product
productIdstringNoFilter by legacy product (deprecated)
lotIdstringNoFilter by lot
binIdstringNoFilter by bin
includeExpiredbooleanNoInclude expired stock (default: false)
includeRecalledbooleanNoInclude recalled stock (default: false)
includeOnHoldbooleanNoInclude held stock (default: false)
summarybooleanNoReturn aggregated summary instead of stock lines (default: false)
includeStockLinesbooleanNoInclude 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.

Permissions & Roles

Availability checks require inventory.read permission. All availability data is scoped to your organization.