/api/rpa/previewCalculate without issuing
Calculates the withholding without persisting anything: no receipt is created and no number is consumed. This is the recommended step before confirming a payment — in an RPA the provider receives less than the agreed amount, and issuing cannot be undone (a reversal does not return the number). Preview is never blocked: if a year's table has not been validated yet, it still calculates and flags this in avisos, while /create refuses.
Required headers
tokenstring | string | Issuing company token |
signstring | string | MD5 signature: MD5(token + path + body + timestamp) |
timestampstring | string | Unix timestamp in seconds |
Body
prestadorId*string | string | Provider ID (returned by /prestador/save) |
dataPagamento*string | string | Date of payment (YYYY-MM-DD). Defines the period — cash basis |
valorBruto*decimal | decimal | Gross amount of the service |
outrasDeducoesdecimal | decimal | Alimony and similar deductions |
baseInssOutrosTomadoresdecimal | decimal | INSS base already consumed by other payers in the period. It is a monthly total, taken from the provider's proof of withholding — the INSS ceiling belongs to the person, not to the payer |
valorInssOutrosTomadoresdecimal | decimal | INSS already withheld by other payers (informational) |
* Required field.
acumulado is the total of the receipts already issued and not reversed for the same CPF in the period, excluding this simulation; memoria is a text describing the calculation; avisos lists notices, for example that the INSS ceiling of the month has been reached or that the year's table has not been confirmed by accounting.
Common errors
| Message | Cause |
|---|---|
| prestadorId inválido / prestadorId无效 | Not a valid ObjectId |
| dataPagamento deve estar no formato AAAA-MM-DD / dataPagamento格式须为YYYY-MM-DD | Missing or not in YYYY-MM-DD format |
| valorBruto deve ser maior que zero / valorBruto必须大于零 | valorBruto missing or not greater than 0 |
| valores de dedução não podem ser negativos / 扣除金额不能为负 | outrasDeducoes, baseInssOutrosTomadores or valorInssOutrosTomadores is negative |
| Prestador não encontrado / 未找到该服务提供方 | The provider of prestadorId does not exist or does not belong to the company |
| Prestador está inativo / 该服务提供方已停用 | The provider is inactive (ativo = false) |
Examples
# sign = md5(token + path + body + timestamp) # Template generated from the endpoint path; replace the placeholders curl -X POST "https://api.tffiscal.com/api/rpa/preview" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"prestadorId": "66c1f0a2e4b0a1c2d3e4f5a6",
"dataPagamento": "2026-08-20",
"valorBruto": 3000.00,
"outrasDeducoes": 0,
"baseInssOutrosTomadores": 0,
"valorInssOutrosTomadores": 0
}
{
"success": true,
"message": "成功",
"data": {
"competencia": 202608,
"calculo": {
"valorBruto": 3000.00,
"baseInss": 3000.00,
"aliquotaInssSegurado": 0.11,
"valorInssSegurado": 330.00,
"aliquotaInssPatronal": 0.20,
"valorInssPatronal": 600.00,
"baseInssOutrosTomadores": 0.00,
"baseIrrf": 2392.80,
"baseIrrfAcumulada": 2392.80,
"aliquotaIrrf": 0.00,
"parcelaDeduzirIrrf": 0.00,
"qtdDependentes": 0,
"valorDeducaoDependentes": 0.00,
"outrasDeducoes": 0.00,
"valorDescontoSimplificado": 607.20,
"usouDescontoSimplificado": true,
"irrfApuradoAcumulado": 0.00,
"valorRedutorIrrf": 0.00,
"valorIrrf": 0.00,
"valorLiquido": 2670.00,
"custoTotalEmpresa": 3600.00,
"tabelaAno": 2026,
"memoria": "...",
"avisos": []
},
"acumulado": {
"qtdRecibos": 0,
"valorBruto": 0.00,
"baseInss": 0.00,
"valorInssSegurado": 0.00,
"baseIrrf": 0.00,
"valorIrrf": 0.00,
"outrasDeducoes": 0.00
}
}
}