Revogar Chave de API
curl --request DELETE \
--url https://notasx-api.fly.dev/v1/chaves-api/{chave_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://notasx-api.fly.dev/v1/chaves-api/{chave_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://notasx-api.fly.dev/v1/chaves-api/{chave_id}', 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/chaves-api/{chave_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://notasx-api.fly.dev/v1/chaves-api/{chave_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://notasx-api.fly.dev/v1/chaves-api/{chave_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/chaves-api/{chave_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "nao_encontrado",
"mensagem": "Chave de API não encontrada."
}
}{
"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."
}
}Chaves de API
Revogar Chave de API
Revoga a chave na hora: requisições com ela passam a receber 401. Não tem volta; crie outra se precisar.
Revogar de novo uma chave já revogada não muda nada.
DELETE
/
v1
/
chaves-api
/
{chave_id}
Revogar Chave de API
curl --request DELETE \
--url https://notasx-api.fly.dev/v1/chaves-api/{chave_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://notasx-api.fly.dev/v1/chaves-api/{chave_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://notasx-api.fly.dev/v1/chaves-api/{chave_id}', 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/chaves-api/{chave_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://notasx-api.fly.dev/v1/chaves-api/{chave_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://notasx-api.fly.dev/v1/chaves-api/{chave_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://notasx-api.fly.dev/v1/chaves-api/{chave_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"erro": {
"codigo": "nao_autenticado",
"mensagem": "Credencial ausente, inválida ou revogada."
}
}{
"erro": {
"codigo": "nao_encontrado",
"mensagem": "Chave de API não encontrada."
}
}{
"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."
}
}