Webhooks de saída (fiscal)
A Nive chama a sua URL quando uma nota muda de status (autorizada, rejeitada, cancelada, em contingência). Cada entrega é um POST JSON com os headers X-Nive-Event, X-Nive-Delivery, X-Nive-Timestamp e X-Nive-Signature (v1=HMAC-SHA256 de “{timestamp}.{corpo}” com o segredo whsec_). Responda 2xx para confirmar; falhas são reenviadas em 1min, 5min, 15min, 1h, 3h, 6h, 12h e 24h. Eventos: fiscal.document.authorized, .rejected, .cancelled, .contingency e .failed. Exige a permissão fiscal na chave.
Base: https://api.nivesistemas.com.br · 8 endpoints
GET /outbound-webhooks
Seção intitulada “GET /outbound-webhooks”Listar destinos
curl -X GET "https://api.nivesistemas.com.br/outbound-webhooks" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks", { method: "GET", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "GET", "https://api.nivesistemas.com.br/outbound-webhooks", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())POST /outbound-webhooks
Seção intitulada “POST /outbound-webhooks”Criar destino
Corpo (JSON)
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
url |
string | sim | URL https que receberá os eventos |
description |
string | não | Descrição (até 200) |
Resposta: 201 Created. Retorna o segredo (whsec_…) uma única vez
curl -X POST "https://api.nivesistemas.com.br/outbound-webhooks" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo" \ -H "Content-Type: application/json" \ -d '{"url":"","description":""}'const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks", { method: "POST", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", "Content-Type": "application/json", }, body: JSON.stringify({ "url": "", "description": "" }),});const data = await res.json();import requests
res = requests.request( "POST", "https://api.nivesistemas.com.br/outbound-webhooks", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", }, json={ "url": "", "description": "" },)print(res.json())PATCH /outbound-webhooks/:id
Seção intitulada “PATCH /outbound-webhooks/:id”Alterar URL, descrição ou ativar/desativar
Parâmetros de rota: id
Corpo (JSON)
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
url |
string | não | Nova URL https |
description |
string | não | Descrição |
active |
boolean | não | Ativa ou pausa o envio |
curl -X PATCH "https://api.nivesistemas.com.br/outbound-webhooks/{id}" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo" \ -H "Content-Type: application/json" \ -d '{"url":"","description":"","active":true}'const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}", { method: "PATCH", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", "Content-Type": "application/json", }, body: JSON.stringify({ "url": "", "description": "", "active": true }),});const data = await res.json();import requests
res = requests.request( "PATCH", "https://api.nivesistemas.com.br/outbound-webhooks/{id}", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", }, json={ "url": "", "description": "", "active": True },)print(res.json())POST /outbound-webhooks/:id/rotate-secret
Seção intitulada “POST /outbound-webhooks/:id/rotate-secret”Gerar novo segredo (mostrado uma vez)
Parâmetros de rota: id
curl -X POST "https://api.nivesistemas.com.br/outbound-webhooks/{id}/rotate-secret" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}/rotate-secret", { method: "POST", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "POST", "https://api.nivesistemas.com.br/outbound-webhooks/{id}/rotate-secret", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())POST /outbound-webhooks/:id/test
Seção intitulada “POST /outbound-webhooks/:id/test”Enviar evento webhook.test para validar URL e assinatura
Parâmetros de rota: id
curl -X POST "https://api.nivesistemas.com.br/outbound-webhooks/{id}/test" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}/test", { method: "POST", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "POST", "https://api.nivesistemas.com.br/outbound-webhooks/{id}/test", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())GET /outbound-webhooks/:id/deliveries
Seção intitulada “GET /outbound-webhooks/:id/deliveries”Últimas 50 entregas e seus status
Parâmetros de rota: id
curl -X GET "https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries", { method: "GET", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "GET", "https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())POST /outbound-webhooks/:id/deliveries/:deliveryId/retry
Seção intitulada “POST /outbound-webhooks/:id/deliveries/:deliveryId/retry”Reenviar entrega que esgotou as tentativas
Parâmetros de rota: id, deliveryId
curl -X POST "https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries/{deliveryId}/retry" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries/{deliveryId}/retry", { method: "POST", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "POST", "https://api.nivesistemas.com.br/outbound-webhooks/{id}/deliveries/{deliveryId}/retry", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())DELETE /outbound-webhooks/:id
Seção intitulada “DELETE /outbound-webhooks/:id”Remover destino
Parâmetros de rota: id
curl -X DELETE "https://api.nivesistemas.com.br/outbound-webhooks/{id}" \ -H "Authorization: Bearer sl_live_exemplo_abc123xyz789" \ -H "X-Store-Slug: loja-demo"const res = await fetch("https://api.nivesistemas.com.br/outbound-webhooks/{id}", { method: "DELETE", headers: { Authorization: "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },});const data = await res.json();import requests
res = requests.request( "DELETE", "https://api.nivesistemas.com.br/outbound-webhooks/{id}", headers={ "Authorization": "Bearer sl_live_exemplo_abc123xyz789", "X-Store-Slug": "loja-demo", },)print(res.json())
