splitwise_create_expense
Create a Splitwise expense with exactly one split mode—equal, explicit shares, or equal split between users—and validate that shares sum to the cost before sending.
Instructions
Create an expense with exactly one split mode; the shares are checked locally before sending.
Calls POST /create_expense. Refused with Error: … writes are disabled unless
SPLITWISE_ALLOW_WRITES=1 (the server's client enforces it; this tool never bypasses
it). Undo with splitwise_delete_expense. NOT idempotent: every successful call
creates a new expense — never retry blindly after a timeout; list first.
Pick EXACTLY ONE split mode:
A
split_equally: true— a GROUP expense (group_id > 0) that YOU paid, split equally among all group members by Splitwise.B
shares: [...]— explicit shares, one per participant (≥ 2), each withuser_idORemail+first_name+last_name, apaid_shareand anowed_share(2-decimal strings). Σ paid_share and Σ owed_share must each equalcost.C
equal_split_between: [user ids]— equal split between these people (≥ 2, INCLUDING the payer). The payer ispaid_by_user_id, or you when omitted (oneGET /get_current_user). Owed shares are cost / n rounded down to the cent; the leftover cents go on the payer so the sums close (10.00 / 3 → 3.34 payer, 3.33, 3.33).
Shares that do not add up are refused with an error naming the mismatch BEFORE any
request. Shares are sent flattened as users__{i}__user_id|email|first_name|last_name| paid_share|owed_share. Money is a 2-decimal string, never a float.
When to Use:
"Add 90.00 for dinner in the Cusco group, split equally" (mode A).
"I paid 30.00 for a taxi with Ana and Luis, split three ways" (mode C).
"Ana paid 50.00; I owe 20.00 of it and she owes 30.00" (mode B).
When NOT to Use:
To change an existing expense (use
splitwise_update_expense).To find a friend's, group's or category's id by name (use
splitwise_resolve_friend,splitwise_resolve_group,splitwise_resolve_categoryfirst).To comment on an expense (use
splitwise_create_comment).
Returns:
A confirmation echoing Splitwise's response: the literal errors value (empty {}
means accepted), and per returned expense its id, description, cost, group, date and
the shares exactly as Splitwise stored them.
Examples:
params = {"cost": "90.00", "description": "Dinner", "group_id": 12345, "split_equally": true}
params = {"cost": "30.00", "description": "Taxi", "equal_split_between": [491923, 678, 910]}
params = {"cost": "50.00", "description": "Groceries", "currency_code": "PEN", "shares": [ {"user_id": 678, "paid_share": "50.00", "owed_share": "30.00"}, {"user_id": 491923, "paid_share": "0.00", "owed_share": "20.00"}]}
Error Handling:
Local refusals (no request made): more or fewer than one split mode, shares that do not
sum to cost, a share with both or neither identity, duplicate participants, split_equally
without a group, a payer missing from equal_split_between. Splitwise answers 200 even
when it rejects an expense — the client turns a non-empty errors into
Error: Splitwise rejected the request…; if that body still carried an expense object
the error adds "Splitwise still returned N expense object(s) … may have landed" with
the ids, so read back before retrying. On a timeout or 5xx the outcome is UNKNOWN:
check splitwise_get_expenses before retrying.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |