Pricebooks - BevvyTech/BrewskiDocs GitHub Wiki
| Method | Path | Description |
|---|---|---|
GET |
/pricebooks |
Retrieve all pricebooks for a team. If the team has none, a Default pricebook is created automatically. |
POST |
/pricebooks |
Create a named pricebook for a team. |
PATCH |
/pricebooks/:pricebookId |
Rename an existing pricebook. |
DELETE |
/pricebooks/:pricebookId |
Remove a pricebook and reassign clients to the team’s default pricebook. |
POST |
/pricebooks/:pricebookId/items |
Add pricing for a beer/container pair. |
PATCH |
/pricebooks/:pricebookId/items/:itemId |
Update pricing or enable/disable a pricebook item. |
DELETE |
/pricebooks/:pricebookId/items/:itemId |
Remove pricing for a beer/container pair. |
Pricebooks scope per-team price lists. Each pricebook contains zero or more items combining a beer and container with a monetary priceMinor (stored in cents/pence), an optional discountPercent (0–100), and an enabled flag. Clients (clients.pricebookId) reference a pricebook; when omitted during create/update the server assigns the team’s default.
-
Query Parameters:
-
teamId(uuid, required)
-
-
Response 200:
{ "pricebooks": [ { "id": "8c48...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "name": "Default", "createdAt": "2025-10-08T10:12:00.000Z", "updatedAt": "2025-10-08T10:12:00.000Z", "items": [ { "id": "0fd1...", "pricebookId": "8c48...", "beerId": "a9f1...", "containerId": "4fb3...", "priceMinor": 9500, "discountPercent": null, "enabled": true, "createdAt": "2025-10-08T10:15:41.000Z", "updatedAt": "2025-10-08T10:15:41.000Z" } ] } ] } -
Notes: Ensures a
Defaultpricebook exists before returning data. Results are ordered bycreatedAtand include all items. -
Notes: Ensures a
Defaultpricebook exists before returning data. Results are ordered bycreatedAt, include all items, and surfacediscountPercentas a percentage (ornullwhen no discount is set). - Errors: 401 unauthorized, 403 when caller is not a member of the team.
-
Body:
{ "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "name": "Wholesale" } -
Response 201:
{ "pricebook": { "id": "2b79...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "name": "Wholesale", "createdAt": "2025-10-08T10:20:12.000Z", "updatedAt": "2025-10-08T10:20:12.000Z", "items": [] } } - Errors: 401 unauthorized, 403 forbidden, 409 when another pricebook with the same name exists for the team.
-
Body:
{ "name": "Retail" } -
Response 200:
{ "pricebook": { "id": "2b79...", "teamId": "d43c046a-10a1-4f52-bd0a-9bf16f828ab7", "name": "Retail", "createdAt": "2025-10-08T10:20:12.000Z", "updatedAt": "2025-10-08T10:25:03.000Z", "items": [] } } - Errors: 401 unauthorized, 403 forbidden, 404 when the pricebook is missing, 409 on duplicate names.
- Behavior: Deletes the pricebook and its items. Clients assigned to it receive the team’s default pricebook (creating one if necessary).
-
Response:
204 No Content - Errors: 401 unauthorized, 403 forbidden, 404 when the pricebook is missing.
-
Body:
{ "beerId": "a9f1...", "containerId": "4fb3...", "priceMinor": 10500, "discountPercent": 12.5, "enabled": true } -
discountPercentis an optional percentage (0–100) applied to the base price; omit or setnullto remove a discount. -
Response 201:
{ "item": { "id": "6d61...", "pricebookId": "2b79...", "beerId": "a9f1...", "containerId": "4fb3...", "priceMinor": 10500, "discountPercent": 12.5, "enabled": true, "createdAt": "2025-10-08T10:27:18.000Z", "updatedAt": "2025-10-08T10:27:18.000Z" } } - Notes: Beer and container must belong to the pricebook’s team. Duplicate beer/container pairs return 409.
- Errors: 401 unauthorized, 403 forbidden, 404 when the pricebook is missing.
-
Body: any subset of
priceMinor,discountPercent,enabled. - Setting
discountPercenttonullremoves an existing discount; values outside 0–100 are rejected. -
Response 200:
{ "item": { "id": "6d61...", "pricebookId": "2b79...", "beerId": "a9f1...", "containerId": "4fb3...", "priceMinor": 9900, "discountPercent": 10, "enabled": true, "createdAt": "2025-10-08T10:27:18.000Z", "updatedAt": "2025-10-08T10:35:55.000Z" } } - Errors: 401 unauthorized, 403 forbidden, 404 when the pricebook or item is missing.
-
Response:
204 No Content - Notes: Only removes the pricebook item; the beer and container remain available for other pricebooks.
- Errors: 401 unauthorized, 403 forbidden, 404 when the pricebook or item is missing.