Guide
Send your whole book
Send asset groups, assets, payment plans and payments in the right order, and check each batch.
This guide sends a whole book to Fence: asset groups, assets, payment plans and payments. Each kind names things the one before it declared, so the order matters. You need a token with submissions:write and portfolio:read; the Quickstart shows how to get one.
The order
- Asset groups, if your program has group kinds:
POST …/submissions/asset-groups. - Assets, naming the groups already sent:
POST …/submissions/assets. - Payment plans, for assets already sent:
POST …/submissions/payment-plans. - Payments, disbursements first in date, then collections, returns and dilutions:
POST …/submissions/payments.
A record that names something not sent yet is refused: asset_group_not_declared for a group, asset_not_declared for an asset. Wait until a batch is decided before you send the next kind.
Send each batch
Every send works the same way. This one sends payments:
curl -s -X POST "$FENCE_API/v1/api/asset-programs/$PROGRAM_ID/submissions/payments" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"records": [
{"payment_id": "dA", "type": "disbursement", "currency": "EUR", "asset_id": "L-123",
"gross_amount": "12000.00", "paid_on": "2026-10-01"},
{"payment_id": "cA", "type": "collection", "currency": "EUR", "asset_id": "L-123",
"gross_amount": "1054.99", "paid_on": "2026-11-01", "instalment_keys": ["L-123-1"]}
]}'Each record's fields are in Assets and asset groups, Payment plans and expected payments and Payments and allocation. The fields your program requires in details are in My programs.
Check each batch
- Read the answer's `status`. If it is
refused, the batch's shape is wrong and nothing was applied. Fix it fromreasonsand send it again. - Wait for the records. If it is
accepted, readGET …/submissions/{id}/recordsuntilcounts.receivedis 0. That usually takes a few seconds. - Read the refused records with
?result=refused. Each names its rule and fields. Fix them at the source and send only those records again.
Keep sending
After the first load, send what changes as it happens: new assets, changed details, new plans, and every payment. Send a record again whenever it changes; Fence answers unchanged for one it already holds exactly.
- To remove an asset declared by mistake, send its
asset_idwith aremoval_reason. - To withdraw a payment declared by mistake, send its
payment_idwith awithdrawal_reason.
Both are final: the id can never be used again.