webmania®
  • Contact

Region and language

Brazil

  • PTPortuguês (Brasil)
  • ENEnglish
  • ESEspañol
Sign in Book a demo
Solutions
Fiscal IssuerFiscal MonitorTax ReconciliationArtificial Intelligence

Document guide

NF‑e (electronic invoice)NFS‑e (service invoice)CT‑e and CT‑e OS (freight bills)NFC‑e (consumer receipt)DC‑e (content declaration)MDF‑e (cargo manifest)NFCom (telecom invoice)CIOT (road freight code)Tax payment slips

Tax intelligence and security

ByPass®Webmania® TaxesTax reformSecurityWebmania® Trust Center
Brazil tax guide

Start here

Brazil tax guideComplete guide

Popular chapters

NF‑e · Electronic invoiceNFS‑e · Service invoiceCT‑e · Freight billTax reformGlossary
Industries
Technology & SaaSRetail & CommerceLogistics & TransportationEnterprise

By company size

Mid-sized Companies

Other industries

ManufacturingBanks & FintechsServices & Subscriptions
Developers
See all documentation →

Tax & Invoicing

Goods invoice (NF‑e)Service invoice (NFS‑e)Telecom invoice (NFCom)Fiscal Monitor

Logistics & Transport

Freight bill (CT‑e)Cargo manifest (MDF‑e)Content declaration (DC‑e)CIOT / PEF (ANTT)

Payments & Management

GNREDARE‑ICMS SPDUA‑ESB2B Management

Resources

Docs for LLMs (llms.txt)Webmania® Status (in Portuguese)SEFAZ Monitor (in Portuguese)City Hall Monitor (in Portuguese)
Company

Webmania

About WebmaniaCustomers
ContactPortuguês (Brasil)
Sign in →Book a demo
Fiscal IssuerIssue NF‑e, NFS‑e, CT‑e and other documents from the panel or the API→Fiscal MonitorReceive the invoices issued to your CNPJs, straight from SEFAZ and city halls→Tax ReconciliationCheck the new CBS tax against the Federal Revenue before you pay→Artificial IntelligenceUnderstand rejections, set up taxes and update records with AI→

Document guide

NF‑eElectronic invoiceNFS‑eService invoiceCT‑e and CT‑e OSFreight billNFC‑eConsumer receiptDC‑eElectronic content declarationMDF‑eCargo manifestNFComTelecom invoice

Document guide

CIOTRoad freight registration codeTax payment slipsGNRE, DARE‑ICMS SP and DUA‑ES from the NF‑e

Tax intelligence and security

ByPass®ERP values without recalculationWebmania® TaxesSet up your Tax ClassesTax reformIBS, CBS and the Selective TaxSecurityCertificate, data and Trust CenterWebmania® Trust CenterSecurity, privacy and subprocessors

Not sure where to start?

Book a demo →

Tax & Invoicing

Goods invoiceNF‑e, NFC‑e, CC‑e and MDeService invoiceNFS‑eTelecom invoiceNFComFiscal MonitorXML download

Logistics & Transport

Freight billCT‑e and CT‑e OSCargo manifestMDF‑eContent declarationDC‑eCIOT / PEF (ANTT)Freight payment

Payments & Management

GNREState tax payment slipDARE‑ICMS SPSão Paulo state ICMSDUA‑ESEspírito Santo payment slipB2B ManagementManage your companies
Ready for LLMs and SDKsAI-ready documentation, with official SDKsllms.txt# Webmania® documentation- NF‑e - NFS‑e Open llms.txt

Live status (in Portuguese): Webmania® Status · SEFAZ Monitor · City Hall Monitor

See all documentation →
Technology & SaaSThe tax layer of your software, through REST APIs.Learn more →Technology team
Retail & CommerceNFC‑e and NF‑e at the checkout and online, by API.Learn more →Retail operation
Logistics & TransportationCT‑e and MDF‑e built into your transportation system.Learn more →Logistics operation
EnterpriseHigh volumes, with VIP Support and governance.Learn more →Enterprise operation

By company size

Mid-sized CompaniesOperations that are scaling up

Other industries

ManufacturingNF‑e at the volume of your operationBanks & FintechsNFS‑e for fees and servicesServices & SubscriptionsNFS‑e at large scale

Not sure where to start?

Book a demo →

Webmania

About WebmaniaThe tax infrastructure and intelligence behind 100,000+ active company IDs (CNPJs).Meet Webmania →CustomersHow companies in different industries issue and monitor their tax documents.See our customers →ContactQuestions about operating in Brazil? Our team replies in your language.Talk to our team →

In numbers

15 million+tax documents per month
1.2 billion+API requests per year
100,000+active company IDs (CNPJs)
99.95%availability

Not sure where to start?

Book a demo →

Start here

Brazil tax guideNew to Brazil? The invoices, taxes and approvals of a sale, explained on one page.Start reading →

Go deeper

Complete guideEvery tax document in detail: when you need it, how to issue, cancel and correct it.Open the complete guide →

Goods and services

NF‑eElectronic invoiceNFC‑eConsumer receiptNFS‑eService invoiceNFComTelecom invoice

Transport

CT‑eFreight billMDF‑eCargo manifestCIOTRoad freight codeDC‑eContent declaration

Taxes and reform

Tax payment slipsGNRE, DARE and DUATax reformCBS and IBS, 2026–2033Tax ClassTax rules, set onceGlossaryTax terms, explained

Not sure which documents your operation needs?

Book a demo →
  • B2B Management REST API
  • Quick guide
    • Company lifecycle
    • Error responses
    • Warnings and partial results
  • SDKs & LLMs
    • LLM-ready
    • Webmania SDKs
  • Authentication
  • Companies
    • Create a company from its CNPJ
      • Partial response
    • List companies
    • Get a company
    • Set up a company
      • Company details
      • Address
      • Taxation
      • Series and numbering
      • A1 digital certificate
      • Settings per document type
      • Optional settings
      • Tax options
    • A1 digital certificate
      • Certificate rejections
    • Company credentials
    • Logo
  • Tax classes
    • Create or edit a class
    • List classes
    • Get a class
    • Delete a class
    • Validation errors
    • Product (NF-e and NFC-e)
      • Scenarios and recipients
      • ICMS
      • ICMS in Simples Nacional
      • ICMS in normal taxation
      • IPI, PIS and COFINS
      • ISSQN
      • IBS/CBS
      • Examples
    • Service (NFS-e)
      • Common fields
      • National standard
      • Municipal layouts
      • IBS/CBS
      • Examples
    • Communication (NFCom)
  • Registrations
    • Create or edit a registration
    • Customers
    • Products
    • Carriers
    • Services
    • Response
    • List registrations
    • Delete a registration
    • Errors
  • Infrastructure
  • Request limits
  • Changelog
⚡ Follow in real time (in Portuguese): Status | SEFAZ Monitor | City Hall Monitor

Last updated: December 3, 2026 · v2.1.0

Version 2.0
  • Version 2.0Account B2B credential and company UUID
  • Version 1.0Earlier integrations, with the four OAuth keys

Region and language

Brazil

  • PTPortuguês (Brasil)
  • ENEnglish
  • ESEspañol
View Markdown index (in Portuguese)
View Markdown indexLists the sections with links (in Portuguese)Open in ChatGPTReads the index and fetches only the sections it needsOpen in ClaudeReads the index and fetches only the sections it needs

B2B Management REST API

B2B Management API: every company in your account B2B Management API: every company in your account

The B2B Management API lets you manage the companies in your Webmania® account from your own system. You create a company from its CNPJ (company ID), set it up by its UUID and read its issuing credentials. You also manage its tax classes (the tax rules that Webmania® uses to calculate taxes automatically) and its registrations of customers, products, carriers and services. To start, see the Quick guide.

What is the B2B Management API? It is the API of your account, not of a single company. It uses the management credential of your account and identifies each company by its uuid. Each company then issues its invoices through the invoicing APIs, with its own credentials.

Create from the CNPJ

Create one company per request from its CNPJ. When available, its details are prefilled from the company registry.

Management credential

One Bearer token of the account authenticates every call. The credentials of a single company do not work on these endpoints.

Full setup

Company details, taxation, series and numbering, A1 digital certificate, logo, tax classes and registrations.

Version 1.0, kept for existing integrations. Integrations already built keep working as before. For new integrations, use version 2.0, with the management credential of the account and the company UUID.

The B2B Management API 1.0 lets you manage the companies in your Webmania® account. You create companies, list existing ones with their credentials, update each company's details and check the month's API usage. To start, see the Quick guide.

What is the B2B Management API? It is the API of your account, not of a single company. It uses the B2B credentials of your account and returns the access credentials of each company it creates.

Create companies

Create 1 to 100 companies per request, within the limit of your plan. Each company gets its own API access credentials.

B2B credentials

The B2B endpoints use the B2B credentials of the account. The credentials of a single company do not work on these endpoints.

API usage

See how many invoices were processed in the month, in total and per company.

Brazilian tax terms you will see. They keep their Brazilian names in the payload and on the invoices:
CNPJ / CPF: the 14-digit company ID (each branch has its own) and the 11-digit individual taxpayer ID.
IE / IM: the state registration of a company that pays ICMS and the city registration of a company that provides services. Fields ie and im.
Regime tributário: Simples Nacional (small companies, several taxes in one monthly payment), Lucro Presumido or Lucro Real. Fields tipo_tributacao and regime_tributario.
ICMS, ICMS-ST, FCP, DIFAL: the state tax on goods and its tax substitution, poverty fund and interstate parts, set per state.
IPI, PIS / COFINS, ISS: the federal tax on manufactured goods, the federal contributions on revenue and the city tax on services.
CFOP, CST / CSOSN, NCM, CEST: the codes of each invoice line: kind of transaction, how each tax applies, product classification and tax substitution code.
IBS / CBS / cClassTrib: the new taxes of the tax reform and the code that says how they apply.
CSC: the code the state tax authority gives each company to build the QR code of its NFC-e.
Every term in plain English: glossary of Brazilian tax terms.

REST API integration
Works with every programming language through JSON. Guaranteed low latency, with more than 200 points of presence on the Amazon Web Services network.
Availability and security
High availability, scalability and redundant servers at the highest PCI DSS security level, on Amazon Web Services, the global leader in cloud computing.

Quick guide

Send every request over encrypted HTTPS to https://api.webmania.com.br, under the /2/b2b prefix. You create a company from its CNPJ (company ID) and from then on identify it by the uuid the API returns.

URL HTTP Verb Function
/2/b2b/empresasPOSTCreate a company from its CNPJ
/2/b2b/empresas/{uuid}/logomarcaPOSTUpload the logo
/2/b2b/empresas/{uuid}/classe-impostoPOSTCreate a tax class
/2/b2b/empresas/{uuid}/cadastros/{tipo}POSTCreate a registration
/2/b2b/empresasGETList companies
/2/b2b/empresas/{uuid}GETGet the company setup
/2/b2b/empresas/{uuid}/credenciaisGETGet the company credentials
/2/b2b/empresas/{uuid}/classe-impostoGETList tax classes
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}GETGet a tax class
/2/b2b/empresas/{uuid}/cadastros/{tipo}GETList registrations
/2/b2b/empresas/{uuid}PUTSet up the company
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}PUTEdit a tax class
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id}PUTEdit a registration
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}DELETEDelete a tax class
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id}DELETEDelete a registration

Responses are in JSON. Every success response has sucesso: true. Failures have erro and codigo, described in Error responses.

How to integrate the B2B Management API:

  1. Generate the management credential Generate the B2B token of the account in the Webmania® Panel, under Settings (Configurações) › Credentials (Credenciais). Send it as a Bearer token.
  2. Create the company from its CNPJ Send the CNPJ in a JSON object. Store the company uuid the API returns.
  3. Check the registration If the response is partial, follow the path in consultar before you repeat the creation.
  4. Set up issuing Use the uuid to set the tax details, series and numbering.
  5. Upload the A1 digital certificate Send the Base64-encoded file and its password to the company uuid, with the same account credential.
  6. Create the tax classesif needed Set the tax rules for products, services or communication services (NFCom) that drive the automatic tax calculation.
  7. Get the company credentialsif needed Read the issuing credentials of the company and use them in the invoicing APIs.

Quick guide
Company lifecycle

You create the company from its CNPJ and then set it up by its uuid. A partial result still means the company was created: check its record before you repeat the POST, so you do not try to create the same company twice.

Company lifecycle in the B2B Management API POST creates the company from its CNPJ. If the registration is confirmed, the HTTP 201 response has the uuid. If it stays partial, the 201 or 202 response has parcial true and the path to check. A rejection returns 422 or 409. With the uuid, set up the company, upload the A1 digital certificate, create the tax classes and read the issuing credentials. POST /2/b2b/empresas Registration confirmed? registry data from the CNPJ Company created HTTP 201 with uuid Partial result parcial: true (201 or 202) check before you repeat Rejected HTTP 422 or 409 fix and send again Set up the company PUT /empresas/{uuid} A1 digital certificate certificado and password Tax classes POST .../classe-imposto Company credentials GET .../credenciais yes no GET consultar
Next steps Check Company available Confirm before you repeat Rejected Your application Check the result
With the uuid, you can do the next steps in any order. Invoice issuing uses the credentials of the company.

Quick guide
Error responses

Check the HTTP status and the fields erro and codigo. In validation errors, campos may have one message per field.

HTTPcodigoReasonWhat to do
400requisicao_invalidaInvalid request.Check the syntax and format of the body.
401nao_autenticadoToken missing or invalid.Check the Authorization header and the token in use.
403acesso_negadoThe credential or the plan has no access to the B2B Management API.Check the account plan and use the B2B management credential.
403acesso_bloqueadoAccess temporarily blocked for security.Wait until access is unblocked before you retry.
404recurso_nao_encontradoThe route or resource does not exist or is not available to the account.Check the path and the UUID registered in your account.
405metodo_nao_permitidoThe HTTP method does not match the route.Use the method documented for the route.
409conflitoThe operation conflicts with the current state. For example, a registration is already in progress for the same CNPJ, or another operation is using the CIOT IPEF numbering.Check the creation by the CNPJ, or wait for the numbering operation in progress, before you try again.
413requisicao_muito_grandeThe body is larger than allowed.Reduce the body and check the size limit of the file you send.
415tipo_de_conteudo_nao_suportadoContent type not supported.Use Content-Type: application/json for JSON bodies.
422validacao_falhouA field validation or a business rule failed. When the A1 digital certificate is rejected, campos points to certificado_senha or certificado. When the city and the state you sent do not identify a municipality, campos points to cidade. When the certificate has expired, campos points to certificado.Fix the fields shown. For the city, check the municipality, the state (UF) and the CEP (postal code). Send a valid A1 certificate and check its password.
429limite_de_requisicoesRequest limit reached. Follow Retry-After when it is present.Wait for the interval in Retry-After, if present.
500erro_internoUnexpected error.Check the state of the company before you repeat a write whose result is uncertain.
503servico_indisponivelService temporarily unavailable.Wait for the service to come back. If the result of a write is uncertain, check the company.

