curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

Tip and bill split API

Tip amount, total and a fair split between people where the shares add up exactly to the bill.

POST https://api.curatedapi.com/v1/calc/everyday/tip

Adds a tip and splits the total. Splitting 100.00 three ways cannot give three equal amounts in cents, so the shares are 33.34, 33.33 and 33.33: they always add up to the total exactly, and the response says how many people pay one extra cent.

Formula

tip = bill × p; shares = total split into whole cents, remainder spread one cent at a time
  • Amounts are plain numbers in any single currency; no currency conversion is done.
  • The tip is calculated on the bill amount you enter (usually before tax).

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
bill_amount required decimal (string) Bill before the tip. Allowed: >= 0 and <= 1000000000000000. Unit: currency.
tip_percent decimal (string)
default 15
Tip in percent of the bill. Allowed: >= 0 and <= 100. Unit: percent.
people integer
default 1
Number of people splitting the bill. Allowed: >= 1 and <= 1000.
options.rounding half_even | half_up | half_down | up | down | ceiling | floor Rounding mode applied once to each result. Default half_even.
options.decimals integer Round results to this many digits after the decimal point.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
tip_amountdecimal (string)The tip. Unit: currency.
totaldecimal (string)Bill plus tip. Unit: currency.
per_persondecimal (string)Total ÷ people, rounded. Unit: currency.
shareslist of stringWhat each person pays; adds up exactly to total.
people_paying_extraintegerHow many shares carry one extra smallest unit.

Examples

100 split 3 ways, no tip

Requestcurl
curl https://api.curatedapi.com/v1/calc/everyday/tip \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bill_amount": "100",
    "tip_percent": "0",
    "people": 3
  }'
200 OKResponse
{
  "calculator": "everyday/tip@1",
  "result": {
    "tip_amount": "0.00",
    "total": "100.00",
    "per_person": "33.33",
    "shares": [
      "33.34",
      "33.33",
      "33.33"
    ],
    "people_paying_extra": 1
  },
  "exactness": {
    "tip_amount": "exact",
    "total": "exact",
    "per_person": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "bill_amount": "100",
    "tip_percent": "0",
    "people": 3
  },
  "formula": "tip = bill × p; shares = total split into whole cents, remainder spread one cent at a time",
  "references": [
    {
      "title": "Largest remainder method (fair rounding of shares)",
      "url": "https://en.wikipedia.org/wiki/Largest_remainders_method"
    }
  ],
  "warnings": []
}

18% tip on 64.50 for 2

Requestcurl
curl https://api.curatedapi.com/v1/calc/everyday/tip \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "bill_amount": "64.50",
    "tip_percent": "18",
    "people": 2
  }'
200 OKResponse
{
  "calculator": "everyday/tip@1",
  "result": {
    "tip_amount": "11.61",
    "total": "76.11",
    "per_person": "38.06",
    "shares": [
      "38.06",
      "38.05"
    ],
    "people_paying_extra": 1
  },
  "exactness": {
    "tip_amount": "exact",
    "total": "exact",
    "per_person": "exact"
  },
  "precision": {
    "rounding": "half_even",
    "decimals": 2
  },
  "inputs": {
    "bill_amount": "64.5",
    "tip_percent": "18",
    "people": 2
  },
  "formula": "tip = bill × p; shares = total split into whole cents, remainder spread one cent at a time",
  "references": [
    {
      "title": "Largest remainder method (fair rounding of shares)",
      "url": "https://en.wikipedia.org/wiki/Largest_remainders_method"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.