Skip to main content

Creating a repurchase batch

Creates the batch (assignment) that will group the assets to be repurchased or sold. The batch starts in pending_assets_insertion.

Available on
ProfileHostRequired permission
Managermanager-apiWrite
Consultantconsultant-apiGranted by the integration team
Assignorassignor-apiWrite

Base URL for each host: Environments (Hosts).

Request​

ENDPOINT
/trade_resolve/fund_class/FUND_CLASS_KEY/assignment
METHOD
POST
Request Body
{
"external_id": "931e9437-d025-41ab-bb53-6b94e10fd361",
"assignment_date": "2024-04-01",
"assignment_configuration_key": "d9308a2b-21fa-4724-9bbe-59ae65287b10",
"source_account": {
"document_number": "11.222.333/0001-81"
}
}

Body Params​

FieldTypeDescriptionCharacters
external_id *stringUnique key identifying this batch in the integrating partner's system.Up to 50
assignment_date *stringRepurchase date. Must equal the fund's current accounting date.YYYY-MM-DD
assignment_configuration_keystringKey of the repurchase configuration, provided by QI Tech. Send this or assignment_type.36
assignment_typestringBatch type, when you use the fund's default configuration for that type: assignment_repurchase, wallet_sale or assignment_resolution. Send this or assignment_configuration_key.Up to 50
source_account *objectAccount that will make the payment to the fund-
Batch configuration

Send exactly one of assignment_configuration_key and assignment_type. With neither, the API returns TRR000017; with both, TRR000016.

Source account object​

FieldTypeDescriptionCharacters
document_number *stringCPF or CNPJ, with mask, of whoever will make the payment to the fund. Must be a valid document.14 to 18

Response​

STATUS
201
Response Body
{
"assignment_key": "41d6ff41-1dac-4df7-9e50-d15210ec57f3",
"assignment_status": "pending_assets_insertion"
}
Retry and duplicates

In case of error, resend the request. A duplicate (TRR000015) means the resource already exists: look it up instead of recreating it. Through assignor-api, the lookup is GET /trade_resolve/fund_class/{fund_class_key}/assignment/{external_id}; manager-api and consultant-api do not expose this lookup, so treat TRR000015 as a batch already created and move on to the asset insertion. See Retry and duplicates.

Errors​

StatusCodeWhen it happens
400QIT000001Body outside the contract: missing required field, unknown field, invalid format
400TRR000014assignment_date different from the fund's accounting date
400TRR000002source_account.document_number is not a valid CPF or CNPJ
400TRR000016assignment_configuration_key and assignment_type sent together
400TRR000017Neither assignment_configuration_key nor assignment_type was sent
400TRR000019The repurchase configuration is not active
403TRR000049The agent does not have access to this fund or this repurchase configuration
404TRR000006There is no fund with this fund_class_key
404TRR000013Repurchase configuration not found for the fund (or the fund has no default configuration for the assignment_type)
404TRR000018assignment_type does not exist
409TRR000015A batch with this external_id already exists in the fund

Authentication, permission and host errors: see API errors.