{ "openapi": "3.0.3", "info": { "title": "dscr.ai API", "version": "1.0.0", "description": "REST API for managing deals, loans, borrowers, entities, scenarios, and more within the dscr.ai platform." }, "servers": [ { "url": "https://pricingengine.pro", "description": "Production" } ], "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "API Key", "description": "Use your organization API key secret as the bearer token: Authorization: Bearer " } }, "schemas": { "Deal": { "type": "object", "properties": { "id": { "type": "string" }, "heading": { "type": "string", "nullable": true }, "status": { "type": "string", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "heading", "status", "created_at", "updated_at" ] }, "ListDealsResponse": { "type": "object", "properties": { "deals": { "type": "array", "items": { "$ref": "#/components/schemas/Deal" } } }, "required": [ "deals" ] }, "ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" }, "statusCode": { "type": "integer" } }, "required": [ "error", "message", "statusCode" ] }, "ValidationErrorResponse": { "type": "object", "properties": { "error": { "type": "string", "enum": [ "Validation Error" ] }, "message": { "type": "string" }, "statusCode": { "type": "number", "enum": [ 422 ] }, "details": { "type": "array", "items": { "type": "object", "properties": { "field": { "type": "string" }, "message": { "type": "string" } }, "required": [ "field", "message" ] } } }, "required": [ "error", "message", "statusCode", "details" ] }, "CreateDealResponse": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ true ] }, "deal": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "ok", "deal" ] }, "CreateDealRequest": { "type": "object", "properties": { "deal_inputs": { "type": "array", "items": { "type": "object", "properties": { "input_id": { "type": "string" }, "input_type": { "type": "string", "enum": [ "text", "number", "select", "date", "boolean" ] }, "value": { "anyOf": [ { "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "nullable": true }, { "nullable": true } ] } }, "required": [ "input_id", "input_type", "value" ] } } }, "required": [ "deal_inputs" ] }, "Loan": { "type": "object", "properties": { "id": { "type": "string" }, "displayId": { "type": "string", "nullable": true }, "label": { "type": "string", "nullable": true }, "deal_id": { "type": "string", "nullable": true }, "status": { "type": "string", "nullable": true }, "loan_amount": { "type": "number", "nullable": true }, "interest_rate": { "type": "number", "nullable": true }, "ltv": { "type": "number", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "displayId", "label", "deal_id", "status", "loan_amount", "interest_rate", "ltv", "created_at", "updated_at" ] }, "ListLoansResponse": { "type": "array", "items": { "$ref": "#/components/schemas/Loan" } }, "UpdateLoanResponse": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ true ] } }, "required": [ "ok" ] }, "UpdateLoanRequest": { "type": "object", "properties": { "status": { "type": "string" }, "action": { "type": "string" }, "loan_amount": { "type": "number" }, "interest_rate": { "type": "number" }, "ltv": { "type": "number" } } }, "SuccessResponse": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ true ] } }, "required": [ "ok" ] }, "Application": { "type": "object", "properties": { "id": { "type": "string" }, "displayId": { "type": "string", "nullable": true }, "appDisplayId": { "type": "string", "nullable": true }, "status": { "type": "string" }, "borrowerEntityName": { "type": "string", "nullable": true }, "propertyAddress": { "type": "string", "nullable": true }, "signingProgressPct": { "type": "number", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "displayId", "appDisplayId", "status", "borrowerEntityName", "propertyAddress", "signingProgressPct", "created_at", "updated_at" ] }, "ListApplicationsResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Application" } } }, "required": [ "items" ] }, "Borrower": { "type": "object", "properties": { "id": { "type": "string" }, "first_name": { "type": "string" }, "last_name": { "type": "string" }, "email": { "type": "string", "nullable": true, "format": "email" }, "phone": { "type": "string", "nullable": true }, "fico_score": { "type": "integer", "nullable": true }, "ssn": { "type": "string", "nullable": true }, "date_of_birth": { "type": "string", "nullable": true }, "citizenship": { "type": "string", "nullable": true }, "marital_status": { "type": "string", "nullable": true }, "deal_count": { "type": "integer" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "first_name", "last_name", "email", "phone", "fico_score", "ssn", "date_of_birth", "citizenship", "marital_status", "created_at", "updated_at" ] }, "SearchBorrowersResponse": { "type": "object", "properties": { "borrowers": { "type": "array", "items": { "$ref": "#/components/schemas/Borrower" } } }, "required": [ "borrowers" ] }, "CreateBorrowerResponse": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ true ] }, "borrower": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "ok", "borrower" ] }, "CreateBorrowerRequest": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string" }, "fico_score": { "type": "integer" }, "ssn": { "type": "string" }, "date_of_birth": { "type": "string" }, "citizenship": { "type": "string" }, "marital_status": { "type": "string" } }, "required": [ "first_name", "last_name" ] }, "ListBorrowersResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Borrower" } } }, "required": [ "items" ] }, "Entity": { "type": "object", "properties": { "id": { "type": "string" }, "entity_name": { "type": "string" }, "entity_type": { "type": "string", "enum": [ "llc", "corporation", "trust", "partnership", "sole_proprietorship", "other" ] }, "ein": { "type": "string", "nullable": true }, "state_of_formation": { "type": "string", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "entity_name", "entity_type", "ein", "state_of_formation", "created_at", "updated_at" ] }, "SearchEntitiesResponse": { "type": "object", "properties": { "entities": { "type": "array", "items": { "$ref": "#/components/schemas/Entity" } } }, "required": [ "entities" ] }, "CreateEntityResponse": { "type": "object", "properties": { "ok": { "type": "boolean", "enum": [ true ] }, "entity": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "ok", "entity" ] }, "CreateEntityRequest": { "type": "object", "properties": { "entity_name": { "type": "string" }, "entity_type": { "type": "string", "enum": [ "llc", "corporation", "trust", "partnership", "sole_proprietorship", "other" ] }, "ein": { "type": "string" }, "state_of_formation": { "type": "string" }, "owners": { "type": "array", "items": { "type": "object", "properties": { "borrower_id": { "type": "string" }, "ownership_pct": { "type": "number", "minimum": 0, "maximum": 100 } }, "required": [ "borrower_id", "ownership_pct" ] } } }, "required": [ "entity_name", "entity_type" ] }, "ListEntitiesResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Entity" } }, "ownersMap": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "object", "properties": { "borrower_id": { "type": "string" }, "ownership_pct": { "type": "number", "minimum": 0, "maximum": 100 } }, "required": [ "borrower_id", "ownership_pct" ] } } } }, "required": [ "items", "ownersMap" ] }, "Scenario": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string", "nullable": true }, "loan_id": { "type": "string", "nullable": true }, "primary": { "type": "boolean" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "name", "loan_id", "primary", "created_at", "updated_at" ] }, "GetScenarioResponse": { "type": "object", "properties": { "scenario": { "$ref": "#/components/schemas/Scenario" } }, "required": [ "scenario" ] }, "UpdateScenarioResponse": { "type": "object", "properties": { "scenario": { "$ref": "#/components/schemas/Scenario" } }, "required": [ "scenario" ] }, "UpdateScenarioRequest": { "type": "object", "properties": { "name": { "type": "string" }, "inputs": { "type": "object", "additionalProperties": { "nullable": true } } } }, "Program": { "type": "object", "properties": { "id": { "type": "string" }, "loan_type": { "type": "string" }, "internal_name": { "type": "string" }, "status": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "loan_type", "internal_name", "status", "created_at", "updated_at" ] }, "ListProgramsResponse": { "type": "object", "properties": { "programs": { "type": "array", "items": { "$ref": "#/components/schemas/Program" } } }, "required": [ "programs" ] }, "AppraisalOrder": { "type": "object", "properties": { "id": { "type": "string" }, "deal_id": { "type": "string" }, "order_type": { "type": "string" }, "status": { "type": "string" }, "property_address": { "type": "string", "nullable": true }, "requested_date": { "type": "string", "nullable": true }, "date_due": { "type": "string", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "deal_id", "order_type", "status", "property_address", "requested_date", "date_due", "created_at", "updated_at" ] }, "ListAppraisalOrdersResponse": { "type": "object", "properties": { "orders": { "type": "array", "items": { "$ref": "#/components/schemas/AppraisalOrder" } } }, "required": [ "orders" ] }, "CreateAppraisalOrderResponse": { "type": "object", "properties": { "order": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "order" ] }, "CreateAppraisalOrderRequest": { "type": "object", "properties": { "deal_id": { "type": "string" }, "order_type": { "type": "string" }, "property_address": { "type": "string" }, "requested_date": { "type": "string" } }, "required": [ "deal_id", "order_type", "property_address" ] }, "UpdateAppraisalOrderResponse": { "type": "object", "properties": { "success": { "type": "boolean", "enum": [ true ] } }, "required": [ "success" ] }, "UpdateAppraisalOrderRequest": { "type": "object", "properties": { "order_status": { "type": "string" }, "date_due": { "type": "string" } } }, "DocumentTemplate": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "html_content": { "type": "string", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "name", "html_content", "created_at", "updated_at" ] }, "ListDocumentTemplatesResponse": { "type": "object", "properties": { "templates": { "type": "array", "items": { "$ref": "#/components/schemas/DocumentTemplate" } } }, "required": [ "templates" ] }, "CreateDocumentTemplateResponse": { "type": "object", "properties": { "template": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "template" ] }, "CreateDocumentTemplateRequest": { "type": "object", "properties": { "name": { "type": "string" }, "html_content": { "type": "string" } }, "required": [ "name" ] }, "CreditReport": { "type": "object", "properties": { "id": { "type": "string" }, "borrower_id": { "type": "string" }, "provider": { "type": "string" }, "pulled_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "borrower_id", "provider", "pulled_at", "created_at", "updated_at" ] }, "ListCreditReportsResponse": { "type": "object", "properties": { "documents": { "type": "array", "items": { "$ref": "#/components/schemas/CreditReport" } } }, "required": [ "documents" ] }, "BackgroundReport": { "type": "object", "properties": { "id": { "type": "string" }, "borrower_id": { "type": "string" }, "entity_id": { "type": "string", "nullable": true }, "report_type": { "type": "string" }, "status": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "borrower_id", "entity_id", "report_type", "status", "created_at", "updated_at" ] }, "ListBackgroundReportsResponse": { "type": "object", "properties": { "reports": { "type": "array", "items": { "$ref": "#/components/schemas/BackgroundReport" } } }, "required": [ "reports" ] }, "CreateBackgroundReportResponse": { "type": "object", "properties": { "report": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "report" ] }, "CreateBackgroundReportRequest": { "type": "object", "properties": { "borrower_id": { "type": "string" }, "entity_id": { "type": "string", "nullable": true }, "report_type": { "type": "string" } }, "required": [ "borrower_id", "report_type" ] }, "PipelineItem": { "type": "object", "properties": { "id": { "type": "string" }, "heading": { "type": "string", "nullable": true }, "stage": { "type": "string", "nullable": true }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "heading", "stage", "updated_at" ] }, "GetPipelineResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/PipelineItem" } } }, "required": [ "items" ] }, "SignatureRequest": { "type": "object", "properties": { "id": { "type": "string" }, "deal_id": { "type": "string" }, "status": { "type": "string" }, "signer_email": { "type": "string", "nullable": true }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } }, "required": [ "id", "deal_id", "status", "signer_email", "created_at", "updated_at" ] }, "ListSignatureRequestsResponse": { "type": "object", "properties": { "requests": { "type": "array", "items": { "$ref": "#/components/schemas/SignatureRequest" } } }, "required": [ "requests" ] } }, "parameters": {} }, "paths": { "/api/deals": { "get": { "operationId": "listDeals", "summary": "List deals", "description": "Returns a paginated list of deals visible to the authenticated API key's organization.", "tags": [ "deals" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "default": 1 }, "required": false, "name": "page", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "maximum": 100, "default": 25 }, "required": false, "name": "per_page", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "status", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListDealsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createDeal", "summary": "Create a deal", "description": "Creates a new deal with the supplied inputs. Each input is identified by its input_id and input_type.", "tags": [ "deals" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateDealRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateDealResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/loans/list": { "get": { "operationId": "listLoans", "summary": "List loans", "description": "Returns all loans visible to the organization.", "tags": [ "loans" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "default": 1 }, "required": false, "name": "page", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "maximum": 100, "default": 25 }, "required": false, "name": "per_page", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "deal_id", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "status", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListLoansResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/loans/{id}": { "patch": { "operationId": "updateLoan", "summary": "Update a loan", "description": "Updates an existing loan's status or triggers an action (e.g. submit, approve).", "tags": [ "loans" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Loan ID" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateLoanRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateLoanResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "archiveLoan", "summary": "Archive a loan", "description": "Soft-deletes a loan by moving it to the archive.", "tags": [ "loans" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Loan ID" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/applications/list": { "get": { "operationId": "listApplications", "summary": "List applications", "description": "Returns all loan applications across the organization pipeline.", "tags": [ "applications" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "default": 1 }, "required": false, "name": "page", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "maximum": 100, "default": 25 }, "required": false, "name": "per_page", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "status", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListApplicationsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/applicants/borrowers": { "get": { "operationId": "searchBorrowers", "summary": "Search borrowers", "description": "Full-text search across borrowers by name, email, or ID. Optionally filter by entity.", "tags": [ "borrowers" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": false, "name": "q", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "entityId", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "includeIds", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchBorrowersResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createBorrower", "summary": "Create a borrower", "description": "Creates a new borrower profile attached to the organization.", "tags": [ "borrowers" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateBorrowerRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateBorrowerResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/applicants/borrowers/list": { "get": { "operationId": "listBorrowers", "summary": "List borrowers", "description": "Returns a pipeline view of all borrowers with summary information.", "tags": [ "borrowers" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "default": 1 }, "required": false, "name": "page", "in": "query" }, { "schema": { "type": "integer", "minimum": 0, "exclusiveMinimum": true, "maximum": 100, "default": 25 }, "required": false, "name": "per_page", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListBorrowersResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/applicants/entities": { "get": { "operationId": "searchEntities", "summary": "Search entities", "description": "Full-text search across entities (LLCs, Trusts, etc.).", "tags": [ "entities" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": false, "name": "q", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "includeIds", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchEntitiesResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createEntity", "summary": "Create an entity", "description": "Creates a new entity (LLC, Trust, Corporation, etc.) and optionally attaches owners.", "tags": [ "entities" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateEntityRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateEntityResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/applicants/entities/list": { "get": { "operationId": "listEntities", "summary": "List entities", "description": "Returns a pipeline view of entities with owner mapping.", "tags": [ "entities" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListEntitiesResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/scenarios/{id}": { "get": { "operationId": "getScenario", "summary": "Get a scenario", "description": "Returns a single scenario by ID, including its inputs and outputs.", "tags": [ "scenarios" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Scenario ID" }, "required": true, "name": "id", "in": "path" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetScenarioResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "updateScenario", "summary": "Update a scenario", "description": "Updates a scenario's name, inputs, or outputs.", "tags": [ "scenarios" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Scenario ID" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateScenarioRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateScenarioResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "archiveScenario", "summary": "Archive a scenario", "description": "Soft-deletes a scenario. Pass action=restore as a query param to unarchive.", "tags": [ "scenarios" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Scenario ID" }, "required": true, "name": "id", "in": "path" }, { "schema": { "type": "string", "enum": [ "restore" ] }, "required": false, "name": "action", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SuccessResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/programs": { "get": { "operationId": "listPrograms", "summary": "List programs", "description": "Returns all lending programs configured for the organization.", "tags": [ "programs" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": false, "name": "status", "in": "query" }, { "schema": { "type": "string" }, "required": false, "name": "loan_type", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListProgramsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/appraisal-orders": { "get": { "operationId": "listAppraisalOrders", "summary": "List appraisal orders", "description": "Returns all appraisal orders for the organization.", "tags": [ "appraisals" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListAppraisalOrdersResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createAppraisalOrder", "summary": "Create an appraisal order", "description": "Creates a new appraisal order for a deal.", "tags": [ "appraisals" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAppraisalOrderRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAppraisalOrderResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/appraisal-orders/{id}": { "patch": { "operationId": "updateAppraisalOrder", "summary": "Update an appraisal order", "description": "Updates an existing appraisal order's status, due date, or other fields.", "tags": [ "appraisals" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string", "description": "Order ID" }, "required": true, "name": "id", "in": "path" } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAppraisalOrderRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAppraisalOrderResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/document-templates": { "get": { "operationId": "listDocumentTemplates", "summary": "List document templates", "description": "Returns all document templates configured for the organization.", "tags": [ "documents" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListDocumentTemplatesResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createDocumentTemplate", "summary": "Create a document template", "description": "Creates a new document template with optional HTML content.", "tags": [ "documents" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateDocumentTemplateRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateDocumentTemplateResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/credit-reports": { "get": { "operationId": "listCreditReports", "summary": "List credit reports", "description": "Returns credit report documents for a specific borrower. The borrowerId query parameter is required.", "tags": [ "credit-reports" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "borrowerId", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListCreditReportsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/background-reports": { "get": { "operationId": "listBackgroundReports", "summary": "List background reports", "description": "Returns all background check reports for the organization.", "tags": [ "background-reports" ], "security": [ { "bearerAuth": [] } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListBackgroundReportsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createBackgroundReport", "summary": "Create a background report", "description": "Initiates a background check for a borrower or entity.", "tags": [ "background-reports" ], "security": [ { "bearerAuth": [] } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateBackgroundReportRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateBackgroundReportResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/pipeline": { "get": { "operationId": "getPipeline", "summary": "Get pipeline data", "description": "Returns pipeline-view data. The shape depends on the view query parameter.", "tags": [ "pipeline" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": false, "name": "view", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPipelineResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/api/signature-requests": { "get": { "operationId": "listSignatureRequests", "summary": "List signature requests", "description": "Returns e-signature requests for a deal. The dealId query parameter is required.", "tags": [ "signature-requests" ], "security": [ { "bearerAuth": [] } ], "parameters": [ { "schema": { "type": "string" }, "required": true, "name": "dealId", "in": "query" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListSignatureRequestsResponse" } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidationErrorResponse" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } } } }