Skip to main content

Settlement Insertion

Endpoint to insert individual settlements into a previously created payment batch. Each settlement represents a payment (full or partial) for an asset in the fund's portfolio — such as installment settlement, amortization, repurchase or interest payment.

Available on
ProfileHostRequired permission
Managermanager-apiWrite
Consultantconsultant-apiCreate Batches
Assignorassignor-apiWrite

Base URL for each host: Environments (Hosts).

Settlement, repurchase and pass-through

Settlement and repurchase use this same endpoint. The collection_origin_type field indicates who paid:

  • borrower — settlement paid by the drawee/debtor.
  • assignor — repurchase paid by the assignor.
  • collection_agent — payment passed through by a collection agent. Requires counter_party_document_number.
  • bankslip — payment received by bankslip.
Where am I in the flow?

This is the 2nd step of the settlement flow. Before this step, you must have created the payment batch. The batch must be in pending_settlements_insertion.

Request​

ENDPOINT
/settlement/fund_class/{fund_class_key}/payment_batch/{external_id}/settlement
METHOD
POST

Path params​

ParameterTypeDescription
external_idstringThe external_id of the payment batch where the settlement will be inserted.
Request Body
{
"asset_type": "ccb",
"total_value": 130.50,
"external_id": "931e9437-d025-41ab-bb53-6b94e10fd361",
"settlement_type": "installment_settlement",
"contract_number": "0123456789/ABC",
"installment_number": 1,
"collection_date": "2025-01-01",
"collection_origin_type": "borrower"
}

Body attributes​

FieldTypeRequiredDescription
asset_typestringrequiredAsset type. See asset_type enumerators. Maximum 255 characters.
total_valuenumberrequiredTotal payment amount, with at most two decimal places. Can be 0 only in installment_settlement, asset_settlement, asset_refund and asset_extension.
external_idstringrequiredUnique key of this settlement within the batch, in the integrating partner's system. Maximum 50 characters.
settlement_typestringrequiredSettlement type. See settlement_type enumerators. Maximum 50 characters.
collection_origin_typestringoptionalWho paid. See collection_origin_type enumerators. When omitted, the default from the fund's settlement configuration applies, if any.
counter_party_document_numberstringconditionalCPF or CNPJ of who paid, with punctuation (14 to 18 characters). Required when collection_origin_type is collection_agent and the fund's settlement configuration does not define a default document. With borrower, bankslip or assignor, when omitted, it is filled in with the document of the asset's drawee or assignor.
contract_numberstringoptionalContract number of the asset. Maximum 50 characters.
asset_external_idstringoptionalUnique asset identification key, provided in the assignment. Maximum 50 characters.
asset_keystringoptionalInternal asset key at QI Tech (UUID, 36 characters).
if_codestringoptionalFinancial instrument code (B3). Maximum 36 characters.
participant_control_numberstringoptionalParticipant control number provided in the assignment. Maximum 50 characters.
installment_numberintegerconditionalInstallment number. See installment identification.
installment_maturity_datestringconditionalInstallment maturity date in YYYY-MM-DD format.
installment_external_idstringconditionalExternal identifier of the installment. Maximum 50 characters.
collection_datestringoptionalPayment date in YYYY-MM-DD format. Field intended for the integrator's own control.
remaining_face_valuenumberoptionalFace value balance remaining in the installment after the payment. Accepted only in installment_amortization and when the settlement affects a single asset.
asset_reduction_valuenumberoptionalAmount to deduct from the asset, when different from the amount paid. Accepted only in installment_amortization and installment_partial_refund. Cannot be greater than total_value.
new_maturity_datestringconditionalNew maturity date, in YYYY-MM-DD format. Required in asset_extension and rejected in the other types.
reversed_settlement_external_idstringconditionalexternal_id of the settlement being reversed. Required in installment_payment_reversal and rejected in the other types.
Difference between external_id fields

The external_id field in the request body refers to the settlement identifier. The external_id field in the URL refers to the payment batch identifier.

Asset and installment identification​

  • Provide exactly one asset identifier: contract_number, asset_external_id, asset_key, if_code or participant_control_number. None or more than one returns an error. Duplicatas and other credit rights do not accept contract_number or if_code; CCBs and other credit operations do not accept participant_control_number.
  • In installment-based settlement types (installment_* and gloss), provide exactly one installment identifier: installment_number, installment_maturity_date or installment_external_id. For CCBs and contracts, installment_external_id alone also identifies the asset.