Example of an HTTP 422 response when the password of the A1 digital certificate is rejected (the API messages are in Portuguese; this one says the certificate could not be opened and asks you to check the password and the file):

{
  "erro": "Não foi possível acessar o Certificado Digital A1. Verifique a senha informada e o arquivo do certificado.",
  "codigo": "validacao_falhou",
  "campos": {
    "certificado_senha": ["Não foi possível acessar o Certificado Digital A1. Verifique a senha informada e o arquivo do certificado."]
  }
}

Quick guide
Warnings and partial results

When present, avisos holds objects with codigo and mensagem.

codigoMeaning
cnpj_inativoThe CNPJ is inactive at the Federal Revenue (Receita Federal).
fiscal_numbering_not_savedThe invoice numbering was not saved.
payment_guide_states_not_savedThe states (UFs) for tax payment slips were not saved.
bearer_token_pendingThe issuing credentials of the company are still being processed.
configuracao_nao_confirmadaNot all setup data could be confirmed.
logomarca_nao_confirmadaThe logo update could not be confirmed.
inscricao_municipal_invalidaThe city registration (inscrição municipal) is not valid in the municipality.
validade_certificado_nao_sincronizadaThe expiry date of the A1 digital certificate was not synchronized automatically.

parcial: true means that part of the result still needs confirmation, or that some setting was not saved. Check the company and the affected fields before you repeat the write.

Quick guide

Send every request over encrypted HTTPS to https://webmania.com.br/api/. The /1/ prefix means you are using version 1.0 of the API.

URL HTTP Verb Function
/1/b2b/empresas/ POST Create new companies
/1/b2b/empresas/ GET List registered companies
/1/nfe/empresa/ POST Update a company, with the credentials of the company
/1/b2b/requests/NEW GET Check requests

Responses are in JSON. Creating and listing companies return an array of objects; checking requests returns an object. Send the headers X-Consumer-Key, X-Consumer-Secret, X-Access-Token and X-Access-Token-Secret with the B2B credentials of your account in every call; see Authentication.

How to integrate the B2B Management API:

  1. Get the B2B credentials Copy the B2B credentials of your account from the Credentials (Credenciais) tab of the Settings (Configurações) menu in the Webmania® Panel. The credentials of a single company do not work on the B2B endpoints.
  2. Create the companies POST to /1/b2b/empresas/ with the quantidade (number) of companies. The response has the id and the credentials of each company; store them in your system.
  3. Complete the registration of each company Using the credentials of the company, update its details at the /1/nfe/empresa/ endpoint, described in Update a company.
  4. List the companies GET to /1/b2b/empresas/ to check the details and credentials of each company, including the bearer_access_token if it came back empty on creation.
  5. Check the requestsif needed GET to /1/b2b/requests/, with optional mes (month) and ano (year), to track the invoices processed for each company.

Quick guide
Error responses

Check the HTTP status and the response body. Authentication failures can return HTTP 401 or 403, but validation and business errors can also return HTTP 200 with the field error. That field means the call failed, even with a 2xx status.

SituationResponseWhat to do
Authentication failureHTTP 401 or 403, with the field errorCheck the four headers with the B2B credentials of the account, described in Authentication.
Validation or business ruleHTTP 200 with the field errorRead the message in error, fix the request and send it again.

Example of an HTTP 401 response, when the Access Token or the Access Token Secret does not match (the API messages are in Portuguese):

{
  "error": "Access Token e Access Token Secret não conferem."
}

SDKs & LLMs

Take this reference to your AI assistant, integrate the API with an official SDK, or start from the ready-made modules and examples.

LLM-ready

Send an AI the section index of this reference: it reads the index and fetches only the sections it needs, in Markdown. The Markdown is in Portuguese; the assistant can answer in English.

  • Section index Start here Every section of this reference with its URL and size, so the AI reads only what it needs. View Markdown index
  • Page in Markdown The full reference in plain text, with the same tables and examples. View as Markdown
  • Open in ChatGPT Reads the index and fetches only the sections it needs. Open in ChatGPT
  • Open in Claude Reads the index and fetches only the sections it needs. Open in Claude
  • llms.txt Starting point for agents, with every public reference. Open llms.txt

Webmania SDKs

Official open-source SDKs on GitHub to integrate the Webmania APIs in the language of your project. Each repository includes installation, examples and the operations it covers.

  • Node.js / TypeScript Available

    Node.js >= 22 README

    git clone https://github.com/webmaniabr/webmania-node.git

  • Python Available

    Python >= 3.11 README

    git clone https://github.com/webmaniabr/webmania-python.git

  • PHP Available

    PHP >= 8.3 README

    git clone https://github.com/webmaniabr/webmania-php.git

  • Perl Available

    Perl 5.36 README

    git clone https://github.com/webmaniabr/webmania-perl.git

  • Go Available

    Go 1.26 README

    git clone https://github.com/webmaniabr/webmania-go.git

  • C Available

    C11, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-c.git

  • C++ Available

    C++, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-cpp.git

  • Lua Available

    Lua 5.4, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-lua.git

  • Dart Available

    Dart >= 3.8.3, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-dart.git

  • R Available

    R >= 4.6.2, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-r.git

  • Java Available

    Java 17+ README

    git clone https://github.com/webmaniabr/webmania-java.git

  • Kotlin Available

    Kotlin 2.4 / JVM 17+ README

    git clone https://github.com/webmaniabr/webmania-kotlin.git

  • Scala Available

    Scala 3.3 / JVM 17+ README

    git clone https://github.com/webmaniabr/webmania-scala.git

  • Clojure Available

    Clojure 1.12 / JVM 17+ README

    git clone https://github.com/webmaniabr/webmania-clojure.git

  • Ruby Available

    Ruby 3.3, Ruby 3.4 README

    git clone https://github.com/webmaniabr/webmania-ruby.git

  • .NET (C#) Available

    .NET 10 README

    git clone https://github.com/webmaniabr/webmania-dotnet.git

  • PowerShell Available

    PowerShell 7.6 README

    git clone https://github.com/webmaniabr/webmania-powershell.git

  • Elixir Available

    Elixir ~> 1.18, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-elixir.git

  • Rust Available

    Rust >= 1.85 README

    git clone https://github.com/webmaniabr/webmania-rust.git

  • Haskell Available

    GHC 9.6.7, Linux arm64 README

    git clone https://github.com/webmaniabr/webmania-haskell.git

  • Swift Available

    macOS 13+, iOS 16+ README

    git clone https://github.com/webmaniabr/webmania-swift.git

Authentication

B2B-only credential. The management credential belongs to the account, not to a company. It authenticates only the B2B endpoints. The credentials of a single company do not work on these endpoints. Access requires a plan that includes B2B.

Generate the credential in the Webmania® Panel of your account, under Settings (Configurações) › Credentials (Credenciais). The token is shown only once, when you generate it: store it on your integration's server. If you generate a new one, update your integration, because the old token is revoked.

Send the header Authorization: Bearer YOUR_B2B_TOKEN in every request (replace YOUR_B2B_TOKEN with your B2B token):

HeaderValue
AuthorizationBearer YOUR_B2B_TOKEN, in every request.
Content-Typeapplication/json, in requests with a JSON body.

The uuid in the URL must belong to the same account as the token.

Example of an authenticated request:

curl 'https://api.webmania.com.br/2/b2b/empresas' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN'

Keep your access credentials safe. Never publish the token in the source code of a website, app or software where users can easily reach it. In mobile apps, send the requests from your server (back end).

Companies
Create a company from its CNPJ

To create a company, send a POST request to /2/b2b/empresas with a single JSON object. Descriptive fields you leave out (legal name, trade name, address and contact) are filled in from the local registry database when the details are available. The values you send in the body take priority. Stay within your plan's capacity.

ParameterRequiredTypeSizeDescription
cnpj
string14Valid CNPJ (company ID) of the company, sent as text to keep the leading zeros
00000000000000 or 00.000.000/0000-00
razao_social
string---Legal name. Required when the CNPJ is not in the registry database
cep
string8CEP (postal code), with or without the hyphen. Required when the CNPJ is not in the registry database
endereco
string---Street. Required when the CNPJ is not in the registry database
numero
string---Street number. Required when the CNPJ is not in the registry database
bairro
string---District. Required when the CNPJ is not in the registry database
cidade
string---Municipality. Required when the CNPJ is not in the registry database
uf
string2Two-letter state abbreviation (UF). Required when the CNPJ is not in the registry database
site_marketplace
string1-120HTTP or HTTPS URL of the marketplace. Required when tipo_emissor_dce is 1

You can also send the other setup fields when you create the company, except the ones marked as edit only. Send the IE (Inscrição Estadual, the state registration of a company that pays ICMS), the IM (Inscrição Municipal, the city registration of a service provider) and the tax regime (regime tributário) that match your company. Invoice issuing depends on the setup of each document type and, when required, on a valid A1 digital certificate.

Example request to create a company:

curl -X POST 'https://api.webmania.com.br/2/b2b/empresas' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "cnpj": "00000000000000",
    "tipo_tributacao": "simples_nacional",
    "ie": "0000000000"
  }'

Example of an HTTP 201 response. empresa has the same details as the company lookup (shortened below):

{
  "sucesso": true,
  "empresa": {
    "uuid": "UUID_DA_EMPRESA",
    "cnpj": "00000000000000",
    "razao_social": "Nome da empresa LTDA",
    "nome_fantasia": "Nome da empresa",
    "status": "ativa",
    "tipo_tributacao": "simples_nacional",
    "certificado": {
      "tem_certificado": false,
      "status": "ausente",
      "vencimento": null,
      "tem_senha": false
    }
  }
}

Create a company from its CNPJ
Partial response

If the registration cannot be fully confirmed, the response has parcial: true. Before you repeat the POST, send a GET to the path in consultar with the same Bearer token. If no response arrived, filter the list by the CNPJ.

HTTPWhen it happensWhat empresa contains
201Registration complete.The registration details, with the uuid. May include avisos.
201 with parcial: trueThe company was created and the uuid is known, but the invoice numbering (fiscal_numbering_not_saved) or the states for tax payment slips (payment_guide_states_not_saved) could not be saved, or the certificate, the subdomain or the setup could not be confirmed (configuracao_nao_confirmada). This includes interruptions after the company was created.uuid and cnpj. Read the details at the path in consultar.
202 with parcial: trueConfirmation of the registration stopped after the company was created, and the uuid is not known yet.cnpj and uuid: null. List the companies by the CNPJ you sent.

Example of an HTTP 202 response:

{
  "sucesso": true,
  "empresa": {
    "uuid": null,
    "cnpj": "00000000000000"
  },
  "parcial": true,
  "consultar": "/2/b2b/empresas?q=00000000000000",
  "avisos": [
    {
      "codigo": "configuracao_nao_confirmada",
      "mensagem": "Não foi possível confirmar todos os dados atualizados. Consulte a empresa antes de repetir a operação."
    }
  ]
}

If a required field is missing, the API returns HTTP 422 and lists the fields in campos. If the registry database lookup is unavailable, it returns HTTP 503.

Companies
List companies

To list the companies of the account, send a GET request to /2/b2b/empresas. The filters are optional and go in the query string.

ParameterRequiredTypeSizeDescription
pagina
integer---Page, starting at 1. Default 1
limite
integer1-50Companies per page. Default 20
q
string1-64Free-text search. You can use it to search by the CNPJ
status
string---Status of the company
ativa
inativa
arquivada

Example request:

curl 'https://api.webmania.com.br/2/b2b/empresas?pagina=1&limite=20' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN'

Example of an HTTP 200 response:

{
  "sucesso": true,
  "empresas": [
    {
      "uuid": "UUID_DA_EMPRESA",
      "cnpj": "00000000000000",
      "cpf": null,
      "razao_social": "Nome da empresa LTDA",
      "nome_fantasia": "Nome da empresa",
      "ie": "0000000000",
      "im": null,
      "uf": "SP",
      "regime": "simples",
      "status": "ativa",
      "certificado": {
        "tem_certificado": true,
        "status": "valido",
        "vencimento": "2027-05-31"
      }
    }
  ],
  "pagina": 1,
  "limite": 20,
  "total": 1,
  "tem_mais": false
}

regime sums up the taxation as simples, normal or mei. certificado.status can be ausente (missing), valido (valid) or vencido (expired).

Companies
Get the company setup

To read a company, send a GET request to /2/b2b/empresas/{uuid}. The HTTP 200 response has sucesso: true and empresa. Writable data uses the same names as the setup. Series come back as text and invoice numbers as integers. Values that were never set may appear as null.

FieldIn the lookup
uuid, cpf, codigo_municipio, status, origem_cadastroRead only.
certificadoObject with tem_certificado, status, vencimento and tem_senha.
logomarcaObject with tem_logomarca and url (public HTTPS URL or null).
nfse_password, nfse_chave_acesso, nfse_app_key, token_ibpt, CSC codesNever returned. The lookup only tells whether they are set: tem_nfse_senha, tem_nfse_chave_acesso, tem_nfse_app_key, tem_token_ibpt, tem_nfce_codigo_csc and tem_nfce_codigo_csc_dev.

Example request:

curl 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN'

Example of an HTTP 200 response, with every field:

