This document outlines the available endpoints based on the provided controllers (LoginController and RegisterController).
Base URL Placeholder: http://localhost:8000
Authenticates a user and returns a JWT token.
POST /login
Content-Type: application/json
{
"email": "john.doe@example.com",
"password": "securepassword123"
}
curl --location 'http://localhost:8000/login' \
--header 'Content-Type: application/json' \
--data '{
"email": "john.doe@example.com",
"password": "securepassword123"
}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_OK",
"data": {
"token": "<jwt>",
"user_id": 1,
"company_id": 1
}
}
{
"status": "fail",
"message": "Invalid credentials",
"code": "E_VALIDATE"
}
Creates a new user account in the database.
POST /register
Content-Type: application/json
{
"username": "John Doe",
"email": "john.doe@example.com",
"password": "securepassword123",
"phone": "+15550199",
"address": "123 Tech Street",
"city": "Silicon Valley",
"state": "CA",
"zip": "94000",
"country": "USA",
"kyc": 1,
"birthdate": 631152000,
"cpf": "12345678900",
"company_id": 1,
"role_id": 2
}
curl --location 'http://localhost:8000/register' \
--header 'Content-Type: application/json' \
--data '{
"username": "John Doe",
"email": "john.doe@example.com",
"password": "securepassword123",
"phone": "+15550199",
"address": "123 Tech Street",
"city": "Silicon Valley",
"state": "CA",
"zip": "94000",
"country": "USA",
"kyc": 1,
"birthdate": 631152000,
"cpf": "12345678900",
"company_id": 1,
"role_id": 1
}'
{
"status": "success",
"code": "S_CREATED",
"data": {
"user_id": 45,
"user_name": "John Doe",
"user_email": "john.doe@example.com",
"company_id": 1,
"role_id": 2
}
}
Email already exists
{
"status": "fail",
"message": "Missing field: phone",
"code": "E_VALIDATE"
}
Creates a company, a user linked to it, and a wallet (address/publicKey/privateKey) in a single transaction. Public endpoint (no auth).
POST /company/user/create
Content-Type: application/json
{
"company_name": "Acme Corp",
"username": "John Doe",
"email": "john.doe@example.com",
"password": "secret123",
"phone": "+55 11 99999-9999",
"address": "Rua A, 123",
"city": "Sao Paulo",
"state": "SP",
"zip": "01234-567",
"country": "BR",
"kyc": 1,
"birthdate": 631152000,
"cpf": "123.456.789-00",
"cnpj": "00000000000001"
}
curl --location 'http://localhost:8000/company/user/create' \
-H 'Content-Type: application/json' \
--data '{
"company_name": "MixTech",
"username": "LuvasLuvas",
"email": "Luvas@email.com",
"password": "secret123",
"phone": "+55 16 93939-2222",
"address": "Rua A, 123",
"city": "Sao Paulo",
"state": "SP",
"zip": "01234-567",
"country": "BR",
"kyc": 1,
"birthdate": 631152000,
"cpf": "12345678900",
"cnpj": "00000000000030"
}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_CREATED",
"data": {
"company_id": 1,
"role_id": 1,
"user": {
"user_id": 1,
"user_name": "John Doe",
"user_email": "john.doe@example.com",
"company_id": 1,
"role_id": 1
},
"wallet_id": 1,
"wallet_address": "0x8AC9615b1a555BeA2938778aAef1ead35205c167"
}
}
{
"status": "failed",
"msg": "Password must be at least 8 characters",
"code": "E_VALIDATE",
"data": []
}
{
"status": "failed",
"msg": "Wallet generation failed",
"code": "E_INTERNAL",
"data": []
}
Updates the authenticated user's email. Requires JWT.
POST /user/change-email
Content-Type: application/json
Authorization: Bearer <JWT>
{
"email": "new.email@example.com"
}
curl --location 'http://localhost:8000/user/change-email' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <JWT>' \
--data '{"email":"new.email@example.com"}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_UPDATED",
"data": {
"user_id": 1,
"user_email": "new.email@example.com"
}
}
{
"status": "failed",
"msg": "Email already in use or update failed",
"code": "E_VALIDATE",
"data": []
}
{
"status": "failed",
"msg": "Unauthorized",
"code": "E_VALIDATE",
"data": []
}
Changes the authenticated user's password. Requires JWT.
POST /user/change-password
Content-Type: application/json
Authorization: Bearer <JWT>
{
"current_password": "minhaSenhaAtual",
"new_password": "novaSenhaForte123"
}
curl --location 'http://localhost:8000/user/change-password' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <JWT>' \
--data '{"current_password":"minhaSenhaAtual","new_password":"novaSenhaForte123"}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_UPDATED",
"data": {
"user_id": 1
}
}
{
"status": "failed",
"msg": "Invalid current password or update failed",
"code": "E_VALIDATE",
"data": []
}
{
"status": "failed",
"msg": "Unauthorized",
"code": "E_VALIDATE",
"data": []
}
Returns all commodities. No request body required. Requires JWT.
POST /commodities/get
Authorization: Bearer <JWT>
curl --location -X POST 'http://localhost:8000/commodities/get' \
-H 'Authorization: Bearer <JWT>'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_OK",
"data": [
{
"commodities_id": 1,
"name": "Gold",
"flag": "a"
}
]
}
{
"status": "fail",
"msg": "Commodities Not Found",
"code": "E_DATABASE",
"data": []
}
Creates a new commodity.
POST /commodity/create
Content-Type: application/json
{
"name": "Gold",
"flag": "a"
}
curl --location 'http://localhost:8000/commodity/create' \
-H 'Content-Type: application/json' \
--data '{
"name": "Gold",
"flag": "a"
}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_CREATED",
"data": {
"commodities_id": 10,
"name": "Gold",
"flag": "a"
}
}
{
"status": "fail",
"msg": "Validation failed: name is required",
"code": "E_VALIDATE",
"data": []
}
Updates an existing commodity.
POST /commodity/update
Content-Type: application/json
{
"commodities_id": 10,
"name": "Silver",
"flag": "b"
}
You may send only name, only flag, or both.
curl --location 'http://localhost:8000/commodity/update' \
-H 'Content-Type: application/json' \
--data '{
"commodities_id": 10,
"name": "Silver",
"flag": "b"
}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_UPDATED",
"data": {
"commodities_id": 10,
"name": "Silver",
"flag": "b"
}
}
No fields to update
{
"status": "fail",
"msg": "Validation failed: nothing to update",
"code": "E_VALIDATE",
"data": []
}
{
"status": "fail",
"msg": "Commodity Not Found or Not Updated",
"code": "E_DATABASE",
"data": []
}
Deletes a commodity by ID.
POST /commodity/delete
Content-Type: application/json
{
"commodities_id": 10
}
curl --location 'http://localhost:8000/commodity/delete' \
-H 'Content-Type: application/json' \
--data '{"commodities_id":10}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_DELETED",
"data": {
"deleted": true
}
}
{
"status": "fail",
"msg": "Validation failed: invalid commodities_id",
"code": "E_VALIDATE",
"data": []
}
{
"status": "fail",
"msg": "Commodity Not Found",
"code": "E_DATABASE",
"data": []
}
Returns all tokens filtered by token_uf and commodities_name. Requires JWT.
POST /token/get
Content-Type: application/json
Authorization: Bearer <JWT>
{
"token_uf": "SP",
"commodities_name": "soja"
}
curl --location 'http://localhost:8000/token/get' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <JWT>' \
--data '{
"token_uf": "SP",
"commodities_name": "soja"
}'
{
"status": "ok",
"msg": "[100] Request ok.",
"code": "S_OK",
"data": [
{
"token_id": 1,
"token_external_id": "abc123",
"token_commodities_amount": 1000,
"token_commodities_value": 5000,
"token_uf": "SP",
"token_city": "Sao Paulo",
"token_content": "financial instrument",
"token_flag": "a",
"wallet_id": 1,
"chain_id": 1,
"commodities_id": 1,
"cpr_id": 1,
"user_id": 1
}
]
}
{
"status": "fail",
"msg": "Token Not Found",
"code": "E_DATABASE",
"data": []
}
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.
POST /b3/cpr/register
Content-Type: application/json
Authorization: Bearer <JWT>
{
"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 --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"]
}'
Returns the JSON body from B3.
Returned if the JSON is invalid or CPR payload is missing.
Returned if the JWT is missing/invalid.
Returned if the request to B3 fails.