Configurar o Webhook
curl --request PUT \
--url https://notasx-api.fly.dev/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://erp.exemplo.com.br/notasx/webhook"
}
'import requests
url = "https://notasx-api.fly.dev/v1/webhook"
payload = { "url": "https://erp.exemplo.com.br/notasx/webhook" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://erp.exemplo.com.br/notasx/webhook'})
};
fetch('https://notasx-api.fly.dev/v1/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://notasx-api.fly.dev/v1/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://erp.exemplo.com.br/notasx/webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://notasx-api.fly.dev/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://notasx-api.fly.dev/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}"
response = http.request(request)
puts response.read_body{
"segredo": "whsec_exemplo-nao-use-Yx8P2kLm9Qr4Tv7Wz1Ab",
"url": "https://erp.exemplo.com.br/notasx/webhook"
}{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "requisicao_invalida",
"mensagem": "corpo.cnpj: String should match pattern '^\\d{14}$'"
}
}{
"erro": {
"codigo": "limite_de_requisicoes",
"mensagem": "Muitas requisições; tente de novo em instantes."
}
}Conta
Configurar o Webhook
Define (ou troca) o endereço do Webhook da Conta. Há um Webhook por Conta.
O NotasX chama esse endereço quando uma Nota chega a um resultado (emitida, rejeitada ou falhou).
A entrega ainda não está ativa (em desenvolvimento): por enquanto, acompanhe as Notas por GET /v1/notas/{id}.
PUT
/
v1
/
webhook
Configurar o Webhook
curl --request PUT \
--url https://notasx-api.fly.dev/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://erp.exemplo.com.br/notasx/webhook"
}
'import requests
url = "https://notasx-api.fly.dev/v1/webhook"
payload = { "url": "https://erp.exemplo.com.br/notasx/webhook" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://erp.exemplo.com.br/notasx/webhook'})
};
fetch('https://notasx-api.fly.dev/v1/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://notasx-api.fly.dev/v1/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://erp.exemplo.com.br/notasx/webhook'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://notasx-api.fly.dev/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://notasx-api.fly.dev/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://erp.exemplo.com.br/notasx/webhook\"\n}"
response = http.request(request)
puts response.read_body{
"segredo": "whsec_exemplo-nao-use-Yx8P2kLm9Qr4Tv7Wz1Ab",
"url": "https://erp.exemplo.com.br/notasx/webhook"
}{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "requisicao_invalida",
"mensagem": "corpo.cnpj: String should match pattern '^\\d{14}$'"
}
}{
"erro": {
"codigo": "limite_de_requisicoes",
"mensagem": "Muitas requisições; tente de novo em instantes."
}
}Authorizations
Authorization: Bearer nx_... com uma Chave de API, ou o JWT de sessão do painel (Supabase Auth). As duas credenciais representam a mesma Conta.
Body
application/json
Endereço HTTPS que receberá os resultados das Notas.
Maximum string length:
2000Pattern:
^https://