{
  "sucesso": true,
  "empresa": {
    "uuid": "UUID_DA_EMPRESA",
    "cnpj": "00000000000000",
    "cpf": null,
    "razao_social": "Nome da empresa LTDA",
    "nome_fantasia": "Nome da empresa",
    "ie": "0000000000",
    "im": "00000",
    "suframa": null,
    "unidade_empresa": "matriz",
    "email": "contato@empresa.com.br",
    "telefone": "1130000000",
    "cep": "01001000",
    "endereco": "Praça da Sé",
    "numero": "100",
    "complemento": null,
    "bairro": "Sé",
    "cidade": "São Paulo",
    "uf": "SP",
    "codigo_municipio": "3550308",
    "status": "ativa",
    "origem_cadastro": null,
    "tipo_tributacao": "simples_nacional",
    "regime_tributario": null,
    "anexo_simples_nacional": "I",
    "cnae": [
      "4751201"
    ],
    "cnae_issqn": null,
    "item_servico": null,
    "regime_especial_nacional": null,
    "regime_especial_municipal": null,
    "regime_apuracao_sn": null,
    "informacoes_fisco": null,
    "tipo_emissor_dce": null,
    "site_marketplace": null,
    "numero_site_autorizador": null,
    "dce_serie": "1",
    "dce_numero": 1,
    "dce_numero_dev": 1,
    "taf_cte_os": null,
    "registro_estadual_cte_os": null,
    "nfse_login": null,
    "nfse_aedf": null,
    "nfse_converter_rps": null,
    "tem_nfse_senha": false,
    "tem_nfse_chave_acesso": false,
    "tem_nfse_app_key": false,
    "certificado": {
      "tem_certificado": true,
      "status": "valido",
      "vencimento": "2027-05-31",
      "tem_senha": true
    },
    "nfce_id_csc": "1",
    "nfce_id_csc_dev": "1",
    "tem_nfce_codigo_csc": true,
    "tem_nfce_codigo_csc_dev": true,
    "tem_token_ibpt": false,
    "contabilidade": [
      "00000000000"
    ],
    "contabilidade_email": "contador@escritorio.com.br",
    "conta_bancaria_banco": null,
    "conta_bancaria_agencia": null,
    "conta_bancaria_numero": null,
    "conta_bancaria_digito": null,
    "url_notificacao": "https://seusite.com.br/notificacao",
    "subdominio": null,
    "orientacao_danfe": "P",
    "partilha_icms_contribuinte": false,
    "partilha_icms_isento": false,
    "base_calculo_ipi_sem_frete": false,
    "exclusao_adi": false,
    "ativar_epec": false,
    "desabilitar_difal": [],
    "guias_declaracao_ufs": [],
    "logomarca": {
      "url": null,
      "tem_logomarca": false
    },
    "nfe_serie": "1",
    "nfce_serie": "1",
    "serie_rps": "1",
    "serie_mdfe": "1",
    "serie_cte": "1",
    "serie_cte_os": "1",
    "serie_nfcom": "1",
    "ciot_ipef_serie": null,
    "ciot_ipef_serie_dev": null,
    "nfe_numero": 1,
    "nfe_numero_dev": 1,
    "nfce_numero": 1,
    "nfce_numero_dev": 1,
    "numero_rps": 1,
    "numero_rps_dev": 1,
    "numero_lote_rps": 1,
    "numero_mdfe": 1,
    "numero_mdfe_dev": 1,
    "numero_cte": 1,
    "numero_cte_dev": 1,
    "numero_cte_os": 1,
    "numero_cte_os_dev": 1,
    "ciot_ipef_numero": null,
    "ciot_ipef_numero_dev": null,
    "microcervejaria": false,
    "refeicoes_sp": false,
    "icms_ref_df": false,
    "notificacao_relatorios": false,
    "exclusao_icms_pis_cofins": false,
    "exclusao_iss_pis_cofins_nfse": false,
    "exclusao_difal_pis_cofins": false,
    "deduzir_desconto_ipi": false,
    "ipi_pauta_fiscal": false,
    "email_automatico_nfse": false,
    "padrao_nacional_nfse": false,
    "ocultar_total_etiqueta": false
  }
}

To get the company's issuing keys, use the credentials lookup.

Companies
Get the company credentials

To read the issuing credentials of a company, send a GET request to the URL /2/b2b/empresas/{uuid}/credenciais, with the B2B Bearer token of the account. Treat the response as confidential: the server sends Cache-Control: no-store.

FieldContent
api_disponivelfalse when the account plan does not include API access.
api_1_0consumer_key, consumer_secret, access_token, access_token_secret and rotacionado_em.
api_2_0bearer_token, requer_regeneracao and rotacionado_em.

Example request:

curl 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/credenciais' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN'

Example of an HTTP 200 response:

{
  "sucesso": true,
  "credenciais": {
    "api_disponivel": true,
    "api_1_0": {
      "consumer_key": "CONSUMER_KEY_DA_EMPRESA",
      "consumer_secret": "CONSUMER_SECRET_DA_EMPRESA",
      "access_token": "ACCESS_TOKEN_DA_EMPRESA",
      "access_token_secret": "ACCESS_TOKEN_SECRET_DA_EMPRESA",
      "rotacionado_em": null
    },
    "api_2_0": {
      "bearer_token": "BEARER_TOKEN_DA_EMPRESA",
      "requer_regeneracao": false,
      "rotacionado_em": null
    }
  }
}

The keys can be null, including when api_disponivel is false. Use the company's credentials for invoicing calls to the matching API. The first lookup may make the company's invoicing Bearer token available.

Companies
Upload the logo

To upload the logo, send a POST request to /2/b2b/empresas/{uuid}/logomarca. The company setup also accepts the same fields. Send only one name per field.

ParameterRequiredTypeSizeDescription
base64
string---JPEG, PNG or WEBP image in base64, up to 1 MB. Send base64 or logomarca
logomarca
string---Public HTTP or HTTPS URL of the image, instead of base64
nome
string1-255Image name. The API names the stored and published file itself, regardless of this field

Example request:

curl -X POST 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/logomarca' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "base64": "IMAGEM_EM_BASE64",
    "nome": "logomarca.png"
  }'

The HTTP 200 response follows the setup response and may include avisos and parcial. To check the result, use empresa.logomarca when it is present, or read the company.

Companies
Set up a company

To set up a company, send a PUT request to /2/b2b/empresas/{uuid} with a JSON object that holds only the fields to change. Fields you leave out keep their current setup. The CNPJ is fixed at creation.

The details of your company must match the national company registry (CNPJ) of the Federal Revenue (Receita Federal) (in Portuguese).

Unknown fields, panel control fields and options that are not available for the current setup of the company return HTTP 422. Use true and false for boolean fields. How null and empty values behave depends on the field. To clear the list of CNAEs (economic activity codes), send cnae as [], null or "".

Example request:

curl -X PUT 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "nome_fantasia": "Minha empresa",
    "email": "contato@empresa.com.br",
    "nfe_serie": "1",
    "nfe_numero": 1
  }'

The HTTP 200 response has sucesso: true and empresa with the same details as the lookup. Check the warnings and the partial confirmation before you repeat a change. If the details cannot be confirmed and the response has parcial: true, empresa holds uuid, cnpj (or cpf, depending on the registration) and the ciot_ipef_* fields you sent whose change was applied.

Set up a company
Company details

ParameterRequiredTypeSizeDescription
razao_social
Company
string2-60Legal name of the company. Cannot be empty when sent
nome_fantasia
string---Trade name
ie
string---State registration (Inscrição Estadual)
im
string---City registration (Inscrição Municipal)
suframa
string8-9SUFRAMA registration (Manaus Free Trade Zone), with 8 or 9 digits
unidade_empresa
string6Type of unit, depending on the plan: head office (matriz) or branch (filial)
matriz
filial
email
string---Customer service email. Send a valid address
telefone
string---Customer service phone
contabilidade
array1-9CPFs or CNPJs of the accountants, as a list of strings or comma-separated
contabilidade_email
string---Valid emails separated by commas
conta_bancaria_banco
string3Bank code. Send the four conta_bancaria_* fields together
conta_bancaria_agencia
string4-5Branch number, digits only
conta_bancaria_numero
string1-20Account number, digits only
conta_bancaria_digito
string1Check digit of the account

Set up a company
Address

ParameterRequiredTypeSizeDescription
cep
string8CEP (postal code) of the company
00000-000 (with or without punctuation)
endereco
string2-60Street address of the company
numero
string1-60Street number
If there is none, send S/N
complemento
string1-60Address complement (suite, floor)
bairro
string2-60District
cidade
string2-60City. When the city and the state do not identify a municipality, the API returns HTTP 422 pointing to cidade
uf
string2State
XX or EX (abroad)

Set up a company
Taxation

ParameterRequiredTypeSizeDescription
tipo_tributacao
string3-26Taxation type: individual micro-entrepreneur (mei), Simples Nacional (small business regime: several taxes in one monthly payment), Simples Nacional above the sub-limit, or normal taxation (lucro_normal)
mei
simples_nacional
simples_nacional_sublimite
lucro_normal
regime_tributario
string---Regime tributário (tax regime): Lucro Real, income tax on the actual profit (lucro_real), or Lucro Presumido, income tax on a fixed share of revenue (lucro_presumido)
lucro_real
lucro_presumido
anexo_simples_nacional
string1-3Simples Nacional annex (activity table)
I
II
III
IV
V
regime_apuracao_sn
integer1Simples Nacional tax calculation method, from 1 to 3
cnae
array---List of CNAE codes (economic activity) with 7 or 9 digits. A single code is also accepted
cnae_issqn
string---CNAE for ISSQN (ISS, the city tax on services; each city sets its rate)
item_servico
string---Item of the service list
regime_especial_nacional
integer1National special tax regime, from 1 to 6
regime_especial_municipal
integer1-2City special tax regime, from 0 to 9 or from 11 to 13, depending on the municipality
informacoes_fisco
string---Information for the tax authority

If the change identifies the municipality from cidade, uf or cep, or includes tipo_tributacao, the API may turn on padrao_nacional_nfse even if you did not send that field. This happens for companies taxed as mei or simples_nacional in the municipalities with IBGE codes 4314902, 4106902 and 3106200.

Set up a company
Series and numbering

Series have up to 3 digits, except where noted below. Numbers are positive integers and can be sent as decimal strings. Fields that end in _dev refer to the sandbox (homologação, the test environment).

DocumentFieldsNumbering limit
NF-enfe_serie, nfe_numero, nfe_numero_dev999999999
NFC-enfce_serie, nfce_numero, nfce_numero_dev999999999
NFS-eserie_rps (text of up to 5 characters), numero_rps, numero_rps_dev, numero_lote_rps999999999 for RPS and 99999999 for batch
CT-eserie_cte, numero_cte, numero_cte_dev999999
CT-e OSserie_cte_os, numero_cte_os, numero_cte_os_dev999999999
MDF-eserie_mdfe, numero_mdfe, numero_mdfe_dev999999
NFComserie_nfcomThe setup accepts the series
DC-edce_serie, dce_numero, dce_numero_dev999999999
CIOT IPEFciot_ipef_serie, ciot_ipef_numero, ciot_ipef_serie_dev, ciot_ipef_numero_devEdit only, depending on your contract. Series of up to 4 digits and numbers of up to 9 digits. When you send the series, send the number of the same environment

The alternative names cte_serie, cte_number, cte_number_dev, cte_os_serie, cte_os_number, cte_os_number_dev, numero_cte_os_homologacao, mdfe_serie, mdfe_number, mdfe_number_dev, nfse_rps_serie, nfse_rps_numero, nfse_rps_numero_dev, nfse_lote_rps_numero, nfcom_serie, serie_dce, numero_dce and numero_dce_dev are also accepted. Send one name per field. Lookups use the names in the table.

Set up a company
A1 digital certificate

ParameterRequiredTypeSizeDescription
certificado
string---A1 digital certificate file in Base64. See A1 digital certificate
certificado_senha
string---Certificate password. Required when certificado is sent

Set up a company
Settings per document type

ParameterRequiredTypeSizeDescription
nfce_id_csc
string---ID of the production CSC (taxpayer security code for the NFC-e consumer receipt), digits only. Send it with nfce_codigo_csc
nfce_codigo_csc
string---Production CSC code (letters, digits or hyphen). Send it with nfce_id_csc
nfce_id_csc_dev
string---ID of the sandbox CSC. Send it with nfce_codigo_csc_dev
nfce_codigo_csc_dev
string---Sandbox CSC code. Send it with nfce_id_csc_dev
nfse_login
string---City hall portal login, when the provider requires it
nfse_password
string---City hall portal password. The lookup only returns tem_nfse_senha
nfse_aedf
string---NFS-e AEDF (document issuing authorization), when the provider requires it
nfse_chave_acesso
string---Provider access key. nfse_token is an alternative name. The lookup only returns tem_nfse_chave_acesso
nfse_app_key
string---Provider app key. The lookup only returns tem_nfse_app_key
nfse_converter_rps
boolean---RPS conversion (provisional service receipt), when the provider uses it
tipo_emissor_dce
integer1Type of DC-e issuer, from 1 to 3
site_marketplace
string1-120HTTP or HTTPS URL of the marketplace. Required for DC-e type 1
numero_site_autorizador
integer1Number of the authorizing website, from 0 to 9
taf_cte_os
string12TAF (charter authorization) for the CT-e OS, with 12 digits
registro_estadual_cte_os
string25Registro Estadual (state transport registration) number for the CT-e OS, with 25 digits

Set up a company
Optional settings

ParameterRequiredTypeSizeDescription
url_notificacao
string---HTTP or HTTPS URL for notifications
subdominio
string1-253Domain name with the nfe. prefix, subject to availability
token_ibpt
string---IBPT token (approximate tax table). ibpt is an alternative name. The lookup only returns tem_token_ibpt
orientacao_danfe
string1Orientation of the DANFE (printed invoice summary)
P (portrait)
L (landscape)
logomarca
string---Edit only. Image in base64 or URL, as in Logo
logomarca_nome
string1-255Edit only. Image name
desabilitar_difal
array1-27State abbreviations, without repeats, where DIFAL (interstate rate difference: on goods sold to a final consumer in another state, the destination state receives the difference between its ICMS rate and the interstate rate) is turned off
guias_declaracao_ufs
array1-27Edit only. State abbreviations for tax payment slips, without repeats

Set up a company
Tax options

Boolean options: send true or false.

ParameterRequiredTypeSizeDescription
partilha_icms_contribuinte
boolean---Legacy DIFAL option for Simples Nacional. The value is saved, but NF-e and NFC-e issuing does not use it to turn on the calculation
partilha_icms_isento
boolean---Legacy DIFAL exemption option for normal taxation (Lucro Normal). The value is saved, but NF-e and NFC-e issuing does not use it to change the calculation
microcervejaria
boolean---Microbrewery flag. It can be turned on only for companies in PR, SC, RS and BA
refeicoes_sp
boolean---Special regime for meals served in bars and restaurants, ICMS (state sales tax) rate of 3.69% (São Paulo). icms_ref_sp is an alternative name
icms_ref_df
boolean---Simplified regime for food supply under Law 3,168/2003, ICMS rate of 2% (Federal District)
exclusao_icms_pis_cofins
boolean---Remove ICMS from the PIS and COFINS (federal contributions on revenue) calculation base (STF, RE 574.706/PR)
exclusao_iss_pis_cofins_nfse
boolean---Remove ISS from the PIS and COFINS calculation base (NFS-e)
exclusao_difal_pis_cofins
boolean---Remove DIFAL from the PIS and COFINS calculation base
deduzir_desconto_ipi
boolean---Deduct the discount from the IPI (federal tax on manufactured goods) calculation base (COSIT 72/2019)
base_calculo_ipi_sem_frete
boolean---Remove freight from the IPI calculation base. Exceptional condition that the accountant must certify
ipi_pauta_fiscal
boolean---Apply IPI on the calculation base of the official price list (pauta fiscal)
exclusao_adi
boolean---Turn off the message about DIFAL not being collected under ADI 5464
notificacao_relatorios
boolean---Email notification when a CSV, XML or DANFE report is generated
email_automatico_nfse
boolean---Automatically email the issued NFS-e to the service buyer
padrao_nacional_nfse
boolean---Issue the NFS-e in the national standard (Padrão Nacional)
ativar_epec
boolean---Turn on EPEC contingency issuing
ocultar_total_etiqueta
boolean---Hide the total value when printing the label DANFE (DANFE Etiqueta)

