|
|
@@ -741,3 +741,294 @@ curl --location 'http://localhost:8000/token/get' \
|
|
|
"data": []
|
|
|
}
|
|
|
```
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 11. B3 — CPR Register
|
|
|
+
|
|
|
+Receives a CPR payload in the **flat** format used by our database, saves it in the `cpr` table, converts it to the B3 nested format, automatically obtains a B3 access token (mTLS), and sends it to the B3 CPR registration endpoint.
|
|
|
+
|
|
|
+### **Endpoint**
|
|
|
+
|
|
|
+`POST /b3/cpr/register`
|
|
|
+
|
|
|
+### **Headers**
|
|
|
+
|
|
|
+`Content-Type: application/json`
|
|
|
+
|
|
|
+`Authorization: Bearer <JWT>`
|
|
|
+
|
|
|
+### **Request Body (JSON)**
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "cpr": {
|
|
|
+ "cpr_type_code": "P",
|
|
|
+ "cpr_otc_register_account_code": "64359.40-5",
|
|
|
+ "cpr_otc_payment_agent_account_code": "64359.40-5",
|
|
|
+ "cpr_otc_custodian_account_code": "64359.00-3",
|
|
|
+ "cpr_internal_control_number": "NA",
|
|
|
+ "cpr_electronic_emission_indicator": "SIM",
|
|
|
+ "cpr_isin_code": "NA",
|
|
|
+ "cpr_issue_date": "2025-11-28",
|
|
|
+ "cpr_maturity_date": "2026-09-30",
|
|
|
+ "cpr_issue_quantity": 1,
|
|
|
+ "cpr_issue_value": 1710000.00,
|
|
|
+ "cpr_issue_financial_value": 1710000.00,
|
|
|
+ "cpr_unit_value": 1710000.00,
|
|
|
+ "cpr_reference_date": "2025-12-09",
|
|
|
+ "cpr_profitability_start_date": "2025-12-09",
|
|
|
+ "cpr_automatic_expiration_indicator": "NÃO",
|
|
|
+ "cpr_collateral_type_code": "Penhor",
|
|
|
+ "cpr_collateral_type_name": "NA",
|
|
|
+ "cpr_constitution_process_indicator": "SIM",
|
|
|
+ "cpr_otc_bondsman_account_code": "NA",
|
|
|
+ "cpr_collaterals_document_number": "NA",
|
|
|
+ "cpr_product_name": "MILHO",
|
|
|
+ "cpr_product_class_name": "MILHO (EM GRAOS)",
|
|
|
+ "cpr_product_harvest": "2026/2026",
|
|
|
+ "cpr_product_description": "Milho brasileiro em grãos, tipo exportação.",
|
|
|
+ "cpr_product_quantity": 2700000,
|
|
|
+ "cpr_measure_unit_name": "QUILO",
|
|
|
+ "cpr_packaging_way_name": "SACA (60 KG)",
|
|
|
+ "cpr_product_status_code": "A PRODUZIR",
|
|
|
+ "cpr_production_type_code": "PROPRIA",
|
|
|
+ "cpr_issuer_name": "MARCELO VINCENZI",
|
|
|
+ "cpr_finality_code": "NA",
|
|
|
+ "cpr_ipoc_code": "NA",
|
|
|
+ "cpr_calculation_type_code": "NA",
|
|
|
+ "cpr_initial_exchange_value": "NA",
|
|
|
+ "cpr_fixing_type_code": "NA",
|
|
|
+ "cpr_data_source_type_code": "NA",
|
|
|
+ "cpr_adjustment_frequency_type_code": "NA",
|
|
|
+ "cpr_adjustment_pro_rata_type_code": "NA",
|
|
|
+ "cpr_adjustment_type_code": "NA",
|
|
|
+ "cpr_creditor_name": "TOO EASY TRADING LTDA",
|
|
|
+ "cpr_ballast_type_code": "NA",
|
|
|
+ "cpr_lot_number": "NA",
|
|
|
+ "cpr_ballast_quantity": "NA",
|
|
|
+ "cpr_currency_code": "NA",
|
|
|
+ "cpr_transaction_identification": "NA",
|
|
|
+ "cpr_additional_text": "NA",
|
|
|
+ "cpr_number": "NA",
|
|
|
+ "cpr_contract_number": "NA",
|
|
|
+ "cpr_event_type_code": "NA",
|
|
|
+ "cpr_event_original_date": "NA",
|
|
|
+ "cpr_unit_price_value": 1710000.00,
|
|
|
+ "cpr_interest_unit_price_value": 0.00,
|
|
|
+ "cpr_residual_value": "NA",
|
|
|
+ "cpr_amortization_percentage": "NA",
|
|
|
+ "cpr_event_quantity": "NA",
|
|
|
+ "cpr_production_place_name": "FAZENDA CORAÇÃO DE MARIA",
|
|
|
+ "cpr_property_registration_number": "14406",
|
|
|
+ "cpr_notary_name": "NA",
|
|
|
+ "cpr_total_production_area_in_hectares_number": "NA",
|
|
|
+ "cpr_total_area_in_hectares_number": 670,
|
|
|
+ "cpr_car_code": "NA",
|
|
|
+ "cpr_latitude_code": "NA",
|
|
|
+ "cpr_longitude_code": "NA",
|
|
|
+ "cpr_zip_code": "78560000",
|
|
|
+ "cpr_green_cpr_indicator": "NA",
|
|
|
+ "cpr_green_cpr_certificate_name": "NA",
|
|
|
+ "cpr_green_cpr_certificate_cnpj_number": "NA",
|
|
|
+ "cpr_green_cpr_georeferencing_description": "NA",
|
|
|
+ "cpr_green_cpr_declaration_indicator": "NA",
|
|
|
+ "cpr_document_deadline_days_number": "NA",
|
|
|
+ "cpr_place_name": "NA",
|
|
|
+ "cpr_guarantee_limit_type_code": "NA",
|
|
|
+ "cpr_mother_code": "NA",
|
|
|
+ "cpr_issuers_person_type_acronym": "PF",
|
|
|
+ "cpr_issuers_state_acronym": "MT",
|
|
|
+ "cpr_issuers_city_name": "SINOP",
|
|
|
+ "cpr_issuers_ibge_code": "NA",
|
|
|
+ "cpr_issuer_legal_nature_code": "02",
|
|
|
+ "cpr_otc_favored_account_code": "64359.00-3",
|
|
|
+ "cpr_issuers_document_number": "867.308.271-49",
|
|
|
+ "cpr_deposit_person_type_acronym": "PF",
|
|
|
+ "cpr_self_number": "NA",
|
|
|
+ "cpr_settlement_modality_type_code": "NA",
|
|
|
+ "cpr_otc_settlement_bank_account_code": "NA",
|
|
|
+ "cpr_deposit_quantity": 1,
|
|
|
+ "cpr_deposit_unit_price_value": "NA",
|
|
|
+ "cpr_payment_method_code": "NA",
|
|
|
+ "cpr_index_code": "NA",
|
|
|
+ "cpr_index_short_name": "NA",
|
|
|
+ "cpr_vcp_indicator_type_code": "NA",
|
|
|
+ "cpr_indexador_percentage_value": "NA",
|
|
|
+ "cpr_interest_rate_spread_percentage": "NA",
|
|
|
+ "cpr_interest_rate_criteria_type_code": "NA",
|
|
|
+ "cpr_interest_payment_date": "NA",
|
|
|
+ "cpr_interest_payment_value": "NA",
|
|
|
+ "cpr_interest_payment_frequency_code": "NA",
|
|
|
+ "cpr_interest_months_quantity": "NA",
|
|
|
+ "cpr_interestPaymentFlow_time_unit_type_code": "NA",
|
|
|
+ "cpr_interestPaymentFlow_deadline_type_code": "NA",
|
|
|
+ "cpr_payment_start_date": "NA",
|
|
|
+ "cpr_amortization_type_code": "NA",
|
|
|
+ "cpr_amortization_months_quantity": "NA",
|
|
|
+ "cpr_amortizationPaymentFlow_time_unit_type_code": "NA",
|
|
|
+ "cpr_amortizationPaymentFlow_deadline_type_code": "NA",
|
|
|
+ "cpr_amortization_start_date": "NA",
|
|
|
+ "cpr_scr_type_code": "N",
|
|
|
+ "cpr_scr_customer_detail": "NA",
|
|
|
+ "cpr_scr_person_type_acronym": "NA",
|
|
|
+ "cpr_deposit_document_number": "NA",
|
|
|
+ "cpr_scr_document_number": "NA",
|
|
|
+ "cpr_creditor_document_number": "47.175.222/0001-09",
|
|
|
+ "cpr_contract_code": "00700",
|
|
|
+ "cpr_operation_modality_type_code": "NA",
|
|
|
+ "cpr_bacen_reference_code": "NA",
|
|
|
+ "cpr_deliveryPlace_state_acronym": "MT",
|
|
|
+ "cpr_deliveryPlace_city_name": "PORTO DOS GAÚCHOS",
|
|
|
+ "cpr_deliveryPlace_ibge_code": "NA FAZENDA EM PRODUÇÃO",
|
|
|
+ "cpr_children_codes": ["NA"]
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+### **cURL Example**
|
|
|
+
|
|
|
+```bash
|
|
|
+curl --location 'http://localhost:8000/b3/cpr/register' \
|
|
|
+ -H 'Content-Type: application/json' \
|
|
|
+ -H 'Authorization: Bearer <JWT>' \
|
|
|
+ --data '{
|
|
|
+ "cpr_type_code": "P",
|
|
|
+ "cpr_otc_register_account_code": "64359.40-5",
|
|
|
+ "cpr_otc_payment_agent_account_code": "64359.40-5",
|
|
|
+ "cpr_otc_custodian_account_code": "64359.00-3",
|
|
|
+ "cpr_internal_control_number": "NA",
|
|
|
+ "cpr_electronic_emission_indicator": "SIM",
|
|
|
+ "cpr_isin_code": "NA",
|
|
|
+ "cpr_issue_date": "2025-11-28",
|
|
|
+ "cpr_maturity_date": "2026-09-30",
|
|
|
+ "cpr_issue_quantity": 1,
|
|
|
+ "cpr_issue_value": 1710000.00,
|
|
|
+ "cpr_issue_financial_value": 1710000.00,
|
|
|
+ "cpr_unit_value": 1710000.00,
|
|
|
+ "cpr_reference_date": "2025-12-09",
|
|
|
+ "cpr_profitability_start_date": "2025-12-09",
|
|
|
+ "cpr_automatic_expiration_indicator": "NÃO",
|
|
|
+ "cpr_collateral_type_code": "Penhor",
|
|
|
+ "cpr_collateral_type_name": "NA",
|
|
|
+ "cpr_constitution_process_indicator": "SIM",
|
|
|
+ "cpr_otc_bondsman_account_code": "NA",
|
|
|
+ "cpr_collaterals_document_number": "NA",
|
|
|
+ "cpr_product_name": "MILHO",
|
|
|
+ "cpr_product_class_name": "MILHO (EM GRAOS)",
|
|
|
+ "cpr_product_harvest": "2026/2026",
|
|
|
+ "cpr_product_description": "Milho brasileiro em grãos, tipo exportação.",
|
|
|
+ "cpr_product_quantity": 2700000,
|
|
|
+ "cpr_measure_unit_name": "QUILO",
|
|
|
+ "cpr_packaging_way_name": "SACA (60 KG)",
|
|
|
+ "cpr_product_status_code": "A PRODUZIR",
|
|
|
+ "cpr_production_type_code": "PROPRIA",
|
|
|
+ "cpr_issuer_name": "MARCELO VINCENZI",
|
|
|
+ "cpr_finality_code": "NA",
|
|
|
+ "cpr_ipoc_code": "NA",
|
|
|
+ "cpr_calculation_type_code": "NA",
|
|
|
+ "cpr_initial_exchange_value": "NA",
|
|
|
+ "cpr_fixing_type_code": "NA",
|
|
|
+ "cpr_data_source_type_code": "NA",
|
|
|
+ "cpr_adjustment_frequency_type_code": "NA",
|
|
|
+ "cpr_adjustment_pro_rata_type_code": "NA",
|
|
|
+ "cpr_adjustment_type_code": "NA",
|
|
|
+ "cpr_creditor_name": "TOO EASY TRADING LTDA",
|
|
|
+ "cpr_ballast_type_code": "NA",
|
|
|
+ "cpr_lot_number": "NA",
|
|
|
+ "cpr_ballast_quantity": "NA",
|
|
|
+ "cpr_currency_code": "NA",
|
|
|
+ "cpr_transaction_identification": "NA",
|
|
|
+ "cpr_additional_text": "NA",
|
|
|
+ "cpr_number": "NA",
|
|
|
+ "cpr_contract_number": "NA",
|
|
|
+ "cpr_event_type_code": "NA",
|
|
|
+ "cpr_event_original_date": "NA",
|
|
|
+ "cpr_unit_price_value": 1710000.00,
|
|
|
+ "cpr_interest_unit_price_value": 0.00,
|
|
|
+ "cpr_residual_value": "NA",
|
|
|
+ "cpr_amortization_percentage": "NA",
|
|
|
+ "cpr_event_quantity": "NA",
|
|
|
+ "cpr_production_place_name": "FAZENDA CORAÇÃO DE MARIA",
|
|
|
+ "cpr_property_registration_number": "14406",
|
|
|
+ "cpr_notary_name": "NA",
|
|
|
+ "cpr_total_production_area_in_hectares_number": "NA",
|
|
|
+ "cpr_total_area_in_hectares_number": 670,
|
|
|
+ "cpr_car_code": "NA",
|
|
|
+ "cpr_latitude_code": "NA",
|
|
|
+ "cpr_longitude_code": "NA",
|
|
|
+ "cpr_zip_code": "78560000",
|
|
|
+ "cpr_green_cpr_indicator": "NA",
|
|
|
+ "cpr_green_cpr_certificate_name": "NA",
|
|
|
+ "cpr_green_cpr_certificate_cnpj_number": "NA",
|
|
|
+ "cpr_green_cpr_georeferencing_description": "NA",
|
|
|
+ "cpr_green_cpr_declaration_indicator": "NA",
|
|
|
+ "cpr_document_deadline_days_number": "NA",
|
|
|
+ "cpr_place_name": "NA",
|
|
|
+ "cpr_guarantee_limit_type_code": "NA",
|
|
|
+ "cpr_mother_code": "NA",
|
|
|
+ "cpr_issuers_person_type_acronym": "PF",
|
|
|
+ "cpr_issuers_state_acronym": "MT",
|
|
|
+ "cpr_issuers_city_name": "SINOP",
|
|
|
+ "cpr_issuers_ibge_code": "NA",
|
|
|
+ "cpr_issuer_legal_nature_code": "02",
|
|
|
+ "cpr_otc_favored_account_code": "64359.00-3",
|
|
|
+ "cpr_issuers_document_number": "867.308.271-49",
|
|
|
+ "cpr_deposit_person_type_acronym": "PF",
|
|
|
+ "cpr_self_number": "NA",
|
|
|
+ "cpr_settlement_modality_type_code": "NA",
|
|
|
+ "cpr_otc_settlement_bank_account_code": "NA",
|
|
|
+ "cpr_deposit_quantity": 1,
|
|
|
+ "cpr_deposit_unit_price_value": "NA",
|
|
|
+ "cpr_payment_method_code": "NA",
|
|
|
+ "cpr_index_code": "NA",
|
|
|
+ "cpr_index_short_name": "NA",
|
|
|
+ "cpr_vcp_indicator_type_code": "NA",
|
|
|
+ "cpr_indexador_percentage_value": "NA",
|
|
|
+ "cpr_interest_rate_spread_percentage": "NA",
|
|
|
+ "cpr_interest_rate_criteria_type_code": "NA",
|
|
|
+ "cpr_interest_payment_date": "NA",
|
|
|
+ "cpr_interest_payment_value": "NA",
|
|
|
+ "cpr_interest_payment_frequency_code": "NA",
|
|
|
+ "cpr_interest_months_quantity": "NA",
|
|
|
+ "cpr_interestPaymentFlow_time_unit_type_code": "NA",
|
|
|
+ "cpr_interestPaymentFlow_deadline_type_code": "NA",
|
|
|
+ "cpr_payment_start_date": "NA",
|
|
|
+ "cpr_amortization_type_code": "NA",
|
|
|
+ "cpr_amortization_months_quantity": "NA",
|
|
|
+ "cpr_amortizationPaymentFlow_time_unit_type_code": "NA",
|
|
|
+ "cpr_amortizationPaymentFlow_deadline_type_code": "NA",
|
|
|
+ "cpr_amortization_start_date": "NA",
|
|
|
+ "cpr_scr_type_code": "N",
|
|
|
+ "cpr_scr_customer_detail": "NA",
|
|
|
+ "cpr_scr_person_type_acronym": "NA",
|
|
|
+ "cpr_deposit_document_number": "NA",
|
|
|
+ "cpr_scr_document_number": "NA",
|
|
|
+ "cpr_creditor_document_number": "47.175.222/0001-09",
|
|
|
+ "cpr_contract_code": "00700",
|
|
|
+ "cpr_operation_modality_type_code": "NA",
|
|
|
+ "cpr_bacen_reference_code": "NA",
|
|
|
+ "cpr_deliveryPlace_state_acronym": "MT",
|
|
|
+ "cpr_deliveryPlace_city_name": "PORTO DOS GAÚCHOS",
|
|
|
+ "cpr_deliveryPlace_ibge_code": "NA FAZENDA EM PRODUÇÃO",
|
|
|
+ "cpr_children_codes": ["NA"]
|
|
|
+ }'
|
|
|
+```
|
|
|
+
|
|
|
+### **Responses**
|
|
|
+
|
|
|
+#### **200 OK (Success)**
|
|
|
+
|
|
|
+Returns the JSON body from B3.
|
|
|
+
|
|
|
+#### **400 Bad Request**
|
|
|
+
|
|
|
+Returned if the JSON is invalid or CPR payload is missing.
|
|
|
+
|
|
|
+#### **401 Unauthorized**
|
|
|
+
|
|
|
+Returned if the JWT is missing/invalid.
|
|
|
+
|
|
|
+#### **502 Bad Gateway**
|
|
|
+
|
|
|
+Returned if the request to B3 fails.
|