> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maxcare.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get stock levels with per-lot breakdown

> Returns current stock levels for a facility with a per-lot breakdown (lot number, expiration date, serial number, quantity) plus expiry stats. Requires read:inventory scope.



## OpenAPI

````yaml /openapi-v4.json get /inventory/stock-levels/detail
openapi: 3.0.0
info:
  title: Max AI Public API
  description: API for third-party marketplace apps
  version: '4.0'
  contact: {}
servers:
  - url: https://api.maxcare.ai/v4
security: []
tags: []
paths:
  /inventory/stock-levels/detail:
    get:
      tags:
        - Inventory
      summary: Get stock levels with per-lot breakdown
      description: >-
        Returns current stock levels for a facility with a per-lot breakdown
        (lot number, expiration date, serial number, quantity) plus expiry
        stats. Requires read:inventory scope.
      operationId: InventoryPublicController_getStockLevelDetail
      parameters:
        - name: facilityId
          required: true
          in: query
          description: Facility ID to get stock levels for
          schema:
            type: string
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
          description: Target clinic organization ID
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetStockLevelDetailSuccessResponseV4'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiUnauthorizedResponse'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiForbiddenResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitResponse'
      security:
        - api-key: []
components:
  schemas:
    GetStockLevelDetailSuccessResponseV4:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/StockLevelDetailResponseDataV4'
      required:
        - code
        - data
    PublicApiUnauthorizedResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unauthorized
        message:
          type: string
          description: Human-readable error message
          example: Invalid or missing API key
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiForbiddenResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: forbidden
        message:
          type: string
          description: Human-readable error message
          example: Insufficient scope
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiRateLimitResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: rate_limit_exceeded
        message:
          type: string
          description: Human-readable error message
          example: Rate limit exceeded. Maximum 1000 requests per 60 seconds.
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    StockLevelDetailResponseDataV4:
      type: object
      properties:
        stockLevels:
          type: array
          items:
            $ref: '#/components/schemas/ExternalStockLevelDetailResponseV4'
        stats:
          $ref: '#/components/schemas/ExternalStockLevelStats'
      required:
        - stockLevels
        - stats
    ExternalStockLevelDetailResponseV4:
      type: object
      properties:
        quantity:
          type: number
          description: Current stock quantity
          example: 24
        updatedAt:
          type: string
          description: Last updated timestamp
          example: '2025-01-20T17:00:00.000Z'
        items:
          description: Per-lot breakdown (lot number, expiry, quantity)
          type: array
          items:
            $ref: '#/components/schemas/ExternalStockLevelLotItem'
        product:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ExternalProductResponseV3'
      required:
        - quantity
        - updatedAt
        - items
        - product
    ExternalStockLevelStats:
      type: object
      properties:
        totalProducts:
          type: number
          description: Total distinct products with stock
          example: 14
        totalQuantity:
          type: number
          description: Total units on hand
          example: 213
        expiredCount:
          type: number
          description: Number of expired lots
          example: 1
        expiringIn30DaysCount:
          type: number
          description: Number of lots expiring within 30 days
          example: 2
        lastInventoryDate:
          type: string
          description: When the last inventory take closed
          nullable: true
      required:
        - totalProducts
        - totalQuantity
        - expiredCount
        - expiringIn30DaysCount
        - lastInventoryDate
    ExternalStockLevelLotItem:
      type: object
      properties:
        lotNumber:
          type: string
          description: Lot number
          nullable: true
          example: C4231A1
        expirationDate:
          type: string
          description: Expiration date (YYYY-MM-DD)
          nullable: true
          example: '2027-03-31'
        serialNumber:
          type: string
          description: Serial number
          nullable: true
          example: null
        quantity:
          type: number
          description: Quantity on hand for this lot
          example: 6
      required:
        - lotNumber
        - expirationDate
        - serialNumber
        - quantity
    ExternalProductResponseV3:
      type: object
      properties:
        id:
          type: string
          description: Product ID
          example: prd_b4c5d6e7f8a94b0c1d2e3f4a5b6c7d8e
        gtin:
          type: string
          description: GTIN barcode
          nullable: true
          example: '00814260991517'
        additionalGtins:
          description: Additional GTINs
          nullable: true
          example:
            - '00814260991524'
          type: array
          items:
            type: string
        customBarcode:
          type: string
          description: Custom barcode
          nullable: true
          example: null
        ndc:
          type: string
          description: NDC code
          nullable: true
          example: 0002-1365-01
        name:
          type: string
          description: Product name
          example: Botox 100 Units
        manufacturer:
          type: string
          description: Manufacturer
          nullable: true
          example: Allergan
        type:
          type: string
          description: Product type
          enum:
            - medical_device
            - drug
            - supply
            - other
          example: drug
        description:
          type: string
          description: Product description
          nullable: true
          example: OnabotulinumtoxinA for injection, 100 units per vial
        unitOfMeasure:
          type: string
          description: Unit of measure
          example: each
        quantityPerUnit:
          type: number
          description: Quantity per unit
          example: 1
        metadata:
          type: string
          description: Additional metadata
          nullable: true
          example: null
        archivedAt:
          type: string
          description: Archived timestamp
          nullable: true
          example: null
        createdAt:
          type: string
          description: Created timestamp
          example: '2025-01-10T12:00:00.000Z'
        updatedAt:
          type: string
          description: Last updated timestamp
          example: '2025-01-15T08:30:00.000Z'
      required:
        - id
        - gtin
        - additionalGtins
        - customBarcode
        - ndc
        - name
        - manufacturer
        - type
        - description
        - unitOfMeasure
        - quantityPerUnit
        - metadata
        - archivedAt
        - createdAt
        - updatedAt
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Marketplace API key

````