Companies
A1 digital certificate

The certificate is now sent by the company UUID. In version 2.0, you send the A1 digital certificate with the management credential of the account, in a PUT request to /2/b2b/empresas/{uuid}, with the same fields certificado and certificado_senha as version 1.0. You no longer need the credentials of each company or the endpoint /1/nfe/empresa/.

The A1 digital certificate is a file from an authorized Brazilian provider (ICP-Brasil) that signs documents in the company's name. It is required to issue documents that must be signed. You can send it when you create the company or at any time in the setup. A new certificate replaces the previous one.

ParameterRequiredTypeSizeDescription
certificado
string---A1 digital certificate file (.pfx or .p12) encoded in Base64
Send the file content, not the file path
certificado_senha
string---Certificate password. It is used exactly as sent: spaces, capital letters, special characters and leading zeros are kept

Always send both fields together, even when only the password changed.

Example request to upload the A1 digital certificate:

curl -X PUT 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "certificado": "MIIKcQIBAzCCCjcGCSqGSIb3DQEHAaCCCigEggokMIIKIDCCBNcGCSqGSIb3...",
    "certificado_senha": "SENHA_DO_CERTIFICADO"
  }'

To Base64-encode the file in a terminal:

base64 -w 0 certificado.pfx      # Linux
base64 -i certificado.pfx        # macOS

The HTTP 200 response has the company details. The file and the password are never returned. The certificado object only shows the status:

{
  "sucesso": true,
  "empresa": {
    "uuid": "UUID_DA_EMPRESA",
    "cnpj": "00000000000000",
    "certificado": {
      "tem_certificado": true,
      "status": "valido",
      "vencimento": "2027-05-31",
      "tem_senha": true
    }
  }
}
FieldDescription
certificado.tem_certificadotrue when the company has a certificate on file.
certificado.statusausente (missing), valido (valid) or vencido (expired). The certificate is valid until the end of its expiry day.
certificado.vencimentoExpiry date in YYYY-MM-DD format, or null when there is no certificate.
certificado.tem_senhatrue when the certificate password is on file.

If the upload cannot be confirmed, the response has parcial: true and the warning configuracao_nao_confirmada. Read the company and check certificado before you send it again. When the expiry date is not synchronized automatically, the response includes the warning validade_certificado_nao_sincronizada.

A1 digital certificate
Certificate rejections

Rejections return HTTP 422 with codigo: validacao_falhou and the affected field in campos. The message is always one of the following (the API returns it in Portuguese; the English meaning is in brackets):

SituationFieldMessage
Wrong password or unreadable filecertificado_senhaNão foi possível acessar o Certificado Digital A1. Verifique a senha informada e o arquivo do certificado.
[The A1 digital certificate could not be opened. Check the password and the certificate file.]
Incomplete certificate chaincertificadoCertificado Digital A1 inválido: a cadeia de certificação está incompleta. Exporte o certificado novamente ou consulte a autoridade certificadora.
[Invalid A1 digital certificate: the certificate chain is incomplete. Export the certificate again or contact the certificate authority.]
Expired certificatecertificadoCertificado Digital A1 vencido. Envie um certificado dentro da validade.
[The A1 digital certificate has expired. Send a certificate that is still valid.]
Content is not Base64certificadoInforme o certificado codificado em base64.
[Send the certificate encoded in base64.]

Example of an HTTP 422 response with an expired certificate:

{
  "erro": "Certificado Digital A1 vencido. Envie um certificado dentro da validade.",
  "codigo": "validacao_falhou",
  "campos": {
    "certificado": ["Certificado Digital A1 vencido. Envie um certificado dentro da validade."]
  }
}

Tax classes

A tax class holds the tax rules that Webmania® uses to calculate the taxes automatically when a document is issued. Each class has a uuid and an issuing reference in the format REF123. You send that reference in classe_imposto on the product or service line of the invoice. There are three types:

tipoDocumentSetup
produtoNF-e and NFC-eICMS, IPI, PIS, COFINS, ISSQN and IBS/CBS per scenario. See Product class.
servicoNFS-eFields defined by the layout of the NFS-e provider of the company's municipality. See Service class.
comunicacaoNFComClassification, ICMS, PIS, COFINS, FUST and FUNTTEL (federal telecom funds). See Communication class.
URLHTTP VerbFunction
/2/b2b/empresas/{uuid}/classe-impostoGETList classes
/2/b2b/empresas/{uuid}/classe-impostoPOSTCreate a class
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}GETGet a class
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}PUTEdit a class
/2/b2b/empresas/{uuid}/classe-imposto/{referencia}DELETEDelete a class

In {referencia}, use the uuid of the class or the reference REF123 (upper or lower case). Any other value returns HTTP 404.

Tax classes
Create or edit a class

Send a single JSON object with the fields below. Any other field at the root is rejected.

ParameterRequiredTypeSizeDescription
tipo
string---Required on creation
produto
servico
comunicacao
The type does not change: on edit, if sent, it must be the current type
descricao
string1-120Description of the class. Required on creation. Repeated spaces are reduced to one
configuracao
object---Tax rules for the type, described in the section for each type. Required on creation. Must be an object, never a list
  • Creation returns HTTP 201; edit and delete return HTTP 200. All three return classe with uuid and referencia; delete also adds excluida: true.
  • On edit, send descricao, configuracao or both. Without configuracao, the tax rules stay exactly as they are.
  • With configuracao, the whole setup is validated again: send every required block of the type, not only what changed.
  • Unknown keys inside configuracao reject the request. Inside the blocks and scenarios, keys that do not apply to the chosen CST (tax status code: how each tax applies to the invoice line) are ignored.

Example of an HTTP 201 response:

{
  "sucesso": true,
  "classe": {
    "uuid": "UUID_DA_CLASSE",
    "referencia": "REF123"
  }
}

Tax classes
List classes

Send a GET request to /2/b2b/empresas/{uuid}/classe-imposto. The list is sorted by reference.

ParameterRequiredTypeSizeDescription
pagina
integer---Page, starting at 1. Default 1
limite
integer1-50Classes per page. Default 20
tipo
string---Filter by type
produto
servico
comunicacao
status
string---Filter by status
ativo
processando
reprovado
inativo
q
string1-120Free-text search
{
  "sucesso": true,
  "classes": [
    {
      "uuid": "UUID_DA_CLASSE",
      "referencia": "REF123",
      "tipo": "produto",
      "descricao": "Venda dentro do estado",
      "status": "ativo"
    }
  ],
  "pagina": 1,
  "limite": 20,
  "total": 1,
  "tem_mais": false
}

Tax classes
Get a class

Send a GET request to /2/b2b/empresas/{uuid}/classe-imposto/{referencia}. The response has classe with uuid, referencia, tipo, descricao, status and configuracao. The setup comes back in normalized form: percentages as text with a decimal point (e.g. "18", "4.65") and codes padded with leading zeros.

Tax classes
Delete a class

Send a DELETE request to /2/b2b/empresas/{uuid}/classe-imposto/{referencia}.

{
  "sucesso": true,
  "classe": {
    "uuid": "UUID_DA_CLASSE",
    "referencia": "REF123",
    "excluida": true
  }
}

Tax classes
Validation errors

Rejections return HTTP 422 with codigo: validacao_falhou and the first field with a problem in campos. The field path is relative to configuracao: icms.0.codigo_cfop is the codigo_cfop of the first ICMS scenario. The messages are in Portuguese.

{
  "erro": "Verifique os dados informados.",
  "codigo": "validacao_falhou",
  "campos": {
    "icms.0.codigo_cfop": ["\"CFOP\" inválido: deve ter 4 dígitos."]
  }
}
SituationExample message
Required field missingPreencha "CFOP". (Fill in "CFOP".)
Value not in the list"Tipo de tributação" inválido: valor não permitido. (Invalid "Taxation type": value not allowed.)
Required list is emptyInforme ao menos um item em "PIS". (Send at least one item in "PIS".)
Invalid percentageinforme um número positivo com até 4 casas decimais (send a positive number with up to 4 decimal places) or deve ser no máximo 100 (must be 100 at most)
MVA missing in the CSTs with STPreencha "Alíquota MVA" — obrigatória para o CST 10. (Fill in "MVA rate", required for CST 10.)
Key outside the typeA configuração contém campos não aceitos para este tipo de classe. (The setup has fields that this type of class does not accept.)
Type changed on editO tipo da classe de imposto não pode ser alterado. (The type of the tax class cannot be changed.)

A concurrent write to the same class returns HTTP 409 (conflito); wait and retry.

Tax classes
Product class (NF-e and NFC-e)

With tipo: produto, configuracao sets the taxes on products in the NF-e (electronic invoice) and the NFC-e (consumer receipt). ICMS, IPI, PIS, COFINS, ISSQN and IBS/CBS are lists of scenarios: each object in the list applies to one combination of transaction scenario and recipient type.

ParameterRequiredTypeSizeDescription
icms
array1-50ICMS (state sales tax) scenarios. See ICMS
ipi
array1-20IPI (federal manufacturing tax) scenarios. See IPI, PIS and COFINS
pis
array1-20PIS scenarios
cofins
array1-20COFINS scenarios
issqn
array0-20ISSQN (city service tax) scenarios. See ISSQN
ibs_cbs
array0-7IBS/CBS scenarios of the tax reform. See IBS/CBS
tributos_federais
decimal0-100Approximate percentage of federal taxes, with up to 2 decimal places
tributos_estaduais
decimal0-100Approximate percentage of state taxes, with up to 2 decimal places
informacoes_fisco
string1-2000Information for the tax authority
informacoes_complementares
string1-2000Additional information for the consumer

Percentages are positive numbers with up to 4 decimal places, sent as a number or as text (18, "4.65" or "4,65").

Product class
Scenarios and recipients

FieldValues
cenariosaida_dentro_estado (outgoing, within the state), saida_fora_estado (outgoing, to another state), saida_exterior (outgoing, abroad: export), entrada_dentro_estado, entrada_fora_estado, entrada_exterior (the same three for incoming transactions). IPI, PIS, COFINS, ISSQN and IBS/CBS also accept padrao, which applies to every scenario.
tipo_pessoafisica (individual), juridica (company), estrangeiro (foreigner). IPI, PIS, COFINS, ISSQN and IBS/CBS also accept padrao.

Product class
ICMS

Each icms scenario has the fields below. The other fields depend on the tax regime and on the CST/CSOSN (tax status code).

ParameterRequiredTypeSizeDescription
tipo_tributacao
string---Tax regime of the scenario
simples_nacional
tributacao_normal
cenario
string---Transaction scenario (without padrao)
tipo_pessoa
string---Recipient type (without padrao)
fisica
juridica
estrangeiro
nao_contribuinte
boolean---Company recipient that is not an ICMS taxpayer. With tipo_pessoa: juridica, the lookup also returns consumidor_final: true
codigo_cfop
string4CFOP of the scenario, with 4 digits: the code that says what kind of transaction it is, for example 5102 = sale inside the state of goods bought from others
situacao_tributaria
string2-3CSOSN in Simples Nacional (the 3-digit code those companies use instead of the ICMS CST)
101, 102, 103, 201, 202, 203, 300, 400, 500, 900CST (tax status code) in normal taxation
00, 02, 10, 15, 20, 30, 40, 41, 50, 51, 53, 60, 61, 70, 90
aliquota
array0-27ICMS rate per state. List of {"estado", "aliquota"}. In normal taxation, it does not apply to CSTs 40, 41 and 50
aliquota_fcp
array0-27FCP (poverty fund surcharge, a small extra ICMS percentage some states charge) rate per state, in the same format
aliquota_reducao_destino
decimal0-100Reduction percentage at destination
credito_presumido
array0-27ICMS presumed credit. List of {"codigo_beneficio_fiscal", "estado", "aliquota"}: code with 8 or 10 characters, state (except DF) and rate up to 100

ICMS
Simples Nacional

Fields of the ICMS scenarios with tipo_tributacao: simples_nacional, by CSOSN.

FieldWhenRule
aliquota_creditoCSOSN 101 and 201Required. Simples Nacional credit percentage, up to 100.
aliquota_importacaocenario: entrada_exteriorRequired. Percentage up to 100.
aliquota_mvaCSOSN 201, 202, 203 and 900MVA (added value margin) per state, up to 1000. Required in CSOSN 201, 202 and 203.
aliquota_st, aliquota_fcp_stCSOSN 201, 202, 203 and 900ICMS-ST (tax substitution: one company in the chain collects the ICMS on later sales in advance) and FCP-ST rate per state.
aliquota_reducao, aliquota_reducao_st, aliquota_efetiva_icms, aliquota_efetiva_icms_stCSOSN 201, 202, 203 and 900Percentages up to 100.
beneficio_fiscalCSOSN 103, 203, 300, 400 and 900List of up to 7 {"estado", "codigo"}: state among DF, GO, PR, RS, RJ, ES, SC and SP, and a code of up to 10 characters.

ICMS
Normal taxation

Fields of the ICMS scenarios with tipo_tributacao: tributacao_normal, by CST.

FieldWhenRule
aliquota_reducaoCST 20, 70 and 90Required in CSTs 20 and 70. Base reduction percentage, up to 100.
aliquota_efetiva_icmsCST 20, 70 and 90Percentage up to 100.
aliquota_mvaCST 10, 30, 70 and 90MVA per state, up to 1000. Required in CSTs 10, 30 and 70.
aliquota_st, aliquota_fcp_stCST 10, 30, 70 and 90ICMS-ST and FCP-ST rate per state.
aliquota_reducao_st, aliquota_efetiva_icms_stCST 10, 30, 70 and 90Percentages up to 100.
aliquota_diferimentoCST 51 and 53Required in CST 51. Deferral percentage, up to 100.
aliquota_diferimento_fcpCST 51FCP deferral percentage, up to 100.
codigo_beneficio_reducao_bcCST 51Benefit code, with 8 or 10 characters.
motivo_desoneracaoCST 20, 30, 40, 41, 50, 51, 70 and 90In CST 20: 3, 9, 10, 11 or 12. In the others: 3, 9 or 12.
deducao_desoneracaoWith motivo_desoneracao0 or 1: deducts the waived ICMS from the item value.
motivo_desoneracao_stCST 20, 40, 41, 50, 51, 70 and 903, 9 or 12.
quantidade_retencao, aliquota_retencaoCST 15Required. Quantity and rate of the single-phase withholding.
percentual_reducaoCST 15Percentage up to 100.
motivo_reducaoCST 150 or 9.
aliquota_importacaocenario: entrada_exteriorRequired in CSTs 00 and 90. Percentage up to 100.
beneficio_fiscalCST 20, 40, 41, 50, 51, 70 and 90List of up to 7 {"estado", "codigo"}: state among DF, GO, PR, RS, RJ, ES, SC and SP, and a code of up to 10 characters.

