/compute/capital-gains-uk
Base URL
https://api.babylon.app/v1
POST /compute/capital-gains-uk
Compute capital gains for an HMRC tax year. The calculation excludes ISA and SIPP accounts and excludes UK gilts.
JSON request body
segmentLedger(required) — segment-ledger identifier.taxYear(required) — tax year such as2024/25or2024/2025.valueDate(optional) — valuation date inYYYY-MM-DDformat; defaults to the current date.target(optional) —CapitalGains(default),ExplainGainsorExcelExplain.
Example request
POST /compute/capital-gains-uk
Content-Type: application/json
{
"segmentLedger": "MyGBSegment",
"taxYear": "2024/25",
"valueDate": "2025-04-05"
}
Example response — 200
The default CapitalGains target returns a table.
{
"name": "CapitalGains",
"description": "Capital gains on ledger MyGBSegment under HMRC for tax year 2024/25.",
"columns": ["accountAlias", "accountType", "bourseSymbol", "isin", "securityType", "description", "tradeDate", "settleDate", "costBasis", "netProceeds", "capitalGain", "currency", "capitalGainInBase", "baseCurrency", "taxYear", "taxAuthority"],
"columnTypes": {
"costBasis": "Decimal",
"netProceeds": "Decimal",
"capitalGain": "Decimal",
"capitalGainInBase": "Decimal"
},
"rows": [
{
"accountAlias": "Broker-GIA",
"accountType": "GIA",
"bourseSymbol": "LSE:VOD",
"isin": "GB00BH4HKS39",
"securityType": "SHRS",
"description": "Vodafone Group PLC",
"tradeDate": "2024-10-01",
"settleDate": "2024-10-03",
"costBasis": "900.00",
"netProceeds": "1100.00",
"capitalGain": "200.00",
"currency": "GBP",
"capitalGainInBase": "200.00",
"baseCurrency": "GBP",
"taxYear": "2024/25",
"taxAuthority": "HMRC"
}
]
}
ExplainGains returns a JSON array of per-security calculation tables. ExcelExplain returns a drill-down report in JSON, or an XLSX workbook when requested with Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
The default table can be requested as CSV with Accept: text/csv.
GET /compute/capital-gains-uk
GET supplies the same operation parameters in the query string.
GET /compute/capital-gains-uk?segmentLedger=MyGBSegment&taxYear=2024%2F25&valueDate=2025-04-05
The response depends on target in the same way as the POST response.