Skip to content

Investment · Calculation

1031 exchange arithmetic

Models adjusted basis, sale equity, cash and debt boot, recognized and deferred gains/loss, replacement basis, entered-rate deferral estimate and calendar limits. Optional supplied state policy is evaluated as an assumption. Reverse, improvement and related-party cases retain professional-review flags.

Open 1031 Exchange Calculator in HT Calc

This HT Calc screen includes a Pro sample for visitors.

Example result · formulaVersion: rules-workflows-1.2.0 See output

Cost per success
20 calculation credits
Production plans
Standard, Business, Scale, Enterprise
Plan allowances
Free sandbox
Not available

Integration example

Make a request

Use a production key scoped to investor-1031-exchange.

Keep the key on your server. A successful call uses 20 calculation credits.

Production request

Set HT_PRODUCTION_KEY on your server. Save as example.mjs and run node example.mjs with Node.js 18 or later.

import { randomUUID } from "node:crypto";

const key = process.env.HT_PRODUCTION_KEY;
if (!key) throw new Error("Set HT_PRODUCTION_KEY on your server.");
const endpoint = "https://calc.hasstechapi.com/v2/calc/investor-1031-exchange";
const input = {
  "exchangeType": "forward",
  "relinquishedTransferDate": "2026-02-01",
  "asOfDate": "2026-02-01",
  "salePrice": 500000,
  "sellingCosts": 30000,
  "originalTaxBasis": 350000,
  "capitalImprovements": 20000,
  "depreciationAllowedOrAllowable": 40000,
  "relinquishedDebt": 200000,
  "replacementPurchasePrice": 600000,
  "qualifiedAcquisitionCosts": 10000,
  "replacementDebt": 340000,
  "replacementCashInvested": 270000,
  "relatedParty": false,
  "capitalGainsTaxPct": 20,
  "depreciationRecaptureTaxPct": 25
};
const requestId = process.env.HT_REQUEST_ID || Date.now() + "." + randomUUID();
// Keep this ID to look up usage if the connection is interrupted.
console.error("Usage lookup ID:", requestId);

const response = await fetch(endpoint, {
  method: "POST",
  redirect: "error",
  headers: {
    "Authorization": "Bearer " + key,
    "Content-Type": "application/json",
    "Idempotency-Key": requestId
  },
  body: JSON.stringify(input)
});
if (!response.ok) {
  const problem = await response.json().catch(() => null);
  const code = problem?.error?.code || response.statusText;
  const delay = response.headers.get("retry-after");
  if (delay) console.error("Retry-After (seconds):", delay);
  console.error("HTTP " + response.status + " " + code + ". Usage lookup ID: " + requestId);
  if (Array.isArray(problem?.error?.details)) {
    for (const issue of problem.error.details) console.error("Input issue:", JSON.stringify(issue));
  }
  process.exitCode = 1;
} else {
  console.log(JSON.stringify(await response.json(), null, 2));
}
cURL (shell)

Set HT_PRODUCTION_KEY on your server. Run in a POSIX shell with cURL 7.76+ and Python 3.7+ to create a request ID.

(
  set -eu
  : "${HT_PRODUCTION_KEY:?Set HT_PRODUCTION_KEY on your server}"
  request_id="${HT_REQUEST_ID:-}"
  if [ -z "$request_id" ]; then
    request_id=$(python3 -c 'import time, uuid; print(str(time.time_ns() // 1000000) + "." + str(uuid.uuid4()))')
  fi
  printf 'Usage lookup ID: %s\n' "$request_id" >&2
  # On INVALID_INPUT, read error.details in the JSON response body.
  curl --disable --silent --show-error --fail-with-body --include \
    --request POST 'https://calc.hasstechapi.com/v2/calc/investor-1031-exchange' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "exchangeType": "forward",
  "relinquishedTransferDate": "2026-02-01",
  "asOfDate": "2026-02-01",
  "salePrice": 500000,
  "sellingCosts": 30000,
  "originalTaxBasis": 350000,
  "capitalImprovements": 20000,
  "depreciationAllowedOrAllowable": 40000,
  "relinquishedDebt": 200000,
  "replacementPurchasePrice": 600000,
  "qualifiedAcquisitionCosts": 10000,
  "replacementDebt": 340000,
  "replacementCashInvested": 270000,
  "relatedParty": false,
  "capitalGainsTaxPct": 20,
  "depreciationRecaptureTaxPct": 25
}
HT_INPUT
)
If your request fails
400 INVALID_INPUT

Read error.details when present. Node prints each issue. cURL returns the JSON body. Each path points into your request. An empty path refers to the whole body.

Check the accepted inputs for required fields, units and ranges. Send the corrected JSON as a new request.

401 or 403
Check that the server has the bearer key for the endpoint’s environment and that the key includes investor-1031-exchange.
429
Read the service error code, check your allowance, and wait for the Retry-After interval when supplied before trying again.
Lost response, 409 or 503
Open Request lookup, select the same environment and enter the printed usage lookup ID. A settled ID has already consumed credits. To retry the same calculation, set HT_REQUEST_ID to the original ID and reuse the same inputs. A settled request does not return its result again. Unset the variable for a new request, which can consume credits.

