> ## Documentation Index
> Fetch the complete documentation index at: https://docs.northaxiumdata.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Infrastructure Project Stats

> Aggregate statistics over the Infrastructure Canada funded projects dataset.

## Overview

Returns grouped aggregate statistics over the Infrastructure Canada projects dataset. Use this to answer questions like "how much federal infrastructure funding has gone to Quebec?" or "which programs have the highest total contribution?"

Accepts the same filter parameters as [Infrastructure Projects](/api-reference/grants/infrastructure), so you can scope statistics to any subset before grouping.

## Query Parameters

<ParamField query="group_by" type="string">
  Field to group results by. One of `province`, `program`, `status`. Default: `province`. Example: `vendor`.
</ParamField>

<ParamField query="sum_field" type="string">
  Field to sum. Only `federal_contribution` is currently supported. Default: `federal_contribution`. Example: `amount`.
</ParamField>

<ParamField query="q" type="string">
  Full-text match across title, recipient, and location — applied before grouping. Example: `University of Toronto`.
</ParamField>

<ParamField query="province" type="string">
  Two-letter province code filter applied before grouping. Example: `ON`.
</ParamField>

<ParamField query="program" type="string">
  Partial match on `program_en` applied before grouping. Example: `Canada Summer Jobs`.
</ParamField>

<ParamField query="status" type="string">
  Exact match on project status applied before grouping. Example: `issued`.
</ParamField>

<ParamField query="min_value" type="number">
  Minimum federal contribution filter applied before grouping. Example: `100000`.
</ParamField>

<ParamField query="max_value" type="number">
  Maximum federal contribution filter applied before grouping. Example: `5000000`.
</ParamField>

<ParamField query="issued_after" type="string">
  ISO 8601 approved-date lower bound applied before grouping. Example: `2023-01-01`.
</ParamField>

<ParamField query="issued_before" type="string">
  ISO 8601 approved-date upper bound applied before grouping. Example: `2023-12-31`.
</ParamField>

<ParamField query="limit" type="integer">
  Max groups to return. Default: `100`. Max: `200`. Example: `25`.
</ParamField>

<ParamField query="offset" type="integer">
  Result offset. Default: `0`. Example: `50`.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -H "X-API-Key: your_api_key_here" \
    "https://api.northaxiumdata.ca/api/v1/infrastructure_projects/stats?group_by=province"
  ```

  ```python Python theme={null}
  import requests

  headers = {"X-API-Key": "your_api_key_here"}

  response = requests.get(
      "https://api.northaxiumdata.ca/api/v1/infrastructure_projects/stats",
      headers=headers,
      params={"group_by": "program"}
  )
  for row in response.json()["data"]:
      print(f"{row['group_value']}: ${row['sum_value']:,.0f} across {row['record_count']} projects")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.northaxiumdata.ca/api/v1/infrastructure_projects/stats?group_by=program",
    { headers: { "X-API-Key": "your_api_key_here" } }
  );
  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "group_by": "province",
        "group_value": "ON",
        "record_count": 4821,
        "sum_field": "federal_contribution",
        "sum_value": 12400000000.00
      },
      {
        "group_by": "province",
        "group_value": "QC",
        "record_count": 3104,
        "sum_field": "federal_contribution",
        "sum_value": 8750000000.00
      }
    ],
    "meta": {
      "total": 13,
      "limit": 100,
      "offset": 0
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": "BAD_REQUEST",
      "message": "group_by must be one of: province, program, status."
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": "UNAUTHORIZED",
      "message": "Missing API key. Pass your key in the X-API-Key header."
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": "RATE_LIMITED",
      "message": "Monthly request limit exceeded. Upgrade your plan for higher limits."
    }
  }
  ```
</ResponseExample>