The per-state rates (aliquota, aliquota_fcp, aliquota_st, aliquota_fcp_st and aliquota_mva) are lists of up to 27 objects, one per state, without repeating a state:

"aliquota_st": [
  { "estado": "SP", "aliquota": "18" },
  { "estado": "RJ", "aliquota": "20" }
]

Product class
IPI, PIS and COFINS

ParameterRequiredTypeSizeDescription
tipo_pessoa
string---Recipient type, including padrao
cenario
string---Transaction scenario, including padrao
situacao_tributaria
string2IPI CST
00, 01, 02, 03, 04, 05, 49, 50, 51, 52, 53, 54, 55, 99PIS and COFINS CST
01 to 09, 49 to 56, 60 to 67, 70 to 75, 98, 99
codigo_enquadramento
string1-3IPI only, where it is required. Legal classification code. CST 52 does not accept 999
aliquota
decimal0-100Tax rate

Product class
ISSQN

ParameterRequiredTypeSizeDescription
tipo_pessoa
string---Recipient type, including padrao
cenario
string---Transaction scenario, including padrao
codigo_cfop
string4CFOP with 4 digits
exigibilidade
string1ISS liability (exigibilidade)
1 to 7
item_servico
string1-5Item of the service list
incentivo_fiscal
string1Tax incentive
1 (yes)
2 (no)
aliquota
decimal0-100ISSQN rate
municipio
string7IBGE code of the municipality
codigo_servico
string1-20Service code in the municipality

Product class
IBS/CBS (tax reform)

Each ibs_cbs scenario sets the CST and the cClassTrib (tax classification). IBS and CBS are the new taxes of the tax reform. The conditional fields depend on the combination of CST and classification in the official tax reform table.

ParameterRequiredTypeSizeDescription
tipo_pessoa
string---Recipient type, including padrao
cenario
string---Transaction scenario, including padrao
situacao_tributaria
string1-3IBS/CBS CST (padded with leading zeros, e.g. 000). Must be accepted for the NF-e
classificacao_tributaria
string1-6cClassTrib (tax classification code of the reform, padded with leading zeros, e.g. 000001): with the CST, it says how IBS and CBS apply. Must match the CST
situacao_tributaria_regular
string1-3CST of the regular taxation. Required when the classification requires regular taxation
classificacao_tributaria_regular
string1-6Classification of the regular taxation, under the same conditions
ibs_estadual
object---Deferral of the state IBS: {"aliquota_diferimento": 0 to 100}. Used only when the CST allows deferral
ibs_municipal
object---Deferral of the city IBS, in the same format
cbs
object---Deferral of the CBS, in the same format
credito_presumido
object---Presumed credit, required when the CST and the classification provide for it: {"classificacao", "aliquota_ibs", "aliquota_cbs"}, with classificacao among 3, 4, 5, 6, 7, 10, 11 and 13 and rates up to 100

Product class
Examples

Class for Simples Nacional, for the resale of goods to individuals and companies:

curl -X POST 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/classe-imposto' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "tipo": "produto",
    "descricao": "Revenda de mercadorias - Simples Nacional",
    "configuracao": {
      "icms": [
        {"tipo_tributacao": "simples_nacional", "cenario": "saida_dentro_estado", "tipo_pessoa": "fisica", "codigo_cfop": "5102", "situacao_tributaria": "102"},
        {"tipo_tributacao": "simples_nacional", "cenario": "saida_fora_estado", "tipo_pessoa": "fisica", "codigo_cfop": "6102", "situacao_tributaria": "102"},
        {"tipo_tributacao": "simples_nacional", "cenario": "saida_dentro_estado", "tipo_pessoa": "juridica", "codigo_cfop": "5102", "situacao_tributaria": "102"},
        {"tipo_tributacao": "simples_nacional", "cenario": "saida_fora_estado", "tipo_pessoa": "juridica", "codigo_cfop": "6102", "situacao_tributaria": "102"}
      ],
      "ipi": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "99", "codigo_enquadramento": "999", "aliquota": "0"}],
      "pis": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "49", "aliquota": "0"}],
      "cofins": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "49", "aliquota": "0"}]
    }
  }'

Class for normal taxation with tax substitution (CST 10) on sales inside the state and the company's own ICMS (CST 00) on sales to other states:

{
  "tipo": "produto",
  "descricao": "Venda com ST - Lucro Presumido",
  "configuracao": {
    "icms": [
      {
        "tipo_tributacao": "tributacao_normal",
        "cenario": "saida_dentro_estado",
        "tipo_pessoa": "juridica",
        "codigo_cfop": "5401",
        "situacao_tributaria": "10",
        "aliquota": [{"estado": "SP", "aliquota": "18"}],
        "aliquota_mva": [{"estado": "SP", "aliquota": "40"}],
        "aliquota_st": [{"estado": "SP", "aliquota": "18"}]
      },
      {
        "tipo_tributacao": "tributacao_normal",
        "cenario": "saida_fora_estado",
        "tipo_pessoa": "juridica",
        "codigo_cfop": "6102",
        "situacao_tributaria": "00",
        "aliquota": [{"estado": "RJ", "aliquota": "12"}, {"estado": "MG", "aliquota": "12"}]
      }
    ],
    "ipi": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "53", "codigo_enquadramento": "999", "aliquota": "0"}],
    "pis": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "01", "aliquota": "0.65"}],
    "cofins": [{"tipo_pessoa": "padrao", "cenario": "padrao", "situacao_tributaria": "01", "aliquota": "3"}],
    "tributos_federais": "13.45",
    "tributos_estaduais": "18"
  }
}

IBS/CBS scenario with full taxation, to add to configuracao.ibs_cbs:

"ibs_cbs": [
  {
    "tipo_pessoa": "padrao",
    "cenario": "padrao",
    "situacao_tributaria": "000",
    "classificacao_tributaria": "000001"
  }
]

The values in the examples are for illustration only: confirm the CFOP, CST, rates and MVA with the company's accountant.

Tax classes
Service class (NFS-e)

With tipo: servico, the fields of configuracao depend on the NFS-e layout of the company's municipality. Each city hall authorizes the NFS-e (service invoice) through its own system or the national standard, so the accepted fields vary by city. The API picks the layout from the municipality's provider (and, in some cases, from the company's regime and plan) on every creation or edit; you do not send it in the request. If the municipality has no NFS-e provider available, the creation is rejected on the field empresa.

How the API picks the layout of the service class When you create or edit a service class, the API checks whether the company's municipality has an NFS-e provider. Without a provider, it rejects the request with HTTP 422 on the field empresa. With a provider, it applies the provider's layout, which defines the accepted fields, and saves the class. POST .../classe-imposto Municipality has a provider? city of the company Rejected HTTP 422 on empresa Provider layout National standard, MEI or municipal Class saved referencia REF123 yes no
Defines the accepted fields Check Class available Rejected
The layout is picked on every creation or edit. Fields of another layout do not reject the request, but they are not saved.
Fields of other layouts are ignored. A field that is valid for another layout does not reject the request, but it is not saved. A conditional field is used only when its condition is met.

Numeric values (iss, pis, cofins, inss, ir, csll, cp, deducoes) are percentages from 0 to 100 with up to 4 decimal places; zero is not saved.

Service class
Common fields

ParameterRequiredTypeSizeDescription
codigo_servico
string1-9Service code in the municipality. In the national layouts, the 6-digit code of the national service list (01.07.01 or 010701), checked against the service list
codigo_cnae
string1-9CNAE (economic activity code) of the service
codigo_tributacao_municipio
string1-20Taxation code of the municipality (up to 9 in the national layouts)
codigo_nbs
string9NBS code (Brazilian service nomenclature). In the national standard, checked against the NBS table
cod_indicador_operacao
string6Transaction indicator of the tax reform
020101, 020201, 020301, 030101 to 030104, 040101, 050101 to 050104, 050201, 060101, 070101, 070102, 080101, 100101, 100102, 100201, 100301, 100302, 100401, 100501, 100502, 100601
consumidor_final
string1Sale to a final consumer
0 (no)
1 (yes)
iss_retido
string1ISS withheld
1 (yes)
2 (no)
responsavel_retencao
string1Party responsible for the withholding, required when iss_retido is 1
1 (service buyer)
2 (intermediary)
iss
decimal0-100ISS (city service tax) rate
pis
decimal0-100PIS rate
cofins
decimal0-100COFINS rate
inss
decimal0-100INSS (social security) rate
ir
decimal0-100IR (income tax) rate
csll
decimal0-100CSLL (social contribution on net profit) rate

Service class
National standard

Layout of the national issuer (Emissor Nacional), which includes the municipalities on the national NFS-e standard (Padrão Nacional) and on NotaControl:

ParameterRequiredTypeSizeDescription
codigo_servico
string6Code of the national service list (01.07.01)
codigo_nbs
string9NBS code, checked against the NBS table
consumidor_final
string10 or 1
cod_indicador_operacao
string6Transaction indicator (list in Common fields)
codigo_tributacao_municipio
string1-9Taxation code of the municipality
codigo_interno
string1-20Internal service code
informacoes_complementares
string1-2000Additional information
tributacao_iss
string1ISSQN taxation
1 (taxable)
2 (immunity)
4 (not levied)
tipo_imunidade
string1Read when tributacao_iss is 2
0 to 5
iss
decimal0-100ISS rate, read when tributacao_iss is 1
iss_retido
string11 (yes) or 2 (no)
responsavel_retencao
string1Required when iss_retido is 1: 1 or 2
cst_pis_cofins
string2PIS/COFINS CST
00 to 09, 49 to 56, 60 to 67, 70 to 75, 98, 99
pis_cofins_retido
string1PIS/COFINS withholding (0 to 9). Required when cst_pis_cofins is sent and is not 00, 04, 06, 08 or 09
pis
decimal0-100PIS rate, under the same conditions as pis_cofins_retido
cofins
decimal0-100COFINS rate, under the same conditions
ir
decimal0-100IR rate
csll
decimal0-100CSLL rate
cp
decimal0-100Social security contribution rate
ibs_cbs
object---IBS/CBS of the service. See IBS/CBS

For an MEI (individual micro-entrepreneur) on the national issuer, the layout can be the full or the simplified one, depending on the plan:

LayoutFields
Full MEItipo_emissao (required: 1 full DPS, 2 simplified), codigo_servico (national list, required), codigo_nbs. With tipo_emissao: 2, discriminacao (required, up to 2,000 characters), and the class keeps the status processando until it is synchronized with the National Portal. With tipo_emissao: 1, the national standard fields above, except consumidor_final, codigo_interno and informacoes_complementares; cst_pis_cofins from 00 to 09 and pis_cofins_retido 1 or 2.
Simplified MEIcodigo_servico (national list, required), codigo_nbs and discriminacao (required, up to 2,000 characters). No IBS/CBS.

Service class
Municipal layouts

In the layouts below, "ISS withheld" means iss_retido is required and responsavel_retencao is required when withheld, and "Rates" means the optional fields iss, pis, cofins, inss, ir and csll. All of them accept ibs_cbs, except Florianópolis.

LayoutFields
Municipal (ABRASF)codigo_cnae, codigo_nbs, codigo_servico (required), codigo_tributacao_municipio, natureza_operacao (required: 1 to 6), exigibilidade_iss (required: 1 to 7), cod_indicador_operacao, consumidor_final, deducoes, ISS withheld, Rates.
Themacodigo_cnae, codigo_servico (required), codigo_tributacao_municipio, codigo_nbs, cod_indicador_operacao, natureza_operacao (required: 51, 52, 53, 58, 59, 61, 62, 63, 64, 68, 69, 78, 79; in Lajeado/RS: 51, 52, 57, 58, 59, 61, 62, 63, 64, 67, 68, 69, 78, 79), ISS withheld, Rates.
São Paulocodigo_cnae, codigo_servico (required), codigo_tributacao_municipio, natureza_operacao (required: 1 to 6), tipo_tributacao (required: T, F, A, B, D, M, N, R, S, X, V, P), ISS withheld, codigo_nbs, consumidor_final, cod_indicador_operacao, Rates.
SIGISScodigo_servico (required), tributacao (required: 1 to 5), codigo_nbs, cod_indicador_operacao, ISS withheld, Rates.
Governacodigo_servico (required), regime_recolhimento (required: 00, 02, 03, 04, 07, 08, 09, 11, 12), forma_recolhimento (required: 00 to 07), codigo_nbs, cod_indicador_operacao, Rates. No ISS withheld.
CECAMcodigo_cnae (required, up to 7), codigo_servico (optional), codigo_nbs, cod_indicador_operacao, local_prestacao (required: 1 to 4), cep_local_prestacao (up to 8 digits, required when local_prestacao is 4), iss_retido (required, without the responsible party), Rates.
DSFcodigo_cnae, codigo_servico (required), codigo_tributacao_municipio, codigo_nbs, cod_indicador_operacao, tipo_tributacao (required: C, E, F, K, N, T, G, H, M), tipo_operacao (required: A, B, C, D, J), exigibilidade_iss (optional), ISS withheld, Rates.
Florianópolisid_cnae (required, up to 20 digits), situacao_tributaria (required: 00, 1 to 16), iss_retido (required), iss, and the list cfps with at least 1 item {"cenario": 1 to 4, "cfps": up to 10 digits}. No IBS/CBS.
Osascocodigo_servico (required), codigo_nbs, cod_indicador_operacao, ISS withheld, Rates.
ELcodigo_cnae, codigo_servico (required), codigo_tributacao_municipio, codigo_nbs, cod_indicador_operacao, natureza_operacao (required: 1 to 6), exigibilidade_iss (required), ISS withheld, local_prestacao (required: 1 or 2), Rates.
São Luíscodigo_cnae, codigo_servico (required), codigo_tributacao_municipio, codigo_nbs, cod_indicador_operacao, natureza_operacao (required), exigibilidade_iss (required), iss_retido (required), tipo_operacao (optional: A, B, C, D, J), responsavel_retencao (required when withheld), Rates.
CONAMcodigo_cnae, codigo_nbs, codigo_servico (required), codigo_tributacao_municipio, natureza_operacao (required), exigibilidade_iss (required), tipo_tributacao (required: 1 to 6), consumidor_final, deducoes, ISS withheld, cod_indicador_operacao, Rates.
Fortalezacodigo_cnae, codigo_nbs, codigo_servico (required), codigo_tributacao_municipio, natureza_operacao (required), exigibilidade_iss (required), cod_indicador_operacao, consumidor_final, tipo_operacao (optional: 1 to 5), deducoes, ISS withheld, Rates.
IMAcodigo_servico (required), codigo_cnae, codigo_tributacao_municipio, codigo_nbs, cod_indicador_operacao, ISS withheld and the list tributacao with 1 or 2 items {"cenario": 1 or 2, "exigibilidade_iss", "deducoes", "iss", "pis", "cofins", "inss", "ir", "csll"}, without repeating the scenario.

Service class
IBS/CBS of the service

For services, ibs_cbs is a single object (not a list of scenarios), with the same fields as the product IBS/CBS, except tipo_pessoa and cenario. The CST must be accepted for the NFS-e, and credito_presumido is a simple code (3, 4, 5, 6, 7, 10, 11 or 13), required when the CST and the classification provide for it.

Service class
Examples

Service class on the national standard, with taxable ISS withheld by the service buyer:

curl -X POST 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/classe-imposto' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "tipo": "servico",
    "descricao": "Desenvolvimento de software",
    "configuracao": {
      "codigo_servico": "01.01.01",
      "tributacao_iss": "1",
      "iss": "2",
      "iss_retido": "1",
      "responsavel_retencao": "1",
      "ibs_cbs": {
        "situacao_tributaria": "000",
        "classificacao_tributaria": "000001"
      }
    }
  }'

