Pular para o conteúdo principal

06 parcelas

Segurança

Para acessar a API, é necessário obter um token de acesso através do fluxo de autenticação OAuth2. Veja mais detalhes em Como obter acesso?

info

Ao gerar o token JWT, não esqueça de utilizar o escopo correto. Caso contrário, a requisição será rejeitada com o código de erro 401 Unauthorized.

Descrição dos campos

CampoTipoDescrição
interest_ratenumberTaxa de juros. No formato "0.0000"
present_valuenumberValor atual
number_of_paymentsnumberNúmero de parcelas
payment_dates[]stringArray de datas. No formato "YYYY-MM-DD"

Requisição

POST https://api-sandbox.catalisa.com.br/calc-engine/api/loan-amortization-schedule-calculator/calculations JWT scope: calculations-engine/calculate

Parâmetros

Sem parâmetros

Cabeçalhos

NomeValor
AuthorizationBearer <token>
Content-Typeapplication/json

Exemplo de Requisição

Corpo da Requisição

{
"data": {
"type": "calculations",
"attributes": {
"interest_rate": 0.0465,
"present_value": 5000,
"number_of_payments": 6,
"payment_dates": [
"2023-07-22",
"2023-08-22",
"2023-09-22",
"2023-10-22",
"2023-11-22",
"2023-12-22"
]
}
}
}

Respostas

CódigoDescrição
201Criado com sucesso. Retorna os dados da tabela de amortização.
401Não autorizado

Exemplo de uso

const headers = new Headers();
headers.append("Authorization", "Bearer <token>");
headers.append("Content-Type", "application/json");

const body = JSON.stringify({
data: {
type: "calculations",
attributes: {
interest_rate: 0.0465,
present_value: 5000,
number_of_payments: 6,
payment_dates: [
"2023-07-22",
"2023-08-22",
"2023-09-22",
"2023-10-22",
"2023-11-22",
"2023-12-22"
]
}
}
});

const requestOptions = {
method: "POST",
headers: headers,
body: body,
};

const response = await fetch(
"https://api-sandbox.catalisa.com.br/calc-engine/api/loan-amortization-schedule-calculator/calculations",
requestOptions
);
const data = await response.json();
console.log(data);

Exemplo de Sucesso

{
"data": {
"id": "668b36db-05a8-4cc0-b441-387ff2a408c4",
"type": "calculations",
"attributes": {
"amortization_schedule": [
{
"payment_number": 1,
"payment_date": "2023-07-22",
"beginning_balance": 5000,
"payment": 974.08874,
"principal_payment": 741.58874,
"interest_payment": 232.5,
"remaining_balance": 4258.4113
},
{
"payment_number": 2,
"payment_date": "2023-08-22",
"beginning_balance": 4258.41126,
"payment": 974.08874,
"principal_payment": 776.07262,
"interest_payment": 198.01612,
"remaining_balance": 3482.3386
},
{
"payment_number": 3,
"payment_date": "2023-09-22",
"beginning_balance": 3482.33864,
"payment": 974.08874,
"principal_payment": 812.15999,
"interest_payment": 161.92875,
"remaining_balance": 2670.1787
},
{
"payment_number": 4,
"payment_date": "2023-10-22",
"beginning_balance": 2670.17865,
"payment": 974.08874,
"principal_payment": 849.92543,
"interest_payment": 124.16331,
"remaining_balance": 1820.2532
},
{
"payment_number": 5,
"payment_date": "2023-11-22",
"beginning_balance": 1820.25322,
"payment": 974.08874,
"principal_payment": 889.44697,
"interest_payment": 84.64177,
"remaining_balance": 930.8063
},
{
"payment_number": 6,
"payment_date": "2023-12-22",
"beginning_balance": 930.80625,
"payment": 974.08874,
"principal_payment": 930.80625,
"interest_payment": 43.28249,
"remaining_balance": 0
}
]
}
}
}