asset_type enumerators​

ValueDescription
ccbBank Credit Note (Cédula de Crédito Bancário)
cceExport Credit Note (Cédula de Crédito à Exportação)
structured_ccbStructured Bank Credit Note
structured_cceStructured Export Credit Note
structured_nceStructured Export Credit Certificate (Nota de Crédito à Exportação)
structured_cciStructured Real Estate Credit Note
duplicata_mercantilCommercial duplicata (Duplicata Mercantil)
duplicata_servicosService duplicata (Duplicata de Serviços)
discounted_contractDiscounted contract
cteElectronic Bill of Lading (Conhecimento de Transporte Eletrônico)
checkCheck
promissory_notePromissory note
legal_feesLegal fees
debt_acknowledgmentDebt acknowledgment
financing_contractFinancing contract
contractContract

settlement_type enumerators​

ValueDescription
asset_settlementFull settlement of the asset.
asset_amortizationAmortization of the asset.
fine_paymentPayment of interest or late charges on the asset.
asset_refundFull refund of the asset.
asset_partial_refundPartial refund of the asset.
asset_glossGloss (deduction) of the asset.
asset_extensionMaturity extension of duplicatas and other credit rights. Requires new_maturity_date and a single asset.
installment_settlementInstallment settlement.
installment_amortizationInstallment amortization.
installment_fine_paymentPayment of interest or late charges on an installment.
installment_refundFull refund of an installment.
installment_partial_refundPartial refund of an installment.
installment_payment_reversalReversal of the payment of an installment of a CCB or credit operation. Requires reversed_settlement_external_id and installment_number; total_value must equal that of the reversed settlement.
glossGloss (deduction) of an installment.
rco_revenueRCO revenue.

Contracts (debt_acknowledgment, financing_contract, contract) accept only asset_settlement, asset_amortization, installment_settlement and installment_amortization.

collection_origin_type enumerators​

ValueDescription
borrowerSettlement — payment made by the drawee/debtor.
assignorRepurchase — payment made by the assignor.
collection_agentPass-through from a collection agent. Requires counter_party_document_number (or a default document in the fund configuration).
bankslipPayment received by bankslip.

Response​

STATUS
201

The response echoes the fields sent in the body and adds the data computed by QI Tech.

Response Body
{
"asset_type": "ccb",
"total_value": 130.50,
"external_id": "931e9437-d025-41ab-bb53-6b94e10fd361",
"settlement_type": "installment_settlement",
"contract_number": "0123456789/ABC",
"installment_number": 1,
"collection_date": "2025-01-01",
"collection_origin_type": "borrower",
"asset_external_id": "CCB-0001",
"assignor_document_number": "33.444.555/0001-81",
"borrower_document_number": "969.698.790-03",
"status": "validated",
"type": "installment_settlement",
"settlement_key": "b2c3d4e5-f6a7-8901-abcd-ef1234567890",
"total_number_of_units": 1,
"settlement_result": 0.0,
"next_execution_datetime": "2025-01-01 13:00:00.000000",
"counter_party_document_number": "969.698.790-03",
"assets": [
{
"asset_key": "f34e9437-d025-41ab-bb53-6b94e10fd361",
"number_of_units": 1,
"present_value": 1250.00,
"installment_face_value": 130.50
}
]
}

Response attributes​

In addition to the fields sent in the body:

FieldTypeDescription
statusstringSettlement status after insertion: validated or pending_validation. See below.
typestringSettlement type (same value as settlement_type).
settlement_keystringUnique settlement identifier generated by QI Tech (UUID).
total_valuenumberTotal payment amount. Negative in gloss, asset_gloss and installment_payment_reversal.
total_number_of_unitsintegerTotal number of asset units affected by the settlement.
installment_numberintegerNumber of the installment found. Present when applicable.
settlement_resultnumberDifference between the amount paid and the expected amount of the asset or installment. Present when calculated.
contract_number, asset_external_idstringIdentifiers of the asset found in the portfolio (CCBs and contracts).
assignor_document_number, borrower_document_numberstringDocument of the asset's assignor and drawee.
counter_party_document_numberstringDocument of who paid. Present when provided or filled in automatically.
collection_origin_typestringPayment origin. Present when provided or defined by the fund configuration.
next_execution_datetimestringQI Tech processing control. Can be ignored.
denial_reasonstringDiscard reason. Present only in discarded settlements.
assetsarrayAssets affected by the settlement. See assets attributes.