Service class on the Municipal (ABRASF) layout:

{
  "tipo": "servico",
  "descricao": "Consultoria",
  "configuracao": {
    "codigo_servico": "1701",
    "natureza_operacao": "1",
    "exigibilidade_iss": "1",
    "iss_retido": "2",
    "iss": "5"
  }
}

The codes in the examples are for illustration only: use the service code and the rates of the company's municipality.

Tax classes
Communication class (NFCom)

With tipo: comunicacao, configuracao sets the taxes on the items of the NFCom (telecom invoice).

ParameterRequiredTypeSizeDescription
codigo_classificacao
string7Classification code of the NFCom item (NFCom table, e.g. 0100101, 0600401)
icms
object---ICMS of the item
icms.situacao_tributaria
string2ICMS CST
00, 20, 40, 51, 60, 90
icms.origem
string1Origin of the goods, from 0 to 8. Default 0
icms.aliquota
decimal0-100ICMS rate, read in CSTs 00, 20 and 90
icms.aliquota_fcp
decimal0-100FCP rate, read in CSTs 00 and 90
icms.codigo_cfop
string4CFOP
5301 to 5307, 5933, 6301 to 6307, 7301
icms.percentual_reducao
decimal0-100Base reduction percentage, required and greater than zero in CST 20
pis
object---{"situacao_tributaria", "aliquota"}, with CST 01, 02, 06, 07, 08, 09 or 49 and an optional rate up to 100
cofins
object---Same format as pis
fust
object---FUST (federal telecom fund) rate: {"aliquota"}, up to 100
funttel
object---FUNTTEL (federal telecom fund) rate: {"aliquota"}, up to 100

Example setup:

{
  "tipo": "comunicacao",
  "descricao": "Assinatura de internet",
  "configuracao": {
    "codigo_classificacao": "0600401",
    "icms": {
      "situacao_tributaria": "00",
      "origem": "0",
      "codigo_cfop": "5307",
      "aliquota": "18"
    },
    "pis": { "situacao_tributaria": "01", "aliquota": "0.65" },
    "cofins": { "situacao_tributaria": "01", "aliquota": "3" },
    "fust": { "aliquota": "1" },
    "funttel": { "aliquota": "0.5" }
  }
}

Company registrations

Each company keeps registrations (cadastros) of its customers, products, carriers and services. The Fiscal Issuer in the Webmania® Panel uses them to fill in documents. You manage them at /2/b2b/empresas/{uuid}/cadastros/{tipo}.

URLHTTP VerbFunction
/2/b2b/empresas/{uuid}/cadastros/{tipo}GETList registrations
/2/b2b/empresas/{uuid}/cadastros/{tipo}POSTCreate a registration
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id}PUTEdit a registration
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id}DELETEDelete a registration
ParameterRequiredTypeSizeDescription
{tipo}
string---Registration type, in the URL: customers, products, carriers or services
clientes
produtos
transportadoras
servicos
{id}
string36UUID of the registration, returned in id. Used to edit and delete

Registrations
Create or edit a registration

Send the fields of the registration at the root of the JSON object or inside data. With data, only its content is used. The fields marked indexed in each type are normalized, are searchable and come back at the top level of the response. The other fields are stored as sent and come back in dados. Use the names shown, which are the ones the Fiscal Issuer uses.

  • The API validates only the required field of each type. It does not check formats such as CPF, CNPJ, CEP, NCM and GTIN: send the data already correct.
  • The Type and Size columns show the format the invoice accepts when it is issued. Fields marked Individual, Company or Foreigner apply to that kind of registration.
  • Edits are partial: the fields you send replace the stored ones and the others are kept. A nested object is replaced as a whole.
  • Create and edit return HTTP 200 with the stored registration in dados.

Registrations
Customers

ParameterRequiredTypeSizeDescription
nome
string2-60Display name of the customer in the Fiscal Issuer. name is an alternative name. Indexed and searchable
tipo_pessoa
string1Person type of the customer
1 - Individual (Pessoa Física)
2 - Company (Pessoa Jurídica)
Indexed
documento
string11-14CPF or CNPJ, stored with digits only (an alphanumeric CNPJ is kept as is). Indexed and used in the search by document
cpf
Individual
string11CPF (individual taxpayer ID) of the customer
000.000.000-00
nome_completo
Individual
string2-60Full name of the individual
cnpj
Company
string14CNPJ (company ID) of the customer
00.000.000/0000-00
razao_social
Company
string2-60Legal name of the company
ie
Company
string2-14State registration (Inscrição Estadual)
im
Company
string1-15City registration (Inscrição Municipal)
suframa
Company
string8-9SUFRAMA registration
substituto_tributario
Company
string---Marks the customer as a tax substitute
id_estrangeiro
Foreigner
string---ID document of the foreign customer
nome_estrangeiro
Foreigner
string---Name of the foreign customer
pais
Foreigner
string---Country of the foreign customer
email
string---Email of the customer. Indexed and searchable
telefone
string---Phone. phone is an alternative name. Indexed
cep
string8CEP (postal code)
00000-000 (with or without punctuation)
endereco
string2-60Street
numero
string1-60Street number
If there is none, send S/N
complemento
string1-60Address complement
bairro
string2-60District
cidade
string2-60City
uf
string2State
XX
curl -X POST 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/cadastros/clientes' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{
    "nome": "Cliente Exemplo LTDA",
    "documento": "00000000000000",
    "tipo_pessoa": "2",
    "cnpj": "00.000.000/0000-00",
    "razao_social": "Cliente Exemplo LTDA",
    "ie": "0000000000",
    "email": "financeiro@cliente.com.br",
    "telefone": "1130000000",
    "endereco": "Avenida Paulista",
    "numero": "1000",
    "bairro": "Bela Vista",
    "cidade": "São Paulo",
    "uf": "SP",
    "cep": "01310100"
  }'

Registrations
Products

ParameterRequiredTypeSizeDescription
nome
string1-120Product name. name is an alternative name. Indexed and searchable
codigo
string1-60Product code (SKU). code is an alternative name. Indexed and searchable
ncm
string8NCM (the 8-digit Mercosur product classification code), stored with digits only. Indexed and searchable
0000.00.00
valor
decimal---Unit price of the product. Indexed
0.00
gtin
string8-14Barcode (GTIN/EAN)
cest
string7CEST, the 7-digit code required on goods listed for ICMS tax substitution; it is linked to the NCM
unidade
string1-6Sales unit
UN, KG, CX, ...
{
  "nome": "Camiseta básica",
  "codigo": "CAM-001",
  "ncm": "61091000",
  "valor": "49.90",
  "gtin": "7890000000000",
  "unidade": "UN"
}

Registrations
Carriers

ParameterRequiredTypeSizeDescription
nome
string2-60Display name of the carrier. name is an alternative name. Indexed and searchable
tipo_pessoa
string1Person type
1 - Individual (Pessoa Física)
2 - Company (Pessoa Jurídica)
cnpj
Company
string14CNPJ of the carrier, stored with digits only. Indexed and searchable
00.000.000/0000-00
razao_social
Company
string2-60Legal name of the carrier
ie
Company
string2-14IE (Inscrição Estadual, state registration). Indexed and searchable
cpf
Individual
string11CPF of the carrier
000.000.000-00
nome_completo
Individual
string2-60Full name of the carrier
cep
string8CEP, stored with digits only. Indexed
endereco
string2-60Full address
cidade
string2-60City
uf
string2State
placa
string7Vehicle license plate
uf_veiculo
string2State of the vehicle
rntc
string---National road cargo carrier registration (RNTC)
reboque_placa
string7Trailer license plate
reboque_uf_veiculo
string2State of the trailer
reboque_rntc
string---RNTC of the trailer
seguro
string---Insurance identification
vagao
string---Rail wagon identification
balsa
string---Barge identification
{
  "nome": "Transportadora Exemplo",
  "razao_social": "Transportadora Exemplo LTDA",
  "tipo_pessoa": "2",
  "cnpj": "00000000000000",
  "ie": "0000000000",
  "cep": "01001000",
  "endereco": "Rua Exemplo, 100",
  "cidade": "São Paulo",
  "uf": "SP",
  "placa": "ABC1D23",
  "uf_veiculo": "SP"
}

Registrations
Services

ParameterRequiredTypeSizeDescription
discriminacao
string---Description of the service. descricao is an alternative name. Indexed and searchable

For services, nome is not used as the identifier: always send discriminacao. Other fields are stored in dados.

{
  "discriminacao": "Consultoria em tecnologia da informação"
}

Registrations
Response

Each registration comes back with id, the indexed fields of its type, criado_em, atualizado_em and dados with everything that was stored. Example of the response when a customer is created:

{
  "sucesso": true,
  "dados": {
    "id": "UUID_DO_CADASTRO",
    "nome": "Cliente Exemplo LTDA",
    "documento": "00000000000000",
    "email": "financeiro@cliente.com.br",
    "telefone": "1130000000",
    "tipo_pessoa": "2",
    "criado_em": "2026-11-28 10:00:00",
    "atualizado_em": "2026-11-28 10:00:00",
    "dados": {
      "nome": "Cliente Exemplo LTDA",
      "documento": "00000000000000",
      "tipo_pessoa": "2",
      "cnpj": "00.000.000/0000-00",
      "razao_social": "Cliente Exemplo LTDA",
      "cidade": "São Paulo",
      "uf": "SP"
    }
  }
}
TypeIndexed fields in the response
clientesnome, documento, email, telefone, tipo_pessoa
produtosnome, codigo, ncm, valor
transportadorasnome, cnpj, ie, cep
servicosdiscriminacao

Registrations
List registrations

Send a GET request to /2/b2b/empresas/{uuid}/cadastros/{tipo}. The list shows the most recently changed registrations first, without pagination.

ParameterRequiredTypeSizeDescription
limit
integer1-250Maximum number of registrations. Default 50
search
string---Case-insensitive search by part of the text. q is an alternative name. Customers: name, document and email. Products: name, code and NCM. Carriers: name, CNPJ and IE. Services: description. For documents and NCM, search with digits only
curl 'https://api.webmania.com.br/2/b2b/empresas/UUID_DA_EMPRESA/cadastros/produtos?search=camiseta&limit=20' \
  -H 'Authorization: Bearer YOUR_B2B_TOKEN'
{
  "sucesso": true,
  "dados": [
    {
      "id": "UUID_DO_CADASTRO",
      "nome": "Camiseta básica",
      "codigo": "CAM-001",
      "ncm": "61091000",
      "valor": "49.90",
      "criado_em": "2026-11-28 10:00:00",
      "atualizado_em": "2026-11-28 10:00:00",
      "dados": {
        "nome": "Camiseta básica",
        "codigo": "CAM-001",
        "ncm": "61091000",
        "valor": "49.90",
        "gtin": "7890000000000",
        "unidade": "UN"
      }
    }
  ]
}

Registrations
Delete a registration

Send a DELETE request to /2/b2b/empresas/{uuid}/cadastros/{tipo}/{id}. The HTTP 200 response has the deleted id. Deleting the same registration a second time returns HTTP 404.

{
  "sucesso": true,
  "dados": {
    "id": "UUID_DO_CADASTRO"
  }
}

Registrations
Errors

HTTPSituation
404The company is not in the account, or the registration does not exist, was already deleted or belongs to another company (recurso_nao_encontrado).
422Invalid type, empty body, id not in UUID format, or a required field missing. The response has erro: "Verifique os dados informados." (check the data you sent) and codigo: validacao_falhou.

Authentication

B2B-only credentials. The B2B management access credentials are unique and work only on the B2B endpoints. Access is available only on some plans.

Use the B2B credentials of your account, found in the Credentials (Credenciais) tab of the Settings (Configurações) menu in the Webmania® Panel. The credentials of a single company do not work on the B2B endpoints. See your credentials here.

Authentication uses HTTP headers. Send the X-Consumer-Key and X-Consumer-Secret of your application, together with the X-Access-Token and X-Access-Token-Secret of your user.

In requests with a body, send the data in JSON, with the header Content-Type set to application/json.

Keep your access credentials safe. Never publish the access credentials in the source code of a website, app or software where users can easily reach them.

For iOS and Android mobile apps, we recommend sending the API requests from your server (back end). The app source code should only make the request, while the processing runs on your server.

Companies

With the B2B Management API you create new companies in your account and list existing ones with their access credentials. You update each company's details later, with its own credentials, in Update a company.

Companies
Create new companies

One call creates as many companies as you request and returns the access credentials of each one.

To create new companies, send a POST request to /1/b2b/empresas/ with only the parameter quantidade: the number of companies you want to create.

Parameter Type Description
quantidade integer Required. Whole number of companies to create, from 1 to 100, within the limit of your plan.

Example request:

curl -X POST \
-H "X-Consumer-Key: YOUR_RESELLER_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_RESELLER_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_RESELLER_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_RESELLER_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
    "quantidade": 3
}' \
https://webmania.com.br/api/1/b2b/empresas/

Example of an HTTP 200 response: an array of JSON objects, one per company created, with the fields id, consumer_key, consumer_secret, access_token, access_token_secret and bearer_access_token:

