https://www.brainiac.software/api/v1/crypto-tax/cost-basis-lots$0.05 USDCMatch disposals to acquisition lots
Match disposals to acquisition lots by FIFO, LIFO, HIFO or average cost and compute gains from a caller-supplied ledger and fiat values. No market prices are fetched.
Body
| Field | Required | Notes |
|---|---|---|
fiatCurrency | Yes | string |
method | Yes | string; One of: FIFO, LIFO, HIFO, AVERAGE |
feePolicy | No | string; One of: add_to_basis_and_deduct_from_proceeds, ignore; Default: "add_to_basis_and_deduct_from_proceeds" |
ledger | Yes | array; Array |
Request exampleJSON
{
"fiatCurrency": "USD",
"method": "FIFO",
"feePolicy": "add_to_basis_and_deduct_from_proceeds",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
]
}Response exampleJSON
{
"disposals": [
{
"id": "s1",
"asset": "BTC",
"qty": "1.5",
"proceeds": 4500000,
"basis": 2000000,
"gain": 2500000,
"matches": [
{
"lotId": "b1",
"qty": "1",
"basis": 1000000,
"acquiredTs": "2025-01-01T00:00:00Z"
},
{
"lotId": "b2",
"qty": "0.5",
"basis": 1000000,
"acquiredTs": "2025-02-01T00:00:00Z"
}
]
}
],
"openLots": [
{
"lotId": "b2",
"asset": "BTC",
"qty": "0.5",
"basis": 1000000,
"acquiredTs": "2025-02-01T00:00:00Z",
"wallet": "w1"
}
],
"warnings": [],
"fiatCurrency": "USD",
"method": "FIFO",
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Lot matching uses FIFO. Partial-lot basis uses half-even rounding to the minor unit; the final slice of a lot takes the…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/cost-basis-lots" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"fiatCurrency": "USD",
"method": "FIFO",
"feePolicy": "add_to_basis_and_deduct_from_proceeds",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/specific-id-select$0.05 USDCApply specific-identification lot selections
Apply caller-chosen lot identifications to disposals, validate timing and quantities, and return matched basis or structured selection errors.
Body
| Field | Required | Notes |
|---|---|---|
fiatCurrency | No | string; Default: "USD" |
feePolicy | No | string; One of: add_to_basis_and_deduct_from_proceeds, ignore; Default: "add_to_basis_and_deduct_from_proceeds" |
ledger | Yes | array; Array |
selections | Yes | array; Array |
Request exampleJSON
{
"fiatCurrency": "USD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
],
"selections": [
{
"disposalId": "s1",
"lots": [
{
"lotId": "b1",
"qty": "1"
},
{
"lotId": "b2",
"qty": "0.5"
}
]
}
]
}Response exampleJSON
{
"disposals": [
{
"id": "s1",
"asset": "BTC",
"qty": "1.5",
"proceeds": 4500000,
"basis": 2000000,
"gain": 2500000,
"matches": [
{
"lotId": "b1",
"qty": "1",
"basis": 1000000,
"acquiredTs": "2025-01-01T00:00:00Z"
},
{
"lotId": "b2",
"qty": "0.5",
"basis": 1000000,
"acquiredTs": "2025-02-01T00:00:00Z"
}
]
}
],
"openLots": [
{
"lotId": "b2",
"asset": "BTC",
"qty": "0.5",
"basis": 1000000,
"acquiredTs": "2025-02-01T00:00:00Z",
"wallet": "w1"
}
],
"warnings": [],
"errors": [],
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Specific identification requires selected lots to exist, predate the disposal, match the asset, and sum exactly to the …",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/specific-id-select" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"fiatCurrency": "USD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
],
"selections": [
{
"disposalId": "s1",
"lots": [
{
"lotId": "b1",
"qty": "1"
},
{
"lotId": "b2",
"qty": "0.5"
}
]
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/us-form-8949-rows$0.04 USDCBuild IRS Form 8949 rows
Produce Form 8949 rows and Schedule D box totals from caller disposals using 2025 short/long-term and 1099-B / 1099-DA box rules.
Body
| Field | Required | Notes |
|---|---|---|
taxYear | Yes | integer |
roundToDollars | No | boolean; Default: false |
disposals | Yes | array; Array |
Request exampleJSON
{
"taxYear": 2025,
"disposals": [
{
"id": "s1",
"description": "1.5 BTC",
"acquired": "2024-01-10",
"sold": "2025-01-11",
"proceeds": 4500000,
"basis": 2000000,
"adjustmentCode": null,
"adjustment": 0,
"reportedOn": "1099-DA",
"basisReported": true
}
]
}Response exampleJSON
{
"rows": [
{
"part": "II",
"box": "J",
"description": "1.5 BTC",
"dateAcquired": "01/10/2024",
"dateSold": "01/11/2025",
"proceeds": 4500000,
"basis": 2000000,
"code": null,
"adjustment": 0,
"gain": 2500000,
"term": "long",
"id": "s1"
}
],
"totalsByBox": {
"J": {
"proceeds": 4500000,
"basis": 2000000,
"adjustment": 0,
"gain": 2500000
}
},
"taxYear": 2025,
"sources": [
{
"source": "IRS Instructions for Form 8949 (2025)",
"url": "https://www.irs.gov/instructions/i8949",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Long-term when the sale date is after the one-year anniversary of the acquisition date (holding period starts the day a…",
"Boxes follow IRS Form 8949 (2025) for 1099-B (A–F) and 1099-DA (G–L).",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/us-form-8949-rows" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"taxYear": 2025,
"disposals": [
{
"id": "s1",
"description": "1.5 BTC",
"acquired": "2024-01-10",
"sold": "2025-01-11",
"proceeds": 4500000,
"basis": 2000000,
"adjustmentCode": null,
"adjustment": 0,
"reportedOn": "1099-DA",
"basisReported": true
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/canada-acb$0.04 USDCCanadian adjusted cost base
Compute Canadian ACB and capital gains with superficial-loss detection for identical properties on a CAD ledger.
Body
| Field | Required | Notes |
|---|---|---|
ledger | Yes | array; Array |
treatment | No | string; Default: "capital" |
fiatCurrency | No | string; Default: "CAD" |
feePolicy | No | string; One of: add_to_basis_and_deduct_from_proceeds, ignore; Default: "add_to_basis_and_deduct_from_proceeds" |
Request exampleJSON
{
"treatment": "capital",
"fiatCurrency": "CAD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "10",
"fiatValue": 100000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "10",
"fiatValue": 200000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "5",
"fiatValue": 150000,
"feeFiat": 0,
"wallet": "w1"
}
]
}Response exampleJSON
{
"disposals": [
{
"id": "s1",
"proceeds": 150000,
"acbUsed": 75000,
"gain": 75000,
"superficialLossDenied": 0
}
],
"acb": {
"BTC": {
"qty": "15",
"acb": 225000
}
},
"warnings": [],
"treatment": "capital",
"sources": [
{
"source": "Income Tax Act (Canada) s.47 identical properties and s.54 superficial loss",
"url": "https://laws-lois.justice.gc.ca/eng/acts/I-3.3/",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Identical properties use average ACB (s.47). Superficial losses in the ±30-day window that remain held at day +30 are d…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/canada-acb" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"treatment": "capital",
"fiatCurrency": "CAD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "10",
"fiatValue": 100000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "10",
"fiatValue": 200000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "5",
"fiatValue": 150000,
"feeFiat": 0,
"wallet": "w1"
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/australia-cgt-discount$0.03 USDCAustralian CGT discount
Apply the Australian 12-month CGT discount by entity type after losses, from caller event proceeds and cost base.
Body
| Field | Required | Notes |
|---|---|---|
entity | Yes | string; One of: individual, trust, super_fund, company |
resident | Yes | boolean |
events | Yes | array; Array |
carriedForwardLosses | No | integer; Default: 0 |
Request exampleJSON
{
"entity": "individual",
"resident": true,
"events": [
{
"id": "s1",
"acquired": "2024-01-01",
"eventDate": "2025-01-02",
"capitalProceeds": 2000000,
"costBase": 1000000
}
],
"carriedForwardLosses": 200000
}Response exampleJSON
{
"events": [
{
"id": "s1",
"gain": 1000000,
"discountEligible": true
}
],
"grossGains": 1000000,
"lossesApplied": 200000,
"discountRate": 0.5,
"netCapitalGain": 400000,
"sources": [
{
"source": "ATO CGT discount (updated 29 Jun 2026)",
"url": "https://www.ato.gov.au/individuals-and-families/investments-and-assets/capital-gains-tax/cgt-discount",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Discount requires ownership of at least 12 months excluding the acquisition day and the CGT event day.",
"Losses apply to non-discountable gains first, then discountable gains, before the discount.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/australia-cgt-discount" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"entity": "individual",
"resident": true,
"events": [
{
"id": "s1",
"acquired": "2024-01-01",
"eventDate": "2025-01-02",
"capitalProceeds": 2000000,
"costBase": 1000000
}
],
"carriedForwardLosses": 200000
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/germany-holding-period$0.04 USDCGerman §23 holding-period screen
Classify crypto private sales under §23 EStG with FIFO (or caller method), one-year holding and the €1,000 Freigrenze.
Body
| Field | Required | Notes |
|---|---|---|
ledger | Yes | array; Array |
calendarYear | Yes | integer |
method | No | string; One of: FIFO, LIFO, HIFO, AVERAGE; Default: "FIFO" |
fiatCurrency | No | string; Default: "EUR" |
feePolicy | No | string; One of: add_to_basis_and_deduct_from_proceeds, ignore; Default: "add_to_basis_and_deduct_from_proceeds" |
Request exampleJSON
{
"calendarYear": 2026,
"method": "FIFO",
"fiatCurrency": "EUR",
"ledger": [
{
"id": "b1",
"ts": "2025-03-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 100000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2026-03-02T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1",
"fiatValue": 150000,
"feeFiat": 0,
"wallet": "w1"
}
]
}Response exampleJSON
{
"disposals": [
{
"id": "s1",
"holdingDays": 366,
"taxable": false,
"gain": 50000,
"acquired": "2025-03-01",
"sold": "2026-03-02"
}
],
"taxableGainTotal": 0,
"exempt": true,
"reason": "no_taxable_gain",
"method": "FIFO",
"calendarYear": 2026,
"sources": [
{
"source": "§23 EStG private sales (Freigrenze €1,000)",
"url": "https://www.gesetze-im-internet.de/estg/__23.html",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Private sales are taxable when the period between acquisition and sale is not more than one year (§23 Abs. 1).",
"Freigrenze: total taxable private-sale gains under €1,000 are exempt; at €1,000 the whole amount is taxable.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/germany-holding-period" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"calendarYear": 2026,
"method": "FIFO",
"fiatCurrency": "EUR",
"ledger": [
{
"id": "b1",
"ts": "2025-03-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 100000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2026-03-02T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1",
"fiatValue": 150000,
"feeFiat": 0,
"wallet": "w1"
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/income-events-value$0.03 USDCValue staking and income events
Value staking, mining, airdrop and interest receipts in fiat using caller-supplied prices within a max lag window.
Body
| Field | Required | Notes |
|---|---|---|
events | Yes | array; Array |
prices | Yes | array; Array |
maxPriceLagHours | Yes | number |
fiatCurrency | Yes | string |
Request exampleJSON
{
"events": [
{
"id": "i1",
"ts": "2026-02-01T10:00:00Z",
"asset": "ETH",
"qty": "0.1",
"kind": "staking"
}
],
"prices": [
{
"asset": "ETH",
"ts": "2026-02-01T00:00:00Z",
"price": 250000
}
],
"maxPriceLagHours": 24,
"fiatCurrency": "USD"
}Response exampleJSON
{
"events": [
{
"id": "i1",
"value": 25000,
"priceTs": "2026-02-01T00:00:00Z",
"kind": "staking",
"asset": "ETH"
}
],
"totalsByKind": {
"staking": 25000
},
"missingPrices": [],
"fiatCurrency": "USD",
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Uses the latest caller price at or before the event within maxPriceLagHours. Missing prices are listed and never guesse…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/income-events-value" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"events": [
{
"id": "i1",
"ts": "2026-02-01T10:00:00Z",
"asset": "ETH",
"qty": "0.1",
"kind": "staking"
}
],
"prices": [
{
"asset": "ETH",
"ts": "2026-02-01T00:00:00Z",
"price": 250000
}
],
"maxPriceLagHours": 24,
"fiatCurrency": "USD"
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/transfer-match$0.04 USDCMatch internal wallet transfers
Pair outgoing and incoming transfers between the caller's own wallets by txHash or amount/time so they are not treated as disposals.
Body
| Field | Required | Notes |
|---|---|---|
ledger | Yes | array; Array |
windowMinutes | No | number; Default: 120 |
maxFeeRatio | No | number; Default: 0.02 |
Request exampleJSON
{
"windowMinutes": 120,
"maxFeeRatio": 0.02,
"ledger": [
{
"id": "t1",
"ts": "2026-01-01T10:00:00Z",
"type": "transfer_out",
"asset": "BTC",
"qty": "1.0000",
"fiatValue": 0,
"feeFiat": 0,
"wallet": "a"
},
{
"id": "t2",
"ts": "2026-01-01T10:20:00Z",
"type": "transfer_in",
"asset": "BTC",
"qty": "0.9998",
"fiatValue": 0,
"feeFiat": 0,
"wallet": "b"
}
]
}Response exampleJSON
{
"pairs": [
{
"outId": "t1",
"inId": "t2",
"asset": "BTC",
"fee": "0.0002",
"matchedBy": "amount_time"
}
],
"unmatchedOut": [],
"unmatchedIn": [],
"warnings": [],
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Pairs by identical txHash first, then earliest same-asset in on a different wallet within windowMinutes where 0 ≤ out−i…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/transfer-match" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"windowMinutes": 120,
"maxFeeRatio": 0.02,
"ledger": [
{
"id": "t1",
"ts": "2026-01-01T10:00:00Z",
"type": "transfer_out",
"asset": "BTC",
"qty": "1.0000",
"fiatValue": 0,
"feeFiat": 0,
"wallet": "a"
},
{
"id": "t2",
"ts": "2026-01-01T10:20:00Z",
"type": "transfer_in",
"asset": "BTC",
"qty": "0.9998",
"fiatValue": 0,
"feeFiat": 0,
"wallet": "b"
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/network-fee-allocate$0.02 USDCAllocate network and gas fees
Assign network/gas fees to acquisition basis, disposal proceeds, expense or fee-asset disposal per caller policy.
Body
| Field | Required | Notes |
|---|---|---|
fees | Yes | array; Array |
policy | Yes | object; Object |
Request exampleJSON
{
"fees": [
{
"id": "f1",
"relatedId": "s1",
"context": "disposal",
"asset": "ETH",
"qty": "0.002",
"fiatValue": 500
}
],
"policy": {
"acquisition": "add_to_basis",
"disposal": "deduct_from_proceeds",
"transfer": "expense",
"failed_tx": "ignore"
}
}Response exampleJSON
{
"adjustments": [
{
"feeId": "f1",
"target": "s1",
"action": "deduct_from_proceeds",
"amount": 500
}
],
"feeAssetDisposals": [],
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Maps each fee context to the caller policy. disposal_of_fee_asset emits a disposal of the fee asset at fiatValue for la…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/network-fee-allocate" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"fees": [
{
"id": "f1",
"relatedId": "s1",
"context": "disposal",
"asset": "ETH",
"qty": "0.002",
"fiatValue": 500
}
],
"policy": {
"acquisition": "add_to_basis",
"disposal": "deduct_from_proceeds",
"transfer": "expense",
"failed_tx": "ignore"
}
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/tax-loss-harvest$0.03 USDCList tax-loss harvest candidates
List open lots with unrealised losses at caller prices and an estimated tax saving, with US/UK rule flags.
Body
| Field | Required | Notes |
|---|---|---|
openLots | Yes | array; Array |
prices | Yes | object |
marginalRate | Yes | number |
jurisdiction | Yes | string; One of: US, UK, other |
asOf | Yes | string; date |
Request exampleJSON
{
"openLots": [
{
"lotId": "b2",
"asset": "BTC",
"qty": "1",
"basis": 2000000,
"acquired": "2025-06-01"
}
],
"prices": {
"BTC": 1500000
},
"marginalRate": 0.24,
"jurisdiction": "US",
"asOf": "2026-11-14"
}Response exampleJSON
{
"candidates": [
{
"lotId": "b2",
"unrealisedLoss": 500000,
"estimatedTaxSaving": 120000,
"flags": [
"check_current_wash_sale_rules"
],
"asset": "BTC",
"qty": "1",
"basis": 2000000,
"value": 1500000
}
],
"totalLoss": 500000,
"asOf": "2026-11-14",
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Estimated tax saving is unrealisedLoss × marginalRate only; it is not a filing figure.",
"UK flags the 30-day bed-and-breakfast rule; US flags that wash-sale applicability to digital assets is not decided here.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/tax-loss-harvest" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"openLots": [
{
"lotId": "b2",
"asset": "BTC",
"qty": "1",
"basis": 2000000,
"acquired": "2025-06-01"
}
],
"prices": {
"BTC": 1500000
},
"marginalRate": 0.24,
"jurisdiction": "US",
"asOf": "2026-11-14"
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/derivatives-pnl$0.03 USDCDerivatives realised P/L
Compute realised P/L for linear perpetuals/futures and options including fees and funding from caller trade inputs.
Body
| Field | Required | Notes |
|---|---|---|
trades | Yes | array; Array |
Request exampleJSON
{
"trades": [
{
"id": "p1",
"instrument": "BTC-PERP",
"kind": "linear_future",
"side": "long",
"qty": "0.5",
"entryPrice": 6000000,
"exitPrice": 6200000,
"fees": 3000,
"fundingPayments": [
-1200,
800
]
}
]
}Response exampleJSON
{
"trades": [
{
"id": "p1",
"instrument": "BTC-PERP",
"grossPnl": 100000,
"fees": 3000,
"funding": -400,
"netPnl": 96600
}
],
"total": 96600,
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Linear futures: (exit−entry)×qty for long, reversed for short. Options use caller premium and settlement. Inverse/coin-…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/derivatives-pnl" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"trades": [
{
"id": "p1",
"instrument": "BTC-PERP",
"kind": "linear_future",
"side": "long",
"qty": "0.5",
"entryPrice": 6000000,
"exitPrice": 6200000,
"fees": 3000,
"fundingPayments": [
-1200,
800
]
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/unrealized-snapshot$0.04 USDCUnrealised holdings snapshot
Replay a ledger to a date with a cost-basis method and report holdings, basis, unrealised gain, dust and unpriced assets at caller prices.
Body
| Field | Required | Notes |
|---|---|---|
ledger | Yes | array; Array |
asOf | Yes | string; date-time |
prices | Yes | object |
method | No | string; One of: FIFO, LIFO, HIFO, AVERAGE; Default: "FIFO" |
feePolicy | No | string; One of: add_to_basis_and_deduct_from_proceeds, ignore; Default: "add_to_basis_and_deduct_from_proceeds" |
dustThresholdFiat | No | integer; Default: 100 |
fiatCurrency | No | string; Default: "USD" |
Request exampleJSON
{
"asOf": "2026-12-31T23:59:59Z",
"prices": {
"BTC": 9000000
},
"method": "FIFO",
"dustThresholdFiat": 100,
"fiatCurrency": "USD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
]
}Response exampleJSON
{
"holdings": [
{
"asset": "BTC",
"qty": "0.5",
"basis": 1000000,
"value": 4500000,
"unrealised": 3500000
}
],
"dust": [],
"unpriced": [],
"openLots": [
{
"lotId": "b2",
"asset": "BTC",
"qty": "0.5",
"basis": 1000000,
"acquiredTs": "2025-02-01T00:00:00Z",
"wallet": "w1"
}
],
"asOf": "2026-12-31T23:59:59Z",
"method": "FIFO",
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Holdings replay the ledger to asOf with FIFO. Assets below dustThresholdFiat are listed under dust.",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/unrealized-snapshot" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"asOf": "2026-12-31T23:59:59Z",
"prices": {
"BTC": 9000000
},
"method": "FIFO",
"dustThresholdFiat": 100,
"fiatCurrency": "USD",
"ledger": [
{
"id": "b1",
"ts": "2025-01-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 1000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "b2",
"ts": "2025-02-01T00:00:00Z",
"type": "buy",
"asset": "BTC",
"qty": "1",
"fiatValue": 2000000,
"feeFiat": 0,
"wallet": "w1"
},
{
"id": "s1",
"ts": "2025-03-01T00:00:00Z",
"type": "sell",
"asset": "BTC",
"qty": "1.5",
"fiatValue": 4500000,
"feeFiat": 0,
"wallet": "w1"
}
]
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/exchange-csv-normalize$0.03 USDCNormalize exchange CSV to ledger
Convert a caller CSV export into the shared ledger schema using a caller column mapping, or return a mapping template from headers.
Body
| Field | Required | Notes |
|---|---|---|
csv | Yes | string |
mapping | No | object; Object |
wallet | No | string; Default: "exchange" |
fiatCurrency | No | string; Default: "USD" |
Request exampleJSON
{
"csv": "Date,Type,Asset,Amount,Total\n2026-01-02 10:00:00,Buy,BTC,0.1,4000.00\n",
"mapping": {
"ts": {
"column": "Date",
"format": "yyyy-MM-dd HH:mm:ss",
"timezone": "UTC"
},
"type": {
"column": "Type",
"values": {
"Buy": "buy",
"Sell": "sell"
}
},
"asset": "Asset",
"qty": "Amount",
"fiatValue": {
"column": "Total",
"scale": 100
}
},
"wallet": "exchange-1",
"fiatCurrency": "USD"
}Response exampleJSON
{
"ledger": [
{
"id": "row-2",
"ts": "2026-01-02T10:00:00+00:00",
"type": "buy",
"asset": "BTC",
"qty": "0.1",
"fiatValue": 400000,
"feeFiat": 0,
"wallet": "exchange-1",
"txHash": null,
"counterAsset": null,
"counterQty": null
}
],
"rejectedRows": [],
"mappingTemplate": null,
"fiatCurrency": "USD",
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"RFC 4180 CSV with caller column mapping only. Timestamps are emitted with an offset. No built-in exchange formats are s…",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/exchange-csv-normalize" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"csv": "Date,Type,Asset,Amount,Total\n2026-01-02 10:00:00,Buy,BTC,0.1,4000.00\n",
"mapping": {
"ts": {
"column": "Date",
"format": "yyyy-MM-dd HH:mm:ss",
"timezone": "UTC"
},
"type": {
"column": "Type",
"values": {
"Buy": "buy",
"Sell": "sell"
}
},
"asset": "Asset",
"qty": "Amount",
"fiatValue": {
"column": "Total",
"scale": 100
}
},
"wallet": "exchange-1",
"fiatCurrency": "USD"
}
JSONhttps://www.brainiac.software/api/v1/crypto-tax/missing-basis-detect$0.03 USDCDetect missing basis problems
Replay balances to find disposal-without-acquisition, negative balance, unmatched transfer-in and unpriced events before gains are computed.
Body
| Field | Required | Notes |
|---|---|---|
ledger | Yes | array; Array |
prices | No | object |
Request exampleJSON
{
"ledger": [
{
"id": "s9",
"ts": "2026-01-01T00:00:00Z",
"type": "sell",
"asset": "SOL",
"qty": "1",
"fiatValue": 100,
"feeFiat": 0,
"wallet": "w1"
}
]
}Response exampleJSON
{
"issues": [
{
"asset": "SOL",
"firstTxId": "s9",
"kind": "disposal_without_acquisition"
},
{
"asset": "SOL",
"firstTxId": "s9",
"kind": "negative_balance"
}
],
"ok": false,
"sources": [
{
"source": "Caller-supplied ledger, prices and jurisdiction inputs processed locally",
"url": "https://www.brainiac.software/api/v1/crypto-tax",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Replays balances per asset and reports the earliest offending transaction per asset and kind.",
"Pure computation on caller input: no exchange, wallet, market-price or tax-authority API is called at request time.",
"…"
]
}cURL
curl -i -X POST "https://www.brainiac.software/api/v1/crypto-tax/missing-basis-detect" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"ledger": [
{
"id": "s9",
"ts": "2026-01-01T00:00:00Z",
"type": "sell",
"asset": "SOL",
"qty": "1",
"fiatValue": 100,
"feeFiat": 0,
"wallet": "w1"
}
]
}
JSON