BrewForge Docs

Deduct a brew's ingredients from stock

Take the ingredients a brew uses out of the inventory, as "Deduct from inventory" on the brew day tab does: each recipe ingredient is matched to a stock lot by name (hops also by form and alpha acid) and the recipe amount is deducted; the brew remembers what was deducted, so it is never deducted twice. Default: every ingredient with enough stock. ingredients limits it to some (names as in the recipe); naming an ingredient also deducts it when the stock is short (the lot goes to 0). dry_run: true only shows what would happen. undo: true puts deducted ingredients back into stock (all, or the named ones). Amounts in g for fermentables and hops, else the recipe unit. Needs the plan feature `inventory`. Scope: `inventory:write` (or `write`).

POST
/api/v1/actions/deduct_brew_ingredients

Take the ingredients a brew uses out of the inventory, as "Deduct from inventory" on the brew day tab does: each recipe ingredient is matched to a stock lot by name (hops also by form and alpha acid) and the recipe amount is deducted; the brew remembers what was deducted, so it is never deducted twice. Default: every ingredient with enough stock. ingredients limits it to some (names as in the recipe); naming an ingredient also deducts it when the stock is short (the lot goes to 0). dry_run: true only shows what would happen. undo: true puts deducted ingredients back into stock (all, or the named ones). Amounts in g for fermentables and hops, else the recipe unit.

Needs the plan feature inventory. 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

brew*string

The brew: its id, its batch number (e.g. 12 or "#12") or its exact name (e.g. "Citra Pale Ale"). Case does not matter.

ingredients?array<>

Only these recipe ingredients, by name, e.g. ["Pilsner Malt", "Saaz"]. Default: all.

Items1 <= items
undo?boolean

true = restore deducted ingredients to stock instead of deducting.

dry_run?boolean

true = change nothing, only report what would be deducted or restored.

[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/deduct_brew_ingredients" \  -H "Content-Type: application/json" \  -d '{    "brew": "string"  }'
{
  "brew": {
    "id": "string",
    "name": "string",
    "status": "string",
    "batch_number": 0
  },
  "ingredients": [
    {
      "ingredient": "string",
      "type": "fermentable",
      "amount": 0,
      "unit": "string",
      "status": "deducted",
      "lot": "string",
      "in_stock": 0
    }
  ],
  "summary": "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": {}
  }
}