Status in the response:

  • validated — the amount paid is within the tolerance relative to the expected amount of the asset or installment. The settlement will be processed when the batch is paid.
  • pending_validation — the amount paid differs from the expected amount beyond the tolerance and the settlement awaits review by QI Tech. At the end of the review it moves to validated or discarded, and you receive the corresponding settlement webhook. Depending on the fund's settlement configuration, the difference may instead reject the insertion with SET000066.

assets attributes​

FieldTypeDescription
asset_keystringUnique asset identifier (UUID).
number_of_unitsintegerNumber of asset units.
present_valuenumberPresent value of the asset in BRL.
installment_face_valuenumberInstallment face value. Present when applicable.
installment_post_maturity_interest_valuenumberPost-maturity interest value of the installment. Present when applicable.
installment_delay_interest_valuenumberLate interest value of the installment. Present when applicable.
installment_delay_fine_valuenumberLate fine value of the installment. Present when applicable.
total_purchase_valuenumberAcquisition value of the asset. Present when applicable.
maturity_datestringMaturity of the asset. Present when applicable.
contract_numberstringContract number of the asset. Present when applicable.
external_idstringExternal identifier of the asset. Present when applicable.

Retry and duplicates​

If an error occurs, resend the request. A duplicate (SET000013) means the settlement already exists in this batch: look it up through the settlement retrieval instead of recreating it. See Retry and duplicates.

Next steps​

After inserting all desired settlements, the flow continues with:

  1. Batch closure — signal that all settlements have been inserted so that processing can begin.

There is no endpoint to remove an individual settlement. If a settlement was inserted by mistake, discard the batch at closure (batch_status: discarded) and create a new batch with the correct settlements.

Errors​

StatusCodeWhen it happens
404SET000010The batch given in the URL does not exist in this fund.
403SET000028The fund does not belong to your profile.
400SET000026The batch is not in pending_settlements_insertion (it has already been closed or discarded).
400SET000013A settlement with this external_id already exists in the batch. Look it up instead of recreating it.
409SET000053Two simultaneous requests with the same external_id; one of them was saved.
400SET000012Invalid asset_type.
400SET000025Invalid settlement_type.
400SET000014total_value with more than two decimal places, or zero in a type that does not accept zero.
400SET000019No asset identifier was provided.
400SET000020More than one asset identifier, or more than one installment identifier.
400SET000029Installment-based settlement type without installment identification.
400SET000040 / SET000041Settlement type or identifier not accepted for this asset_type.
400SET000022 / SET000023 / SET000047The asset is not active or does not accept this settlement type in its current status.
400SET000086 / SET000087 / SET000088remaining_face_value outside installment_amortization, with more than two decimal places, or with the settlement affecting more than one asset.
400SET000092 / SET000093 / SET000094asset_extension without new_maturity_date, new_maturity_date in another type, or an extension affecting more than one asset.
400SET000112 / SET000113 / SET000114asset_reduction_value outside installment_amortization/installment_partial_refund, with more than two decimal places, or greater than total_value.
400SET000104 / SET000105installment_payment_reversal without reversed_settlement_external_id/installment_number, or reversed_settlement_external_id in another type.
400 / 404 / 409SET000106 to SET000111, SET000115The reversed settlement does not exist, is not settled, is of another type, installment or asset, has already been reversed, or the amount differs.
404SET000015No asset found in the fund's portfolio with the identifier provided.
400SET000035 / SET000042 / SET000052 / SET000060The installment provided does not exist or has no balance in the asset.
400SET000046Another settlement of the same group for the same asset/installment already exists in the same batch.
400SET000080Full settlement of an asset that is already settled (present value zero).
400SET000066Amount paid outside the tolerance and the fund is configured to reject automatically.
400SET000067Invalid collection_origin_type.
400SET000078collection_origin_type is collection_agent without counter_party_document_number.
400SET000001counter_party_document_number is not a valid CPF/CNPJ.
400QIT000001Invalid body (missing required field, wrong type or field not accepted).

Authentication, permission and host errors: see API errors.