Parameter Type Description
id integer Unique ID of the company
consumer_key string Consumer Key
API 1.0 credential
consumer_secret string Consumer Secret
API 1.0 credential
access_token string Access Token
API 1.0 credential
access_token_secret string Access Token Secret
API 1.0 credential
bearer_access_token string Bearer Access Token
API 2.0 credential
[
  {
    "id": 1234,
    "consumer_key": "YOUR_CONSUMER_KEY",
    "consumer_secret": "YOUR_CONSUMER_SECRET",
    "access_token": "YOUR_ACCESS_TOKEN",
    "access_token_secret": "YOUR_ACCESS_TOKEN_SECRET",
    "bearer_access_token": "YOUR_BEARER_ACCESS_SECRET"
  },{
    "id": 1235,
    "consumer_key": "YOUR_CONSUMER_KEY",
    "consumer_secret": "YOUR_CONSUMER_SECRET",
    "access_token": "YOUR_ACCESS_TOKEN",
    "access_token_secret": "YOUR_ACCESS_TOKEN_SECRET",
    "bearer_access_token": "YOUR_BEARER_ACCESS_SECRET"
  },
  {
    "id": 1236,
    "consumer_key": "YOUR_CONSUMER_KEY",
    "consumer_secret": "YOUR_CONSUMER_SECRET",
    "access_token": "YOUR_ACCESS_TOKEN", 
    "access_token_secret": "YOUR_ACCESS_TOKEN_SECRET",
    "bearer_access_token": "YOUR_BEARER_ACCESS_SECRET"
  }
]
Plans that issue only through the Webmania® Panel: when the customer's account is on a plan that does not include API access, the response also has the field api_available with the value false, and the credential fields (consumer_key, consumer_secret, access_token, access_token_secret and bearer_access_token) come back empty. The company is still created as usual and access to the Webmania® Panel does not change: the tax documents are issued in the panel. On the other plans, the response stays exactly as documented above.

The field bearer_access_token can come back empty while the API 2.0 credential is being made available. List the companies again to get the credential when it is ready.

With these access credentials, you update the details of each company at the endpoint /1/nfe/empresa/, described in Update a company.

Companies
List companies

The list returns every company in the account, with the registration details and access credentials of each. Also use it to get the bearer_access_token if it came back empty on creation.

To list the registered companies, send a GET request to /1/b2b/empresas/. The response is a JSON array with these fields:

Parameter Type Description
id string or integer Unique ID number. The type can change between requests: it comes back as a string and, when the list is served from the cache, as an integer. Handle the value in a type-tolerant way (for example, convert it to a string before you compare).
cnpj
Company
string CNPJ (company ID) of the issuing company
00.000.000/0000-00
razao_social
Company
string Legal name of the company
cpf
Individual
string CPF (individual taxpayer ID) of the issuing individual
000.000.000-00
nome_completo
Individual
string Full name of the individual
cidade string Name of the city where the company is located
estado string State of the city where the company is located
ie string State registration (Inscrição Estadual) number
unidade_empresa string Type of unit: head office (matriz) or branch (filial)
matriz
filial
tipo_tributacao string Taxation type
mei
simples_nacional
simples_nacional_sublimite
lucro_normal
credenciais object Access credentials of the company. The credential values come back empty when the plan does not include API access.

Example request:

curl -X GET \
-H "X-Consumer-Key: YOUR_RESELLER_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_RESELLER_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_RESELLER_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_RESELLER_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
https://webmania.com.br/api/1/b2b/empresas/

Example of an HTTP 200 response. The field id can come back as a string or as an integer (see the table above); the example below shows both forms:

[
  {
    "id": "1234",
    "razao_social": "Nome da empresa LTDA",
    "cnpj": "00000000000000",
    "ie": "0000000000",
    "unidade_empresa": "matriz",
    "tipo_tributacao": "simples_nacional",
    "credenciais": {
        "consumer_key": "YOUR_CONSUMER_KEY",
        "consumer_secret": "YOUR_CONSUMER_SECRET",
        "access_token": "YOUR_ACCESS_TOKEN",
        "access_token_secret": "YOUR_ACCESS_TOKEN_SECRET",
        "bearer_access_token": "YOUR_BEARER_ACCESS_SECRET"
    }
  },
  {
    "id": 1235,
    "nome_completo": "Nome da empresa LTDA",
    "cpf": "00000000000",
    "ie": "0000000000",
    "unidade_empresa": "matriz",
    "tipo_tributacao": "simples_nacional",
    "credenciais": {
        "consumer_key": "YOUR_CONSUMER_KEY",
        "consumer_secret": "YOUR_CONSUMER_SECRET",
        "access_token": "YOUR_ACCESS_TOKEN",
        "access_token_secret": "YOUR_ACCESS_TOKEN_SECRET",
        "bearer_access_token": "YOUR_BEARER_ACCESS_SECRET"
    }
  }
]

Update a company

You can update the details of the issuing company in the Webmania® Panel or through the REST API: registration details, address, series and numbering of each document type, A1 digital certificate and optional settings.

To update the company details, send a POST request to /1/nfe/empresa/, with the access credentials of the company returned on creation or in the list. The B2B credentials of the account do not work on this endpoint.

New integrations should set up the company by its UUID in version 2.0.

The endpoint accepts partial updates: send only the fields to change. The conditional marks apply when validar_setup_completo is turned on and data that should already be on file is missing; CNPJ/CPF and legal name/full name are alternatives. Whether IE (Inscrição Estadual, state registration) or IM (Inscrição Municipal, city registration) applies depends on the plan.

The details of your company must match the national company registry (CNPJ) of the Federal Revenue (Receita Federal) (in Portuguese).
Parameter All types Type Size Description
tipo_tributacao
string 3-26 Taxation type: individual micro-entrepreneur (mei), Simples Nacional (small business regime), Simples Nacional above the sub-limit, or normal taxation (lucro_normal)
mei
simples_nacional
simples_nacional_sublimite
lucro_normal
regime_tributario
string --- Regime tributário (tax regime): Lucro Real (actual profit) or Lucro Presumido (presumed profit)
lucro_real
lucro_presumido
cnpj
Company
string 14 CNPJ (company ID) of the issuing company
00.000.000/0000-00
razao_social
Company
string 2-60 Legal name of the company
cpf
Individual
string 11 CPF (individual taxpayer ID) of the issuing individual
000.000.000-00
nome_completo
Individual
string 2-60 Full name of the individual
nome_fantasia
string 1-60 Trade name of the issuer
ie
string 2-14 State registration (Inscrição Estadual) number
im
string 1-15 City registration (Inscrição Municipal) number
unidade_empresa
string 6 Type of unit: head office (matriz) or branch (filial)
matriz
filial
email
string 1-60 Customer service email
telefone
string 6-14 Customer service phone
conta_bancaria_banco
string 1-3 Bank code
EX: 77 - BANCO INTER
When you send bank details, send the four conta_bancaria_* fields together, as strings. The code is checked against the list of banks.
conta_bancaria_agencia
string 4-5 Bank branch number. Digits only.
conta_bancaria_numero
string 1-20 Bank account number. Digits only.
conta_bancaria_digito
string 1 Check digit of the bank account.
contabilidade
string 11 or 14 per item CPF/CNPJ of the accountant
Send at most 9 valid CNPJ/CPF numbers separated by commas; duplicates are removed.
url_notificacao
string --- Notification URL
logomarca
string --- Logo URL
Allowed formats: JPEG, PNG or WEBP. Maximum size 1MB; the image is converted to JPEG.

Example request to update the main details of the company:

curl -X POST \
-H "X-Consumer-Key: YOUR_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
  "tipo_tributacao": "simples_nacional",
  "cnpj": "00.000.000/0000-00",
  "razao_social": "Nome da empresa LTDA",
  "nome_fantasia": "Nome da empresa",
  "ie": "0000000000",
  "unidade_empresa": "matriz",
  "email": "atendimento@example.com",
  "conta_bancaria_banco": "001",
  "conta_bancaria_agencia": "1234",
  "conta_bancaria_numero": "1234567",
  "conta_bancaria_digito": "1",
  "subdominio": "nfe.meudominio.com.br",
  "url_notificacao": "http://meudominio.com/retorno.php",
  "logomarca": "http://meudominio.com.br/logomarca.jpg"
}' \
https://webmania.com.br/api/1/nfe/empresa/

Example of an HTTP 200 response. A success response has success; it can also carry alerts or warnings, including about numbering that was not saved. Also check error, even with HTTP 2xx. This example is a success without warnings (the request above is only an illustration: use a valid CPF/CNPJ and the real details of the company):

{
  "success": "Empresa atualizada com sucesso."
}

Update a company
Address

To update the address of the company, send a POST request to /1/nfe/empresa/.

Partial updates are also accepted. The conditional fields are required for the complete registration only when they are not on file yet.

The details of your company must match the national company registry (CNPJ) of the Federal Revenue (Receita Federal) (in Portuguese).
Parameter All types Type Size Description
cep
string 8 digits CEP (postal code) of the company
00000-000 (with or without punctuation)
endereco
string 2-60 Street address of the company
numero
string 1-60 Street number
If there is none, send S/N
complemento
string 1-60 Address complement
bairro
string 2-60 District
cidade
string 2-60 City
uf
string 2 State
XX

Example request to update the address of the company:

curl -X POST \
-H "X-Consumer-Key: YOUR_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
  "cep": "00000-000",
  "endereco": "Av. Brg. Faria Lima",
  "numero": "1000",
  "complemento": "Nome da empresa",
  "bairro": "Itaim Bibi",
  "cidade": "São Paulo",
  "uf": "SP"
}' \
https://webmania.com.br/api/1/nfe/empresa/

Update a company
Invoice settings

To update the numbering and the series of the invoices, send a POST request to /1/nfe/empresa/.

Send only the settings to change; series, numbering and CSC are not required in every update. When you send a CSC (taxpayer security code for the NFC-e), send the ID and the code together for the same environment. Fields marked as sandbox apply to the test environment (homologação).

Webmania manages the invoice numbering automatically, so you do not need to change it for each document. Only set it at the start, or correct it when needed or when your accountant asks.
Document: NF-e
Parameter NF-e Type Size Description
nfe_serie
integer 1-3 Series number of the NF-e
nfe_numero
integer 1-9 Number of the NEXT INVOICE
Production environment
nfe_numero_dev
integer 1-9 Number of the NEXT INVOICE
Sandbox environment
informacoes_fisco
string 1-2000 Information for the tax authority
Text printed on every document. Example: Documento emitido por ME ou EPP optante pelo Simples Nacional. Não gera direito a crédito fiscal de ICMS e IPI. (Issued by a small business in Simples Nacional; no ICMS or IPI tax credit.)
cnae_issqn
string 7 CNAE (economic activity code) of the main activity

Document: NFC-e
Parameter NFC-e Type Size Description
nfce_serie
integer 1-3 Series number of the NFC-e
nfce_numero
integer 1-9 Number of the NEXT INVOICE
Production environment
nfce_id_csc
string --- ID of the CSC code. Learn more (in Portuguese)
Production environment
nfce_codigo_csc
string 36 CSC code
Production environment
nfce_numero_dev
integer 1-9 Number of the NEXT INVOICE
Sandbox environment
nfce_id_csc_dev
string --- ID of the CSC code. Learn more (in Portuguese)
Sandbox environment
nfce_codigo_csc_dev
string 36 CSC code
Sandbox environment
informacoes_fisco
string 1-2000 Information for the tax authority
Text printed on every document. Example: Documento emitido por ME ou EPP optante pelo Simples Nacional. Não gera direito a crédito fiscal de ICMS e IPI. (Issued by a small business in Simples Nacional; no ICMS or IPI tax credit.)
Document: CT-e / CT-e OS
Parameter CT-e / CT-e OS Type Size Description
cte_serie
integer 1-3 Series number of the CT-e
cte_number
integer 1-9 Number of the NEXT CT-e
Production environment
cte_number_dev
integer 1-9 Number of the NEXT CT-e
Sandbox environment
cte_os_serie
integer 1-3 Series number of the CT-e OS
cte_os_number
integer 1-9 Number of the NEXT CT-e OS
Production environment
cte_os_number_dev
integer 1-9 Number of the NEXT CT-e OS
Sandbox environment
taf_cte_os
string 12 TAF (charter authorization, Termo de Autorização de Fretamento) for road CT-e OS
Digits only
registro_estadual_cte_os
string 25 Registro Estadual (state transport registration) number for road CT-e OS
Digits only
Document: DC-e
Parameter DC-e Type Size Description
dce_serie
integer 1-3 Series number of the DC-e
dce_numero
integer 1-9 Number of the NEXT DC-e
Production environment
dce_numero_dev
integer 1-9 Number of the NEXT DC-e
Sandbox environment
tipo_emissor_dce
integer 1 Type of DC-e issuer.
1 - Marketplace
2 - Own issuer
3 - Carrier
site_marketplace
string 2-120 Valid URL of the marketplace website.
Required when you send tipo_emissor_dce = 1; for the other types, it is not kept.
Document: CIOT IPEF

This change is available only to companies whose CIOT (road freight registration code) issuing through an IPEF (electronic freight payment institution) is active in that environment. The number cannot go back to a number already used in the series; to start over, send another series. ciot_ipef_numero is required when you send ciot_ipef_serie; in the sandbox, ciot_ipef_numero_dev is required when you send ciot_ipef_serie_dev.

Parameter CIOT IPEF Type Size Description
ciot_ipef_serie
integer 1-4 Series number of the CIOT IPEF
Production environment
ciot_ipef_numero
integer 1-9 Number of the NEXT CIOT IPEF, greater than zero
Production environment
ciot_ipef_serie_dev
integer 1-4 Series number of the CIOT IPEF
Sandbox environment
ciot_ipef_numero_dev
integer 1-9 Number of the NEXT CIOT IPEF, greater than zero
Sandbox environment
Document: NFS-e
Parameter NFS-e Type Size Description
nfse_rps_serie
string
integer (simplified MEI)
1-5 RPS series of the NFS-e (RPS: provisional service receipt)
Example: A1
nfse_rps_numero
integer 1-9 Number of the NEXT RPS
Production environment
cnae
array
string
7 or 9 CNAE codes of the activities; send one code or a list of numeric codes with 7 or 9 digits.
nfse_login
string --- Login of the city hall portal.
Check how the municipality authenticates (A1 certificate, login/password or token): see the city list.
nfse_password
string --- Password of the city hall portal.
Check how the municipality authenticates (A1 certificate, login/password or token): see the city list.
nfse_token
string --- Token (access key or secret phrase) for issuing tax documents.
Check how the municipality authenticates (A1 certificate, login/password or token): see the city list.
regime_apuracao_sn
string 1 Simples Nacional tax calculation method.
Required if the company is in Simples Nacional
1 - Federal and city taxes calculated under Simples Nacional (SN)
2 – Federal taxes calculated under SN, and ISSQN on the NFS-e under the city tax law
3 – Federal and city taxes calculated on the NFS-e under the federal and city law of each tax
regime_especial_nacional
string 1 Special tax regime
Available for the national standard (Padrão Nacional)
1 - Cooperative act (Cooperative)
2 - Estimate
3 - City micro-enterprise
4 - Notary or registrar
5 - Self-employed professional
6 - Professional partnership
regime_especial_municipal
string 1 City tax regime
Available for the Abrasf model
1 - City micro-enterprise
2 - Estimate
3 - Professional partnership
4 - Cooperative
5 - Individual micro-entrepreneur (MEI)
6 - Micro and small business (ME/EPP)
7 - Simples Nacional company (only Ponta Grossa-PR and Tapejara-PR)
8 - Limited company
9 - Corporation (sociedade anônima)
11 - Single-member limited company (EIRELI)
12 - Small business (EPP)
13 - Micro-entrepreneur