The usage lookup ID is the Idempotency-Key your server sends. The response’s x-request-id identifies the HTTP exchange for support.

Output

Example result

These values come from running this operation on the example inputs.

formulaVersion
rules-workflows-1.2.0
status
requires-professional-review
identificationDeadline
2026-03-18

Result warnings

  • A versioned jurisdiction source is required; no generic rule is substituted.
How to interpret this result
  • Caller supplies tax basis, debt, rates, transaction form and dates. Deferral arithmetic assumes a qualifying real-property exchange. A qualified intermediary and tax professional must determine qualification, exceptions and filing treatment.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "formulaVersion": "rules-workflows-1.2.0",
    "status": "requires-professional-review",
    "identificationDeadline": "2026-03-18",
    "statutoryReceiptDeadline": "2026-07-31",
    "exchangeDeadline": "2026-07-31",
    "identificationTimely": null,
    "receiptTimely": null,
    "adjustedBasis": 330000,
    "amountRealized": 470000,
    "realizedGain": 140000,
    "netEquity": 270000,
    "cashBoot": 0,
    "debtBoot": 0,
    "totalBoot": 0,
    "recognizedGain": 0,
    "deferredGain": 140000,
    "deferredLoss": 0,
    "replacementBasis": 470000,
    "basisConservationDifference": 0,
    "stateDeferralStatus": "unavailable",
    "professionalReviewRequired": true,
    "issues": [
      {
        "code": "authority-missing",
        "severity": "error",
        "message": "A versioned jurisdiction source is required; no generic rule is substituted."
      }
    ],
    "engineStatus": "unavailable",
    "capitalGainsTaxDeferralEstimate": 20000,
    "depreciationRecaptureTaxDeferralEstimate": 10000,
    "federalTaxDeferralEstimate": 30000,
    "stateTaxDeferralEstimate": null,
    "warnings": [
      {
        "code": "authority-missing",
        "severity": "error",
        "message": "A versioned jurisdiction source is required; no generic rule is substituted."
      }
    ]
  },
  "formulaVersion": "rules-workflows-1.2.0",
  "units": {
    "amounts": "USD",
    "dates": "YYYY-MM-DD calendar dates",
    "rates": "percent points (25 = 25%)"
  },
  "assumptions": [
    "Caller supplies tax basis, debt, rates, transaction form and dates. Deferral arithmetic assumes a qualifying real-property exchange. A qualified intermediary and tax professional must determine qualification, exceptions and filing treatment."
  ],
  "warnings": [
    "A versioned jurisdiction source is required; no generic rule is substituted."
  ],
  "creditCost": 20
}

Request contract

Accepted inputs

Fields for this example. Expand the schema for all supported combinations and limits.

FieldType, units and limits

exchangeTypeRequired
stringAllowed: "forward", "reverse", "improvement"
relinquishedTransferDateRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
identificationMadeOnOptional
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
replacementReceivedOnOptional
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
returnDueDateIncludingExtensionsOptional
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
asOfDateRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
salePriceRequired
number

Gross sale price of the relinquished property in USD.

Min 0 · Max 1000000000
sellingCostsRequired
number

Disposition expenses paid on the relinquished property in USD.

Min 0 · Max 1000000000
originalTaxBasisRequired
number

Original tax basis of the relinquished property in USD before the entered improvements and depreciation.

Min 0 · Max 1000000000
capitalImprovementsRequired
number

USD of basis additions for capital improvements to the relinquished property.

Min 0 · Max 1000000000
depreciationAllowedOrAllowableRequired
number

Cumulative depreciation in USD deducted from original basis plus capital improvements.

Min 0 · Max 1000000000
relinquishedDebtRequired
number

USD of debt relieved on the relinquished property in the exchange.

Min 0 · Max 1000000000
replacementPurchasePriceRequired
number

Purchase price of the replacement property in USD.

Min 0 · Max 1000000000
qualifiedAcquisitionCostsRequired
number

USD of acquisition costs the caller treats as includible in replacement basis.

Min 0 · Max 1000000000
replacementDebtRequired
number

USD of debt assumed or incurred on the replacement property.

Min 0 · Max 1000000000
replacementCashInvestedRequired
number

USD of cash actually invested in the replacement property for cash-boot and debt-relief calculations.

Min 0 · Max 1000000000
relatedPartyRequired
boolean
relatedPartyDispositionDateOptional
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
capitalGainsTaxPctRequired
number

Entered federal capital gains tax rate in percent applied to deferred gain above the modeled recapture component.

Min 0 · Max 100
depreciationRecaptureTaxPctRequired
number

Entered federal recapture tax rate in percent applied to deferred gain attributable to prior depreciation.

Min 0 · Max 100
stateTaxPctOptional
number

Entered state tax rate in percent applied to deferred gain only under a supplied, current conforming state policy.

