---
title: "Get Profitability For Window"
method: GET
path: "/v2/tms/profitability/window"
tags: ["v2", "tms", "profitability"]
---

# Get Profitability For Window

`GET /v2/tms/profitability/window`

## Request

- Base URL: `https://api.mentium.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mentium.io/v2/tms/profitability/window`
- Auth: HTTP bearer

Profitability computed live for a window no snapshot covers (all time, today, a custom range).

Same figures as the snapshot, by booked-at, with `period` null. Prior-window
totals cover the equal-length window before a custom range; all time has none.

## Query parameters

- `integration_connection_id` string, required: TMS integration connection UUID
- `start_datetime` string, date-time, nullable: Inclusive window start (timezone-aware ISO-8601). Requires end_datetime_exclusive.
- `end_datetime_exclusive` string, date-time, nullable: Exclusive window end (timezone-aware ISO-8601). Requires start_datetime.
- `all_time` boolean: Every load booked so far. Excludes the explicit bounds.

## Headers

- `mentium-workspace-id` string, nullable

## Response `200`

Successful Response

- GetProfitabilitySnapshotResponse: Profitability for the caller's org: a precomputed snapshot, or a live window.
  - `exists` boolean, required: False when the cron has not yet computed this period
  - `period` 'SEVEN_DAYS' | 'THIRTY_DAYS' | 'NINETY_DAYS': Trailing window a profitability snapshot is computed over.
  - `currency` string, required: Organization base currency of all amounts
  - `computed_at` string, date-time, nullable: When the snapshot was computed
  - `window_start_datetime` string, date-time, nullable
  - `window_end_datetime_exclusive` string, date-time, nullable
  - `total_loads` integer
  - `loads_with_financials` integer
  - `profitable_loads` integer
  - `unprofitable_loads` integer
  - `profitable_percentage` number, nullable: profitable_loads / loads_with_financials * 100
  - `unprofitable_percentage` number, nullable: unprofitable_loads / loads_with_financials * 100
  - `total_revenue` number
  - `total_margin` number
  - `total_loss` number
  - `average_margin` number, nullable: Average margin per load with financials
  - `margin_percentage` number, nullable: total_margin / total_revenue * 100
  - `average_margin_per_mile` number, nullable: total_margin / total carrier miles (RPM-style)
  - `average_time_to_book_seconds` number, nullable
  - `slow_booked_loads` integer
  - `slow_booked_loss` number
  - `slow_booked_percentage` number, nullable: slow_booked_loss / total_loss * 100
  - `lead_time_buckets` ProfitabilityLeadTimeBucket[]
    - `bucket_index` integer, required: Stable display order (0 = Same Day)
    - `bucket_label` string, required: Human label, e.g. 'Same Day', '2-3 days'
    - `total_loads` integer, required: Loads booked in this lead-time bucket
    - `loads_with_financials` integer, required: Loads in the bucket that have financials
    - `unprofitable_loads` integer, required: Loads with negative margin
    - `total_revenue` number, required
    - `total_margin` number, required: Net win/loss for the bucket
    - `total_loss` number, required: Sum of losses on loss-making loads (>= 0)
    - `average_margin` number, nullable: Average margin per load with financials
    - `loss_rate` number, nullable: unprofitable_loads / loads_with_financials * 100
    - `margin_percentage` number, nullable: total_margin / total_revenue * 100
  - `lead_time_excluded_loads` integer: Loads with booking+pickup time booked at/after pickup, excluded from buckets
  - `lead_time_excluded_unprofitable_loads` integer: Of lead_time_excluded_loads, how many lost money
  - `prior_total_revenue` number, nullable
  - `prior_total_margin` number, nullable
  - `prior_total_loss` number, nullable
  - `customers` ProfitabilityCustomer[]
    - `customer_id` string, nullable: Customer UUID, if known
    - `customer_name` string, required: Customer display name
    - `total_loads` integer, required: Loads booked in the window
    - `unprofitable_loads` integer, required: Loads with negative margin
    - `total_revenue` number, required: Total customer revenue
    - `total_margin` number, required: Total net margin (can be negative)
    - `total_loss` number, required: Sum of losses on loss-making loads (>= 0)
    - `average_margin` number, nullable: Average margin per load with financials
  - `lanes` ProfitabilityLane[]
    - `source_city` string, required
    - `source_state` string, required
    - `destination_city` string, required
    - `destination_state` string, required
    - `total_loads` integer, required: Loads on this lane in the window
    - `unprofitable_loads` integer, required: Loads with negative margin
    - `total_revenue` number, required
    - `total_margin` number, required: Net win/loss on this lane
    - `total_loss` number, required: Sum of losses on loss-making loads (>= 0)
    - `average_margin` number, nullable: Average margin per load with financials
  - `agents` ProfitabilityAgent[]
    - `agent_id` string, nullable: Dispatcher user UUID, if known
    - `agent_name` string, required: Agent display name
    - `total_loads` integer, required: Loads handled in the window
    - `unprofitable_loads` integer, required: Loads with negative margin
    - `total_revenue` number, required
    - `total_margin` number, required
    - `total_loss` number, required: Sum of losses on loss-making loads (>= 0)
    - `average_margin` number, nullable: Average margin per load with financials

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/mentium/apis/mentium-api.md) - [All operations](https://skmtc.dev/mentium/apis/mentium-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mentium/apis/mentium-api/revisions/b4ed8e59432e?raw)
