import Link from "next/link" import { Code2, Lock, Zap, BookOpen, Webhook } from "lucide-react" import { WEBHOOK_EVENTS } from "@/lib/webhooks/events" export const metadata = { title: "API Docs", description: "Property Management Network REST API documentation for developers.", alternates: { canonical: "/api-docs" }, } // The real, deployed origin. Falls back to a placeholder only when the env var // isn't set (e.g. local docs previews). const BASE_URL = `${process.env.NEXT_PUBLIC_APP_URL ?? "https://your-app-url"}/api/v1` const ENDPOINTS = [ { method: "GET", path: "/properties", desc: "List all properties for the authenticated account" }, { method: "POST", path: "/properties", desc: "Create a new property" }, { method: "GET", path: "/tenants", desc: "List tenants with their unit and lease status" }, { method: "GET", path: "/payments", desc: "List rent payments (filter by status, tenant_id, from/to date range)" }, { method: "POST", path: "/payments", desc: "Record a rent payment" }, { method: "GET", path: "/maintenance", desc: "List maintenance requests (filter by status, priority, property_id)" }, { method: "POST", path: "/maintenance", desc: "Create a maintenance request" }, { method: "PATCH", path: "/maintenance/:id", desc: "Update a maintenance request's status or fields" }, { method: "GET", path: "/webhooks", desc: "List webhook subscriptions" }, { method: "POST", path: "/webhooks", desc: "Create a webhook subscription (Zapier REST Hook subscribe)" }, { method: "DELETE", path: "/webhooks/:id", desc: "Delete a webhook subscription (Zapier REST Hook unsubscribe)" }, ] const METHOD_COLORS: Record = { GET: "text-emerald-400 bg-emerald-500/10", POST: "text-blue-400 bg-blue-500/10", PATCH: "text-amber-400 bg-amber-500/10", DELETE: "text-red-400 bg-red-500/10", } export default function ApiDocsPage() { return (
{/* Hero */}
REST API · v1

API Documentation

Build on top of Property Management Network. Automate your workflows, sync with external tools, or build custom dashboards using our REST API.

Base URL: {BASE_URL}
{/* Auth */}

Authentication

All API requests require a Bearer API key in the Authorization header. Keys look like{" "} pmn_live_… and are generated from{" "} Settings → API keys{" "} inside your dashboard. The plaintext key is shown only once at creation, so store it securely.

# Example request

curl {BASE_URL}/properties \

-H "Authorization: Bearer pmn_live_..."

{/* Endpoints */}

Endpoints

{ENDPOINTS.map((ep, i) => (
{ep.method}
{ep.path}

{ep.desc}

))}
{/* Response format */}

Response Format

All responses are JSON. List endpoints return a data array with a count. Single-record and create responses return a{" "} data object (create returns HTTP 201). Errors return an{" "} error object with a numeric code and a message.

{"// Success (list)"}

{"{"} "data": [...], "count": 12 {"}"}


{"// Success (single / create)"}

{"{"} "data": {"{"} ... {"}"} {"}"}


{"// Error"}

{"{"} "error": {"{"} "code": 401, "message": "Unauthorized" {"}"} {"}"}

{/* Webhooks */}

Webhooks

Subscribe to real-time events instead of polling. Add endpoints in{" "} Settings → Webhooks{" "} (or via the /webhooks API), and we'll POST a signed JSON payload the moment something happens. This is the same mechanism that powers our{" "} Zapier integration — Zapier subscribes and unsubscribes through the POST /webhooks and{" "} DELETE /webhooks/:id endpoints (the REST Hook pattern).

{/* Events */}

Available events

{WEBHOOK_EVENTS.map((ev, i) => (
{ev.id}

{ev.description}

))}
{/* Payload + signature */}

Payload & signature

Each request body is a JSON envelope. Every delivery carries an{" "} X-PMN-Signature header —{" "} t=<unix>,v1=<hex> — where{" "} v1 is the HMAC-SHA256 of{" "} {"`${t}.${rawBody}`"} keyed with your endpoint's signing secret. Recompute it and compare in constant time; reject if the timestamp is stale.

{"// POST body"}

{"{"}

"id": "evt_9f2c…",

"event": "tenant.created",

"created_at": "2026-07-02T12:00:00.000Z",

"data": {"{"} "tenant": {"{"} … {"}"} {"}"}

{"}"}

{"# Headers"}

X-PMN-Event: tenant.created

X-PMN-Delivery: <delivery id>

X-PMN-Signature: t=1751457600,v1=1a2b3c…

Respond with any 2xx to acknowledge. Non-2xx or timeouts are retried with exponential backoff (up to 5 attempts); a test event is available from the dashboard.

{/* SDK note */}

Official client SDKs are not yet available. Call the endpoints directly over HTTP with any language or HTTP client.

) }