
Tip Calculator & Bill Splitter API
Finance
Work out the tip and split the bill: pick 10 to 25% or a custom tip, choose how many people, tip on the pre-tax amount if you like, and round each share up.
Authentication
Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.
Rate Limit
120 requests per minute
Endpoints
2 endpoints available
Overview
Works out the tip, the total and each person's share of a restaurant bill.
Notes
billis the amount printed on the receipt, tax included.- To tip on the amount before tax, give the tax as
taxRate(a percentage, such as 13 for HST, which is backed out of the bill) or astaxAmount(the dollar amount on the receipt). Send one, not both. SettipOnPreTaxto false to tip on the whole bill instead. roundUprounds each person's share up to a whole unit (dollar, euro, pound). It only changes the result when it actually changes the amount.roundedPerPersonandroundedTotalarenullotherwise, andeffectiveTipthen includes the rounding.- Money is rounded to the cent.
splitgives exact shares in whole cents that add up to the total:peopleAtLowerSharepeople paylowerShareandpeopleAtHigherSharepeople pay one cent more (higherShare). When the total divides evenly,peopleAtHigherShareis 0. - Up to 1,000 people.
Endpoints
POST
https://opentools.ca/api/v1/tools/tip-calculatorCalculate a tip and split the bill
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| bill | number | Required | Bill amount including tax, above 0. |
| tipPercent | number | Required | Tip as a percentage, 0 to 1000. |
| people | number | Optional | Number of people sharing, 1 to 1,000.Default: 1 |
| taxRate | number | Optional | Tax rate in percent, included in the bill. Use instead of taxAmount. |
| taxAmount | number | Optional | Tax in dollars, as printed on the receipt. Use instead of taxRate. |
| tipOnPreTax | boolean | Optional | Work the tip out on the amount before tax. Only matters when tax is given.Default: true |
| roundUp | boolean | Optional | Round each share up to a whole unit.Default: false |
Response Example
{
"success": true,
"bill": 113,
"people": 2,
"subtotal": 100,
"tax": 13,
"tipBase": 100,
"tip": 18,
"total": 131,
"perPerson": 65.5,
"tipPerPerson": 9,
"roundedPerPerson": null,
"roundedTotal": null,
"effectiveTip": 18,
"effectiveTipPercent": 18,
"split": {
"lowerShare": 65.5,
"higherShare": 65.51,
"peopleAtLowerShare": 2,
"peopleAtHigherShare": 0
}
}Error Codes
400
Bad Request - A field is missing or invalid. The response lists each problem.401
Unauthorized - Missing or invalid API key403
Forbidden - The API key is inactive or expired, or the request IP is not allowed405
Method Not Allowed - This endpoint accepts GET and POST only429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)500
Internal Server ErrorGET
https://opentools.ca/api/v1/tools/tip-calculatorCalculate a tip and split the bill. Same fields as the POST body, sent as query parameters.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| bill | number | Required | Bill amount including tax, above 0. |
| tipPercent | number | Required | Tip as a percentage, 0 to 1000. |
| people | number | Optional | Number of people sharing, 1 to 1,000.Default: 1 |
| taxRate | number | Optional | Tax rate in percent, included in the bill. Use instead of taxAmount. |
| taxAmount | number | Optional | Tax in dollars, as printed on the receipt. Use instead of taxRate. |
| tipOnPreTax | boolean | Optional | Work the tip out on the amount before tax. Only matters when tax is given.Default: true |
| roundUp | boolean | Optional | Round each share up to a whole unit.Default: false |
Response Example
{
"success": true,
"bill": 113,
"people": 2,
"subtotal": 100,
"tax": 13,
"tipBase": 100,
"tip": 18,
"total": 131,
"perPerson": 65.5,
"tipPerPerson": 9,
"roundedPerPerson": null,
"roundedTotal": null,
"effectiveTip": 18,
"effectiveTipPercent": 18,
"split": {
"lowerShare": 65.5,
"higherShare": 65.51,
"peopleAtLowerShare": 2,
"peopleAtHigherShare": 0
}
}Error Codes
400
Bad Request - A field is missing or invalid. The response lists each problem.401
Unauthorized - Missing or invalid API key403
Forbidden - The API key is inactive or expired, or the request IP is not allowed405
Method Not Allowed - This endpoint accepts GET and POST only429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)500
Internal Server ErrorCode Examples
# Split a bill two ways, tip on the pre-tax amount
curl -X POST https://opentools.ca/api/v1/tools/tip-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"bill": 113,
"tipPercent": 18,
"people": 2,
"taxRate": 13
}'
# The same request as a GET with query parameters
curl "https://opentools.ca/api/v1/tools/tip-calculator?bill=113&tipPercent=18&people=2&taxRate=13" \
-H "Authorization: Bearer YOUR_API_KEY"Rather use it in your browser? Open the Tip Calculator & Bill Splitter