---
title: "List Constraint Costs For Location"
method: GET
path: "/constraints/locations/{location_gs_entity_id}/constraint-costs"
tags: ["Constraints"]
---

# List Constraint Costs For Location

`GET /constraints/locations/{location_gs_entity_id}/constraint-costs`

Get location-adjusted constraint costs over a time range.

The endpoint computes total cost per constraint/contingency pair from the
specified constraint dataset in ClickHouse, then multiplies each by the
location's aggregated shift factor (mean) from
``linear_estimated_shift_factors`` for the same dataset.
For datasets without ``contingency_gs_entity_id``, costs are computed per
constraint and reused across that constraint's shift-factor contingency rows.

Pass ``group_by=constraint`` to roll contingency-grained rows up to one row
per constraint (sum of ``adjusted_cost``, mean ``shift_factor``; contingency
fields are null). ``total_cost`` is summed when the dataset has a
contingency column; otherwise the shared per-constraint cost is kept once.

## Path parameters

- `location_gs_entity_id` string, required

## Query parameters

- `dataset_id` string, required
- `start_time` string, date-time, required — Filter to rows where time index >= start_time (ISO 8601)
- `end_time` string, date-time, required — Filter to rows where time index < end_time (ISO 8601)
- `group_by` 'constraint' | 'constraint_contingency' — Row grain. `constraint_contingency` (default) returns one row per constraint/contingency pair. `constraint` rolls those rows up to one row per constraint (sum of adjusted_cost, mean shift factor; total_cost summed only when the dataset has a contingency column).
- `api_key` string, nullable — API key for authentication (query)

## Headers

- `x-api-key` string, nullable — API key for authentication (header)

## Response `200`

Successful Response

- LocationConstraintCostResponse[]
  - `constraint_gs_entity_id` string, required
  - `constraint_name` string, required
  - `contingency_gs_entity_id` string, nullable, required
  - `contingency_name` string, nullable, required
  - `shift_factor` number, required
  - `total_cost` number, nullable, required
  - `adjusted_cost` number, nullable, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/gridstatus/apis/grid-status-api.md) · [All operations](https://skmtc.net/gridstatus/apis/grid-status-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gridstatus/grid-status-api/revisions/fa1f094be2d4/schema)
