TF Fiscal

NF-e Invoices

POST/api/invoice/return

Issue return NF-e

Issues a return NF-e (model 55, purpose 4) from an original NF-e. Two modes are supported: full return (reference the original invoice via uuid or chave — the return is a full clone of the original NF-e) or partial/custom return (send chave + the complete invoice fields in the request body itself, same structure as /api/invoice/create).

Required headers

tokenstringstringIssuing company token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body — fields always read from the root

uuidstringstringUUID of the original NF-e (full return; send either this or chave).
chavestringstring44-digit access key of the original NF-e (required for partial return; alternative to uuid for full return)
return_detailobjectobjectPartial-return detail object.
cfop*stringstringReturn CFOP.
natureza_operacaostringstringOperation nature (e.g., "Devolução de venda").

Body — fields inside return_detail

All fields below go inside the return_detail object. Placing them at the request root has no effect — the endpoint returns an error instead of silently falling back to a full return.

transaction_typestringstringOperation type.
modelstringstringDocument model: "55" (required for partial return)
issuance_typestringstringIssuance type: "1"=normal (required for partial return)
ambientestringstringEnvironment: "1"=production, "2"=homologation (required for partial return)
idstringstringOrder number (return deduplication key).
total_discount_amountnumbernumberTotal discount amount for the note.
clienteobjectobjectRecipient data, same structure as /api/invoice/create (required for partial return).
productsarrayarrayReturned items, same structure as /api/invoice/create (required for partial return).

 * Required field. uuid OR chave is also required (exactly one).

Automatic on returns: payment goes out as 90 (No Payment) — pag_info is ignored; on a full return, an empty natureza_operacao defaults to "Devolução de Mercadoria"; item taxation (CST/CSOSN, PIS/COFINS, IPI, IBS/CBS) comes from the fiscal category of category_id, matched by person type and scenario, or is sent inline per item via impostos — either one.

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/invoice/return" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json