@dscr-ai/app-pricing-engine
v0.1.0
Published
Official TypeScript SDK for pricingengine.pro REST API. Create and manage deals, loans, borrowers, entities, and scenarios on dscr.ai.
Readme
dscr.ai API
Generated TypeScript SDK for the dscr.ai API API. REST API for managing deals, loans, borrowers, entities, scenarios, and more within the dscr.ai platform.
Contents
- Installation
- Quickstart
- Authentication
- Client Options
- Request Options
- Resources
- Errors
- Retries and Timeouts
- Logging
- Debugging
- Requirements
Installation
npm install @dscr-ai/app-pricing-engineQuickstart
import DscrAiAppPricingEngine from "@dscr-ai/app-pricing-engine";
const client = new DscrAiAppPricingEngine();
const listDeals = await client.deals.list({
page: 1,
per_page: 25,
});
console.log(listDeals);Authentication
Pass credentials to the generated client constructor. Environment variables are read automatically when supported by the target runtime.
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| bearerAuth | string \| provider | - | Use your organization API key secret as the bearer token: Authorization: Bearer <api_key_secret> Defaults to BEARER_AUTH. |
Declared schemes:
bearerAuthbearer token
Client Options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| bearerAuth | string \| AuthTokenProvider | process.env["BEARER_AUTH"] | Use your organization API key secret as the bearer token: Authorization: Bearer <api_key_secret> |
| baseURL | string \| null | process.env["DSCR-AI_BASE_URL"] | Override the default API base URL. Pass null when selecting a configured environment. |
| timeout | number | 60000 | Maximum time in milliseconds to wait for a response before aborting a request. |
| maxRetries | number | 2 | Number of retries for temporary failures. |
| defaultHeaders | HeadersInit | - | Headers sent with every request. |
| defaultQuery | Record<string, string \| undefined> | - | Query parameters sent with every request. |
| fetchOptions | RequestInit | - | Additional fetch options sent with every request. |
| fetch | Fetch | - | Custom fetch implementation. |
| logLevel | "off" \| "error" \| "warn" \| "info" \| "debug" \| null | process.env["DSCR-AI_LOG"] | Controls request and retry debug logging. |
| logger | Logger \| null | console | Custom logger implementation. |
Request Options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| headers | HeadersInit | - | Per-request headers. |
| query | Record<string, unknown> | - | Per-request query parameters. |
| body | unknown | - | Override the generated request body. |
| timeout | number | - | Per-request timeout in milliseconds. |
| maxRetries | number | - | Per-request retry count. |
| signal | AbortSignal | - | Abort an in-flight request. |
| fetchOptions | RequestInit | - | Per-request fetch options. |
| idempotencyKey | string | - | Idempotency key for retry-safe operations. |
Resources
Deals
List deals
Returns a paginated list of deals visible to the authenticated API key's organization.
const listDeals = await client.deals.list({
page: 1,
per_page: 25,
});Create a deal
Creates a new deal with the supplied inputs. Each input is identified by its input_id and input_type.
const createDeal = await client.deals.create();List deal inputs
Returns a flat object mapping input_code to the current value for every input on the deal, exactly as the API key's creator user would see them on the Deal Details page. Includes both stored values (typed primitives) and computed/expression-driven values evaluated live from the logic engine. Inputs hidden by logic-rule visibility, archived inputs, and section headers are omitted. Stored values take precedence over computed values when both exist.
const inputs = await client.deals.listInputs("id");Spreadsheets
Compute spreadsheet values
Stateless compute against a Sheets spreadsheet. Overlays optional input cell values on top of the spreadsheet's persisted cells, recalculates the HyperFormula graph, and returns the requested ranges. Nothing is written back to the database. Input cells must be input widgets on a table whose Form switch is enabled. Authenticate with an organization API key (Authorization: Bearer <api_key_secret>); the key's organization must own the spreadsheet.
const computeSpreadsheet = await client.spreadsheets.compute("id");Loans
List loans
Returns all loans visible to the organization.
const listLoans = await client.loans.list({
page: 1,
per_page: 25,
});Archive a loan
Soft-deletes a loan by moving it to the archive.
const success = await client.loans.archive("id");Update a loan
Updates an existing loan's status or triggers an action (e.g. submit, approve).
const updateLoan = await client.loans.update("id");Applications
List applications
Returns all loan applications across the organization pipeline.
const listApplications = await client.applications.list({
page: 1,
per_page: 25,
});Borrowers
Search borrowers
Full-text search across borrowers by name, email, or ID. Optionally filter by entity.
const searchBorrowers = await client.borrowers.search();Create a borrower
Creates a new borrower profile attached to the organization.
const createBorrower = await client.borrowers.create();List borrowers
Returns a pipeline view of all borrowers with summary information.
const listBorrowers = await client.borrowers.list({
page: 1,
per_page: 25,
});Entities
Search entities
Full-text search across entities (LLCs, Trusts, etc.).
const searchEntities = await client.entities.search();Create an entity
Creates a new entity (LLC, Trust, Corporation, etc.) and optionally attaches owners.
const createEntity = await client.entities.create();List entities
Returns a pipeline view of entities with owner mapping.
const listEntities = await client.entities.list();Scenarios
Archive a scenario
Soft-deletes a scenario. Pass action=restore as a query param to unarchive.
const success = await client.scenarios.archive("id");Get a scenario
Returns a single scenario by ID, including its inputs and outputs.
const getScenario = await client.scenarios.retrieve("id");Update a scenario
Updates a scenario's name, inputs, or outputs.
const updateScenario = await client.scenarios.update("id");Programs
List programs
Returns all lending programs configured for the organization.
const listPrograms = await client.programs.list();Appraisals
List appraisal orders
Returns all appraisal orders for the organization.
const listAppraisalOrders = await client.appraisals.listOrders();Create an appraisal order
Creates a new appraisal order for a deal.
const createAppraisalOrder = await client.appraisals.createOrder();Update an appraisal order
Updates an existing appraisal order's status, due date, or other fields.
const updateAppraisalOrder = await client.appraisals.updateOrder("id");Documents
List document templates
Returns all document templates configured for the organization.
const listDocumentTemplates = await client.documents.listTemplates();Create a document template
Creates a new document template with optional HTML content.
const createDocumentTemplate = await client.documents.createTemplate();CreditReports
List credit reports
Returns credit report documents for a specific borrower. The borrowerId query parameter is required.
const listCreditReports = await client.creditReports.list({
borrowerId: "borrowerId",
});BackgroundReports
List background reports
Returns all background check reports for the organization.
const listBackgroundReports = await client.backgroundReports.list();Create a background report
Initiates a background check for a borrower or entity.
const createBackgroundReport = await client.backgroundReports.create();Pipeline
Get pipeline data
Returns pipeline-view data. The shape depends on the view query parameter.
const getPipeline = await client.pipeline.list();SignatureRequests
List signature requests
Returns e-signature requests for a deal. The dealId query parameter is required.
const listSignatureRequests = await client.signatureRequests.list({
dealId: "dealId",
});Errors
Non-success responses throw generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.
Documented error statuses: 400, 401, 404, 422, 500.
Retries and Timeouts
Generated clients support request timeouts and retry temporary failures such as network errors, 408, 409, 429, and 5xx responses. Retry delays honor Retry-After headers when present.
Logging
- Set
logLevel: "debug"to log request URLs, options, response status, response headers, and retry attempts. - Pass a custom
loggerto route logs into your own observability pipeline. - Set
logLevel: nullto disable environment-driven logging.
Debugging
- Use
.withResponse()on any request to inspect both parsed data and the rawResponseobject. - Catch generated API errors to inspect status, headers, response body, and request metadata.
Requirements
- Node.js 20+, a modern browser, or any runtime with
fetchsupport
Powered by Scalar.
Contributions
This SDK is generated programmatically. Manual edits to generated files will be overwritten on the next build.
