Axiom NFe

Exemplos de Integracao

Exemplos completos para integrar com a API Axiom NFe. Escolha sua linguagem e copie o codigo.

Neste guia

Listar empresas cadastradas

GET /empresas

Retorna todas as empresas (CNPJs) cadastradas na sua conta.

# Listar todas as empresas
curl -u "nfe_SuaApiKeyAqui:" \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/empresas

Emitir NF-e (modelo 55)

POST /nfe/emitir

Emite uma NF-e com processamento assincrono. Envie o header X-Empresa-Id com o ID da empresa emitente.

# Emitir NF-e
curl -X POST -u "nfe_SuaApiKeyAqui:" \
  -H "Content-Type: application/json" \
  -H "X-Empresa-Id: abc123" \
  -d '{
    "ide": { "natOp": "VENDA", "indPag": 0 },
    "dest": {
      "CNPJ": "11222333000181",
      "xNome": "EMPRESA TESTE LTDA",
      "endereco": {
        "xLgr": "Rua Teste", "nro": "100",
        "xBairro": "Centro", "cMun": "4314902",
        "xMun": "Porto Alegre", "UF": "RS", "CEP": "90000000"
      },
      "indIEDest": 1,
      "IE": "1234567890"
    },
    "produtos": [{
      "cProd": "001",
      "xProd": "PRODUTO TESTE",
      "NCM": "61091000",
      "CFOP": "5102",
      "uCom": "UN",
      "qCom": 2,
      "vUnCom": 50.00,
      "vProd": 100.00,
      "icms": { "orig": 0, "CST": "00", "modBC": 3, "vBC": 100.00, "pICMS": 18, "vICMS": 18.00 },
      "pis": { "CST": "01", "vBC": 100.00, "pPIS": 1.65, "vPIS": 1.65 },
      "cofins": { "CST": "01", "vBC": 100.00, "pCOFINS": 7.60, "vCOFINS": 7.60 }
    }],
    "pagamentos": [{ "tPag": "01", "vPag": 100.00 }]
  }' \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/nfe/emitir
Resposta (200 - Autorizado)
{
  "message": "NF-e authorized",
  "chaveAcesso": "35260212345678000195550010000000011234567890",
  "protocolo": {
    "nProt": "135260000001234",
    "dhRecbto": "2026-02-15T10:30:00-03:00",
    "cStat": "100",
    "xMotivo": "Autorizado o uso da NF-e"
  },
  "status": "authorized"
}

Consultar nota por chave

GET /nfe/:chaveAcesso

Consulta os detalhes de uma NF-e pela chave de acesso (44 digitos).

CHAVE="35260212345678000195550010000000011234567890"

curl -u "nfe_SuaApiKeyAqui:" \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/nfe/${CHAVE}

Download XML autorizado

GET /xml/:chaveAcesso

Retorna o XML autorizado (nfeProc) para download. Obrigatorio guardar por 5 anos.

CHAVE="35260212345678000195550010000000011234567890"

# Salvar XML em arquivo
curl -u "nfe_SuaApiKeyAqui:" \
  -o "nfe_${CHAVE}.xml" \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/xml/${CHAVE}

Download DANFE (PDF)

GET /danfe/:chaveAcesso

Retorna o PDF do DANFE. NF-e gera A4, NFC-e gera formato termico 80mm. Use /danfe/:chave/download para forcar download.

CHAVE="35260212345678000195550010000000011234567890"

# Visualizar inline (retorna PDF)
curl -u "nfe_SuaApiKeyAqui:" \
  -o "danfe_${CHAVE}.pdf" \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/danfe/${CHAVE}

# Forcar download (Content-Disposition: attachment)
curl -u "nfe_SuaApiKeyAqui:" \
  -o "danfe_${CHAVE}.pdf" \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/danfe/${CHAVE}/download

Cancelar nota

POST /eventos/cancelar

Cancela uma NF-e ou NFC-e autorizada. Permitido ate 24 horas apos a autorizacao. Justificativa minima de 15 caracteres.

