Allocate Expense by Weight
accounting.allocate_expense_by_weight
Overview
Perform bounded exact-decimal allocate expense by weight and return the calculation with an audit receipt. Closed inputs, fixed precision, deterministic ordering, and typed failures apply.
You receive exact totals and a compact audit receipt for accounting.allocate_expense_by_weight.
Reliability
Closed shapes and precision bounds fail before expensive work. DECIMAL_INVALID means a malformed or over-limit decimal; correct it. CONTROL_INVALID means duplicate or malformed rows; correct their ids and shape. CURRENCY_MISMATCH means the currency is unsupported or inconsistent; use one supported currency. TOLERANCE_INVALID means tolerance is negative or malformed; provide a non-negative decimal. ALLOCATION_INVALID means weights are negative, duplicated, or unusable; correct them. ZERO_DENOMINATOR means the weight sum or divisor is zero; provide a positive divisor. ROUNDING_INVALID means mode, scale, or quantization is invalid; use a published mode and scale. BASIS_INVALID means elapsed and total basis are inconsistent; keep elapsed in range. PERIOD_INVALID means the count is outside 1 through 1,200; correct it. ITEM_LIMIT_EXCEEDED means a bounded count was exceeded; split the request. This guidance applies to accounting.allocate_expense_by_weight.
Context footprint
The result replaces repeated prompt arithmetic with one reproducible receipt for accounting.allocate_expense_by_weight. A successful call costs 1 execution credit.
When to use it
When an expense total must be split across unique weight keys at one published rounding profile.
When weights are unknown, or you need a cash rollforward rather than an expense split.
Scope
Non-goals
- Does not infer currency conversion, calendar basis, accounting policy, or materiality for accounting.allocate_expense_by_weight.
- Does not mutate a ledger, read files, or process unbounded rows for accounting.allocate_expense_by_weight.
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| expense | string | Yes | Expense amount to allocate. |
| weights | array | Yes | From 1 through 10,000 closed {id, weight} objects preserved in output order. |
| rounding | object | Yes | Closed object with required mode and scale properties for final-stage decimal rounding. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| allocations | array | Yes | From 1 through 10,000 closed {id, amount, exactAmount} objects in input order. |
| residual | string | Yes | Expense minus the rounded allocation sum. |
| rounding | object | Yes | Closed receipt object with required mode, scale, and point properties for final-stage rounding. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"accounting.allocate_expense_by_weight","input":{"expense":"100","weights":[{"id":"a","weight":"1"},{"id":"b","weight":"3"}],"rounding":{"mode":"HALF_UP","scale":2}}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("accounting.allocate_expense_by_weight", {"weights":[{"id":"a","weight":"1"},{"id":"b","weight":"3"}],"expense":"100","rounding":{"mode":"HALF_UP","scale":2}});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| DECIMAL_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ALLOCATION_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ZERO_DENOMINATOR | 400 | No | The request payload failed this skill's input validation. |
| ROUNDING_INVALID | 400 | No | The request payload failed this skill's input validation. |
| ITEM_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not infer currency conversion, calendar basis, accounting policy, or materiality for accounting.allocate_expense_by_weight.
- Does not mutate a ledger, read files, or process unbounded rows for accounting.allocate_expense_by_weight.
- Inferred policy, conversion, posting, or schedules outside the closed input
- Inputs above the declared bounds for accounting.allocate_expense_by_weight.
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "accounting.allocate_expense_by_weight",
"input": {
"weights": [
{
"id": "a",
"weight": "1"
},
{
"id": "b",
"weight": "3"
}
],
"expense": "100",
"rounding": {
"mode": "HALF_UP",
"scale": 2
}
}
}Examples
Verified calculation
{
"weights": [
{
"id": "a",
"weight": "1"
},
{
"id": "b",
"weight": "3"
}
],
"expense": "100",
"rounding": {
"mode": "HALF_UP",
"scale": 2
}
}{
"allocations": [
{
"id": "a",
"amount": "25.00",
"exactAmount": "25"
},
{
"id": "b",
"amount": "75.00",
"exactAmount": "75"
}
],
"residual": "0",
"rounding": {
"mode": "HALF_UP",
"scale": 2,
"point": "final"
}
}Alternative bounded calculation
{
"weights": [
{
"id": "a",
"weight": "1"
},
{
"id": "b",
"weight": "1"
},
{
"id": "c",
"weight": "1"
}
],
"expense": "0.05",
"rounding": {
"mode": "HALF_UP",
"scale": 2
}
}{
"allocations": [
{
"id": "a",
"amount": "0.02",
"exactAmount": "0.01666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667"
},
{
"id": "b",
"amount": "0.02",
"exactAmount": "0.01666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667"
},
{
"id": "c",
"amount": "0.02",
"exactAmount": "0.01666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666667"
}
],
"residual": "-0.01",
"rounding": {
"mode": "HALF_UP",
"scale": 2,
"point": "final"
}
}Recommended use cases
- Auditable bounded allocate expense by weight
- Exact-decimal fund-accounting controls for accounting.allocate_expense_by_weight.
Avoid for
- Inferred policy, conversion, posting, or schedules outside the closed input
- Inputs above the declared bounds for accounting.allocate_expense_by_weight.
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.