/api/invoice/returnIssue 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
tokenstring | string | Issuing company token |
signstring | string | MD5 signature |
timestampstring | string | Unix timestamp in seconds |
Body — fields always read from the root
uuidstring | string | UUID of the original NF-e (full return; send either this or chave).It is a 36-character GUID with dashes, not the 24-character _id. With uuid and no return_detail the note is cloned in full; if return_detail is also sent, a partial return is performed |
chavestring | string | 44-digit access key of the original NF-e (required for partial return; alternative to uuid for full return) |
return_object | object | Partial-return detail object. Every partial-return field must go inside this object (cliente, products, transaction_type, model, issuance_type, ambiente, id); leaving them at the request root returns an error. chave, cfop and natureza_operacao are always read from the root; nature_of_operation inside the object has no effect, and the operation nature is taken only from the root natureza_operacao |
cfop*string | string | Return CFOP. A return NF-e is inbound ( tpNF=0) and requires an inbound CFOP: "1202", "1411" within the state, "2202", "2411" interstate. If omitted, the error cfop vazio is returned. Sending an outbound CFOP ("5202", "6202", ...) conflicts with tpNF and is rejected by the tax authority |
natureza_string | string | Operation nature (e.g., "Devolução de venda"). Alias accepted: nature_of_operation. Optional for a full return, in which case "Devolução de Mercadoria" is used; required for a partial return, otherwise The nature_of_operation field cannot be empty is returned |
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_string | string | Operation type. Required but the value has no effect: the endpoint unconditionally overrides it to inbound ( tpNF=0), so "0" and "1" behave identically — it is only a placeholder |
modelstring | string | Document model: "55" (required for partial return) |
issuance_string | string | Issuance type: "1"=normal (required for partial return) |
ambientestring | string | Environment: "1"=production, "2"=homologation (required for partial return) |
idstring | string | Order number (return deduplication key). Returns do not use the order-reservation mechanism, so duplicate protection relies entirely on this field: when a return already exists for the same id, that note is returned instead of issuing a new one. Without it there is no duplicate protection at all and the same return can be issued repeatedly — strongly recommended |
total_number | number | Total discount amount for the note. Defaults to 0 |
clienteobject | object | Recipient data, same structure as /api/invoice/create (required for partial return).Quirk: the address number field is number (in English), not numero. Without number, the address goes out with nro "S/N"; IBGE code, city and state are resolved from cep |
productsarray | array | Returned items, same structure as /api/invoice/create (required for partial return).codigo is optional — when absent, cProd falls back to name Tax data via category_id or impostos — either one; use the latter when the original invoice was issued by another provider. |
n_int | int | Item number on the original invoice (1..990). Homologação only: there the return references the original per item, and a partial return cannot infer that number (the original may not be on this platform). Omitted, the reference group is dropped and tax authority returns Rejeição 321. Production references at header level and does not need this field |
* 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
{
"uuid": "4663a257-adf1-4561-971f-6aaffbd30ca8",
"cfop": "1202",
"natureza_operacao": "Devolução de venda"
}
{
"chave": "35210112345678901234567890123456789012345678",
"cfop": "1202",
"natureza_operacao": "Devolução parcial",
"return_detail": {
"id": "PED-2026-0001",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"total_discount_amount": 0,
"cliente": {
"cnpj": "12345678000199",
"cpf": "",
"ie": "111222333444",
"name": "Fornecedor",
"endereco": "Rua das Flores",
"number": "1000",
"complemento": "Sala 2",
"bairro": "Centro",
"city": "Sao Paulo",
"uf": "SP",
"cep": "01001000",
"telefone": "1132294790",
"email": "fornecedor@exemplo.com.br"
},
"products": [
{
"name": "Produto A",
"codigo": "SKU-001",
"ncm": "39269090",
"cest": "",
"gtin": "SEM GTIN",
"gtin_tributavel": "SEM GTIN",
"count": 1,
"unit": "UN",
"unit_price": 100,
"total_price": 100,
"discount_price": 0,
"category_id": "68b1f0c2a1d4e5f6a7b8c9d0",
"origem": 0,
"indicador_total": 1,
"price_includes_ipi": false,
"n_item_ped": 1,
"n_item": 1
}
]
}
}
{
"chave": "35210112345678901234567890123456789012345678",
"cfop": "1202",
"natureza_operacao": "Devolução parcial",
"return_detail": {
"id": "PED-2026-0002",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"cliente": {
"cnpj": "12345678000199",
"name": "Fornecedor",
"endereco": "Rua das Flores",
"number": "1000",
"bairro": "Centro",
"city": "Sao Paulo",
"uf": "SP",
"cep": "01001000"
},
"products": [
{
"name": "Produto A",
"ncm": "39269090",
"count": 1,
"unit": "UN",
"unit_price": 100,
"total_price": 100,
"origem": 0,
"indicador_total": 1,
"n_item": 1,
"impostos": {
"icms": {
"codigo_cfop": "1202",
"situacao_tributaria": "102",
"tipo_pessoa": "juridica",
"aliquota": "18"
},
"ipi": {
"codigo_enquadramento": "999",
"situacao_tributaria": "99",
"aliquota": "0.00",
"tipo_pessoa": "juridica"
},
"pis": {
"situacao_tributaria": "07",
"aliquota": "0.00",
"tipo_pessoa": "juridica"
},
"cofins": {
"situacao_tributaria": "07",
"aliquota": "0.00",
"tipo_pessoa": "juridica"
}
}
}
]
}
}