forked from koala73/worldmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTradeService.openapi.json
More file actions
1 lines (1 loc) · 17.4 KB
/
TradeService.openapi.json
File metadata and controls
1 lines (1 loc) · 17.4 KB
1
{"components":{"schemas":{"ComtradeFlowRecord":{"description":"ComtradeFlowRecord is a single bilateral commodity flow record.","properties":{"cmdCode":{"description":"HS commodity code.","type":"string"},"cmdDesc":{"description":"Commodity description.","type":"string"},"isAnomaly":{"description":"True if the YoY change exceeds the anomaly threshold (30%).","type":"boolean"},"netWeightKg":{"description":"Net weight in kg.","format":"double","type":"number"},"partnerCode":{"description":"Partner country code (\"000\" = world total).","type":"string"},"partnerName":{"description":"Partner country name.","type":"string"},"reporterCode":{"description":"UN Comtrade reporter code.","type":"string"},"reporterName":{"description":"Reporter country name.","type":"string"},"tradeValueUsd":{"description":"Trade value in USD.","format":"double","type":"number"},"year":{"description":"Reporting year.","format":"int32","type":"integer"},"yoyChange":{"description":"Year-over-year change (ratio, e.g. 0.35 = +35%).","format":"double","type":"number"}},"type":"object"},"CustomsRevenueMonth":{"description":"Monthly US customs duties revenue from Treasury MTS data.","properties":{"calendarMonth":{"format":"int32","type":"integer"},"calendarYear":{"format":"int32","type":"integer"},"fiscalYear":{"format":"int32","type":"integer"},"fytdAmountBillions":{"format":"double","type":"number"},"monthlyAmountBillions":{"format":"double","type":"number"},"recordDate":{"type":"string"}},"type":"object"},"EffectiveTariffRate":{"description":"Current effective tariff estimate for countries with coverage beyond WTO MFN baselines.","properties":{"observationPeriod":{"description":"Human-readable observation period (for example \"December 2025\").","type":"string"},"sourceName":{"description":"Source name for the effective-rate estimate.","type":"string"},"sourceUrl":{"description":"Canonical source URL for the estimate/methodology.","type":"string"},"tariffRate":{"description":"Effective tariff rate (percentage).","format":"double","type":"number"},"updatedAt":{"description":"ISO 8601 date when the source page was last updated, if known.","type":"string"}},"type":"object"},"Error":{"description":"Error is returned when a handler encounters an error. It contains a simple error message that the developer can customize.","properties":{"message":{"description":"Error message (e.g., 'user not found', 'database connection failed')","type":"string"}},"type":"object"},"FieldViolation":{"description":"FieldViolation describes a single validation error for a specific field.","properties":{"description":{"description":"Human-readable description of the validation violation (e.g., 'must be a valid email address', 'required field missing')","type":"string"},"field":{"description":"The field path that failed validation (e.g., 'user.email' for nested fields). For header validation, this will be the header name (e.g., 'X-API-Key')","type":"string"}},"required":["field","description"],"type":"object"},"GetCustomsRevenueRequest":{"type":"object"},"GetCustomsRevenueResponse":{"properties":{"fetchedAt":{"type":"string"},"months":{"items":{"$ref":"#/components/schemas/CustomsRevenueMonth"},"type":"array"},"upstreamUnavailable":{"type":"boolean"}},"type":"object"},"GetTariffTrendsRequest":{"description":"Request for tariff timeseries data.","properties":{"partnerCountry":{"description":"WTO member code of partner country (e.g. \"156\" = China).","type":"string"},"productSector":{"description":"Product sector filter (HS chapter). Empty = aggregate.","type":"string"},"reportingCountry":{"description":"WTO member code of reporting country (e.g. \"840\" = US).","type":"string"},"years":{"description":"Number of years to look back (default 10, max 30).","format":"int32","type":"integer"}},"type":"object"},"GetTariffTrendsResponse":{"description":"Response containing tariff trend datapoints.","properties":{"datapoints":{"items":{"$ref":"#/components/schemas/TariffDataPoint"},"type":"array"},"effectiveTariffRate":{"$ref":"#/components/schemas/EffectiveTariffRate"},"fetchedAt":{"description":"ISO 8601 timestamp when data was fetched from WTO.","type":"string"},"upstreamUnavailable":{"description":"True if upstream fetch failed and results may be stale/empty.","type":"boolean"}},"type":"object"},"GetTradeBarriersRequest":{"description":"Request for SPS/TBT trade barrier notifications.","properties":{"countries":{"items":{"description":"WTO member codes to filter by. Empty = all.","type":"string"},"type":"array"},"limit":{"description":"Max results to return (server caps at 100).","format":"int32","type":"integer"},"measureType":{"description":"Filter by measure type: \"SPS\", \"TBT\", or empty for both.","type":"string"}},"type":"object"},"GetTradeBarriersResponse":{"description":"Response containing trade barrier notifications.","properties":{"barriers":{"items":{"$ref":"#/components/schemas/TradeBarrier"},"type":"array"},"fetchedAt":{"description":"ISO 8601 timestamp when data was fetched from WTO.","type":"string"},"upstreamUnavailable":{"description":"True if upstream fetch failed and results may be stale/empty.","type":"boolean"}},"type":"object"},"GetTradeFlowsRequest":{"description":"Request for bilateral trade flow data.","properties":{"partnerCountry":{"description":"WTO member code of partner country.","type":"string"},"reportingCountry":{"description":"WTO member code of reporting country.","type":"string"},"years":{"description":"Number of years to look back (default 10, max 30).","format":"int32","type":"integer"}},"type":"object"},"GetTradeFlowsResponse":{"description":"Response containing trade flow records.","properties":{"fetchedAt":{"description":"ISO 8601 timestamp when data was fetched from WTO.","type":"string"},"flows":{"items":{"$ref":"#/components/schemas/TradeFlowRecord"},"type":"array"},"upstreamUnavailable":{"description":"True if upstream fetch failed and results may be stale/empty.","type":"boolean"}},"type":"object"},"GetTradeRestrictionsRequest":{"description":"Request for quantitative restriction data.","properties":{"countries":{"items":{"description":"WTO member codes to filter by. Empty = all.","type":"string"},"type":"array"},"limit":{"description":"Max results to return (server caps at 100).","format":"int32","type":"integer"}},"type":"object"},"GetTradeRestrictionsResponse":{"description":"Response containing trade restrictions and fetch metadata.","properties":{"fetchedAt":{"description":"ISO 8601 timestamp when data was fetched from WTO.","type":"string"},"restrictions":{"items":{"$ref":"#/components/schemas/TradeRestriction"},"type":"array"},"upstreamUnavailable":{"description":"True if upstream fetch failed and results may be stale/empty.","type":"boolean"}},"type":"object"},"ListComtradeFlowsRequest":{"description":"ListComtradeFlowsRequest filters strategic commodity trade flows.","properties":{"anomaliesOnly":{"description":"If true, only return flows with a year-over-year change exceeding 30%.","type":"boolean"},"cmdCode":{"description":"HS commodity code (e.g. \"2709\" = crude oil). Empty returns all commodities.","type":"string"},"reporterCode":{"description":"UN Comtrade reporter code (e.g. \"842\" = US, \"156\" = China). Empty returns all reporters.","type":"string"}},"type":"object"},"ListComtradeFlowsResponse":{"description":"ListComtradeFlowsResponse contains strategic commodity trade flows.","properties":{"fetchedAt":{"description":"ISO 8601 timestamp when data was seeded.","type":"string"},"flows":{"items":{"$ref":"#/components/schemas/ComtradeFlowRecord"},"type":"array"},"upstreamUnavailable":{"description":"True if seeded data is missing or stale.","type":"boolean"}},"type":"object"},"TariffDataPoint":{"description":"Single tariff data point for a reporter-partner-product combination.","properties":{"boundRate":{"description":"WTO bound tariff rate (percentage).","format":"double","type":"number"},"indicatorCode":{"description":"WTO indicator code used for this datapoint.","type":"string"},"partnerCountry":{"description":"WTO member code of partner country.","type":"string"},"productSector":{"description":"Product sector or HS chapter.","type":"string"},"reportingCountry":{"description":"WTO member code of reporting country.","type":"string"},"tariffRate":{"description":"Applied MFN tariff rate (percentage).","format":"double","type":"number"},"year":{"description":"Year of observation.","format":"int32","type":"integer"}},"type":"object"},"TradeBarrier":{"description":"SPS or TBT trade barrier notification.","properties":{"dateDistributed":{"description":"ISO 8601 date when notification was distributed.","type":"string"},"id":{"description":"Unique barrier notification identifier.","type":"string"},"measureType":{"description":"Measure classification: \"SPS\" or \"TBT\".","type":"string"},"notifyingCountry":{"description":"Country that notified the measure.","type":"string"},"objective":{"description":"Stated objective of the measure.","type":"string"},"productDescription":{"description":"Product description or affected goods.","type":"string"},"sourceUrl":{"description":"WTO source document URL (must be http/https protocol).","type":"string"},"status":{"description":"Status of the notification.","type":"string"},"title":{"description":"Title of the notification.","type":"string"}},"type":"object"},"TradeFlowRecord":{"description":"Bilateral trade flow record for a reporting-partner pair.","properties":{"exportValueUsd":{"description":"Merchandise export value in millions USD.","format":"double","type":"number"},"importValueUsd":{"description":"Merchandise import value in millions USD.","format":"double","type":"number"},"partnerCountry":{"description":"WTO member code of partner country.","type":"string"},"productSector":{"description":"Product sector or HS chapter.","type":"string"},"reportingCountry":{"description":"WTO member code of reporting country.","type":"string"},"year":{"description":"Year of observation.","format":"int32","type":"integer"},"yoyExportChange":{"description":"Year-over-year export change (percentage).","format":"double","type":"number"},"yoyImportChange":{"description":"Year-over-year import change (percentage).","format":"double","type":"number"}},"type":"object"},"TradeRestriction":{"description":"Quantitative restriction or export control measure notified to WTO.","properties":{"affectedCountry":{"description":"Country affected by the restriction.","type":"string"},"description":{"description":"Human-readable description of the measure.","type":"string"},"id":{"description":"Unique restriction identifier from WTO.","type":"string"},"measureType":{"description":"Measure classification: \"QR\", \"EXPORT_BAN\", \"IMPORT_BAN\", \"LICENSING\".","type":"string"},"notifiedAt":{"description":"ISO 8601 date when measure was notified.","type":"string"},"productSector":{"description":"Product sector or HS chapter description.","type":"string"},"reportingCountry":{"description":"ISO 3166-1 alpha-3 or WTO member code of reporting country.","type":"string"},"sourceUrl":{"description":"WTO source document URL (must be http/https protocol).","type":"string"},"status":{"description":"Current status: \"IN_FORCE\", \"TERMINATED\", \"NOTIFIED\".","type":"string"}},"type":"object"},"ValidationError":{"description":"ValidationError is returned when request validation fails. It contains a list of field violations describing what went wrong.","properties":{"violations":{"description":"List of validation violations","items":{"$ref":"#/components/schemas/FieldViolation"},"type":"array"}},"required":["violations"],"type":"object"}}},"info":{"title":"TradeService API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/trade/v1/get-customs-revenue":{"get":{"description":"Get US customs duties revenue (Treasury MTS data, seeded by Railway).","operationId":"GetCustomsRevenue","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetCustomsRevenueResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"GetCustomsRevenue","tags":["TradeService"]}},"/api/trade/v1/get-tariff-trends":{"get":{"description":"Get tariff rate timeseries for a country pair.","operationId":"GetTariffTrends","parameters":[{"description":"WTO member code of reporting country (e.g. \"840\" = US).","in":"query","name":"reporting_country","required":false,"schema":{"type":"string"}},{"description":"WTO member code of partner country (e.g. \"156\" = China).","in":"query","name":"partner_country","required":false,"schema":{"type":"string"}},{"description":"Product sector filter (HS chapter). Empty = aggregate.","in":"query","name":"product_sector","required":false,"schema":{"type":"string"}},{"description":"Number of years to look back (default 10, max 30).","in":"query","name":"years","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTariffTrendsResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"GetTariffTrends","tags":["TradeService"]}},"/api/trade/v1/get-trade-barriers":{"get":{"description":"Get SPS/TBT barrier notifications.","operationId":"GetTradeBarriers","parameters":[{"description":"WTO member codes to filter by. Empty = all.","in":"query","name":"countries","required":false,"schema":{"type":"string"}},{"description":"Filter by measure type: \"SPS\", \"TBT\", or empty for both.","in":"query","name":"measure_type","required":false,"schema":{"type":"string"}},{"description":"Max results to return (server caps at 100).","in":"query","name":"limit","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTradeBarriersResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"GetTradeBarriers","tags":["TradeService"]}},"/api/trade/v1/get-trade-flows":{"get":{"description":"Get bilateral merchandise trade flows.","operationId":"GetTradeFlows","parameters":[{"description":"WTO member code of reporting country.","in":"query","name":"reporting_country","required":false,"schema":{"type":"string"}},{"description":"WTO member code of partner country.","in":"query","name":"partner_country","required":false,"schema":{"type":"string"}},{"description":"Number of years to look back (default 10, max 30).","in":"query","name":"years","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTradeFlowsResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"GetTradeFlows","tags":["TradeService"]}},"/api/trade/v1/get-trade-restrictions":{"get":{"description":"Get quantitative restrictions and export controls.","operationId":"GetTradeRestrictions","parameters":[{"description":"WTO member codes to filter by. Empty = all.","in":"query","name":"countries","required":false,"schema":{"type":"string"}},{"description":"Max results to return (server caps at 100).","in":"query","name":"limit","required":false,"schema":{"format":"int32","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTradeRestrictionsResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"GetTradeRestrictions","tags":["TradeService"]}},"/api/trade/v1/list-comtrade-flows":{"get":{"description":"List UN Comtrade strategic commodity flows with anomaly detection.","operationId":"ListComtradeFlows","parameters":[{"description":"UN Comtrade reporter code (e.g. \"842\" = US, \"156\" = China). Empty returns all reporters.","in":"query","name":"reporter_code","required":false,"schema":{"type":"string"}},{"description":"HS commodity code (e.g. \"2709\" = crude oil). Empty returns all commodities.","in":"query","name":"cmd_code","required":false,"schema":{"type":"string"}},{"description":"If true, only return flows with a year-over-year change exceeding 30%.","in":"query","name":"anomalies_only","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListComtradeFlowsResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"},"default":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Error response"}},"summary":"ListComtradeFlows","tags":["TradeService"]}}}}