Min 0 · Max 100
statePolicyOptional
object
statePolicy.jurisdictionRequired
stringMin length 2 · Max length 2
statePolicy.versionRequired
stringMin length 1 · Max length 16
statePolicy.sourceUrlRequired
stringMin length 14 · Max length 240
statePolicy.effectiveDateRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
statePolicy.expiresOnRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
statePolicy.conformsToFederalDeferralRequired
boolean
Example request body (JSON)
{
  "exchangeType": "forward",
  "relinquishedTransferDate": "2026-02-01",
  "asOfDate": "2026-02-01",
  "salePrice": 500000,
  "sellingCosts": 30000,
  "originalTaxBasis": 350000,
  "capitalImprovements": 20000,
  "depreciationAllowedOrAllowable": 40000,
  "relinquishedDebt": 200000,
  "replacementPurchasePrice": 600000,
  "qualifiedAcquisitionCosts": 10000,
  "replacementDebt": 340000,
  "replacementCashInvested": 270000,
  "relatedParty": false,
  "capitalGainsTaxPct": 20,
  "depreciationRecaptureTaxPct": 25
}
Full JSON schema
{
  "type": "object",
  "properties": {
    "exchangeType": {
      "enum": [
        "forward",
        "reverse",
        "improvement"
      ]
    },
    "relinquishedTransferDate": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "identificationMadeOn": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "replacementReceivedOn": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "returnDueDateIncludingExtensions": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "asOfDate": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "salePrice": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Gross sale price of the relinquished property in USD."
    },
    "sellingCosts": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Disposition expenses paid on the relinquished property in USD."
    },
    "originalTaxBasis": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Original tax basis of the relinquished property in USD before the entered improvements and depreciation."
    },
    "capitalImprovements": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD of basis additions for capital improvements to the relinquished property."
    },
    "depreciationAllowedOrAllowable": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Cumulative depreciation in USD deducted from original basis plus capital improvements."
    },
    "relinquishedDebt": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD of debt relieved on the relinquished property in the exchange."
    },
    "replacementPurchasePrice": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Purchase price of the replacement property in USD."
    },
    "qualifiedAcquisitionCosts": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD of acquisition costs the caller treats as includible in replacement basis."
    },
    "replacementDebt": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD of debt assumed or incurred on the replacement property."
    },
    "replacementCashInvested": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD of cash actually invested in the replacement property for cash-boot and debt-relief calculations."
    },
    "relatedParty": {
      "type": "boolean"
    },
    "relatedPartyDispositionDate": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "capitalGainsTaxPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Entered federal capital gains tax rate in percent applied to deferred gain above the modeled recapture component."
    },
    "depreciationRecaptureTaxPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Entered federal recapture tax rate in percent applied to deferred gain attributable to prior depreciation."
    },
    "stateTaxPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Entered state tax rate in percent applied to deferred gain only under a supplied, current conforming state policy."
    },
    "statePolicy": {
      "type": "object",
      "properties": {
        "jurisdiction": {
          "type": "string",
          "minLength": 2,
          "maxLength": 2,
          "pattern": "^[A-Z]{2}$"
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "maxLength": 16,
          "pattern": "^[0-9][0-9.-]{0,15}$"
        },
        "sourceUrl": {
          "type": "string",
          "minLength": 14,
          "maxLength": 240,
          "pattern": "^https://[a-z0-9.-]+[.]gov(?:/[a-zA-Z0-9._~/-]*)?$"
        },
        "effectiveDate": {
          "type": "string",
          "format": "date",
          "minLength": 10,
          "maxLength": 10,
          "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
          "description": "Gregorian calendar date, YYYY-MM-DD."
        },
        "expiresOn": {
          "type": "string",
          "format": "date",
          "minLength": 10,
          "maxLength": 10,
          "pattern": "^(?:19|20|21)[0-9]{2}-[0-9]{2}-[0-9]{2}$",
          "description": "Gregorian calendar date, YYYY-MM-DD."
        },
        "conformsToFederalDeferral": {
          "type": "boolean"
        }
      },
      "required": [
        "jurisdiction",
        "version",
        "sourceUrl",
        "effectiveDate",
        "expiresOn",
        "conformsToFederalDeferral"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "exchangeType",
    "relinquishedTransferDate",
    "asOfDate",
    "salePrice",
    "sellingCosts",
    "originalTaxBasis",
    "capitalImprovements",
    "depreciationAllowedOrAllowable",
    "relinquishedDebt",
    "replacementPurchasePrice",
    "qualifiedAcquisitionCosts",
    "replacementDebt",
    "replacementCashInvested",
    "relatedParty",
    "capitalGainsTaxPct",
    "depreciationRecaptureTaxPct"
  ],
  "additionalProperties": false,
  "description": "Models adjusted basis, sale equity, cash and debt boot, recognized and deferred gains/loss, replacement basis, entered-rate deferral estimate and calendar limits. Optional supplied state policy is evaluated as an assumption. Reverse, improvement and related-party cases retain professional-review flags."
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-1031-exchange
Formula: rules-workflows-1.2.0

Related PDF reports