# Freight & LTL API
> Freight and logistics maths as an API, computed locally and deterministically — the LTL freight class and load-planning numbers a shipper, broker or warehouse works to. The freight-class endpoint computes the density (weight ÷ cubic feet) of a shipment and maps it to the NMFC density-based freight class — the 18-band scale from class 50 (densest, cheapest) to 500 (lightest) — so a 200 lb pallet measuring 48×40×48 inches is 3.75 lb/ft³ and lands in class 250. The pallet endpoint palletizes a carton: it takes the better of the two footprint orientations for cartons per layer, fills the usable stack height in layers, and returns the cartons per pallet limited by the smaller of the cube and the weight cap, with the cargo weight and stack height (defaulting to a 48×40 GMA pallet). The container endpoint loads a 40-foot high-cube container (or any dimensions you give): how many units fit by axis-aligned stacking and by payload, which one is the limiting factor, the total weight and the cube utilisation. Everything is computed locally and deterministically, so it is instant and private. Ideal for logistics, freight-brokerage, 3PL, warehouse-management and supply-chain app developers, LTL rating and load-planning tools, and shipping calculators. Pure local computation — no key, no third-party service, instant. Imperial units (inches, pounds, cubic feet) as the NMFC scale is US-based. Live, nothing stored. 3 compute endpoints. This is freight-class and load-planning maths; for single-parcel courier billing weight use a dimensional-weight API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/freight-api/..."
```

## Pricing
- **Free** (Free) — 4,050 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 42,000 calls/Mo, 6 req/s
- **Pro** ($18/Mo) — 197,000 calls/Mo, 15 req/s
- **Mega** ($53/Mo) — 1,145,000 calls/Mo, 40 req/s

## Endpoints

### Freight

#### `GET /v1/container` — Units per container

**Parameters:**
- `item_length` (query, required, string) — Item length (in) Example: `48`
- `item_width` (query, required, string) — Item width (in) Example: `40`
- `item_height` (query, required, string) — Item height (in) Example: `48`
- `item_weight` (query, required, string) — Item weight (lb) Example: `960`
- `container_length` (query, optional, string) — Container length (default 472)
- `container_width` (query, optional, string) — Container width (default 92.5)
- `container_height` (query, optional, string) — Container height (default 102)
- `max_payload` (query, optional, string) — Max payload (default 58000)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/freight-api/v1/container?item_length=48&item_width=40&item_height=48&item_weight=960"
```

**Response:**
```json
{
    "data": {
        "note": "Axis-aligned stacking (no rotation): units fit along each axis, capped by the payload. Volume utilisation shows the unused cube — palletised or rotated loads may fit more.",
        "inputs": {
            "item_width": 40,
            "item_height": 48,
            "item_length": 48,
            "item_weight": 960,
            "max_payload": 58000,
            "container_width": 92.5,
            "container_height": 102,
            "container_length": 472
        },
        "total_weight": 34560,
        "units_loadable": 36,
        "limiting_factor": "volume",
        "units_by_volume": 36,
        "units_by_weight": 60,
        "volume_utilization_percent": 74.5008
    },
    "meta": {
        "timestamp": "2026-06-05T21:48:47.382Z",
        "request_id": "bfc5d266-3a2c-4359-85fb-0ae911a069ae"
    },
    "status": "ok",
    "message": "Container loading",
    "success": true
}
```

#### `GET /v1/freight-class` — NMFC LTL freight class

**Parameters:**
- `weight` (query, required, string) — Weight (lb) Example: `200`
- `length` (query, optional, string) — Length (in) Example: `48`
- `width` (query, optional, string) — Width (in) Example: `40`
- `height` (query, optional, string) — Height (in) Example: `48`
- `cubic_feet` (query, optional, string) — Cubic feet (instead of dims)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/freight-api/v1/freight-class?weight=200&length=48&width=40&height=48"
```

**Response:**
```json
{
    "data": {
        "note": "LTL freight class from the NMFC density scale: density = weight / cubic feet. Denser freight is a lower (cheaper) class — 50 is densest, 500 lightest.",
        "inputs": {
            "width": 40,
            "height": 48,
            "length": 48,
            "weight": 200
        },
        "cubic_feet": 53.3333,
        "freight_class": 250,
        "density_lb_per_cuft": 3.75
    },
    "meta": {
        "timestamp": "2026-06-05T21:48:47.468Z",
        "request_id": "6685750f-0f28-40ac-a2be-a5c6b8cfc00b"
    },
    "status": "ok",
    "message": "Freight class",
    "success": true
}
```

#### `GET /v1/pallet` — Cartons per pallet

**Parameters:**
- `carton_length` (query, required, string) — Carton length (in) Example: `12`
- `carton_width` (query, required, string) — Carton width (in) Example: `12`
- `carton_height` (query, required, string) — Carton height (in) Example: `12`
- `carton_weight` (query, required, string) — Carton weight (lb) Example: `20`
- `pallet_length` (query, optional, string) — Pallet length (default 48)
- `pallet_width` (query, optional, string) — Pallet width (default 40)
- `max_height` (query, optional, string) — Max stack height (default 60)
- `max_weight` (query, optional, string) — Max cargo weight (default 2200)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/freight-api/v1/pallet?carton_length=12&carton_width=12&carton_height=12&carton_weight=20"
```

**Response:**
```json
{
    "data": {
        "note": "Cartons per layer takes the better of the two footprint orientations; layers fill the usable height. The pallet holds the smaller of the cube and weight limits.",
        "inputs": {
            "max_height": 60,
            "max_weight": 2200,
            "carton_width": 12,
            "pallet_width": 40,
            "carton_height": 12,
            "carton_length": 12,
            "carton_weight": 20,
            "pallet_length": 48
        },
        "layers": 4,
        "stack_height": 54,
        "cartons_by_cube": 48,
        "limiting_factor": "cube",
        "cartons_by_weight": 110,
        "cartons_per_layer": 12,
        "cartons_per_pallet": 48,
        "pallet_cargo_weight": 960
    },
    "meta": {
        "timestamp": "2026-06-05T21:48:47.557Z",
        "request_id": "1a03e167-98f9-4354-9d2f-799d747e011c"
    },
    "status": "ok",
    "message": "Palletization",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/freight-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Imperial units: inches, pounds, cubic feet (the NMFC class scale is US-based). Pallet defaults to a 48×40 GMA pallet; container to a 40 ft high-cube. For single-parcel courier billing weight use a dimensional-weight API.",
        "service": "freight-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/pallet": "Cartons per pallet by cube and by weight, with layers and stack height.",
            "GET /v1/container": "Units per container/trailer by stacking and by payload, with cube utilisation.",
            "GET /v1/freight-class": "NMFC LTL freight class from weight and dimensions (or cubic feet)."
        },
        "description": "Freight & logistics maths: LTL freight class from density (NMFC scale), palletization and container/trailer loading."
    },
    "meta": {
        "timestamp": "2026-06-05T21:48:47.652Z",
        "request_id": "8e80e95c-99a9-49ae-a618-8ea7b0eeec09"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/freight-api
OpenAPI spec: https://www.oanor.com/api/freight-api/openapi.json
