# The Kenya Duty Estimator, read on 29-10-2026

Read on 29-10-2026 at [kenya-tariff.eregistrations.dev](https://kenya-tariff.eregistrations.dev/): the page, its script, and its own server's `/api/status`, `/api/search` ("rice") and `/api/details` (`1006300000`). No estimate was sent. The page names no author. Its copy is kept as [the page](2026-10-29-kenya-duty-estimator-page.html.txt) (SHA-256 `5f69b853…16510`). Kept as written; the second pass of step 3 starts from it, and it is the case of D56 (melux, 29-10-2026).

## What it is

A one-page tariff calculator for Kenya, written by hand: not eRegulations v7, and without v7's site around it. Its own server forwards three calls to KRA's Customs Tax Calculator ([KRA's API](2026-10-26-kra-customs-tax-calculator.md)); `/api/status` answered `{"configured":true,"baseUrl":"https://sbx.kra.go.ke"}`, so it runs on KRA's sandbox, live. Without credentials it falls back to a demo mode with three products and figures computed in the page, and says so in a notice.

| Page call | KRA operation | Checked 29-10-2026 |
|---|---|---|
| `POST /api/search {q}` | `searchByHSCode` when the text is digits, `searchByDesc` otherwise | "rice": 200 in 2.7 s, KRA's six lines as KRA sends them, `"soursuccessce":"cache"` included |
| `POST /api/details {nmctcode}` | `details` | `1006300000`: 200, code `10063000`, seven rates |
| `POST /api/calculate {value, quantity, currency, movement, nmctcode}` | `calculate` | Not called |

## What the trader sees

1. A title, "Calculate customs duties & taxes — Kenya", a badge "Live: KRA sandbox" or "Demo data".
2. Two cards, Import and Export, as in v7.
3. Product: one box for a code (4 digits at least) or words (3 letters at least), a list of up to 100 lines sorted by code, and four code boxes, `00 00 00 00`, with a fifth when digits 9–10 are not `00`.
4. As soon as a product is chosen, a table of KRA's rates for the direction chosen, from `details`: charge, rate, "on value" or "per unit", zero rates greyed; on imports, a note that the Import Declaration Fee and the Railway Development Levy come with the result.
5. Quantity, in KRA's unit for the product.
6. One currency for the whole shipment, from a list of 23 written in the page; cost of goods, insurance and freight; the customs value (CIF) added up in the page. "Estimate duties" stays disabled until a product, a value and a quantity are given.
7. The result: "Total amount due" in KES, the customs value in KES, KRA's exchange rate, and a table of two lines on imports: "Customs duty, excise duty and VAT", and "Levies: Import Declaration Fee + Railway Development Levy" with both rates; one line, "Export duty", on exports. Then the notice "Figures are estimates returned by the KRA Customs Tax Calculator…", a folded "Raw API response", CSV and print.
8. Light and dark themes; one column on a phone.

## Against the decisions

| Decision | What the page does | Agrees |
|---|---|---|
| D4, the estimate notice | Under the result, every time | Yes |
| D56, totals as they come, rates beside them | Shows KRA's total and its levies as they come, the rates from `details` in their own table, before the estimate; but makes a line "Customs duty, excise duty and VAT" by computing `Tax − Levies`, a figure KRA does not send; and gives no time for either call | Partly |
| D23, an amount per box, each with its currency | One currency for all; cost, insurance and freight added in the page and sent as one `value`, as KRA asks | No: KRA takes one value |
| D23, rounded once | Every figure shown through `toLocaleString` to two decimals; `value` rounded to cents before it is sent | Yes for display |
| D53, currencies quoted by customs | 23 currencies written in the page; KRA has no list | No |
| D46, D47, the local currency and the rate | The total is always in KES; the rate "1 USD = 129.89 KES", without date or source | Partly |
| Lesson 7 of the KRA note, check the code first | Does not: an unknown code would still get the levies as a figure | No |
| Lesson 3, refuse a rate it cannot read | A rate it cannot read shows as 0 | No |

## What it shows that the second pass can use

1. The rates come before the estimate, from customs, for the direction chosen; the trader sees what applies before typing a value.
2. The estimate button says why it waits: it is disabled until the three things it needs are there.
3. The code is shown as four pairs, zeros included, the fifth only when it carries something.
4. A whole result in one card: total, value, rate, lines, notice, CSV, print.
5. Dark mode and a phone layout, without v7's site around it.

## What it gets wrong, to avoid

1. A computed line (`Tax − Levies`) shown among customs' figures (D56).
2. Rice's specific duty: KRA describes it "IN USD PER MT" but sends `"calcMethod":"Per KGM"`; the page shows "200.00 USD / KGM", a thousand times too much. The rate should be shown as KRA describes it, or not at all, until KRA's data agrees with itself.
3. KRA's tax codes not in its list of names (`P_DUTY_SPEC_RATE_USD`) show KRA's own description, in capitals.
4. The raw API answer offered to the trader.
5. The demo mode's figures look like real ones: a notice says so, the result does not.

## Not verified

- Who built it, from which repository, and whether it is meant to stay online.
- The estimate through its server; its time limit; what it shows when KRA answers 400 or 500.
