Skip to content

API Reference

The FreightFlow platform provides a high-performance REST interface for shipment management, container tracking, and terminal scraping orchestration.


1. Backend Core API

All core backend endpoints are prefixed with /api/v1 and generally require JWT Bearer Authorization unless specified otherwise.

Authentication & Users

EndpointMethodDescription
/auth/jwt/loginPOSTExchange email and password for access token.
/login/microsoftGETInitiate Microsoft OAuth 2.0 flow.
/auth/callbackGETMicrosoft OAuth callback handler.
/usersGETRetrieve list of registered users.

Organizations & Offices

EndpointMethodDescription
/organizationsGET / POSTList all organizations or create a new one.
/organizations/{id}GET / PATCH / DELETERetrieve, update, or remove an organization.
/officesGET / POSTList all operational offices or create a new one.
/office/{office_id}GET / PATCH / DELETERetrieve, update, or remove an office.

Shipments, Carriers & Terminals

EndpointMethodDescription
/shipmentsGETList active shipments with search and filters.
/shipments/{shipment_id}GETRetrieve detailed shipment and container records.
/tai/{reference_number}PATCHSynchronize updates from TAI system manually.
/carriersGETRetrieve list of all available carriers.
/portsGETRetrieve list of all registered oceanic ports.
/terminalsGETRetrieve list of tracking terminals.

Containers & Holds Tracking

EndpointMethodDescription
/containers/mbl-groupedGETView tracking data grouped by Master Bill of Lading.
/containers/archivedGETFetch list of archived/completed containers.
/containers/{container_id}GET / PATCHRetrieve or update a specific container's timeline.
/containers/{container_id}/archivePOSTManually mark a container as completed/archived.
/containers/{container_id}/scrapePOSTDispatch manual background scrape for a single container.
/containers/bulk-scrapePOSTDispatch tracking tasks for all active containers.
/containers/{container_id}/holdsPOSTRegister a new custom hold (Customs, USDA, etc.).
/containers/holds/{hold_id}DELETERemove/release a registered hold.

Shipment Imports & Bulk Sync

EndpointMethodDescription
/shipment-import/import-csvPOSTUpload a CSV file to bulk import missing shipments.
/shipment-import/import-sample-csvGETDownload the CSV template for imports.
/shipment-import/import-status/{task_id}GETCheck the background async status of an import task.
/shipment-import/trigger-syncPOSTTrigger bulk sync across Cargoes Flow.
/shipment-import/trigger-sync/{mbl_number}POSTForce tracking sync for a specific Master Bill of Lading.
/shipment-import/create-carriersPOSTRegister missing carriers flagged during imports.
/shipment-import/liveGETReal-time import operational logs.
/shipment-import/map-routes/{shipment_number}GETFetch geographic routing waypoints for the UI map.
/shipment-import/missing-mblGETIdentify shipments missing a valid tracking MBL.

Gravitas Management (New)

Base Path: /api/v1/gravitas

EndpointMethodDescriptionAuth Required
/gravitas/importPOSTUpload CSV file to import Gravitas shipments. Admin only.JWT + Admin Role
/gravitas/containersGETList all tracked Gravitas containers with pagination.JWT
/gravitas/containers/mbl-groupedGETView Gravitas containers grouped by MBL with KPI filtering.JWT
/gravitas/shipmentsGETList all raw Gravitas shipment records.JWT
/gravitas/shipments/{shipment_id}GETRetrieve specific Gravitas shipment details.JWT
/gravitas/shipments/{shipment_id}/syncPOSTForce tracking sync for a specific shipment.JWT
/gravitas/analytics/dashboardGETGet aggregated analytics for Gravitas dashboard.JWT
/gravitas/containers/{container_id}GET / PATCHRetrieve or update a Gravitas container.JWT
/gravitas/containers/{container_id}/scrapePOSTTrigger manual scraper for Gravitas container.JWT

Gravitas CSV Import Format

