Inventory Inventory API
A simple and powerful API to programmatically access and manage your inventory data. This guide is designed to be understood by both human developers and AI agents. For example if you have an e-commerce website, you can directly load your products, and once sold, your API can update the quantity in your inventory.

Base URL

All API requests should be made to the following base URL:

https://us-central1-studio-9300027708-1f0ae.cloudfunctions.net/getInventory

Authentication

The API uses a Bearer Token for authentication. You must include your personal API key in the `Authorization` header for all requests. You can generate and manage your API key from your profile page.

Authorization: Bearer YOUR_API_KEY_HERE

Endpoints

GETFetch Inventory Items

Retrieves a list of all inventory items that have been explicitly marked for inclusion in the API.

Example Request

curl -X GET "https://us-central1-studio-9300027708-1f0ae.cloudfunctions.net/getInventory" \
     -H "Authorization: Bearer YOUR_API_KEY_HERE"

Success Response (200 OK)

Returns a JSON array of `InventoryItem` objects.

[
  {
    "id": "1N3RTWf049jLR8jyN4p5",
    "name": "potato",
    "description": "A root vegetable",
    "quantity": 2,
    "includeInApi": true,
    "createdAt": "2026-02-04T16:46:21.372Z",
    "updatedAt": "2026-02-05T16:04:34.537Z"
  },
  {
    "id": "X0qno0rSbD9CnrirCudG",
    "name": "carrot",
    "description": "A fresh carrot",
    "quantity": 6,
    "price": 90,
    "includeInApi": true,
    "createdAt": "2026-02-04T16:46:21.522Z",
    "updatedAt": "2026-02-05T16:42:02.945Z"
  }
]

POSTUpdate Item Quantities

Updates the quantity of one or more items, typically after a sale. The request body must be a JSON object containing an `items` array. Each object in the array must have an `itemId` and the `quantity` to subtract.

Request Body

{
  "items": [
    { "itemId": "ID_OF_ITEM_1", "quantity": 1 },
    { "itemId": "ID_OF_ITEM_2", "quantity": 5 }
  ]
}

Example Request

curl -X POST "https://us-central1-studio-9300027708-1f0ae.cloudfunctions.net/getInventory" \
     -H "Authorization: Bearer YOUR_API_KEY_HERE" \
     -H "Content-Type: application/json" \
     -d '{
           "items": [
             { "itemId": "1N3RTWf049jLR8jyN4p5", "quantity": 1 },
             { "itemId": "X0qno0rSbD9CnrirCudG", "quantity": 2 }
           ]
         }'

Success Response (200 OK)

{
  "success": true,
  "message": "2 item(s) updated successfully."
}

Error Responses

400 Bad Request - Insufficient stock for the requested quantity.

Bad Request: Insufficient stock for item "potato".

404 Not Found - One of the provided `itemId` values does not exist.

Bad Request: Item with ID "INVALID_ID_HERE" not found.

Data Models

InventoryItem Object

The structure for a single item in your inventory.

{
  "id": "X0qno0rSbD9CnrirCudG",
  "name": "carrot",
  "description": "A fresh carrot",
  "quantity": 6,
  "price": 90,
  "barcode": "6441494753334",
  "userId": "H1S3hTMYYeZoP7SHuhaPMfjggqR2",
  "imageUrl": "https://path/to/image.jpg",
  "includeInApi": true,
  "createdAt": "2026-02-04T16:46:21.522Z",
  "updatedAt": "2026-02-05T16:42:02.945Z"
}