{
  "name": "us-customs-duties",
  "title": "US Customs Duties by Month: Gross Collections, Refunds and Net Receipts, 2015-2026",
  "description": "US federal customs duties by month from March 2015 to October 2026: gross receipts, refunds and net receipts (gross minus refunds), for the month and fiscal year to date, in US dollars, from the Monthly Treasury Statement (MTS) Table 4, Receipts of the U.S. Government, via the Treasury Fiscal Data API. A second table gives complete fiscal-year totals for FY2014 to FY2026. Frozen snapshot taken on 2026-11-28.",
  "status": "structured",
  "licenses": [
    {
      "name": "US-PD",
      "title": "Public domain: work of the US federal government. Fiscal Data: \"The data is offered free, without restriction, and available to copy, adapt, redistribute, or otherwise use for non-commercial or commercial purposes.\"",
      "path": "https://fiscaldata.treasury.gov/api-documentation/"
    }
  ],
  "sources": [
    {
      "title": "US Department of the Treasury, Bureau of the Fiscal Service, Monthly Treasury Statement (MTS), Table 4: Receipts of the U.S. Government (Fiscal Data API endpoint mts_table_4), statements for March 2015 to October 2026",
      "path": "https://fiscaldata.treasury.gov/datasets/monthly-treasury-statement/receipts-of-the-u-s-government"
    },
    {
      "title": "Fiscal Data API query used for this snapshot (Customs Duties rows of mts_table_4)",
      "path": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/mts/mts_table_4?filter=classification_desc:eq:Customs%20Duties&sort=record_date&page%5Bsize%5D=1000"
    }
  ],
  "upkeep": { "mode": "frozen", "snapshot": "2026-11-28" },
  "resources": [
    {
      "path": "data/customs-duties-monthly.csv",
      "name": "customs-duties-monthly",
      "title": "US customs duties by month: gross, refunds and net, March 2015 to October 2026",
      "mediatype": "text/csv",
      "encoding": "utf-8",
      "schema": {
        "fields": [
          { "name": "month", "type": "string", "description": "Calendar month the statement covers, YYYY-MM.", "constraints": { "pattern": "^\\d{4}-\\d{2}$" } },
          { "name": "record_date", "type": "date", "description": "Fiscal Data record_date: the last day of the month the statement covers. The statement itself is released about eight business days later." },
          { "name": "fiscal_year", "type": "integer", "description": "US federal fiscal year, 1 October to 30 September, named for the year it ends (October 2026 is in FY2027)." },
          { "name": "fiscal_month", "type": "integer", "description": "Month of the fiscal year: 1 = October ... 12 = September.", "constraints": { "minimum": 1, "maximum": 12 } },
          { "name": "gross_usd", "type": "number", "description": "Customs duties received in the month before refunds, US dollars (Treasury: 'without regard to refunds or other offsets')." },
          { "name": "refunds_usd", "type": "number", "description": "Customs duties refunded in the month, US dollars, as a positive number (Treasury: 'the return of excess payments'). A refund paid in a month may relate to duties collected in an earlier month." },
          { "name": "net_usd", "type": "number", "description": "Net customs receipts for the month, US dollars: gross_usd minus refunds_usd. Negative when refunds exceed collections." },
          { "name": "fytd_gross_usd", "type": "number", "description": "Gross customs duties, fiscal year to date through this month, US dollars." },
          { "name": "fytd_refunds_usd", "type": "number", "description": "Customs duty refunds, fiscal year to date through this month, US dollars." },
          { "name": "fytd_net_usd", "type": "number", "description": "Net customs receipts, fiscal year to date through this month, US dollars." }
        ],
        "primaryKey": ["month"]
      }
    },
    {
      "path": "data/customs-duties-fiscal-year.csv",
      "name": "customs-duties-fiscal-year",
      "title": "US customs duties by fiscal year: gross, refunds and net, FY2014 to FY2026",
      "mediatype": "text/csv",
      "encoding": "utf-8",
      "schema": {
        "fields": [
          { "name": "fiscal_year", "type": "integer", "description": "US federal fiscal year (1 October to 30 September, named for the year it ends). Complete years only." },
          { "name": "gross_usd", "type": "number", "description": "Customs duties received in the fiscal year before refunds, US dollars." },
          { "name": "refunds_usd", "type": "number", "description": "Customs duties refunded in the fiscal year, US dollars, as a positive number." },
          { "name": "net_usd", "type": "number", "description": "Net customs receipts for the fiscal year, US dollars: gross_usd minus refunds_usd." },
          { "name": "source_statement", "type": "date", "description": "record_date of the September statement the totals are taken from." },
          { "name": "source_columns", "type": "string", "description": "Which columns of that statement: current_fytd (current fiscal year to date) or prior_fytd (prior fiscal year to date; FY2014 only, from the September 2015 statement).", "constraints": { "enum": ["current_fytd", "prior_fytd"] } }
        ],
        "primaryKey": ["fiscal_year"]
      }
    }
  ],
  "views": [
    {
      "name": "monthly-gross-refunds-net",
      "title": "US customs duties by month: gross, refunds and net (billion US dollars)",
      "resources": ["customs-duties-monthly"],
      "specType": "vega-lite",
      "spec": {
        "width": "container",
        "height": 340,
        "transform": [
          { "fold": ["gross_usd", "refunds_usd", "net_usd"], "as": ["measure", "usd"] },
          { "calculate": "datum.usd / 1e9", "as": "billion_usd" },
          { "calculate": "datum.measure == 'gross_usd' ? 'Gross' : datum.measure == 'refunds_usd' ? 'Refunds' : 'Net'", "as": "series" }
        ],
        "mark": { "type": "line", "point": { "size": 12 } },
        "encoding": {
          "x": { "field": "record_date", "type": "temporal", "axis": { "title": "Month" } },
          "y": { "field": "billion_usd", "type": "quantitative", "axis": { "title": "Billion US dollars" } },
          "color": { "field": "series", "type": "nominal", "title": "Measure", "sort": ["Gross", "Refunds", "Net"] },
          "tooltip": [
            { "field": "month", "type": "nominal" },
            { "field": "series", "type": "nominal" },
            { "field": "billion_usd", "type": "quantitative", "format": ".3f" }
          ]
        }
      }
    }
  ]
}
