TF Fiscal

RPA Receipts

POST/api/rpa/preview

Calculate 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

tokenstringstringIssuing company token
signstringstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringstringUnix timestamp in seconds

Body

prestadorId*stringstringProvider ID (returned by /prestador/save)
dataPagamento*stringstringDate of payment (YYYY-MM-DD).
valorBruto*decimaldecimalGross amount of the service
outrasDeducoesdecimaldecimalAlimony and similar deductions
baseInssOutrosTomadoresdecimaldecimalINSS base already consumed by other payers in the period.
valorInssOutrosTomadoresdecimaldecimalINSS 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

MessageCause
prestadorId inválido / prestadorId无效Not a valid ObjectId
dataPagamento deve estar no formato AAAA-MM-DD / dataPagamento格式须为YYYY-MM-DDMissing 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