Note
The values 8, 9, 11, 12 and 13 apply only to the city of São Pedro da Aldeia RJ.
regime_apuracao_sn
string 1 Simples Nacional calculation method
Available for the CONAM provider
1 - Federal and city taxes (SS) under SN
2 - Federal taxes under SN and ISSQN on the NFS-e
3 - Federal and city taxes calculated on the NFS-e under the federal and city law of each tax
nfse_lote_rps_numero
integer 1-9 Number of the NEXT RPS BATCH
Check whether the municipality allows batch issuing: see the city list.
nfse_rps_numero_dev
integer 1-9 Number of the NEXT RPS
Sandbox environment

Example request to update the invoice settings of the company:

curl -X POST \
-H "X-Consumer-Key: YOUR_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
  "nfe_serie": 1,
  "nfe_numero": 1,
  "nfe_numero_dev": 1,
  "informacoes_fisco": "Documento emitido por ME ou EPP.."
}' \
https://webmania.com.br/api/1/nfe/empresa/

Update a company
A1 digital certificate

To update the A1 digital certificate, send a POST request to /1/nfe/empresa/.

Send the parameter certificado in Base64 encoding.

Parameter All types Type Size Description
certificado
Base64 encode --- A1 digital certificate. Learn more (in Portuguese)
certificado_senha
string --- Password of the A1 certificate; required when you send a certificate. Keep letters, special characters and leading zeros as they are.

Illustrative example to update the A1 digital certificate of the company: replace certificado with a valid A1 file in Base64 and send the password as text.

curl -X POST \
-H "X-Consumer-Key: YOUR_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
  "certificado": "VXRpbGl6ZSBhIFJFU1QgQVBJIGRhIFdlYm1hbmlhQlLCriBwYXJhIHJlYWxpemFyIGludGVncmHDp8OjbyBuYSBzdWEgTG9qYSBWaXJ0dWFsLCBFUlAgZSBTaXN0ZW1hcyBGaW5hbmNlaXJvcyBwYXJhIGVtaXNzw6NvIGRlIE5vdGEgRmlzY2FsIEVsZXRyw7RuaWNhIChORi1lKSBlIE5vdGEgRmlzY2FsIGRvIENvbnN1bWlkb3IgRWxldHLDtG5pY2EgKE5GQy1lKS4=",
  "certificado_senha": "0123456"
}' \
https://webmania.com.br/api/1/nfe/empresa/

Update a company
Optional settings

To update the optional settings of the company, send a POST request to /1/nfe/empresa/.

The activity is set per establishment in the field tipo_atividade. In the Webmania® Panel, go to Configurações > Opcionais > “Atividade do estabelecimento (ICMS)” (Settings > Optional > Establishment activity); in Panel v2 (version 2 of the Webmania® Panel), use the tax options of the company. The options are “Não informado” (not set), “Comerciante (revenda)” (trader, resale), “Indústria” (manufacturer) and “Produtor” (producer). In API 1.0, send the field at the root of POST /api/1/nfe/empresa/, with the credentials of the company.

In API 2.0, the same field can be updated in POST /2/empresa and read in GET /2/empresa. These channels accept the same values and require access authorization to the company. When read, an activity that is not set comes back as null.

Example of a partial update that keeps the other settings:

{
  "tipo_atividade": "industria"
}

To clear the activity, send {"tipo_atividade":null} or {"tipo_atividade":""}. Leaving the field out keeps the saved value; it is not the same as clearing it. Declaring an activity does not confirm the classification of every product, nor does it prove earlier tax payments. The recipient uses another set of values in cliente.tipo_atividade, which accepts only comerciante or industria.

Parameter All types Type Size Description
tipo_atividade NEW
string / null --- Activity of the issuing establishment: comerciante (trader, resale), industria (manufacturer) or produtor (producer). null or "" clears the setting. Used to calculate the basic food basket (cesta básica) taxes.
partilha_icms_contribuinte
boolean --- Legacy DIFAL option for Simples Nacional.
The value is saved, but the NF-e/NFC-e flow loads this option as turned off; do not use it to turn on the calculation.
partilha_icms_isento
boolean --- Legacy DIFAL exemption option for normal taxation (Lucro Normal).
The value is saved, but the NF-e/NFC-e flow loads this option as turned off; do not use it to change the calculation.
orientacao_danfe
string 1 Orientation of the DANFE (printed invoice summary)
P - Portrait
L - Landscape
microcervejaria
boolean --- Microbrewery flag.
It can be turned on only for companies in PR, SC, RS and BA; the accountant must confirm the tax classification. Learn more (in Portuguese).
icms_ref_sp
boolean --- Opts into the special tax regime for meals served in bars and restaurants
- ICMS rate 3.69%
State of São Paulo
refeicoes_sp
boolean --- Opts into the special tax regime for meals
served in bars and restaurants
- ICMS rate 3.69%
State of São Paulo
icms_ref_df
boolean --- Opts into the simplified regime for food supply
under Law 3,168/2003
- ICMS rate 2%
Federal District
exclusao_icms_pis_cofins
boolean --- Remove ICMS from the PIS COFINS calculation base
STF - RE 574.706/PR
exclusao_difal_pis_cofins
boolean --- Remove DIFAL from the PIS COFINS calculation base
SEI nº 71.2025
deduzir_desconto_ipi NEW
boolean --- Deduct the discount from the IPI calculation base
COSIT Nº 72 DE 14/03/2019 - Published in the DOU on 28 Mar 2019 (Page 35)
base_calculo_ipi_sem_frete NEW
boolean --- Removes the freight value from the IPI calculation base
Exceptional conditions that the company's accountant must certify
email_automatico_nfse
boolean --- Automatically email the issued NFS-e to the service buyer
ativar_epec
string 1 Turn on EPEC contingency issuing
1 - Yes
0 - No
ocultar_total_etiqueta
string 1 Hide the total value when printing the label DANFE (DANFE Etiqueta)
1 - Yes
0 - No

Example request to update the optional settings of the company:

curl -X POST \
-H "X-Consumer-Key: YOUR_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
-d '{
  "orientacao_danfe": "L"
}' \
https://webmania.com.br/api/1/nfe/empresa/

Requests
Check requests

This lookup shows monthly API usage: the total number of invoices processed in the account and the count per company.

To check the requests, send a GET request to /1/b2b/requests/. The parameters mes (month) and ano (year) are optional; without them, the lookup uses the current month and year.

Parameter Type Size Description
mes integer 2 Optional. Month to check, from 01 to 12. When omitted, the current month is used.
E.g.: 01
ano integer 4 Optional. Only the current year or the previous year can be checked. When omitted, the current year is used.

Example request:

curl -X GET \
-H "X-Consumer-Key: YOUR_RESELLER_CONSUMER_KEY" \
-H "X-Consumer-Secret: YOUR_RESELLER_CONSUMER_SECRET" \
-H "X-Access-Token: YOUR_RESELLER_ACCESS_TOKEN" \
-H "X-Access-Token-Secret: YOUR_RESELLER_ACCESS_TOKEN_SECRET" \
-H "Content-Type: application/json" \
https://webmania.com.br/api/1/b2b/requests/?mes=01

For each company, modelos breaks down the documents and events counted per document type.

The possible keys are nfe, nfce, nfse, lote_rps, mdfe, cte, cte_os, cce, mde, nfcom, evento_ibs_cbs, econf, dce and ciot.

Example of an HTTP 200 response:

{
    "total_notas_processadas": 12000,
    "empresas": [
        {
          "cnpj": "00000000000000",
          "razao_social": "Empresa 1",
          "ie": "0000000000",
          "notas_processadas": 7000,
          "modelos": {
            "nfe": 4500,
            "nfce": 2000,
            "mde": 500
          }
        },
        {
          "cpf": "00000000000",
          "nome_completo": "Empresa 2",
          "ie": "0000000000",
          "notas_processadas": 5000,
          "modelos": {
            "nfse": 5000
          }
        }
    ]
}

Infrastructure

The Webmania® API runs on Amazon AWS, the global leader in cloud computing, in the us-east-1 region (US East), with a point of presence in sa-east-1 (São Paulo). The entry point is anycast and highly available: from anywhere in the world, your request goes to the server closest to you.

Anycast entry of the Webmania API around the world World map with the us-east-1 region, in the eastern United States, and the sa-east-1 point of presence, in São Paulo. Requests from many parts of the world enter through the anycast network and go to the nearest server: North America, Europe and Asia to us-east-1, and South America, Africa and Oceania to sa-east-1. us-east-1 US East sa-east-1 São Paulo
Webmania AWS region Your application Anycast route to the nearest server
Illustration. The dots stand for applications in different regions of the world, not for real server addresses.

Global anycast

The same entry IPs serve the whole world. Your request goes to the server closest to you, with no setup on your side.

Two AWS locations

us-east-1 (US East) and sa-east-1 (São Paulo). Keep your infrastructure close to one of them for a shorter response time.

Static IPs

Fixed IPs for inbound and outbound traffic: allow them in your firewall and check the source of the notifications you receive.

Static inbound IPs Requests from your application to the API.
  • 13.248.145.90
  • 76.223.17.240
Static outbound IPs Notifications sent by Webmania® to your URL.
  • 34.196.69.38
  • 44.219.142.86

Request limits

The Webmania® API limits the number of requests per second to keep every integration stable and fast. Each limit is counted per second, separately for each HTTP method and each endpoint.

GET 15per second

Reading: lookups and lists.

POST No limit

Creating: issuing and other submissions. See the specific limits below.

PUT / DELETE 5per second

Changing and removing resources.

Specific limits

Some endpoints have a lower limit, which applies instead of the method's limit:

Request Limit Reason
Tax document events, such as cancellation, correction letter and recipient acknowledgment 1 request per second, on any method Safe communication with SEFAZ (the state tax authority) and the city halls.

Need a higher request volume? Contact us and we will review it.

When the limit is exceeded

A request over the limit is refused with HTTP 429 (Too Many Requests) before it is processed. Nothing is issued, changed or canceled, and you can safely resend the same request.

Header Example Description
Retry-After 1 Seconds to wait before you resend the request. If the response does not include this header, wait 1 second.

Example of an HTTP 429 response:

{
  "error": "Too Many Requests"
}
Detect the limit by the HTTP status 429, not by the text of the error field: the message can change from one endpoint to another.

How to handle HTTP 429

  1. Pause sendingStop sending new requests to the same endpoint.
  2. Wait the time shownWait the number of seconds in the Retry-After header, or 1 second if the header is missing.
  3. Resend the same requestThe refused request was not processed. Resend it with the same content.
  4. Wait longer if the 429 repeatsFor each new 429 in a row, double the wait time (1, 2, 4, 8 seconds) and set a maximum number of retries.

Best practices

Use the notification URL

Receive the API results at your notification URL instead of polling in a loop. When a result arrives, update your database and download the PDF and the XML.

Send through a queue

Spread your requests through a queue that respects the per-second limit of each method, instead of sending everything at once.

Send valid credentials

The endpoints require valid access credentials in the request header. Sending them incorrectly is treated as misuse of the API.

Allow your server IP

By default, the firewall blocks servers in regions with a high rate of attacks or a poor reputation. If a GET to https://webmania.com.br/api/ or https://api.webmania.com.br returns 403 Forbidden by mistake, contact us and we will allow your IP.

Changelog

  1. v2.1.0 · December 3, 2026 · API · Added

    The monthly request lookup of the B2B Management API 1.0 now returns, in modelos, the count of documents and events per model for each company.

    Changed section: consultar-requisicoes

  2. v2.0.0 · November 28, 2026 · Documentation · Added

    Version 2.0 of the B2B Management API: account management credential, company creation by CNPJ (company ID), setup by UUID, A1 digital certificate, Tax Classes and records. Version 1.0 is still available in the version selector and now includes the company update.

    Changed sections: b2b-api2, b2b-api2-autenticacao, b2b-api2-criar-empresa, b2b-api2-editar-empresa, b2b-api2-classes-de-imposto, atualizar-empresa

  3. v1.3.4 · November 9, 2026 · Documentation · Added

    The documentation is now LLM-ready: copy the page or each section as Markdown, a section index and llms.txt.

Solutions

Fiscal IssuerFiscal MonitorTax ReconciliationArtificial Intelligence

Industries

Logistics & TransportationTechnology & SaaSManufacturingBanks & FintechsServices & SubscriptionsRetail & CommerceMid-sized CompaniesEnterprise

Brazil tax guide

Start hereComplete guideGlossaryNF‑e (electronic invoice)NFS‑e (service invoice)CT‑e (freight bill)Tax reform

Company

AboutCustomersContactBook a demoPolicies and termsTrust Center

Developers

API documentationNF‑e and NFC‑e APINFS‑e APICT‑e and CT‑e OS APIDC‑e APIMDF‑e APINFCom APICIOT / PEF APITax payment slips APIFiscal Monitor APIB2B Management APISDKs on GitHubDocs for LLMs (llms.txt)

Offices

United States

Webmania Inc8 The Green, STE R, Dover, DE 19901

São Paulo, Brazil

Cubo Itaú innovation hubAlameda Vicente Pinzon, 54 - 10th floor, Vila Olímpia, São Paulo - SP

Curitiba, Brazil

HeadquartersAv. Água Verde, 1413 - 5th floor, Água Verde, Curitiba - PR

HOTMILK innovation hubR. Imac. Conceição, 1430, Prado Velho, Curitiba - PR

Talk to our team

Quick access

Customer panelContact
Webmania® Status SEFAZ Monitor City Hall Monitor
Cubo Itaú Startup 2025
webmania®

Copyright © 2009-2026 Webmania®.Webmania® is a registered trademark used exclusively by WMBR SERVICOS EMPRESARIAIS LTDA
CNPJ 11.290.027/0001-82, headquartered at Av. Água Verde, 1413, 5th floor - Curitiba, PR, Brazil - ZIP 80620-200

Region and language

Brazil

  • PTPortuguês (Brasil)
  • ENEnglish
  • ESEspañol
We use cookies to improve your experience on Webmania®. Learn more in our Privacy Policy and Cookie Policy.