Advanced Models
Developer Guide
Integration & API Guide
March 29, 2026

Two APIs, One Financial Engine
HedgeTech exposes two GraphQL APIs that share the same financial engine underneath:
-
Reporting API — read-only queries for dashboards, financial statements, analytics, and intelligence. Used by embedded apps, admin panels, and any system that needs to read financial state.
-
Profit Guard API — read + write mutations for processing transactions, managing settings, evaluating promotions, and governing financial operations. Used by Shopify webhooks, POS integrations, and external platforms.
Both APIs authenticate via JWT (issued by the vault service). Both return structured, typed responses. And both enforce the same financial rules — because they run on the same engine.
1
Executive Dashboard & Board Summary
query {
executiveDashboard(input: {
periodStart: "2026-01-01T00:00:00Z"
periodEnd: "2026-03-31T23:59:59Z"
waccBps: 850
}) {
totalRevenue
totalLeakageDetected
totalLeakagePrevented
refundRiskIndexRate
loyaltyLiabilityEstimate
marketingEfficiencyRatioRate
enterpriseValueDelta
}
}
Returns KPIs across revenue, leakage, risk, and enterprise value for any date range. The boardSummary query provides a CFO-level view with severity distribution and strategic flags.
2
Financial Statements
query {
profitAndLoss(input: {
periodStart: "2026-01-01T00:00:00Z"
periodEnd: "2026-03-31T23:59:59Z"
}) {
revenue { gross net discounts refunds }
cogs { total shipping handling }
grossProfit
operatingExpenses { marketing loyalty fulfillment }
netIncome
}
}
Also available scoped by location (locationPnl), by SKU (skuPnl), or by sales channel (channelPnl). Plus workingCapital, cashFlowStatement, and dcfValuation queries.
3
Inventory & Customer Intelligence
query {
inventoryFinancialSummary(input: {
periodStart: "2026-01-01T00:00:00Z"
periodEnd: "2026-03-31T23:59:59Z"
}) {
totalInventoryValue
turnoverRate
daysInventoryOutstanding
deadStockValue
shrinkageDetected
}
}
customerEconomics returns lifetime value, acquisition cost, payback period, and churn risk per segment. sensitivityAnalysis and capitalAllocation provide what-if modelling.
4
Home Dashboard
query {
computeDashboardHome(input: {
periodStart: "2026-03-01T00:00:00Z"
periodEnd: "2026-03-29T23:59:59Z"
}) {
financialSnapshot { ... }
riskSnapshot { ... }
inventorySnapshot { ... }
governanceEffectiveness { ... }
strategicSignals { ... }
forwardRisk { ... }
}
}
A single query that returns the entire home dashboard — financial snapshot, risk radar, inventory health, governance effectiveness, strategic signals, and forward risk assessment. One call, complete picture.
Profit Guard API — Mutations
The Profit Guard API processes every financial event as a validated mutation. Each mutation enforces business rules, generates journal entries, and updates projections atomically.
Processing a Shopify order:
mutation {
processOrder(input: {
orderId: "gid://shopify/Order/12345"
lineItems: [{
variantId: "gid://shopify/ProductVariant/99"
quantity: 2
price: { amount: 8999, currencyCode: AUD }
cost: { amount: 3850, currencyCode: AUD }
}]
gatewayFees: [{ amount: 250, currencyCode: AUD }]
}) {
journalId
grossMargin
netMargin
}
}
Processing a refund:
mutation {
processRefund(input: {
orderId: "gid://shopify/Order/12345"
refundLineItems: [{
variantId: "gid://shopify/ProductVariant/99"
quantity: 1
amount: { amount: 8999, currencyCode: AUD }
}]
reverseGatewayFees: true
}) {
journalId
adjustedMargin
}
}
PROMOTIONS
Evaluate a promotion before it goes live. Returns margin impact, stacking conflicts, and exposure limits. If the promotion fails financial validation, it is rejected before any customer sees it.
mutation { evaluatePromotions(input: { ... }) { approved marginImpact conflicts } }
OPERATIONS
Track chargebacks, reversals, inventory adjustments, cost revaluations, and fulfilment events. Each mutation generates double-entry journal pairs and maintains a complete audit trail.
mutation { processChargeback(input: { ... }) { journalId financialImpact } }
mutation { processInventoryAdjustment(input: { ... }) { adjustmentGid } }
mutation { processCostRevaluation(input: { ... }) { updatedCount } }
SETTINGS
Configure tax settings, fiscal year, accounting methods, WACC model, inflation parameters, and risk-free rates. Settings are versioned and auditable — changes are tracked as events.
mutation { upsertSettings(input: { ... }) { settingsId updatedAt } }
mutation { bootstrapSettings(input: { ... }) { settingsId } }
One Engine, Every Channel
Whether the request comes from a Shopify webhook, a POS terminal, an embedded Remix app, or a direct API call — it hits the same GraphQL schema, enforces the same rules, and produces the same deterministic result.
The Reporting API answers questions: What is my margin? Where is my risk? How is my inventory performing?
The Profit Guard API governs actions: Process this order. Evaluate this promotion. Adjust this inventory.
Together, they provide complete financial control over read and write operations. Every query is validated. Every mutation is enforced. Every result is auditable.
You Don’t Need Better Reporting. You Need Guaranteed Correctness.
Most systems show you what went wrong after the fact. HTQL guarantees correctness before execution. Every transaction validated. Every rule enforced. Every outcome deterministic. This is not analytics — this is control infrastructure.

Profit Guard Insights




