BrewForge Docs

Order what the planned brews are short of

Put everything the planned brews are short of (the planner's to_buy amounts, after stock and open orders) on an order in one step: a new draft order, or an existing draft order (order). Defaults: all planned brews and all ingredient types; narrow with brews and type. Lines for the same ingredient merge. Returns the order with its lines; when nothing is short, nothing is created. Recipe lines not linked to an ingredient become free-text order lines (see free_text_items); receive_order links them by name when it can. Check get_planner first to see what will be ordered. Afterwards adjust lines with edit_order_items and mark it ordered with save_order. Needs the plan feature `inventory_planner`. Scope: `inventory:write` (or `write`).

POST
/api/v1/actions/create_order_from_shortages

Put everything the planned brews are short of (the planner's to_buy amounts, after stock and open orders) on an order in one step: a new draft order, or an existing draft order (order). Defaults: all planned brews and all ingredient types; narrow with brews and type. Lines for the same ingredient merge. Returns the order with its lines; when nothing is short, nothing is created. Recipe lines not linked to an ingredient become free-text order lines (see free_text_items); receive_order links them by name when it can. Check get_planner first to see what will be ordered. Afterwards adjust lines with edit_order_items and mark it ordered with save_order.

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

brews?array<>

Only these planned brews (ids, batch numbers or exact names, e.g. ["#14", "Wiesn Festbier"]). Default: every brew with status "planned".

Itemsitems <= 50
type?string

Only shortages of this ingredient type.

Value in"fermentable" | "hop" | "yeast" | "misc"
order?string

Add to this existing order (id or exact name; should be a draft). Leave out to create a new order.

name?string

Name of the new order (default "Shortages YYYY-MM-DD").

Length1 <= length <= 200
supplier?string

Shop for the new order.

Lengthlength <= 200
notes?string

Notes for the new order.

Lengthlength <= 1000
[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/create_order_from_shortages" \  -H "Content-Type: application/json" \  -d '{}'
{
  "created": true,
  "added_lines": 0,
  "order": {
    "id": "string",
    "name": "string",
    "supplier": "string",
    "status": "draft",
    "ordered_date": "string",
    "expected_date": "string",
    "received_date": "string",
    "shipping_cost": 0,
    "notes": "string",
    "item_count": 0,
    "arrived_count": 0,
    "items_cost": 0,
    "total_cost": 0,
    "next_step": "add_items",
    "free_text_items": [
      "string"
    ],
    "items": [
      {
        "id": "string",
        "type": "fermentable",
        "name": "string",
        "ingredient_id": "string",
        "form": "string",
        "alpha_acid_pct": 0,
        "harvest_year": 0,
        "amount": 0,
        "ordered_amount": 0,
        "unit": "string",
        "received": 0,
        "remaining": 0,
        "arrival": "pending",
        "estimated_cost": 0,
        "price_paid": 0,
        "notes": "string"
      }
    ]
  },
  "message": "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": {}
  }
}