---
title: "Exchange Rates in Customs Filing and Freight Forwarding Software: Developer Guide"
description: "How to build the exchange rate step of a customs declaration: which date picks the rate, routing by clearance country, import and export rates, next-period tables, amendments, caching and the audit record to keep."
canonical: https://allratestoday.com/docs/customs/customs-filing-software/
source: AllRatesToday (https://allratestoday.com/) — Markdown mirror of the page above; index of all pages at https://allratestoday.com/llms.txt
generated: 2026-11-25T14:59:28.388Z
---

# Exchange Rates in Customs Filing and Freight Forwarding Software: Developer Guide

How to build the exchange rate step of a customs declaration: which date picks the rate, routing by clearance country, import and export rates, next-period tables, amendments, caching and the audit record to keep.

By [Madhushan](https://allratestoday.com/authors/madhushan/), Founder & Lead Developer · Updated 25 Nov 2026

Every customs declaration that carries a foreign-currency invoice needs one number the declarant does not choose: the exchange rate the customs authority of the clearance country fixed for that declaration. This guide is for teams building customs filing, brokerage and freight forwarding software. It covers which date picks the rate, how to route by clearance country, and what to store so the entry survives a post-clearance audit. The data comes from the [customs exchange rate API](https://allratestoday.com/customs-exchange-rate-api/), which covers 66 clearance countries.

## 1. Pick the rate by the date the law names

The invoice date and the shipping date are usually the wrong keys. Each customs law names its own date, and the rate is the one in force on that date:

- **European Union:** the monthly table under Article 53 of the Union Customs Code and Article 146 of its Implementing Regulation, for the month in which the declaration is accepted.
- **United States:** the rate for the date of exportation of the goods (19 CFR 159.32), not the date of entry.
- **India:** the rate in force on the date the bill of entry (imports) or shipping bill (exports) is presented (Customs Act 1962, section 14).

Pass that date to `/api/v1/customs/{country}/{YYYY-MM-DD}`. The API returns the table in force then: the latest table on or before the date. Weekends and holidays fall back to the table still in force, which is what the rules require.

## 2. Route by clearance country, not by authority

Your software knows the clearance country (the office of entry, or the country of the declaration). It does not need to know that Dutch customs, US CBP or the Korea Customs Service sets the table. The country endpoint takes the ISO code and answers from the right authority, and the map lists them all:

```
# Which authority's table applies in each clearance country (no key needed)
curl "https://allratestoday.com/api/v1/customs"
```

Cache the map and refresh it weekly; coverage only grows. A country that is not covered returns `404` with a link to request it, so your UI can fall back to a manual rate field instead of silently using a market rate.

Inside the EU, the clearance country decides, not where the importer is established: goods cleared in Rotterdam use the Dutch table, goods cleared in Hamburg the German one. Euro-area states without their own table we fetch return the rule-based EU table, labelled as such.

## 3. The call for one declaration

```
# Bill of entry presented in India on 24 November 2026, invoice in USD
curl "https://allratestoday.com/api/v1/customs/IN/2026-11-24?source=USD&target=INR&type=import" \
  -H "Authorization: Bearer art_live_your_key"
```

```
{
  "clearance_country": "IN",
  "authority": { "code": "cbic", "name": "Central Board of Indirect Taxes and Customs (CBIC)", ... },
  "bank": "cbic",
  "rate_date": "2026-11-20",
  "source": "USD",
  "target": "INR",
  "rate": 94.1,
  "rate_type": "import",
  "derived": false,
  "method": "published",
  ...
}
```

The date asked for is 24 November; `rate_date` is 20 November because the CBIC notification issued for that date was still in force. Store `rate_date`, not the request date. A fuller client:

```
import requests

API = "https://allratestoday.com/api/v1/customs"
HEADERS = {"Authorization": "Bearer art_live_your_key"}

def declaration_rate(country, legal_date, invoice_ccy, local_ccy, direction="import"):
    """Rate for one declaration line, plus the evidence to store with the entry.

    legal_date: the date the clearance country's law names (acceptance in the EU,
    exportation in the US, bill of entry / shipping bill presentation in India).
    direction:  "import" or "export"; only two-sided tables use it.
    """
    params = {"source": invoice_ccy, "target": local_ccy}
    if direction == "export":
        params["type"] = "export"
    r = requests.get(f"{API}/{country}/{legal_date}", params=params, headers=HEADERS, timeout=10)
    r.raise_for_status()
    body = r.json()
    evidence = {
        "authority": body["authority"]["code"],
        "table_date": body["rate_date"],      # the authority's table, not today
        "rate_type": body["rate_type"],
        "derived": body["derived"],
        "method": body["method"],
        "basis": body.get("basis"),           # set when a table is built by rule
    }
    return body["rate"], evidence

rate, evidence = declaration_rate("IN", "2026-11-24", "USD", "INR")
customs_value_inr = round(18_400 * rate, 2)
```

## 4. Import and export rates are different series

Some authorities fix a separate rate for each direction. CBIC's notification in force from 20 November 2026 sets USD at 94.10 rupees for imported goods and 92.40 for exported goods. Thai Customs, the Korea Customs Service, Iceland Revenue and Customs and the Uganda Revenue Authority also keep separate import and export series. They come back as `rate_type` `import` and `export`:

- Without `type`, a pair resolves to the **import** side.
- For an export declaration, always send `type=export`. Do not rely on the default.
- Single-series tables (most EU monthly tables, Japan's weekly rate) ignore direction; the same rate values both.

The [export declarations guide](https://allratestoday.com/docs/customs/export-declarations/) covers this in detail.

## 5. Tables known before they apply

Many tables are fixed before their period starts. EU monthly customs tables are set from the rate of the second-last Wednesday of the previous month, Canada and Australia set tomorrow's rate the evening before, and China's monthly rate is fixed mid-month for the next. `/api/v1/customs/{country}/next` (paid plans) returns that table as soon as it exists, with `in_force_from`. Use it to pre-load rates for declarations you will file at the start of a period. It returns `404` until the authority has set the next table, so treat that as "not yet", not as an error.

## 6. Amendments and mid-period changes

A few authorities revise part of a table mid-period: German, French and Belgian customs among them, plus North Macedonia and Uganda. The API applies the revision for you. A request for a date returns the table as it stood in force on that date, with every row carrying the date it was set. Re-query only if you file after a revision for a date before it, which is the case the authority's own rules govern.

## 7. Caching

A table does not change inside its period, so one fetch per country per period covers every declaration in it. Store each table once under `(country, rate_date)` from the response, and map the legal dates you looked up onto it:

```
tables = {}    # (country, rate_date) -> table, one copy per authority table
by_date = {}   # (country, legal_date) -> the same table object

def table_for(country, legal_date):
    key = (country, legal_date)
    if key not in by_date:
        t = requests.get(f"{API}/{country}/{legal_date}", headers=HEADERS, timeout=10).json()
        by_date[key] = tables.setdefault((country, t["rate_date"]), t)
    return by_date[key]
```

An answer for a date in a closed period does not change, so it can be kept. Refresh dates inside the current period once a day, which also picks up amendments. Daily tables (Canada, Australia, South Africa, Switzerland and others) need a fetch per day; weekly and monthly tables far fewer. The response's `stale` flag is `true` if the authority is late with its next table. Show that to the user rather than filing on it unchecked.

## 8. What to store with each entry

- **authority** code and **rate_date**: which table was applied.
- **rate_type**: import, export, or the table's own series name.
- **derived** and **method**: whether the pair was printed by the authority or computed from its table (an inverse or a cross through the home currency).
- **basis**, when present: the US CBP and China customs tables, and the EU Article 146 tables, are built by applying the regulation to official central bank rates, and say so with `"method": "rule"` and the rule they follow.
- The legal date you looked up, and the rate as returned before any rounding. Round the converted amount, not the rate.

With those fields, a post-clearance audit can re-run the lookup months later (`/api/v1/customs/{country}/{date}` returns the same table) and get the same value.

## Files instead of JSON

If the system imports a rate file rather than calling an API, add `format=csv`, `xml` or `xlsx` to the same URL. File responses carry the authority in the `X-Customs-Authority` header. For Node.js, the [customs-exchange-rates](https://www.npmjs.com/package/customs-exchange-rates) package wraps these calls. Past dates, `/next` and `/all/latest` need a paid plan; the latest table is on every plan.

## Related guides

- [Landed-cost calculators and DDP checkout](https://allratestoday.com/docs/customs/landed-cost-and-ddp/)
- [Export declarations: which rate applies](https://allratestoday.com/docs/customs/export-declarations/)
- [SAP Global Trade Services](https://allratestoday.com/docs/integrations/sap/#gts), [Dynamics 365 Finance](https://allratestoday.com/docs/integrations/dynamics-365-finance/), [Oracle Fusion and OTM/GTM](https://allratestoday.com/docs/integrations/oracle-fusion/)

## Building customs or forwarding software?

Tell us your clearance countries and we will confirm coverage, or set up a direct feed.

 [Talk to us](https://allratestoday.com/contact?tab=business&topic=tax_authority_data) [Customs exchange rate API](https://allratestoday.com/customs-exchange-rate-api/)
