Documentação da API de Tributação

Visão Geral

Esta API permite consultar a tributação de produtos e serviços no Brasil com base nos dados do IBPT.

Endpoint da API

Use a seguinte URL base:

https://api-ibpt.seunegocionanuvem.com.br/api_ibpt.php

Exemplo de Resposta (JSON)

{
    "codigo": "22030000",
    "ex": "",
    "tipo": 0,
    "descricao": "Cervejas de malte",
    "nacionalfederal": "16.08",
    "importadosfederal": "28.76",
    "estadual": "25.00",
    "municipal": "0.00",
    "vigenciainicio": "2025-04-20",
    "vigenciafim": "2025-05-31",
    "versao": "25.1.E",
    "fonte": "IBPT/empresometro.com.br",
    "uf": "MG"
}

Exibição em Tabela HTML

NCM22030000
DescriçãoCervejas de malte...
Imposto Nacional17.36%
Imposto Importado20.46%
Estadual0.00%
Municipal5.00%
Vigência01/04/2025 a 30/06/2025
Versão25.1.E
FonteIBPT
UFSP

Como Utilizar

Exemplo de chamada GET:

GET https://api-ibpt.seunegocionanuvem.com.br/api_ibpt.php?codigo=22030000&uf=SP

Exemplo em PHP

<?php
$codigo = '21069090'; // Código NCM
$uf = 'SP'; // Estado

$url = "https://api-ibpt.seunegocionanuvem.com.br/api_ibpt.php?codigo=$codigo&uf=$uf";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Accept: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode == 200) {
    $data = json_decode($response, true);
    echo "Impostos para NCM $codigo em $uf:\n";
    echo "Nacional: " . $data['nacionalfederal'] . "%\n";
    echo "Importado: " . $data['importadosfederal'] . "%\n";
    echo "Estadual: " . $data['estadual'] . "%\n";
} else {
    $error = json_decode($response, true);
    echo "Erro: " . $error['error']['message'] . "\n";
}

curl_close($ch);
?>

Exemplo em C#

using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

class Program
{
    static async Task Main()
    {
        var ncm = "22030000";
        var uf = "SP";
        var url = $"https://api-ibpt.seunegocionanuvem.com.br/api_ibpt.php?codigo={ncm}&uf={uf}";

        using HttpClient client = new HttpClient();
        try
        {
            var response = await client.GetStringAsync(url);
            var data = JObject.Parse(response);
            Console.WriteLine($"Descrição: {data["descricao"]}");
            Console.WriteLine($"Imposto Nacional: {data["nacionalfederal"]}%");
            Console.WriteLine($"Imposto Importado: {data["importadosfederal"]}%");
            Console.WriteLine($"Estadual: {data["estadual"]}%");
            Console.WriteLine($"Municipal: {data["municipal"]}%");
            Console.WriteLine($"Vigência: {data["vigenciainicio"]} a {data["vigenciafim"]}");
            Console.WriteLine($"UF: {data["uf"]}");
            Console.WriteLine($"Versão: {data["versao"]}");
            Console.WriteLine($"Fonte: {data["fonte"]}");
        }
        catch (Exception e)
        {
            Console.WriteLine($"Erro: {e.Message}");
        }
    }
}

Exemplo em Delphi

uses
  System.SysUtils, System.Net.HttpClient, System.JSON;

var
  HttpClient: THttpClient;
  Response: IHTTPResponse;
  Data: TJSONObject;
begin
  HttpClient := THttpClient.Create;
  try
    Response := HttpClient.Get('https://api-ibpt.seunegocionanuvem.com.br/api_ibpt.php?codigo=22030000&uf=SP');
    Data := TJSONObject.ParseJSONValue(Response.ContentAsString) as TJSONObject;
    if Assigned(Data) then
    begin
      WriteLn('Descrição: ' + Data.GetValue('descricao').Value);
      WriteLn('Imposto Nacional: ' + Data.GetValue('nacionalfederal').Value + '%');
      WriteLn('Imposto Importado: ' + Data.GetValue('importadosfederal').Value + '%');
      WriteLn('Estadual: ' + Data.GetValue('estadual').Value + '%');
      WriteLn('Municipal: ' + Data.GetValue('municipal').Value + '%');
      WriteLn('Vigência: ' + Data.GetValue('vigenciainicio').Value + ' a ' + Data.GetValue('vigenciafim').Value);
      WriteLn('UF: ' + Data.GetValue('uf').Value);
      WriteLn('Versão: ' + Data.GetValue('versao').Value);
      WriteLn('Fonte: ' + Data.GetValue('fonte').Value);
    end;
  finally
    HttpClient.Free;
  end;
end.

Pesquisar Tributação