TF Fiscal

NFC-e Consumer Invoices

POST/api/nfce/return

Return an NFC-e

Issues a return document for an authorized NFC-e. The return is an inbound NF-e (model 55) that references the access key of the original NFC-e in its XML; the NFC-e itself has no return document. The original is looked up among NFC-e records by uuid or chave, and items and tax fields are carried over from it. /api/invoice/return only searches NF-e records and answers "invoice does not exist" for any NFC-e; use this endpoint instead.

Required headers

tokenstringstringIssuing company token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

FieldTypeRequiredDescription
uuidstringNouuid of the original NFC-e. Either this or chave
chavestringNo44-digit access key of the original NFC-e. Either this or uuid
cfopstringYesCFOP of the return, typically 1202 within the state and 2202 across states
natureza_operacaostringNoNature of the operation. Defaults to Devolução de Mercadoria. The field name nature_of_operation is also accepted
clienteobjectNoThe recipient, that is, the buyer of the original document. Fields: cpf, cnpj, ie, name, endereco, numero, complemento, bairro, city, uf, cep, email, telefone. Non-empty fields sent override the original; fields omitted or sent as empty strings are taken from it. When the original carries no buyer CPF/CNPJ, cpf or cnpj is required

The return is an NF-e, and the recipient address is mandatory, whereas an NFC-e usually records no buyer address. When the original XML carries no address, cliente must include endereco, bairro, city, uf and cep; the endpoint lists whichever are missing.

Only an authorized NFC-e can be returned. The environment (production or test) follows the original and is neither required nor accepted as a parameter.

Repeated calls do not issue twice: when a return already exists for the same original in the same environment, that document is returned.

The whole document is returned. Items, quantities and tax fields come from the original; tax fields are resolved through the tax category first and, when the category is missing, copied from the CST and rates in the original XML.

Response fields (data)

uuidstringstringIdentifier of the return document
statusstringstringSuccess authorized, Failed rejected
motivostringstringMessage returned by the tax authority
nfeintintNumber of the return document
serieintintSeries of the return document
chavestringstring44-digit access key of the return document
modelostringstringAlways nfe: the return is an NF-e
epecbooleanbooleanWhether contingency issuance was used
xmlstringstringURL of the return document XML

Response — error

For parameter or original-document problems success is false, the reason is in message and there is no data. When the tax authority rejects the document, success is also false but data is present, with status equal to Failed and the reason in motivo.
{
  "success": false,
  "message": "A devolução é uma NF-e e exige o endereço do comprador; a NFC-e original não o traz. Informe em cliente: endereco, bairro, city, uf, cep / 退货票是 NF-e,必须有买方地址,原 NFC-e 没有。请在 cliente 里传:endereco、bairro、city、uf、cep"
}

Examples

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