TF Fiscal

NFC-e Consumer Invoices

POST/api/nfce/create

Issue NFC-e

Issues an NFC-e (model 65, always intrastate outbound, no shipping). Key differences from the NFe endpoint: the consumer object is called client (not cliente); the address number is client.number; the consumer is optional; impostos.ipi, shipping_address, delivery_address and transportation do not exist. The value field in pag_info is named amount.

Required headers

tokenstringstringNFC-e company token
signstringstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringstringUnix timestamp in seconds (5-minute window)

Body (root)

nature_of_operation*stringstringOperation nature (e.g.
issuance_type*stringstringIssuance type: send "1" (normal).
ambiente*stringstring"1" production, "2" homologation.
products*arrayarrayProduct list (see details below)
idstringstringExternal identifier — goes to xPed without spaces and cut to 15 characters.
ind_presstringstringBuyer presence: "1" in person (default) or "4" home delivery — the values the tax authority accepts for model 65 ("5", in person outside the establishment, depending on the UF).
ind_intermedstringstringUse "0" (no intermediary).
total_discount_amountdecimaldecimalTotal invoice discount.
trocodecimaldecimalChange value (vTroco).
segurodecimaldecimalInsurance amount — split in proportion to each item's quantity (not its value) and rounded per item; the sum may differ from the amount sent by a few cents
outras_despesasdecimaldecimalOther ancillary expenses — split in proportion to each item's quantity (not its value) and rounded per item; the sum may differ from the amount sent by a few cents
informacoes_complementaresstringstringComplementary info for the consumer
informacoes_fiscostringstringInfo of interest to the tax authority
clientobjectobjectConsumer data (optional — see table)
pag_infoarrayarrayPayments (default: cash, paid in full — see table)

 * Required field. category_id or impostos, one of them is required.

Response fields (data)

uuidstringstringInternal NFC-e identifier.
statusstringstringSituation: "Success" (authorized), "Failed" (rejected/failed), "Contingencia" (issued in offline contingency, pending transmission)
motivostringstringTax authority text for the cStat; mapped rejections come in PT / 中文.
nfceintintIssued NFC-e number (note: the field is named nfce, not nfe)
serieintintNFC-e series
chavestringstring44-digit access key (empty when the invoice was not authorized)
modelostringstringDocument model: "nfce"
xmlstringstringURL of the authorized XML
danfestringstringNFC-e DANFE URL — empty at issuance; generate it on demand with /api/nfce/get_danfe
In offline contingency (triggered automatically when the tax authority is unavailable), the response comes with status: "Contingencia" plus the extra fields contingencia: true and tpEmis: 9; the invoice must be transmitted to the tax authority later.

Response — rejection / error

When the tax authority rejects the invoice, success is false and data.motivo holds the reason; chave comes back empty. Field validation errors (before reaching the tax authority) return success: false with the message in message and no data object.
{
  "success": false,
  "data": {
    "uuid": "65f8b9a1c2d3e4f5a6b7c8d9",
    "status": "Failed",
    "motivo": "Rejeição 226: Código da UF do Emitente diverge da UF autorizadora / 拒绝 226: 发件人所在州代码与授权州不一致",
    "nfce": 5,
    "serie": 1,
    "chave": "",
    "modelo": "nfce",
    "xml": "",
    "danfe": ""
  }
}

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/create" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json

NFC-e Complete Examples

Example 1 — In-Person Sale (no recipient)

{
  "nature_of_operation": "Venda de mercadoria",
  "issuance_type": "1",
  "ambiente": "2",
  "ind_pres": "1",
  "products": [
    {
      "codigo": "001",
      "name": "Refrigerante 350ml",
      "ncm": "22021000",
      "count": 3,
      "unit": "UN",
      "unit_price": 5.50,
      "total_price": 16.50,
      "category_id": "TF123",
      "origem": 0,
      "indicador_total": 1
    }
  ],
  "pag_info": [
    { "payment_indicator": "0", "payment_method": "17" }
  ]
}

Example 2 — Home Delivery (with recipient)

{
  "nature_of_operation": "Venda de mercadoria",
  "issuance_type": "1",
  "ambiente": "2",
  "ind_pres": "4",
  "client": {
    "cpf": "12345678909",
    "name": "Maria Silva",
    "endereco": "Rua das Flores",
    "number": "456",
    "bairro": "Jardim Primavera",
    "city": "São Paulo",
    "uf": "SP",
    "cep": "04567000"
  },
  "products": [
    {
      "codigo": "PIZZA01",
      "name": "Pizza Grande Marguerita",
      "ncm": "19059090",
      "count": 1,
      "unit": "UN",
      "unit_price": 45.90,
      "total_price": 45.90,
      "category_id": "TF124",
      "origem": 0,
      "indicador_total": 1
    }
  ],
  "pag_info": [
    { "payment_indicator": "0", "payment_method": "03" }
  ],
  "informacoes_complementares": "Entrega em até 40 minutos"
}