The CSV import expects the following columns:

ColumnRequiredDescription
File No.NoInternal file reference number
MB/L No.YesMaster Bill of Lading (primary key)
OfficeNoOperating office (defaults to "Gravitas")
ConsigneeNoConsignee name
Oversea AgentNoOverseas agent name
Container No.NoContainer number (optional, system discovers all containers via MBL)
ShipperNoShipper name

Import Process:

  1. CSV uploaded via /gravitas/import
  2. System creates/updates GravitasShipment by MBL
  3. Syncs with Cargoes Flow to discover all containers under MBL
  4. Creates GravitasContainer records for each container
  5. Triggers terminal scrapers for LFD/LRD data

Gravitas KPI Filter Parameters

The /gravitas/containers/mbl-grouped endpoint supports KPI filtering:

Filter ValueDescription
rail-shipmentsRail shipments only
manual-input-lfdContainers needing manual LFD input
manual-input-lrdContainers needing manual LRD input
demurrage-alertContainers with demurrage risk
detention-alertContainers with detention risk
lfd-alertContainers needing fee input
pod-full-outFull out from POD
pod-awaitingAwaiting at POD
pod-need-attentionPOD awaiting or full out
in-transitIn transit containers
arriving-todayArriving today
delayedDelayed containers
untrackableUntrackable status

Analytics Dashboard

EndpointMethodDescription
/analytics/dashboardGETAggregate key performance indicators (KPIs) and summaries.

Webhooks (Internal Callback Logic)

NOTE

These endpoints consume data from other systems or microservices. They are secured via specialized X-API-TOKEN verification to prevent spoofing.

EndpointMethodDescription
/webhook/tmsPOSTStandardized payload ingestion from TAI TMS platform.
/webhooks/testPOSTDiagnostic endpoint for testing TMS webhook integration.
/webhooks/scraperPOSTFeedback loop that parses the final scraped data sent back from the Scraper workers.

2. Terminal Scraper API

The Scraper service runs in isolation, providing a gateway to various unstructured terminal portals. Authentication is strictly via the X-API-TOKEN header.

Common Tracking Pattern

All terminal routers respond to a simple JSON payload:

  • Format: POST /terminal/scrape/{terminal_id}
  • Payload: { "container_numbers": ["CONT1234567"] }

Supported Endpoints

Terminal / PortEndpoint PathImplementation Tech
PNCT (Port Newark)/scrape/pnctLegacy / API Priority
APM Terminals/scrape/apmAPI Based
APM Miami/scrape/apm-miamiAPI Based
Maher Terminal/scrape/maherSelenium UI
Port Houston/scrape/port-houstonAPI Based
Fenix Marine/scrape/fenix-marineSelenium UI
Yusen / YTI/scrape/yusenAPI Based
POMTOC/scrape/pomtocAPI Based
eModal Platform/scrape/emodalAPI Based
Conley Terminal/scrape/conleyAPI Based
Baltimore Seagirt/scrape/baltimore-seagirtAPI Based
Port of Savannah/scrape/savannahAPI Based
ITS Terminal/scrape/itsAPI Based
ONE Carrier/scrape/oneDynamic Scrapling

Email Automation (Microsoft Outlook)

EndpointMethodDescription
/emailPOSTConsumes verification codes forwarded by MS PowerAutomate. Required when a terminal UI prompts for 2FA.

Security Context

CAUTION

Production Hardening: Ensure the Terminal Scraper instance limits incoming traffic solely to your Backend API's IP address.

JWT (User Facing)

  • Header: Authorization: Bearer <TOKEN>
  • Created when logging in via POST /api/v1/auth/jwt/login.
  • Used to authenticate all frontend dashboard requests.

API Key (Service-to-Service)

  • Header: X-API-TOKEN
  • Sourced from .env variable SCRAPER_API_KEY.
  • Used when Backend triggers a scrape task, and when Scraper answers back via Webhook.

FreightFlow Platform Documentation