/segments
Base URLhttps://api.babylon.app/v1
GET /segments
List all segments.
Query parameters
- (none)
Example request
GET /segments
Example response — 200
{
"segments" = ["MyGBSegment", "MySASegment"]
}
GET /segments/{segmentLedger}
Fetch all entries in a specific segment ledger.
Path parameters
segmentLedger— segment ledger identifier (case-preserving)
Query parameters
format(optional) —json(default) orcsvcolumns(optional) — comma-separated field names; subset + order applied
Example request (JSON, all fields)
GET /segments/MyGBLedger
Example response — 200 (JSON, columnar)
{
"ledgerId": ["MyGBSegment","MyGBSegment"],
"accountAlias": ["AJBell-ISA","HL-SIPP"],
"type": ["Buy","Buy"],
"quantity": [100,1000],
"symbol": ["PNL","BDZZSM8"],
"netAmount": [531.80,1116.90],
"currency": ["GBP","GBP"],
"settleDate": ["2025-10-10","2025-10-10"],
"bourse": ["XLON","GBFUND"],
"isin": [null,"GB00BDZZSM84"],
"comments": ["Personal Assets Trust","Plain English Finance Fund"],
"tradeDate": [null,null],
"commission": [null,null],
"price": [null,null]
}
Example request (JSON with columns)
GET /segments/MyGBSegment?columns=symbol,quantity,netAmount
Example response — 200 (JSON, ordered subset)
{
"symbol": ["PNL","BDZZSM8"],
"quantity": [100,1000],
"netAmount": [531.80,1116.90]
}
Example request (CSV with columns)
GET /segments/MyGBSegment?format=csv&columns=symbol,quantity,netAmount
Example response — 200 (CSV, ordered subset)
symbol,quantity,netAmount
PNL,100,531.80
BDZZSM8,1000,1116.90
POST /segments
Append rows to a segment ledger.
Body
{ "data": <columnar JSON object | CSV string> }
Example request (columnar JSON)
POST /segments
{
"data": {
"segmentId": ["MyGBSegment"],
"accountAlias": ["AJBell-ISA"],
"type": ["Buy"],
"quantity": [100],
"symbol": ["PNL"],
"netAmount": [531.80],
"currency": ["GBP"],
"settleDate": ["2025-10-10"],
"bourse": ["XLON"],
"isin": [null],
"comments": ["Initial investment"],
"tradeDate": [null],
"commission": [null],
"price": [null]
}
}
Example response — 201
{
"status": "created",
"segmentId": "MyGBSegment"
}
Example request (CSV string in data)
POST /v1/segments
{
"data": "accountAlias,type,quantity,symbol,netAmount,currency,settleDate,bourse,isin,comments,tradeDate,commission,price\nAJBell-ISA,Buy,100,PNL,531.80,GBP,2025-10-10,XLON,,Initial investment,,,"
}
Example response — 201
{
"status": "created",
"segmentId": "MyGBSegment"
}
PUT /segments/{segmentLedger}
Create or fully replace a segment ledger.
Path parameters
segmentLedger— segment to create or replace
Semantics
- 201 Created if new
- 200 OK if replaced
Body
{ "data": <columnar JSON | CSV string> }
Example request (columnar JSON)
PUT /segments/MyGBSegment
{
"data": {
"segmentLedger": ["MyGBSegment"],
"accountAlias": ["AJBell-ISA"],
"type": ["Buy"],
"quantity": [100],
"symbol": ["PNL"],
"netAmount": [531.80],
"currency": ["GBP"],
"settleDate": ["2025-10-10"],
"bourse": ["XLON"],
"isin": [null],
"comments": ["Initial investment"],
"tradeDate": [null],
"commission": [null],
"price": [null]
}
}
Example response — 200/201
{
"status": "ok",
"segmentLedger": "MyGBSegment",
"rows": 1
}
Example request (CSV string)
PUT /segments/MyGBSegment
{
"data": "accountAlias,type,quantity,symbol,netAmount,currency,settleDate,bourse,isin,comments,tradeDate,commission,price\nAJBell-ISA,Buy,100,PNL,531.80,GBP,2025-10-10,XLON,,Initial investment,,,"
}
Example response — 200/201
{
"status": "ok",
"segmentLedger": "MyGBSegment",
"rows": 1
}
DELETE /segments/{segmentLedger}
Delete a segment.
Example request
DELETE /segments/MyGBSegment
Example response — 200
{
"status": "deleted",
"segmentLedger": "MyGBSegment"
}