curl --request POST \
--url https://notasx-api.fly.dev/v1/prestadores \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}
'import requests
url = "https://notasx-api.fly.dev/v1/prestadores"
payload = {
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cnpj: '12345678000195',
codigo_municipio: '2408102',
inscricao_municipal: '1234567',
op_simp_nac: 3,
razao_social: 'Exemplo Serviços LTDA'
})
};
fetch('https://notasx-api.fly.dev/v1/prestadores', 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/prestadores",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cnpj' => '12345678000195',
'codigo_municipio' => '2408102',
'inscricao_municipal' => '1234567',
'op_simp_nac' => 3,
'razao_social' => 'Exemplo Serviços LTDA'
]),
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/prestadores"
payload := strings.NewReader("{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://notasx-api.fly.dev/v1/prestadores")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/prestadores")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}"
response = http.request(request)
puts response.read_body{
"ambiente": "homologacao",
"ativo": true,
"certificado_valido_ate": "2027-04-28T12:00:00Z",
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"id": "3891f091-65d6-4a88-ac60-72dbe3e98319",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "cnpj_ja_cadastrado",
"mensagem": "Este CNPJ já está cadastrado no NotasX."
}
}{
"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."
}
}Cadastrar Prestador
Cadastra o Prestador e o vincula à sua Conta. Ele começa em homologacao e inativo: envie o Certificado
em seguida. Cada CNPJ existe uma única vez no NotasX; se já estiver cadastrado, a resposta é 409.
curl --request POST \
--url https://notasx-api.fly.dev/v1/prestadores \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}
'import requests
url = "https://notasx-api.fly.dev/v1/prestadores"
payload = {
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cnpj: '12345678000195',
codigo_municipio: '2408102',
inscricao_municipal: '1234567',
op_simp_nac: 3,
razao_social: 'Exemplo Serviços LTDA'
})
};
fetch('https://notasx-api.fly.dev/v1/prestadores', 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/prestadores",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cnpj' => '12345678000195',
'codigo_municipio' => '2408102',
'inscricao_municipal' => '1234567',
'op_simp_nac' => 3,
'razao_social' => 'Exemplo Serviços LTDA'
]),
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/prestadores"
payload := strings.NewReader("{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://notasx-api.fly.dev/v1/prestadores")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/prestadores")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cnpj\": \"12345678000195\",\n \"codigo_municipio\": \"2408102\",\n \"inscricao_municipal\": \"1234567\",\n \"op_simp_nac\": 3,\n \"razao_social\": \"Exemplo Serviços LTDA\"\n}"
response = http.request(request)
puts response.read_body{
"ambiente": "homologacao",
"ativo": true,
"certificado_valido_ate": "2027-04-28T12:00:00Z",
"cnpj": "12345678000195",
"codigo_municipio": "2408102",
"id": "3891f091-65d6-4a88-ac60-72dbe3e98319",
"inscricao_municipal": "1234567",
"op_simp_nac": 3,
"razao_social": "Exemplo Serviços LTDA"
}{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "cnpj_ja_cadastrado",
"mensagem": "Este CNPJ já está cadastrado no NotasX."
}
}{
"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
CNPJ do Prestador, só dígitos. Único no NotasX.
^\d{14}$Código IBGE do município do Prestador (Natal/RN = 2408102).
^\d{7}$Situação no Simples Nacional: 1 não optante, 2 MEI, 3 ME/EPP.
1, 2, 3 Razão social, opcional (a Sefin usa a do cadastro do CNPJ).
300Inscrição municipal, se o município exigir.
15Response
Successful Response
Id do Prestador no NotasX.
CNPJ, só dígitos.
Razão social informada no cadastro.
Código IBGE do município.
Inscrição municipal, se informada.
1 não optante, 2 MEI, 3 ME/EPP do Simples Nacional.
Ambiente das próximas Notas. Começa em homologacao; muda com ativar-producao.
homologacao, producao true quando há Certificado ativo do próprio CNPJ.
Validade do Certificado ativo; null sem Certificado.