Budget API
The Sublogin Budget API allows management of order limits and periodic budgets for both main customers and sublogins.
Base URL
https://yourstore.com/rest/V1/sublogin-budget
Endpoints
1. Get Budget by ID
GET /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_manage
2. Search Budgets
GET /V1/sublogin-budget/searchACL: MageB2B_SubloginBudget::budget_manage
3. Create Budget
POST /V1/sublogin-budgetACL: MageB2B_SubloginBudget::budget_save
4. Update Budget
PUT /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_save
5. Delete Budget
DELETE /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_delete
Field Reference
| Field | Type | Required | Description |
|---|---|---|---|
budget_id | int | No (auto) | Primary key |
sublogin_id | int | Conditional* | ID of the sublogin user (FK to customer_sublogin.id) |
customer_id | int | Conditional* | Magento Customer Entity ID (FK to customer_entity.entity_id) |
budget_type_id | int | Yes | Budget period type (see below) |
per_order | float | No | Maximum amount per single order |
amount | float | No | Total budget for the period |
valid_from_date | string | No | Start date (YYYY-MM-DD) |
status | int | No | 1 = active, 0 = disabled |
Important: Set either
sublogin_idORcustomer_id, never both!
Budget Type IDs (budget_type_id)
| ID | Label | Description |
|---|---|---|
| 1 | Year | One-time budget for a specific calendar year |
| 2 | Yearly | Recurring budget, resets every year |
| 3 | Month | One-time budget for a specific calendar month |
| 4 | Monthly | Recurring budget, resets every month |
| 5 | Day | One-time budget for a specific calendar day |
| 6 | Daily | Recurring budget, resets every day |
| 7 | Per Order | Limit per single order (no time period) |
Extension Attributes
is_one_time (int)
If set to 1, the budget is used once and automatically disabled after one order. All other budget types are ignored while a one-time budget is active.
Examples
Create Monthly Recurring Budget for Sublogin
curl -X POST "https://yourstore.com/rest/V1/sublogin-budget" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{ "subloginBudget": { "sublogin_id": 5, "budget_type_id": 4, "per_order": 500.00, "amount": 2000.00, "status": 1 } }' Create One-Time Budget
curl -X POST "https://yourstore.com/rest/V1/sublogin-budget" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{ "subloginBudget": { "sublogin_id": 5, "budget_type_id": 7, "amount": 500.00, "status": 1, "extension_attributes": { "is_one_time": 1 } } }' 