API Reference

Complete REST API documentation for PIE. All endpoints accept and return JSON.

Base URL

http://72.46.85.157:31841/api

All list endpoints support ?search=, ?limit=, and ?offset= query parameters.

AI Endpoints

POST /api/enrich — Gemini Permit Enrichment

curl -X POST /api/enrich \
  -H 'Content-Type: application/json' \
  -d '{"normalized_permit_id": "uuid-here"}'

Sends the permit's work description to Gemini and returns structured intelligence including systems impacted, asset classes, lifecycle event, criticality, relevance scores, and reasoning.

POST /api/ai-populate — AI Auto-Populate

curl -X POST /api/ai-populate \
  -H 'Content-Type: application/json' \
  -d '{"clue": "Park Hyatt NYC", "entity_type": "properties"}'

Accepts a natural language clue and entity type. Returns structured form data generated by Gemini based on real-world knowledge.

Supported entity_type values: jurisdictions, properties, locations, systems, assets, contractors, permits, inspections, findings, evidence, signals, obligations, lifecycle

All Endpoints (33)

MethodEndpointDescription
GET/api/dashboardReal-time counts across all entity types
GET/api/jurisdictionsList jurisdictions with search and pagination
POST/api/jurisdictionsCreate a new jurisdiction
GET/api/propertiesList properties with search and pagination
POST/api/propertiesCreate a new property
GET/api/locationsList locations within properties
POST/api/locationsCreate a new location
GET/api/systemsList building systems
POST/api/systemsCreate a new system
GET/api/assetsList assets/equipment
POST/api/assetsCreate a new asset
GET/api/contractorsList contractors
POST/api/contractorsCreate a new contractor
GET/api/permitsList normalized permits
POST/api/permitsCreate a new permit
GET/api/inspectionsList inspections
POST/api/inspectionsCreate a new inspection
GET/api/findingsList findings and evidence gaps
POST/api/findingsCreate a new finding
GET/api/evidenceList evidence records
POST/api/evidenceCreate evidence record
GET/api/signalsList insurance signals
POST/api/signalsCreate insurance signal
GET/api/obligationsList obligations
POST/api/obligationsCreate obligation
GET/api/lifecycleList lifecycle events
POST/api/lifecycleCreate lifecycle event
GET/api/relationshipsList entity relationships
POST/api/relationshipsCreate relationship
GET/api/targetingList market targeting scores
POST/api/targetingCreate targeting score
POST/api/enrichRun Gemini AI enrichment on a permit
POST/api/ai-populateAI auto-populate form fields from a clue

Response Format

List Response

{
  "data": [
    { "property_id": "uuid", "address": "...", ... },
    { "property_id": "uuid", "address": "...", ... }
  ],
  "total": 42
}

Create Response

{
  "property_id": "uuid-generated",
  "address": "153 W 57th St...",
  "property_type": "hotel",
  "created_at": "2026-04-01T..."
}

Database Schema

The PIE database consists of 25 PostgreSQL tables organized into 5 domains:

Registry (7 tables)

  • organizations
  • users
  • jurisdictions
  • properties
  • locations
  • systems
  • assets

Intelligence (8 tables)

  • contractors
  • sync_batches
  • raw_permits
  • normalized_permits
  • inspections
  • findings
  • permit_enrichments
  • candidate_matches

Operations (10 tables)

  • evidence_records
  • attachments
  • obligations
  • insurance_signals
  • lifecycle_events
  • relationships
  • market_targeting_scores
  • review_logs
  • user_notes