curl -X POST -u "nfe_SuaApiKeyAqui:" \
  -H "Content-Type: application/json" \
  -H "X-Empresa-Id: abc123" \
  -d '{
    "chaveAcesso": "35260212345678000195550010000000011234567890",
    "justificativa": "Erro no cadastro do destinatario da nota fiscal"
  }' \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/eventos/cancelar
Resposta (200 - Cancelado)
{
  "message": "Cancellation approved",
  "chaveAcesso": "35260212345678000195550010000000011234567890",
  "protocolo": "135260000005678",
  "status": "cancelled"
}

Emitir NFC-e (PDV)

POST /nfce/emitir

Emite uma NFC-e (modelo 65) com processamento sincrono. Ideal para PDV. Requer CSC configurado. Destinatario opcional abaixo de R$ 200.

curl -X POST -u "nfe_SuaApiKeyAqui:" \
  -H "Content-Type: application/json" \
  -H "X-Empresa-Id: abc123" \
  -d '{
    "produtos": [{
      "cProd": "7891234560012",
      "xProd": "CAMISETA ALGODAO P",
      "NCM": "61091000",
      "CFOP": "5102",
      "uCom": "UN",
      "qCom": 1,
      "vUnCom": 59.90,
      "vProd": 59.90,
      "icms": { "orig": 0, "CSOSN": "102" },
      "pis": { "CST": "49" },
      "cofins": { "CST": "49" }
    }],
    "pagamentos": [{ "tPag": "17", "vPag": 59.90 }]
  }' \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/nfce/emitir
Resposta (200 - NFC-e Autorizada)
{
  "message": "NFC-e authorized",
  "chaveAcesso": "35260212345678000195650010000000021234567891",
  "status": "authorized",
  "protocolo": {
    "nProt": "135260000009876",
    "dhRecbto": "2026-03-06T14:22:00-03:00"
  },
  "qrCodeUrl": "https://www.sefaz.rs.gov.br/NFCE/NFCE-COM.aspx?p=..."
}

Registrar webhook

POST /webhooks

Registra uma URL para receber callbacks em tempo real. Cada callback inclui assinatura HMAC-SHA256 para verificacao.

curl -X POST -u "nfe_SuaApiKeyAqui:" \
  -H "Content-Type: application/json" \
  -H "X-Empresa-Id: abc123" \
  -d '{
    "url": "https://meusite.com/webhook/nfe",
    "events": ["nfe.authorized", "nfe.rejected", "evento.cancelamento"],
    "secret": "meu-secret-hmac-256"
  }' \
  https://southamerica-east1-axiom-nfe.cloudfunctions.net/api/webhooks
Resposta (201 - Webhook Registrado)
{
  "webhookId": "wh_abc123def456",
  "url": "https://meusite.com/webhook/nfe",
  "events": ["nfe.authorized", "nfe.rejected", "evento.cancelamento"],
  "message": "Webhook registered"
}

Verificar assinatura do webhook

Quando voce configura um secret, cada callback inclui os headers X-Axiom-Signature e X-Axiom-Timestamp. Use HMAC-SHA256 para verificar a autenticidade.

import crypto from 'crypto';

// No seu endpoint de webhook (Express, por exemplo)
function verifyWebhookSignature(req, secret) {
  const signature = req.headers['x-axiom-signature'];
  const timestamp = req.headers['x-axiom-timestamp'];
  const body = JSON.stringify(req.body);

  // Gerar assinatura esperada
  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}.${body}`)
    .digest('hex');

  return signature === `sha256=${expected}`;
}

// Uso no Express
app.post('/webhook/nfe', (req, res) => {
  const valid = verifyWebhookSignature(req, 'meu-secret-hmac-256');

  if (!valid) {
    return res.status(401).json({ error: 'Invalid signature' });
  }

  const { event, data } = req.body;
  console.log(`Evento: ${event}`, data);

  // Processar evento...
  res.status(200).json({ received: true });
});
Payload recebido no webhook
{
  "event": "nfe.authorized",
  "data": {
    "chaveAcesso": "35260212345678000195550010000000011234567890",
    "modelo": 55,
    "nProt": "135260000001234",
    "dhRecbto": "2026-02-15T10:30:00-03:00"
  },
  "timestamp": "2026-02-15T13:30:00.000Z"
}