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

# Permit Signal Stats

> Fetch permit-scoped signal aggregates for a geo_id

Use this endpoint to fetch permit-scoped aggregates for a non-property `geo_id`.

It returns counts and distributions for selected permit signals, plus the effective freshness window used for the calculation.

Use this endpoint for monitoring and dashboard rollups; use [Permit Signal Leads](/api-reference/endpoint/permit-signals-leads) for actionable row-level leads.

Supported permit-pack keys are documented in [Signals Catalog](/signals).

See also [Permit Signal Leads](/api-reference/endpoint/permit-signals-leads).

### Required input

* `geo_id` (query, required, non-property geo)

### Optional input

* `signal_keys` (CSV list)
* `from_date`, `to_date` (`YYYY-MM-DD`)
* `min_confidence` (`0..1`)
* `max_freshness_days` (`1..3650`)
* `include_stale` (`true|false`)

### Example request

```bash theme={null}
curl -sS "$API_BASE_URL/v1/signals/permit/stats?geo_id=geo_county_6973f63e37a900040c0d&signal_keys=site_prep_issued_nowcast,new_construction_issued_nowcast&max_freshness_days=60" \
  -H "x-api-key: $HOMELOGS_API_KEY"
```

### Response shape

* `geo_id`, `geo_type`, `scope=permit`
* `signal_keys[]`
* `max_freshness_days`
* `total_active_leads`
* `signals_breakdown[]`
* `top_counties[]`, `top_cities[]`, `top_zips[]`
* `confidence_distribution`
* `freshness_distribution`


## OpenAPI

````yaml GET /v1/signals/permit/stats
openapi: 3.1.0
info:
  title: HomeLogs Geo + Permit Intelligence API
  version: 1.0.0
  description: >-
    Geo-first API for location resolution, permit retrieval, and active geo
    signal access.
servers:
  - url: https://api.homelogs.io
    description: Production API
security:
  - ApiKeyAuth: []
tags:
  - name: locations
    description: Location resolution and anchor detail endpoints.
  - name: permits
    description: Raw permit retrieval by geo scope.
  - name: signals
    description: Signal catalog and signal reads.
  - name: permit-signals
    description: Permit-scoped signal leads and aggregates.
  - name: health
    description: Service liveness endpoint.
paths:
  /v1/signals/permit/stats:
    get:
      tags:
        - permit-signals
      summary: Get permit-scoped signal aggregates for a geo ID
      description: >-
        Returns permit-scoped counts and distributions for a non-property
        geo_id. Freshness defaults to the last 60 days unless
        include_stale=true. A 422 is returned for unsupported property geo_id
        anchors or invalid freshness values.
      operationId: getPermitSignalStats
      parameters:
        - name: geo_id
          in: query
          required: true
          description: Location identity token for a non-property geo scope.
          schema:
            type: string
            example: geo_county_6973f63e37a900040c0d
        - name: signal_keys
          in: query
          required: false
          description: >-
            Optional CSV list of customer-facing permit signal keys. Allowed
            values: site_prep_issued_nowcast, new_construction_issued_nowcast,
            framing_nowcast_early, framing_window_late, rough_in_nowcast_early,
            rough_in_window_late.
          schema:
            type: string
            example: framing_nowcast_early,rough_in_nowcast_early
        - name: from_date
          in: query
          required: false
          description: Optional lower bound in YYYY-MM-DD format.
          schema:
            type: string
            format: date
        - name: to_date
          in: query
          required: false
          description: Optional upper bound in YYYY-MM-DD format.
          schema:
            type: string
            format: date
        - name: min_confidence
          in: query
          required: false
          description: Optional minimum confidence between 0 and 1.
          schema:
            type: number
            minimum: 0
            maximum: 1
        - name: max_freshness_days
          in: query
          required: false
          description: >-
            Optional freshness window in days, between 1 and 3650. Defaults to
            60 when include_stale is false.
          schema:
            type: integer
            minimum: 1
            maximum: 3650
            default: 60
        - name: include_stale
          in: query
          required: false
          description: When true, disables the default freshness filter.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Permit-scoped aggregates and distributions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermitSignalStatsResponse'
        '403':
          $ref: '#/components/responses/GatewayAuth403'
        '404':
          $ref: '#/components/responses/LocationNotFound404'
        '422':
          $ref: '#/components/responses/ValidationError422'
        '429':
          $ref: '#/components/responses/GatewayThrottle429'
        '500':
          $ref: '#/components/responses/InternalError500'
components:
  schemas:
    PermitSignalStatsResponse:
      type: object
      required:
        - geo_id
        - geo_type
        - scope
        - signal_keys
        - max_freshness_days
        - total_active_leads
        - signals_breakdown
        - top_counties
        - top_cities
        - top_zips
        - confidence_distribution
        - freshness_distribution
      properties:
        geo_id:
          type: string
        geo_type:
          type:
            - string
            - 'null'
          enum:
            - jurisdiction
            - city
            - zip
            - county
            - state
            - null
        scope:
          type: string
          enum:
            - permit
        signal_keys:
          type: array
          items:
            type: string
        max_freshness_days:
          type:
            - integer
            - 'null'
          minimum: 1
          maximum: 3650
        total_active_leads:
          type: integer
          minimum: 0
        signals_breakdown:
          type: array
          items:
            $ref: '#/components/schemas/PermitSignalBreakdownEntry'
        top_counties:
          type: array
          items:
            $ref: '#/components/schemas/PermitSignalCountEntry'
        top_cities:
          type: array
          items:
            $ref: '#/components/schemas/PermitSignalCountEntry'
        top_zips:
          type: array
          items:
            $ref: '#/components/schemas/PermitSignalCountEntry'
        confidence_distribution:
          $ref: '#/components/schemas/PermitSignalConfidenceDistribution'
        freshness_distribution:
          $ref: '#/components/schemas/PermitSignalFreshnessDistribution'
      additionalProperties: false
    PermitSignalBreakdownEntry:
      type: object
      required:
        - signal_key
        - count
      properties:
        signal_key:
          type: string
        count:
          type: integer
          minimum: 0
      additionalProperties: false
    PermitSignalCountEntry:
      type: object
      required:
        - value
        - count
      properties:
        value:
          type: string
        count:
          type: integer
          minimum: 0
      additionalProperties: false
    PermitSignalConfidenceDistribution:
      type: object
      required:
        - high
        - medium
        - low
      properties:
        high:
          type: integer
          minimum: 0
        medium:
          type: integer
          minimum: 0
        low:
          type: integer
          minimum: 0
      additionalProperties: false
    PermitSignalFreshnessDistribution:
      type: object
      required:
        - '0_7'
        - '8_14'
        - '15_30'
        - 31_plus
      properties:
        '0_7':
          type: integer
          minimum: 0
        '8_14':
          type: integer
          minimum: 0
        '15_30':
          type: integer
          minimum: 0
        31_plus:
          type: integer
          minimum: 0
      additionalProperties: false
    GatewayErrorResponse:
      type: object
      properties:
        message:
          type: string
      additionalProperties: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
              example: state must be a 2-letter code
            request_id:
              type:
                - string
                - 'null'
              example: req-123
  responses:
    GatewayAuth403:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayErrorResponse'
    LocationNotFound404:
      description: No matching location/resource found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError422:
      description: Validation failure.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    GatewayThrottle429:
      description: Rate limit or quota exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GatewayErrorResponse'
    InternalError500:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````