API Docs

Global settings

Get products supply prices

Gets all products with their latest Supply Order price

GET/https://api-products-supply-prices-kigtdz23uq-ew.a.run.app

Headers

x-api-key
<API_KEY>
string

Body Parameters

No body, query, or path parameters are required.

cURL

curl -i \
  -H "x-api-key: <API_KEY>" \
  https://api-products-supply-prices-kigtdz23uq-ew.a.run.app

Response

200 Success

{
  "count": 1,
  "products": [
    {
      "id": "productId",
      "name": "Product name",
      "sku": "SKU-001",
      "manufacturer": "Manufacturer name",
      "category": "Category",
      "subcategory": "Subcategory",
      "size": {
        "cbm": 1.2,
        "depth": 10,
        "gross_weight": 20,
        "height": 30,
        "net_weight": 18,
        "width": 40
      },
      "supply": {
        "currency": "USD",
        "price": 123.45,
        "created_at": "2026-06-09T00:00:00.000Z",
        "updated_at": "2026-06-09T00:00:00.000Z"
      }
    }
  ]
}

401 Unauthorized

{
  "error": "Unauthorized"
}

405 Method not allowed

{
  "error": "Method not allowed"
}

500 API key is not configured

{
  "error": "API key is not configured"
}

Behavior / Side effects

Read-only endpoint

This endpoint only reads data from Firestore and from the static CSV fallback price map. It does not create, update, or delete any documents.

Authentication

The request must include a valid x-api-key header. Missing or invalid API keys return 401 Unauthorized.

Response shape

  • Returns a top-level count and a products array.
  • count is the number of products returned.
  • Each product includes id, name, sku, manufacturer, category, subcategory, size, and supply.

Product size

  • size is read from the product document.
  • If spec_info is missing, invalid, or does not contain size as an object, size is returned as null.
  • If size exists but one numeric field is missing or invalid, that specific field is returned as null.

Supply price priority

  • For each product, the endpoint first tries to find the latest valid supply order price.
  • If no valid supply order price is found, it tries to use the static USD CSV fallback price by matching the product sku.
  • If neither source has a valid price, supply is returned as null.

Latest supply selection

  • Supply orders are read from the supply collection ordered by created_at descending.
  • The first valid match for each product is used as the latest supply price.
  • A supply entry is valid only when it has a valid currency, created_at, and new_products.{product_id}.unit_price.

CSV fallback behavior

  • The CSV fallback is matched by normalized SKU.
  • Both the product SKU and CSV SKU are trimmed and uppercased before matching.
  • CSV fallback prices always return currency: "USD".
  • When the price comes from the CSV fallback, created_at and updated_at are returned as null.

Field mapping

  • id is the Firestore product document ID.
  • name is read from products/{product_id}.name.
  • sku is read from products/{product_id}.sku.
  • manufacturer is read from products/{product_id}.manufacturer_name.
  • category is read from products/{product_id}.type.
  • subcategory is read from products/{product_id}.subtype.
  • size is read from products/{product_id}.spec_info.size.
  • size.cbm is read from products/{product_id}.spec_info.size.product_cbm.
  • size.depth is read from products/{product_id}.spec_info.size.product_depth.
  • size.gross_weight is read from products/{product_id}.spec_info.size.product_gross_weight.
  • size.height is read from products/{product_id}.spec_info.size.product_height.
  • size.net_weight is read from products/{product_id}.spec_info.size.product_net_weight.
  • size.width is read from products/{product_id}.spec_info.size.product_width.
  • supply.currency is read from the matching supply document currency, or set to "USD" for CSV fallback.
  • supply.price is read from supply.new_products.{product_id}.unit_price, or from the CSV fallback price.
  • supply.created_at is read from the matching supply document created_at.
  • supply.updated_at is read from the matching supply document updated_at.

Data quality expectations

  • Missing or invalid product string fields are returned as null.
  • Missing or invalid numeric size fields are returned as null.
  • The endpoint does not calculate or transform product size values; it returns the stored numeric values.
  • Supply timestamps are returned as ISO strings when they come from Firestore supply orders.
  • CSV fallback timestamps are returned as null.