BrewForge Docs

Use up, correct or edit stock

Change one stock row: take an amount out ("I used 50 g of Citra" → change: -50), add to it (change: 500), set the counted amount (amount: 1200), or edit its lot, expiry date, supplier, price, notes, or hop alpha/form/harvest year. Reference the row by id (from find_stock) or ingredient name; if a name has several rows and only one still has stock, a negative change uses that one. change and amount use the row's unit (grams for fermentables/hops; send unit "kg"/"oz"/"lb" to convert). Stock never goes below 0. To book a new purchase use add_stock (it merges lots); deducting a whole brew's ingredients belongs to the brew tools. Text fields: send "" to clear. Scope: `inventory:write` (or `write`).

POST
/api/v1/actions/update_stock

Change one stock row: take an amount out ("I used 50 g of Citra" → change: -50), add to it (change: 500), set the counted amount (amount: 1200), or edit its lot, expiry date, supplier, price, notes, or hop alpha/form/harvest year. Reference the row by id (from find_stock) or ingredient name; if a name has several rows and only one still has stock, a negative change uses that one. change and amount use the row's unit (grams for fermentables/hops; send unit "kg"/"oz"/"lb" to convert). Stock never goes below 0. To book a new purchase use add_stock (it merges lots); deducting a whole brew's ingredients belongs to the brew tools. Text fields: send "" to clear.

Scope: inventory:write (or write).

AuthorizationBearer <token>

API token in format: bfk_. Each operation lists the token scope it requires (the scopes are listed below).

  • read: Read everything (all areas)
  • write: Create, change and delete everything (all areas)
  • brews:read: List and view brews
  • brews:write: Create, update, delete brews and notes
  • inventory:read: List inventory items
  • inventory:write: Create, update, delete inventory items
  • equipment:read: List equipment profiles
  • equipment:write: Create, update, delete equipment profiles
  • styles:read: List style profiles
  • styles:write: Create, update, delete style profiles
  • profiles:read: List mash, fermentation, and water profiles
  • custom-fields:read: List custom field definitions
  • custom-fields:write: Create, update, delete custom field definitions
  • profiles:write: Create, update, delete mash, fermentation, and water profiles
  • cellar:read: View cellar, packaged stock, tap lists, and labels
  • cellar:write: Manage cellar, packaging, stock, tap lists, and labels
  • settings:read: View preferences, imports, calculators, and your data export
  • settings:write: Change preferences and undo imports
  • community:read: View community, feedback, tickets, inbox, and account overview
  • community:write: Post, vote, and reply in community, feedback, and tickets

In: header

Scope: inventory:write

Request Body

application/json

stock*string

The stock row: its id (from find_stock) or the ingredient's exact name (e.g. "Citra"). A name that matches several rows (lots, harvest years) returns them as candidates; call again with the row id.

type?string

Ingredient type: "fermentable" (malts, sugars, extracts), "hop", "yeast" or "misc" (water agents, finings, spices, ...).

Value in"fermentable" | "hop" | "yeast" | "misc"
change?number

Add (positive) or take out (negative) this much, e.g. -50 for "used 50 g".

amount?number

Set the amount in stock to this (after counting), e.g. 1200. Use instead of change.

Range0 <= value
unit?string

Unit of amount. Fermentables and hops are stored in grams: send "g" (default), "kg", "oz" or "lb". Yeast counts in "pkg" (packs, default), "ml", "g" or "cells"; misc in "g", "ml", "each" or "mg" (default: the ingredient's own unit).

Value in"g" | "kg" | "oz" | "lb" | "mg" | "pkg" | "ml" | "cells" | "each"
lot?string

Lot number.

Lengthlength <= 100
expiry_date?|

Expiry date, YYYY-MM-DD (e.g. "2027-03-31"); YYYY-MM means the last day of that month.

supplier?string

Where it was bought.

Lengthlength <= 200
cost_per_kg?number

Price per kg, for fermentables and hops, in the user's currency (e.g. 2.4).

Range0 <= value
cost_per_unit?number

Price per counted unit (per pack for yeast in pkg, per gram for misc in g, ...), in the user's currency (e.g. 4.5).

Range0 <= value
total_cost?number

What the whole amount cost, in the user's currency (e.g. 12.9 for 5 kg); converted to the price per kg or per unit. Use instead of cost_per_kg / cost_per_unit.

Range0 <= value
notes?string

Free text.

Lengthlength <= 500
alpha_acid_pct?number

Hops only: alpha acid % of this lot.

Range0 <= value <= 30
form?string

Hops only: pellet, whole, cryo or extract.

Value in"pellet" | "whole" | "cryo" | "extract"
harvest_year?integer

Hops only: crop year.

Range1900 <= value <= 2100
manufacturing_date?string

Yeast only: production date, YYYY-MM-DD (e.g. "2027-03-31"); YYYY-MM means the last day of that month.

Match^\d{4}-\d{2}(-\d{2})?$
[key: string]?never

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://brewforge.sh/api/v1/actions/update_stock" \  -H "Content-Type: application/json" \  -d '{    "stock": "string"  }'
{
  "stock": {
    "id": "string",
    "type": "fermentable",
    "name": "string",
    "ingredient_id": "string",
    "amount": 0,
    "unit": "string",
    "status": "in_stock",
    "lot": "string",
    "expiry_date": "string",
    "purchase_date": "string",
    "supplier": "string",
    "cost_per_kg": 0,
    "cost_per_unit": 0,
    "alpha_acid_pct": 0,
    "form": "string",
    "harvest_year": 0,
    "lab": "string",
    "notes": "string"
  },
  "previous_amount": 0,
  "note": "string"
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "hint": "string",
    "candidates": [
      {
        "id": "string",
        "name": "string"
      }
    ],
    "fields": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "details": {}
  }
}