{
  "openapi": "3.1.0",
  "info": {
    "title": "Narmada Public API",
    "version": "1.3.1",
    "description": "Read-only REST API for pulling client, asset, assessment, ticket, and contract data into BI tools (BrightGauge, Power BI, Tableau, etc.). Every response after authentication carries X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (Unix seconds). The `assessments:read-full` scope is a superset of `assessments:read`; keys holding it also receive additional columns on /assessment-responses, /assessment-controls, and /score-snapshots (including internal notes and free-text answers). The spec is public — fetch it without an Authorization header. Sending credentials to the spec URL is unnecessary and can trigger a CORS preflight in browser-based tools. Scopes gate at two layers: endpoint-level scopes return 403 when absent, while the field-level `assessments:read-full` scope still returns 200 but with only the base field set (the additional fields are simply absent, not an error).",
    "contact": {
      "name": "Narmada",
      "url": "https://narmada.cloud"
    }
  },
  "servers": [
    {
      "url": "https://narmada.cloud/functions/v1/api-v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "nmd_live_...",
        "description": "API key issued from Settings → API Access. Send as `Authorization: Bearer nmd_live_...`."
      }
    },
    "parameters": {
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500,
          "default": 100
        }
      },
      "Offset": {
        "name": "offset",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        }
      },
      "UpdatedSince": {
        "name": "updated_since",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "date-time"
        },
        "description": "ISO 8601. Returns rows updated at or after this value. Ordering and the exact timestamp column depend on the endpoint — most use (updated_at ASC, id ASC); append-only endpoints (budget-item-links, score-snapshots, control-score-snapshots) filter and order on created_at / snapshot date, as noted in each endpoint's description."
      },
      "ClientId": {
        "name": "client_id",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Restrict to a single client. Must be in the key's permitted client set; unknown or unpermitted IDs return 404 (byte-identical to any other 404) to defeat enumeration."
      },
      "AssessmentId": {
        "name": "assessment_id",
        "in": "query",
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Restrict to a single assessment (assessment-responses only)."
      }
    },
    "schemas": {
      "Pagination": {
        "type": "object",
        "properties": {
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "count": {
            "type": "integer",
            "nullable": true
          },
          "next_offset": {
            "type": "integer",
            "nullable": true
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "code",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable message. Do not parse; use `code` for logic."
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid_request",
              "unauthorized",
              "forbidden",
              "not_found",
              "method_not_allowed",
              "rate_limited",
              "internal_error"
            ],
            "description": "Stable machine-readable error code."
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      },
      "Client": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "short_code": {
            "type": "string",
            "nullable": true
          },
          "logo_url": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Asset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "hostname": {
            "type": "string",
            "nullable": true
          },
          "asset_type": {
            "type": "string",
            "nullable": true
          },
          "device_class": {
            "type": "string",
            "nullable": true
          },
          "operating_system": {
            "type": "string",
            "nullable": true
          },
          "os_version": {
            "type": "string",
            "nullable": true
          },
          "manufacturer": {
            "type": "string",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "serial_number": {
            "type": "string",
            "nullable": true
          },
          "ip_address": {
            "type": "string",
            "nullable": true
          },
          "mac_address": {
            "type": "string",
            "nullable": true
          },
          "last_seen": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "NetworkAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "asset_type_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "hostname": {
            "type": "string",
            "nullable": true
          },
          "site": {
            "type": "string",
            "nullable": true
          },
          "operating_system": {
            "type": "string",
            "nullable": true
          },
          "asset_status": {
            "type": "string",
            "nullable": true
          },
          "health": {
            "type": "string",
            "nullable": true
          },
          "security_risk": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "warranty_end": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "purchase_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "renewal_cost": {
            "type": "number",
            "nullable": true
          },
          "budget_quarter": {
            "type": "string",
            "nullable": true,
            "description": "Fiscal quarter label (e.g. 'Q1')."
          },
          "budget_year": {
            "type": "integer",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "is_template": {
            "type": "boolean"
          },
          "implementation_status": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Assessment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "template_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "assessment_type": {
            "type": "string",
            "nullable": true
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "overall_score": {
            "type": "number",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AssessmentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "assessment_id": {
            "type": "string",
            "format": "uuid"
          },
          "control_id": {
            "type": "string",
            "format": "uuid"
          },
          "response_status": {
            "type": "string",
            "nullable": true,
            "description": "Auditor's chosen value; corresponds to an entry in the matching control's status_options array (join on control_id)."
          },
          "weight_level_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "is_excluded": {
            "type": "boolean",
            "nullable": true
          },
          "is_risk_accepted": {
            "type": "boolean",
            "nullable": true
          },
          "implementation_status": {
            "type": "string",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "nullable": true
          },
          "impact": {
            "type": "integer",
            "nullable": true
          },
          "assigned_to": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "reviewed": {
            "type": "boolean",
            "nullable": true
          },
          "presented": {
            "type": "boolean",
            "nullable": true
          },
          "office_location": {
            "type": "string",
            "nullable": true
          },
          "last_checked": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "next_check": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "liongard_value_fetched_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AssessmentControl": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "template_id": {
            "type": "string",
            "format": "uuid"
          },
          "category_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "area": {
            "type": "string"
          },
          "sub_area": {
            "type": "string",
            "nullable": true
          },
          "reference": {
            "type": "string",
            "nullable": true
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "frequency_name": {
            "type": "string",
            "nullable": true
          },
          "default_weight_level_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "probability": {
            "type": "integer"
          },
          "impact": {
            "type": "integer"
          },
          "is_active": {
            "type": "boolean",
            "nullable": true
          },
          "client_questionnaire": {
            "type": "boolean",
            "nullable": true
          },
          "show_in_stack_alignment": {
            "type": "boolean",
            "nullable": true
          },
          "health_check_type_name": {
            "type": "string",
            "nullable": true
          },
          "implementation_status": {
            "type": "string",
            "nullable": true
          },
          "liongard_inspector": {
            "type": "string",
            "nullable": true
          },
          "liongard_section": {
            "type": "string",
            "nullable": true
          },
          "liongard_metric_type": {
            "type": "string",
            "nullable": true
          },
          "trends_topics": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AssessmentCategory": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "template_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Ticket": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "ticket_number": {
            "type": "string",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "assigned_to": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "source": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SyncedTicket": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "external_id": {
            "type": "string"
          },
          "ticket_number": {
            "type": "string",
            "nullable": true
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "ticket_type": {
            "type": "string",
            "nullable": true
          },
          "assigned_tech": {
            "type": "string",
            "nullable": true
          },
          "due_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_external_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updated_external_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Contract": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "template_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "contract_number": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true,
            "description": "Postgres enum contract_status."
          },
          "effective_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "term_months": {
            "type": "integer",
            "nullable": true
          },
          "expiration_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "signed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SyncedContract": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "external_id": {
            "type": "string"
          },
          "contract_name": {
            "type": "string",
            "nullable": true
          },
          "contract_number": {
            "type": "string",
            "nullable": true
          },
          "contract_type": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "estimated_revenue": {
            "type": "number",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Meeting": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "meeting_type": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "scheduled_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "start_time": {
            "type": "string",
            "format": "time",
            "nullable": true,
            "description": "Postgres `time` — wall-clock, no date."
          },
          "end_time": {
            "type": "string",
            "format": "time",
            "nullable": true,
            "description": "Postgres `time` — wall-clock, no date."
          },
          "location": {
            "type": "string",
            "nullable": true
          },
          "opportunity_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_by": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Opportunity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "external_id": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "stage": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "nullable": true
          },
          "projected_close_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "company_id": {
            "type": "string",
            "nullable": true
          },
          "company_name": {
            "type": "string",
            "nullable": true
          },
          "owner_id": {
            "type": "string",
            "nullable": true
          },
          "owner_name": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Project": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "external_id": {
            "type": "string"
          },
          "project_name": {
            "type": "string",
            "nullable": true
          },
          "project_number": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "project_type": {
            "type": "string",
            "nullable": true
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completed_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "company_id": {
            "type": "string",
            "nullable": true
          },
          "company_name": {
            "type": "string",
            "nullable": true
          },
          "project_lead_name": {
            "type": "string",
            "nullable": true
          },
          "estimated_hours": {
            "type": "number",
            "nullable": true
          },
          "actual_hours": {
            "type": "number",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PmProject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "folder_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "icon_name": {
            "type": "string",
            "nullable": true
          },
          "default_view": {
            "type": "string",
            "nullable": true,
            "description": "Postgres enum pm_view_type."
          },
          "is_template": {
            "type": "boolean"
          },
          "status_set_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "created_by": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AssessmentResponseFull": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AssessmentResponse"
          },
          {
            "type": "object",
            "description": "Extra fields returned only when the key holds `assessments:read-full`.",
            "properties": {
              "recommendation": {
                "type": "string",
                "nullable": true,
                "description": "Auditor's chosen value; corresponds to an entry in the matching control's recommendation_options array (join on control_id). (returned only when the key holds `assessments:read-full`)"
              },
              "client_decision": {
                "type": "string",
                "nullable": true,
                "description": "Auditor's chosen value; corresponds to an entry in the matching control's decision_options array (join on control_id). (returned only when the key holds `assessments:read-full`)"
              },
              "internal_notes": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "notes": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "liongard_value": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "trends_topics": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "updated_by": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              }
            }
          }
        ]
      },
      "AssessmentControlFull": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AssessmentControl"
          },
          {
            "type": "object",
            "description": "Extra fields returned only when the key holds `assessments:read-full`.",
            "properties": {
              "recommendation": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "notes": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "internal_notes": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "default_status": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "default_client_decision": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "office_location": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "action_needed_by": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "is_risk_accepted": {
                "type": "boolean",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "is_reviewed": {
                "type": "boolean",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "liongard_custom_metric_name": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "last_checked": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "liongard_value_mapping": {
                "type": "object",
                "nullable": true,
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Free-form mapping of Liongard inspector values to response statuses. Keys and values are strings. (returned only when the key holds `assessments:read-full`)"
              },
              "status_options": {
                "type": "array",
                "nullable": true,
                "items": {
                  "type": "string"
                },
                "description": "Ordered JSONB array of the response_status choices the auditor picks from for this control. Array index is the option's ordinal rank; authoritative per-check menu for the assessment workflow. (returned only when the key holds `assessments:read-full`)"
              },
              "recommendation_options": {
                "type": "array",
                "nullable": true,
                "items": {
                  "type": "string"
                },
                "description": "Ordered JSONB array of the recommendation choices the auditor picks from for this control. Array index is the option's ordinal rank. (returned only when the key holds `assessments:read-full`)"
              },
              "decision_options": {
                "type": "array",
                "nullable": true,
                "items": {
                  "type": "string"
                },
                "description": "Ordered JSONB array of the client_decision choices the auditor picks from for this control. Array index is the option's ordinal rank. (returned only when the key holds `assessments:read-full`)"
              },
              "tech_doc_content": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              },
              "tech_doc_file_path": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              }
            }
          }
        ]
      },
      "AssessmentTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "string",
            "nullable": true
          },
          "is_active": {
            "type": "boolean",
            "nullable": true
          },
          "scoring_config_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ResponseStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "config_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "points": {
            "type": "number",
            "nullable": true
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "is_excluded": {
            "type": "boolean",
            "nullable": true
          },
          "is_default": {
            "type": "boolean",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WeightLevel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "config_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "multiplier": {
            "type": "number",
            "nullable": true
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "is_default": {
            "type": "boolean",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ScoreSnapshot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "snapshot_date": {
            "type": "string",
            "format": "date"
          },
          "achieved": {
            "type": "number",
            "nullable": true
          },
          "possible": {
            "type": "number",
            "nullable": true
          },
          "score_percentage": {
            "type": "number",
            "nullable": true
          },
          "is_manual": {
            "type": "boolean",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ScoreSnapshotFull": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ScoreSnapshot"
          },
          {
            "type": "object",
            "description": "Extra fields returned only when the key holds `assessments:read-full`.",
            "properties": {
              "notes": {
                "type": "string",
                "nullable": true,
                "description": "(returned only when the key holds `assessments:read-full`)"
              }
            }
          }
        ]
      },
      "ControlScoreSnapshot": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "response_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "snapshot_month": {
            "type": "string",
            "format": "date",
            "description": "First-of-month date."
          },
          "implementation_status": {
            "type": "string",
            "nullable": true
          },
          "probability": {
            "type": "integer",
            "nullable": true
          },
          "impact": {
            "type": "integer",
            "nullable": true
          },
          "achieved": {
            "type": "number",
            "nullable": true
          },
          "possible": {
            "type": "number",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BudgetItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "nullable": true
          },
          "priority": {
            "type": "string",
            "nullable": true
          },
          "approval_status": {
            "type": "string",
            "nullable": true
          },
          "warranty_support_end": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "end_of_life": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "target_year": {
            "type": "integer",
            "nullable": true
          },
          "target_quarter": {
            "type": "integer",
            "nullable": true
          },
          "target_month": {
            "type": "integer",
            "nullable": true
          },
          "cost_q1": {
            "type": "number",
            "nullable": true
          },
          "cost_q2": {
            "type": "number",
            "nullable": true
          },
          "cost_q3": {
            "type": "number",
            "nullable": true
          },
          "cost_q4": {
            "type": "number",
            "nullable": true
          },
          "cost_m1": {
            "type": "number",
            "nullable": true
          },
          "cost_m2": {
            "type": "number",
            "nullable": true
          },
          "cost_m3": {
            "type": "number",
            "nullable": true
          },
          "cost_m4": {
            "type": "number",
            "nullable": true
          },
          "cost_m5": {
            "type": "number",
            "nullable": true
          },
          "cost_m6": {
            "type": "number",
            "nullable": true
          },
          "cost_m7": {
            "type": "number",
            "nullable": true
          },
          "cost_m8": {
            "type": "number",
            "nullable": true
          },
          "cost_m9": {
            "type": "number",
            "nullable": true
          },
          "cost_m10": {
            "type": "number",
            "nullable": true
          },
          "cost_m11": {
            "type": "number",
            "nullable": true
          },
          "cost_m12": {
            "type": "number",
            "nullable": true
          },
          "cost_annual": {
            "type": "number",
            "nullable": true
          },
          "synced_base_value": {
            "type": "number",
            "nullable": true,
            "description": "Base value synced from a linked contract, opportunity, or asset. Null for purely manual items."
          },
          "cost_multiplier": {
            "type": "number",
            "nullable": true,
            "description": "Multiplier applied to synced_base_value (defaults to 1)."
          },
          "item_total": {
            "type": "number",
            "description": "Computed total for the item: cost_q1..q4 + cost_m1..m12 + cost_annual, plus synced_base_value * cost_multiplier when synced_base_value is set. Matches the Item Total shown in the app."
          },
          "is_recurring": {
            "type": "boolean",
            "nullable": true
          },
          "recurrence_interval": {
            "type": "string",
            "nullable": true
          },
          "linked_opportunity_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "linked_contract_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "linked_project_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "linked_asset_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "source_type": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BudgetItemLink": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "account_id": {
            "type": "string",
            "format": "uuid"
          },
          "budget_item_id": {
            "type": "string",
            "format": "uuid"
          },
          "linked_type": {
            "type": "string"
          },
          "linked_id": {
            "type": "string",
            "format": "uuid"
          },
          "sort_order": {
            "type": "integer",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SummaryCounts": {
        "type": "object",
        "required": [
          "clients",
          "assets",
          "network_assets",
          "assessments",
          "assessment_responses",
          "assessment_controls",
          "assessment_categories",
          "assessment_templates",
          "response_statuses",
          "weight_levels",
          "score_snapshots",
          "control_score_snapshots",
          "tickets",
          "synced_tickets",
          "contracts",
          "synced_contracts",
          "meetings",
          "opportunities",
          "synced_projects",
          "pm_projects",
          "budget_items",
          "budget_item_links"
        ],
        "properties": {
          "clients": {
            "type": "integer"
          },
          "assets": {
            "type": "integer"
          },
          "network_assets": {
            "type": "integer"
          },
          "assessments": {
            "type": "integer"
          },
          "assessment_responses": {
            "type": "integer"
          },
          "assessment_controls": {
            "type": "integer"
          },
          "assessment_categories": {
            "type": "integer"
          },
          "assessment_templates": {
            "type": "integer"
          },
          "response_statuses": {
            "type": "integer"
          },
          "weight_levels": {
            "type": "integer"
          },
          "score_snapshots": {
            "type": "integer"
          },
          "control_score_snapshots": {
            "type": "integer"
          },
          "tickets": {
            "type": "integer"
          },
          "synced_tickets": {
            "type": "integer"
          },
          "contracts": {
            "type": "integer"
          },
          "synced_contracts": {
            "type": "integer"
          },
          "meetings": {
            "type": "integer"
          },
          "opportunities": {
            "type": "integer"
          },
          "synced_projects": {
            "type": "integer"
          },
          "pm_projects": {
            "type": "integer"
          },
          "budget_items": {
            "type": "integer"
          },
          "budget_item_links": {
            "type": "integer"
          }
        }
      },
      "SummaryResponse": {
        "type": "object",
        "required": [
          "data",
          "request_id"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/SummaryCounts"
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing/invalid/revoked/expired key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Scope not held by this key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Unknown endpoint, or client_id not permitted (byte-identical response to defeat enumeration)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "1000 req/hr per key exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/clients": {
      "get": {
        "summary": "List clients",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `clients:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Client"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "clients:read"
        ],
        "x-narmada-group": "Clients",
        "x-narmada-title": "List clients",
        "x-narmada-columns": [
          "id",
          "account_id",
          "name",
          "email",
          "phone",
          "address",
          "short_code",
          "logo_url",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/assets": {
      "get": {
        "summary": "List assets (synced RMM assets)",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `assets:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Asset"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assets:read"
        ],
        "x-narmada-group": "Assets",
        "x-narmada-title": "List assets",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "connection_id",
          "external_id",
          "name",
          "hostname",
          "asset_type",
          "device_class",
          "operating_system",
          "os_version",
          "manufacturer",
          "model",
          "serial_number",
          "ip_address",
          "mac_address",
          "last_seen",
          "status",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/network-assets": {
      "get": {
        "summary": "List network (local) assets",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `assets:read`. Manually-managed local assets (separate from synced /assets).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NetworkAsset"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assets:read"
        ],
        "x-narmada-group": "Assets",
        "x-narmada-title": "List network (local) assets",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "asset_type_id",
          "name",
          "hostname",
          "site",
          "operating_system",
          "asset_status",
          "health",
          "security_risk",
          "priority",
          "warranty_end",
          "purchase_date",
          "renewal_cost",
          "budget_quarter",
          "budget_year",
          "is_active",
          "is_template",
          "implementation_status",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/assessments": {
      "get": {
        "summary": "List assessments",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `assessments:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Assessment"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List assessments",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "template_id",
          "name",
          "status",
          "assessment_type",
          "started_at",
          "completed_at",
          "overall_score",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/assessment-responses": {
      "get": {
        "summary": "List per-question responses inside assessments",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          },
          {
            "$ref": "#/components/parameters/AssessmentId"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`, which is a superset and returns additional columns per `AssessmentResponseFull`). One row per answered question. Scoped through client_assessments.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssessmentResponseFull"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List assessment responses",
        "x-narmada-columns": [
          "id",
          "assessment_id",
          "control_id",
          "response_status",
          "weight_level_id",
          "is_excluded",
          "is_risk_accepted",
          "implementation_status",
          "probability",
          "impact",
          "assigned_to",
          "reviewed",
          "presented",
          "office_location",
          "last_checked",
          "next_check",
          "liongard_value_fetched_at",
          "created_at",
          "updated_at"
        ],
        "x-narmada-full-columns": [
          "recommendation",
          "client_decision",
          "internal_notes",
          "notes",
          "trends_topics",
          "updated_by",
          "liongard_value"
        ]
      }
    },
    "/assessment-controls": {
      "get": {
        "summary": "List master question library per template",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`, which is a superset and returns additional columns per `AssessmentControlFull`). Template-scoped; `client_id` not supported.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssessmentControlFull"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List assessment controls",
        "x-narmada-columns": [
          "id",
          "template_id",
          "category_id",
          "area",
          "sub_area",
          "reference",
          "sort_order",
          "frequency_name",
          "default_weight_level_id",
          "probability",
          "impact",
          "is_active",
          "client_questionnaire",
          "show_in_stack_alignment",
          "health_check_type_name",
          "implementation_status",
          "liongard_inspector",
          "liongard_section",
          "liongard_metric_type",
          "trends_topics",
          "created_at",
          "updated_at"
        ],
        "x-narmada-full-columns": [
          "recommendation",
          "status_options",
          "recommendation_options",
          "decision_options",
          "default_status",
          "default_client_decision",
          "notes",
          "internal_notes",
          "office_location",
          "action_needed_by",
          "is_risk_accepted",
          "liongard_custom_metric_name",
          "last_checked",
          "liongard_value_mapping",
          "tech_doc_content",
          "tech_doc_file_path",
          "is_reviewed"
        ]
      }
    },
    "/assessment-categories": {
      "get": {
        "summary": "List category groupings for controls",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`). Template-scoped; `client_id` not supported.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssessmentCategory"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List assessment categories",
        "x-narmada-columns": [
          "id",
          "template_id",
          "name",
          "color",
          "sort_order",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/assessment-templates": {
      "get": {
        "summary": "List assessment templates",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`). Reference endpoint — does not accept `client_id` or `updated_since` (sending either returns 400).",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AssessmentTemplate"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List assessment templates",
        "x-narmada-columns": [
          "id",
          "account_id",
          "name",
          "description",
          "version",
          "is_active",
          "scoring_config_id",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/response-statuses": {
      "get": {
        "summary": "List response statuses per scoring configuration",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`). Belongs to the optional per-account configurable-scoring feature and is EMPTY for most accounts. The authoritative per-check answer menu for the assessment workflow lives on `/assessment-controls.status_options` (full scope). Only join this endpoint if the template has a `scoring_config_id` and this endpoint returns rows. Reference endpoint — does not accept `client_id` or `updated_since`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ResponseStatus"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List response statuses",
        "x-narmada-columns": [
          "id",
          "config_id",
          "name",
          "points",
          "sort_order",
          "is_excluded",
          "is_default",
          "color",
          "created_at"
        ]
      }
    },
    "/weight-levels": {
      "get": {
        "summary": "List weight levels per scoring configuration",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`). Belongs to the optional per-account configurable-scoring feature and is EMPTY for most accounts. Weight multipliers per scoring config; only relevant if the template has a `scoring_config_id`. Reference endpoint — does not accept `client_id` or `updated_since`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WeightLevel"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Assessments",
        "x-narmada-title": "List weight levels",
        "x-narmada-columns": [
          "id",
          "config_id",
          "name",
          "multiplier",
          "sort_order",
          "is_default",
          "color",
          "created_at"
        ]
      }
    },
    "/score-snapshots": {
      "get": {
        "summary": "List assessment-level score snapshots",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`, which also returns `notes` per `ScoreSnapshotFull`). Append-only table — `updated_since` filters `created_at`. Ordered by `snapshot_date ASC, id ASC`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ScoreSnapshotFull"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Scoring",
        "x-narmada-title": "List score snapshots",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "snapshot_date",
          "achieved",
          "possible",
          "score_percentage",
          "is_manual",
          "created_at"
        ],
        "x-narmada-full-columns": [
          "notes"
        ],
        "x-narmada-updated-since-col": "created_at"
      }
    },
    "/control-score-snapshots": {
      "get": {
        "summary": "List per-response monthly score snapshots",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `assessments:read` (or `assessments:read-full`). Append-only table — `updated_since` filters `created_at`. Ordered by `snapshot_month ASC, id ASC`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ControlScoreSnapshot"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "assessments:read",
          "assessments:read-full"
        ],
        "x-narmada-group": "Scoring",
        "x-narmada-title": "List control score snapshots",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "response_id",
          "snapshot_month",
          "implementation_status",
          "probability",
          "impact",
          "achieved",
          "possible",
          "created_at"
        ],
        "x-narmada-updated-since-col": "created_at"
      }
    },
    "/tickets": {
      "get": {
        "summary": "List native tickets",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `tickets:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Ticket"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "tickets:read"
        ],
        "x-narmada-group": "Tickets",
        "x-narmada-title": "List tickets",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "ticket_number",
          "subject",
          "status",
          "priority",
          "assigned_to",
          "due_date",
          "resolved_at",
          "source",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/synced-tickets": {
      "get": {
        "summary": "List PSA-synced tickets",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `tickets:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SyncedTicket"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "tickets:read"
        ],
        "x-narmada-group": "Tickets",
        "x-narmada-title": "List synced tickets",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "connection_id",
          "external_id",
          "ticket_number",
          "subject",
          "status",
          "priority",
          "ticket_type",
          "assigned_tech",
          "due_date",
          "resolved_at",
          "created_external_at",
          "updated_external_at",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/contracts": {
      "get": {
        "summary": "List native contracts",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `contracts:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contract"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "contracts:read"
        ],
        "x-narmada-group": "Contracts",
        "x-narmada-title": "List contracts",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "template_id",
          "title",
          "contract_number",
          "status",
          "effective_date",
          "term_months",
          "expiration_date",
          "signed_at",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/synced-contracts": {
      "get": {
        "summary": "List PSA-synced contracts",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `contracts:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SyncedContract"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "contracts:read"
        ],
        "x-narmada-group": "Contracts",
        "x-narmada-title": "List synced contracts",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "connection_id",
          "external_id",
          "contract_name",
          "contract_number",
          "contract_type",
          "status",
          "start_date",
          "end_date",
          "estimated_revenue",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/meetings": {
      "get": {
        "summary": "List meetings",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `meetings:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Meeting"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "meetings:read"
        ],
        "x-narmada-group": "Meetings",
        "x-narmada-title": "List meetings",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "title",
          "meeting_type",
          "status",
          "scheduled_date",
          "start_time",
          "end_time",
          "location",
          "opportunity_id",
          "created_by",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/opportunities": {
      "get": {
        "summary": "List PSA-synced opportunities",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `opportunities:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Opportunity"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "opportunities:read"
        ],
        "x-narmada-group": "Opportunities",
        "x-narmada-title": "List opportunities",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "connection_id",
          "external_id",
          "title",
          "stage",
          "status",
          "amount",
          "probability",
          "projected_close_date",
          "company_id",
          "company_name",
          "owner_id",
          "owner_name",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/projects": {
      "get": {
        "summary": "List PSA-synced projects",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `projects:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Project"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "projects:read"
        ],
        "x-narmada-group": "Projects",
        "x-narmada-title": "List projects (synced)",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "connection_id",
          "external_id",
          "project_name",
          "project_number",
          "status",
          "project_type",
          "start_date",
          "end_date",
          "completed_date",
          "company_id",
          "company_name",
          "project_lead_name",
          "estimated_hours",
          "actual_hours",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/pm-projects": {
      "get": {
        "summary": "List internal PM app projects",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `projects:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PmProject"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "projects:read"
        ],
        "x-narmada-group": "Projects",
        "x-narmada-title": "List PM projects",
        "x-narmada-columns": [
          "id",
          "account_id",
          "workspace_id",
          "folder_id",
          "client_id",
          "name",
          "color",
          "icon_name",
          "default_view",
          "is_template",
          "status_set_id",
          "sort_order",
          "created_by",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/budget-items": {
      "get": {
        "summary": "List budget & roadmap items",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `budget:read`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BudgetItem"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "budget:read"
        ],
        "x-narmada-group": "Budget & Roadmap",
        "x-narmada-title": "List budget items",
        "x-narmada-columns": [
          "id",
          "account_id",
          "client_id",
          "name",
          "description",
          "category",
          "priority",
          "approval_status",
          "warranty_support_end",
          "end_of_life",
          "target_year",
          "target_quarter",
          "target_month",
          "cost_q1",
          "cost_q2",
          "cost_q3",
          "cost_q4",
          "cost_m1",
          "cost_m2",
          "cost_m3",
          "cost_m4",
          "cost_m5",
          "cost_m6",
          "cost_m7",
          "cost_m8",
          "cost_m9",
          "cost_m10",
          "cost_m11",
          "cost_m12",
          "cost_annual",
          "synced_base_value",
          "cost_multiplier",
          "is_recurring",
          "recurrence_interval",
          "linked_opportunity_id",
          "linked_contract_id",
          "linked_project_id",
          "linked_asset_id",
          "source_type",
          "created_at",
          "updated_at"
        ]
      }
    },
    "/budget-item-links": {
      "get": {
        "summary": "List links between budget items and related records (opportunities, contracts, projects, assets)",
        "tags": [
          "Resources"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Offset"
          },
          {
            "$ref": "#/components/parameters/UpdatedSince"
          },
          {
            "$ref": "#/components/parameters/ClientId"
          }
        ],
        "description": "Requires scope `budget:read`. `updated_since` filters on `created_at` (this table has no `updated_at`). `client_id` narrows the permitted parent `budget_items` — the links table itself has no `client_id` column, so the restriction is enforced by resolving permitted `budget_item_id`s first, then filtering.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BudgetItemLink"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/Pagination"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "budget:read"
        ],
        "x-narmada-group": "Budget & Roadmap",
        "x-narmada-title": "List budget item links",
        "x-narmada-updated-since-col": "created_at",
        "x-narmada-columns": [
          "id",
          "account_id",
          "budget_item_id",
          "linked_type",
          "linked_id",
          "sort_order",
          "created_at"
        ]
      }
    },
    "/summary": {
      "get": {
        "summary": "Aggregate counts across all resources",
        "tags": [
          "Aggregate"
        ],
        "description": "Requires scope `summary:read`. Returns a wrapped envelope (`{ data: { ...counts }, request_id }`) with all 22 count keys always present.\n\n**Count parity guarantee.** Each key in the response equals the total row count that would be returned by the matching list endpoint under the same API key and scopes:\n\n- `clients` ↔ `/clients`\n- `assets` ↔ `/assets`\n- `network_assets` ↔ `/network-assets`\n- `assessments` ↔ `/assessments`\n- `assessment_responses` ↔ `/assessment-responses` (resolved through `client_assessments`)\n- `assessment_controls` / `assessment_categories` ↔ their list endpoints (resolved through `assessment_templates`; client-scoped keys resolve through `client_assessments`)\n- `assessment_templates` ↔ `/assessment-templates`\n- `response_statuses` / `weight_levels` ↔ their list endpoints (resolved through `scoring_configurations` for the same account)\n- `score_snapshots` / `control_score_snapshots` ↔ their list endpoints\n- `tickets`, `synced_tickets`, `contracts`, `synced_contracts`, `meetings`, `opportunities`, `pm_projects`, `budget_items` ↔ same-name list endpoints\n- `synced_projects` ↔ `/projects` (renamed for backend clarity)\n- `budget_item_links` ↔ `/budget-item-links` (resolved through `budget_items` for client-scoped keys)",
        "responses": {
          "200": {
            "description": "Counts by resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        },
        "x-narmada-scopes": [
          "summary:read"
        ],
        "x-narmada-group": "Summary",
        "x-narmada-title": "Get summary counts",
        "x-narmada-columns": [
          "clients",
          "assets",
          "network_assets",
          "assessments",
          "assessment_responses",
          "assessment_controls",
          "assessment_categories",
          "assessment_templates",
          "response_statuses",
          "weight_levels",
          "score_snapshots",
          "control_score_snapshots",
          "tickets",
          "synced_tickets",
          "contracts",
          "synced_contracts",
          "meetings",
          "opportunities",
          "synced_projects",
          "pm_projects",
          "budget_items",
          "budget_item_links"
        ]
      }
    }
  },
  "x-narmada-concepts": {
    "overview": {
      "title": "Overview",
      "body": "The Narmada Public API is a read-only REST API for pulling your account data into BI tools like BrightGauge, Power BI, Tableau, and Looker Studio. All endpoints return JSON and enforce per-account and per-client isolation via API keys you issue from **Settings → API Access**.\n\n**Base URL**\n\n```\nhttps://narmada.cloud/functions/v1/api-v1\n```\n\nEvery request is authenticated with a Bearer token, ordered deterministically for incremental sync, paginated with a 500-row hard cap, and rate-limited to 1,000 requests per hour per key."
    },
    "authentication": {
      "title": "Authentication",
      "body": "Send your key in the `Authorization` header. Keys look like `nmd_live_...` and are shown **exactly once** when created.\n\n**Issuing a key**\n\n1. Go to **Settings → API Access**.\n2. Click **Create key**, give it a name, pick the scopes it needs, and optionally restrict it to a subset of your clients.\n3. Copy the token immediately — it is hashed at rest (SHA-256) and cannot be retrieved later.\n4. Store it in your BI tool's credentials vault.\n\n**Revocation**\n\nRevoke a key from the same panel; the token is invalidated immediately (no propagation delay). Lost or leaked keys must be revoked and re-issued — there is no recovery flow.\n\n**Per-client allowlist**\n\nWhen a key is created with a client allowlist, every request is filtered to those clients. Passing a `client_id` that isn't in the allowlist returns a **404** — byte-identical to the response for an unknown endpoint. That is intentional: it prevents callers from enumerating which clients belong to your account.\n\n**Logging**\n\nEvery request is logged with method, path, status code, IP address, duration, and request id. The request id is echoed in the `X-Request-Id` response header and in every error body — include it when contacting support.\n\n**Scopes**\n\nEach key is issued with one or more scopes. A scope gates which endpoints the key can call — a request against an endpoint whose scope the key does not hold returns `403 forbidden`.\n\n{{table:scopes}}\n\n**Two layers of scope gating**\n\nEndpoint-level scopes (`clients:read`, `assets:read`, `assessments:read`, `tickets:read`, `contracts:read`, `meetings:read`, `opportunities:read`, `projects:read`, `budget:read`, `summary:read`) return `403` if a key lacks them. The field-level scope `assessments:read-full` is different: a key without it still receives `200` on the assessment endpoints, but only the base field set — the additional fields (internal notes, free-text answers, option arrays, etc.) are simply absent, not an error. If assessment fields you expect are missing, check that the key holds `assessments:read-full`.\n\nA key's scopes can be edited after creation in **Settings → API Access** and take effect immediately, with no need to reissue the key.",
      "tables": [
        {
          "id": "scopes",
          "title": "Scopes",
          "columns": [
            {
              "key": "scope",
              "label": "Scope",
              "mono": true
            },
            {
              "key": "description",
              "label": "Description"
            }
          ],
          "rows": [
            {
              "scope": "clients:read",
              "description": "Read `/clients` — company records (name, email, phone, short_code, logo)."
            },
            {
              "scope": "assets:read",
              "description": "Read `/assets` (RMM-synced) and `/network-assets` (locally-managed) with hardware, OS, warranty, and lifecycle fields."
            },
            {
              "scope": "assessments:read",
              "description": "Read every assessment endpoint with a SAFE column set — omits internal notes, free-text answers, and option arrays."
            },
            {
              "scope": "assessments:read-full",
              "description": "**Superset of `assessments:read`.** Also unlocks `internal_notes`, free-text answers, `recommendation`, `client_decision`, and the `status_options` / `recommendation_options` / `decision_options` JSONB arrays on `/assessment-responses`, `/assessment-controls`, and `/score-snapshots`."
            },
            {
              "scope": "tickets:read",
              "description": "Read `/tickets` — PSA-synced tickets with status, priority, requester, and timestamps."
            },
            {
              "scope": "contracts:read",
              "description": "Read `/contracts` — PSA-synced contract records with dates, value, and status."
            },
            {
              "scope": "meetings:read",
              "description": "Read `/meetings` — CRM-logged meetings with attendees and notes."
            },
            {
              "scope": "opportunities:read",
              "description": "Read `/opportunities` — CRM sales opportunities with stage, value, and close dates."
            },
            {
              "scope": "projects:read",
              "description": "Read `/projects` — project records with status, dates, and owner."
            },
            {
              "scope": "budget:read",
              "description": "Read `/budget-items` and `/budget-item-links` — budget & roadmap items with cost breakdowns and their links to opportunities, contracts, projects, and assets."
            },
            {
              "scope": "summary:read",
              "description": "Read `/summary` — row counts for every resource the key can access (parity with the list endpoints)."
            }
          ]
        }
      ]
    },
    "pagination": {
      "title": "Pagination & incremental sync",
      "body": "All list endpoints accept the same core query parameters.\n\n{{table:params}}\n\n**Total ordering**\n\nEvery list is ordered by `(orderCol ASC, id ASC)`. The `id` tiebreaker means two rows with the same `updated_at` still have a stable order across pages — safe to paginate deep without skipping or duplicating rows.\n\n**Incremental sync recipe**\n\n1. First run: pull with `limit=500` and walk `offset` until `has_more` is false. Track the maximum `updated_at` seen.\n2. Subsequent runs: request `updated_since=<max_updated_at>` and walk again. Dedupe on `id` (the boundary row may appear again because the filter is `>=`, not `>`).\n3. Snapshot endpoints (`/score-snapshots`, `/control-score-snapshots`) are append-only — their `updated_since` filters `created_at` instead of `updated_at`. Track `created_at` for those.\n\n**Reference endpoints**\n\n`/assessment-templates`, `/response-statuses`, and `/weight-levels` are pure reference data — they reject `client_id` and `updated_since` with a 400. Re-fetch them in full on each sync run (rows are few).",
      "tables": [
        {
          "id": "params",
          "title": "Query parameters",
          "columns": [
            {
              "key": "param",
              "label": "Param",
              "mono": true
            },
            {
              "key": "type",
              "label": "Type"
            },
            {
              "key": "notes",
              "label": "Notes"
            }
          ],
          "rows": [
            {
              "param": "limit",
              "type": "int 1–500 (default 100)",
              "notes": "Page size. Hard cap is 500; larger values return 400."
            },
            {
              "param": "offset",
              "type": "int ≥ 0 (default 0)",
              "notes": "Row offset. Use `next_offset` from the response."
            },
            {
              "param": "updated_since",
              "type": "ISO 8601",
              "notes": "Return only rows updated at or after this time."
            },
            {
              "param": "client_id",
              "type": "UUID",
              "notes": "Restrict to one client (must be permitted). Not on `/assessment-controls`, `/assessment-categories`, `/assessment-templates`, `/response-statuses`, or `/weight-levels`."
            },
            {
              "param": "assessment_id",
              "type": "UUID",
              "notes": "`/assessment-responses` only."
            }
          ]
        }
      ]
    },
    "rate-limits": {
      "title": "Rate limits",
      "body": "Each key is limited to **1,000 requests per hour** (fixed hourly buckets, not sliding). Every response after authentication carries these headers:\n\n{{table:headers}}\n\nRequests that fail authentication (401) do NOT consume quota. Requests that fail authorization (403) or validation (400) DO consume quota — those are still real requests against the key.",
      "tables": [
        {
          "id": "headers",
          "title": "Response headers",
          "columns": [
            {
              "key": "header",
              "label": "Header",
              "mono": true
            },
            {
              "key": "meaning",
              "label": "Meaning"
            }
          ],
          "rows": [
            {
              "header": "X-RateLimit-Limit",
              "meaning": "Hourly quota (always `1000`)."
            },
            {
              "header": "X-RateLimit-Remaining",
              "meaning": "Requests left in the current window. Decrements on every request."
            },
            {
              "header": "X-RateLimit-Reset",
              "meaning": "Unix timestamp (seconds) when the current hourly window ends."
            },
            {
              "header": "Retry-After",
              "meaning": "Only on `429`. Always `3600`."
            }
          ]
        }
      ]
    },
    "errors": {
      "title": "Errors",
      "body": "Errors return a JSON body with an `error` message, a stable machine-readable `code`, and a `request_id`. Parse the `code` — the human message may change.\n\n{{table:codes}}",
      "tables": [
        {
          "id": "codes",
          "title": "Error codes",
          "columns": [
            {
              "key": "status",
              "label": "Status",
              "mono": true
            },
            {
              "key": "code",
              "label": "Code",
              "mono": true
            },
            {
              "key": "meaning",
              "label": "Meaning"
            }
          ],
          "rows": [
            {
              "status": "400",
              "code": "invalid_request",
              "meaning": "Malformed or unknown query parameter (bad UUID, unsupported name, bad ISO date, param on wrong endpoint)."
            },
            {
              "status": "401",
              "code": "unauthorized",
              "meaning": "Missing, invalid, revoked, or expired key — all indistinguishable to defeat enumeration."
            },
            {
              "status": "403",
              "code": "forbidden",
              "meaning": "Key lacks the required scope for this endpoint."
            },
            {
              "status": "404",
              "code": "not_found",
              "meaning": "Unknown endpoint, *or* `client_id` not in the key's allowlist. Both cases return a byte-identical response so callers cannot enumerate which clients an account owns."
            },
            {
              "status": "405",
              "code": "method_not_allowed",
              "meaning": "Method other than `GET`, `HEAD`, or `OPTIONS`."
            },
            {
              "status": "429",
              "code": "rate_limited",
              "meaning": "Hourly rate limit exceeded. `Retry-After: 3600` set."
            },
            {
              "status": "500",
              "code": "internal_error",
              "meaning": "Server-side query failure. Never leaks SQL, table names, or stack traces."
            }
          ]
        }
      ]
    },
    "openapi": {
      "title": "OpenAPI spec",
      "body": "Import the machine-readable spec into Postman, Insomnia, or code-generators. The spec is the single source of truth for this reference page — anything you see here is derived from `api-v1.json`.\n\n[Download api-v1.json](/openapi/api-v1.json)"
    }
  },
  "x-narmada-scope-catalog": {
    "clients:read": {
      "label": "Clients (read)",
      "description": "Read the /clients endpoint — company records you manage (name, email, phone, short_code, logo)."
    },
    "assets:read": {
      "label": "Assets (read)",
      "description": "Read /assets (RMM-synced) and /network-assets (locally-managed). Includes hardware, OS, warranty, and lifecycle fields."
    },
    "assessments:read": {
      "label": "Assessments (read)",
      "description": "Read every assessment endpoint (parent records, per-question responses, master control library, categories, templates, reference tables, and score snapshots) with a SAFE column set — omits internal notes, free-text answers, and option arrays."
    },
    "assessments:read-full": {
      "label": "Assessments (read-full) — SENSITIVE",
      "description": "SUPERSET of assessments:read. Additionally unlocks internal_notes, notes, recommendation, client_decision, trends_topics, updated_by, liongard_value on /assessment-responses; the full control definition (status_options, recommendation_options, decision_options, default_status, default_client_decision, tech_doc_content, liongard_value_mapping, etc.) on /assessment-controls; and notes on /score-snapshots. Grant only to trusted BI destinations — includes free-text auditor commentary and internal decision rationale."
    },
    "tickets:read": {
      "label": "Tickets (read)",
      "description": "Read /tickets (native Narmada tickets) and /synced-tickets (PSA-synced tickets)."
    },
    "contracts:read": {
      "label": "Contracts (read)",
      "description": "Read /contracts (native) and /synced-contracts (PSA-synced)."
    },
    "meetings:read": {
      "label": "Meetings (read)",
      "description": "Read /meetings — QBRs, kickoffs, and other meeting records tied to accounts/clients."
    },
    "opportunities:read": {
      "label": "Opportunities (read)",
      "description": "Read /opportunities — PSA-synced sales opportunities with stage, amount, probability, projected close."
    },
    "projects:read": {
      "label": "Projects (read)",
      "description": "Read /projects (PSA-synced) and /pm-projects (internal Project Management app)."
    },
    "budget:read": {
      "label": "Budget & Roadmap (read)",
      "description": "Read /budget-items and /budget-item-links — budget items with cost breakdowns and their links to opportunities, contracts, projects, and assets."
    },
    "summary:read": {
      "label": "Summary (read)",
      "description": "Read /summary — aggregate counts across every resource permitted by the key. Cheap heartbeat for dashboards and freshness checks."
    }
  },
  "x-narmada-group-order": [
    "Getting started",
    "Clients",
    "Assets",
    "Assessments",
    "Scoring",
    "Tickets",
    "Contracts",
    "Meetings",
    "Opportunities",
    "Projects",
    "Budget & Roadmap",
    "Summary"
  ]
}
