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 one company per request from its CNPJ. When available, its details are prefilled from the company registry.
One Bearer token of the account authenticates every call. The credentials of a single company do not work on these endpoints.
Company details, taxation, series and numbering, A1 digital certificate, logo, tax classes and registrations.
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 1 to 100 companies per request, within the limit of your plan. Each company gets its own API access credentials.
The B2B endpoints use the B2B credentials of the account. The credentials of a single company do not work on these endpoints.
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.
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/empresas | POST | Create a company from its CNPJ |
/2/b2b/empresas/{uuid}/logomarca | POST | Upload the logo |
/2/b2b/empresas/{uuid}/classe-imposto | POST | Create a tax class |
/2/b2b/empresas/{uuid}/cadastros/{tipo} | POST | Create a registration |
/2/b2b/empresas | GET | List companies |
/2/b2b/empresas/{uuid} | GET | Get the company setup |
/2/b2b/empresas/{uuid}/credenciais | GET | Get the company credentials |
/2/b2b/empresas/{uuid}/classe-imposto | GET | List tax classes |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | GET | Get a tax class |
/2/b2b/empresas/{uuid}/cadastros/{tipo} | GET | List registrations |
/2/b2b/empresas/{uuid} | PUT | Set up the company |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | PUT | Edit a tax class |
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id} | PUT | Edit a registration |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | DELETE | Delete a tax class |
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id} | DELETE | Delete 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:
uuid the API returns. consultar before you repeat the creation. uuid to set the tax details, series and numbering. uuid, with the same account credential. 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.
uuid, you can do the next steps in any order. Invoice issuing uses the credentials of the company.Check the HTTP status and the fields erro and codigo. In validation errors, campos may have one message per field.
| HTTP | codigo | Reason | What to do |
|---|---|---|---|
| 400 | requisicao_invalida | Invalid request. | Check the syntax and format of the body. |
| 401 | nao_autenticado | Token missing or invalid. | Check the Authorization header and the token in use. |
| 403 | acesso_negado | The credential or the plan has no access to the B2B Management API. | Check the account plan and use the B2B management credential. |
| 403 | acesso_bloqueado | Access temporarily blocked for security. | Wait until access is unblocked before you retry. |
| 404 | recurso_nao_encontrado | The route or resource does not exist or is not available to the account. | Check the path and the UUID registered in your account. |
| 405 | metodo_nao_permitido | The HTTP method does not match the route. | Use the method documented for the route. |
| 409 | conflito | The 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. |
| 413 | requisicao_muito_grande | The body is larger than allowed. | Reduce the body and check the size limit of the file you send. |
| 415 | tipo_de_conteudo_nao_suportado | Content type not supported. | Use Content-Type: application/json for JSON bodies. |
| 422 | validacao_falhou | A 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. |
| 429 | limite_de_requisicoes | Request limit reached. Follow Retry-After when it is present. | Wait for the interval in Retry-After, if present. |
| 500 | erro_interno | Unexpected error. | Check the state of the company before you repeat a write whose result is uncertain. |
| 503 | servico_indisponivel | Service 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."]
}
} When present, avisos holds objects with codigo and mensagem.
| codigo | Meaning |
|---|---|
cnpj_inativo | The CNPJ is inactive at the Federal Revenue (Receita Federal). |
fiscal_numbering_not_saved | The invoice numbering was not saved. |
payment_guide_states_not_saved | The states (UFs) for tax payment slips were not saved. |
bearer_token_pending | The issuing credentials of the company are still being processed. |
configuracao_nao_confirmada | Not all setup data could be confirmed. |
logomarca_nao_confirmada | The logo update could not be confirmed. |
inscricao_municipal_invalida | The city registration (inscrição municipal) is not valid in the municipality. |
validade_certificado_nao_sincronizada | The 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.
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/b2b/empresas/ with the quantidade (number) of companies. The response has the id and the credentials of each company; store them in your system. /1/nfe/empresa/ endpoint, described in Update a company. /1/b2b/empresas/ to check the details and credentials of each company, including the bearer_access_token if it came back empty on creation. /1/b2b/requests/, with optional mes (month) and ano (year), to track the invoices processed for each company. 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.
| Situation | Response | What to do |
|---|---|---|
| Authentication failure | HTTP 401 or 403, with the field error | Check the four headers with the B2B credentials of the account, described in Authentication. |
| Validation or business rule | HTTP 200 with the field error | Read 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."
} Take this reference to your AI assistant, integrate the API with an official SDK, or start from the ready-made modules and examples.
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.
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
git clone https://github.com/
Python Available
git clone https://github.com/
PHP Available
git clone https://github.com/
Perl Available
git clone https://github.com/
Go Available
git clone https://github.com/
C Available
git clone https://github.com/
C++ Available
git clone https://github.com/
Lua Available
git clone https://github.com/
Dart Available
git clone https://github.com/
R Available
git clone https://github.com/
Java Available
git clone https://github.com/
Kotlin Available
git clone https://github.com/
Scala Available
git clone https://github.com/
Clojure Available
git clone https://github.com/
Ruby Available
git clone https://github.com/
.NET (C#) Available
git clone https://github.com/
PowerShell Available
git clone https://github.com/
Elixir Available
git clone https://github.com/
Rust Available
git clone https://github.com/
Haskell Available
git clone https://github.com/
Swift Available
git clone https://github.com/
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):
| Header | Value |
|---|---|
Authorization | Bearer YOUR_B2B_TOKEN, in every request. |
Content-Type | application/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).
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
cnpj | string | 14 | Valid CNPJ (company ID) of the company, sent as text to keep the leading zeros00000000000000 or 00.000.000/0000-00 | |
razao_social | string | --- | Legal name. Required when the CNPJ is not in the registry database | |
cep | string | 8 | CEP (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 | string | 2 | Two-letter state abbreviation (UF). Required when the CNPJ is not in the registry database | |
site_marketplace | string | 1-120 | HTTP 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
}
}
} 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.
| HTTP | When it happens | What empresa contains |
|---|---|---|
| 201 | Registration complete. | The registration details, with the uuid. May include avisos. |
201 with parcial: true | The 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: true | Confirmation 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.
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
pagina | integer | --- | Page, starting at 1. Default 1 | |
limite | integer | 1-50 | Companies per page. Default 20 | |
q | string | 1-64 | Free-text search. You can use it to search by the CNPJ | |
status | string | --- | Status of the companyativa |
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).
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.
| Field | In the lookup |
|---|---|
uuid, cpf, codigo_municipio, status, origem_cadastro | Read only. |
certificado | Object with tem_certificado, status, vencimento and tem_senha. |
logomarca | Object with tem_logomarca and url (public HTTPS URL or null). |
nfse_password, nfse_chave_acesso, nfse_app_key, token_ibpt, CSC codes | Never 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.
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.
| Field | Content |
|---|---|
api_disponivel | false when the account plan does not include API access. |
api_1_0 | consumer_key, consumer_secret, access_token, access_token_secret and rotacionado_em. |
api_2_0 | bearer_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.
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
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 | string | 1-255 | Image 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.
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.
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
razao_socialCompany | string | 2-60 | Legal 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 | string | 8-9 | SUFRAMA registration (Manaus Free Trade Zone), with 8 or 9 digits | |
unidade_empresa | string | 6 | Type of unit, depending on the plan: head office (matriz) or branch (filial)matriz | |
email | string | --- | Customer service email. Send a valid address | |
telefone | string | --- | Customer service phone | |
contabilidade | array | 1-9 | CPFs or CNPJs of the accountants, as a list of strings or comma-separated | |
contabilidade_email | string | --- | Valid emails separated by commas | |
conta_bancaria_banco | string | 3 | Bank code. Send the four conta_bancaria_* fields together | |
conta_bancaria_agencia | string | 4-5 | Branch number, digits only | |
conta_bancaria_numero | string | 1-20 | Account number, digits only | |
conta_bancaria_digito | string | 1 | Check digit of the account |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
cep | string | 8 | CEP (postal code) of the company00000-000 (with or without punctuation) | |
endereco | string | 2-60 | Street address of the company | |
numero | string | 1-60 | Street numberIf there is none, send S/N | |
complemento | string | 1-60 | Address complement (suite, floor) | |
bairro | string | 2-60 | District | |
cidade | string | 2-60 | City. When the city and the state do not identify a municipality, the API returns HTTP 422 pointing to cidade | |
uf | string | 2 | StateXX or EX (abroad) |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_tributacao | string | 3-26 | Taxation 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 | |
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 | |
anexo_simples_nacional | string | 1-3 | Simples Nacional annex (activity table)I | |
regime_apuracao_sn | integer | 1 | Simples 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 | integer | 1 | National special tax regime, from 1 to 6 | |
regime_especial_municipal | integer | 1-2 | City 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.
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).
| Document | Fields | Numbering limit |
|---|---|---|
| NF-e | nfe_serie, nfe_numero, nfe_numero_dev | 999999999 |
| NFC-e | nfce_serie, nfce_numero, nfce_numero_dev | 999999999 |
| NFS-e | serie_rps (text of up to 5 characters), numero_rps, numero_rps_dev, numero_lote_rps | 999999999 for RPS and 99999999 for batch |
| CT-e | serie_cte, numero_cte, numero_cte_dev | 999999 |
| CT-e OS | serie_cte_os, numero_cte_os, numero_cte_os_dev | 999999999 |
| MDF-e | serie_mdfe, numero_mdfe, numero_mdfe_dev | 999999 |
| NFCom | serie_nfcom | The setup accepts the series |
| DC-e | dce_serie, dce_numero, dce_numero_dev | 999999999 |
| CIOT IPEF | ciot_ipef_serie, ciot_ipef_numero, ciot_ipef_serie_dev, ciot_ipef_numero_dev | Edit 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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
certificado | string | --- | A1 digital certificate file in Base64. See A1 digital certificate | |
certificado_senha | string | --- | Certificate password. Required when certificado is sent |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
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 | integer | 1 | Type of DC-e issuer, from 1 to 3 | |
site_marketplace | string | 1-120 | HTTP or HTTPS URL of the marketplace. Required for DC-e type 1 | |
numero_site_autorizador | integer | 1 | Number of the authorizing website, from 0 to 9 | |
taf_cte_os | string | 12 | TAF (charter authorization) for the CT-e OS, with 12 digits | |
registro_estadual_cte_os | string | 25 | Registro Estadual (state transport registration) number for the CT-e OS, with 25 digits |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
url_notificacao | string | --- | HTTP or HTTPS URL for notifications | |
subdominio | string | 1-253 | Domain 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 | string | 1 | Orientation of the DANFE (printed invoice summary)P (portrait) | |
logomarca | string | --- | Edit only. Image in base64 or URL, as in Logo | |
logomarca_nome | string | 1-255 | Edit only. Image name | |
desabilitar_difal | array | 1-27 | State 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 | array | 1-27 | Edit only. State abbreviations for tax payment slips, without repeats |
Boolean options: send true or false.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
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) |
/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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
certificado | string | --- | A1 digital certificate file (.pfx or .p12) encoded in Base64Send 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
}
}
} | Field | Description |
|---|---|
certificado.tem_certificado | true when the company has a certificate on file. |
certificado.status | ausente (missing), valido (valid) or vencido (expired). The certificate is valid until the end of its expiry day. |
certificado.vencimento | Expiry date in YYYY-MM-DD format, or null when there is no certificate. |
certificado.tem_senha | true 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.
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):
| Situation | Field | Message |
|---|---|---|
| Wrong password or unreadable file | certificado_senha | Nã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 chain | certificado | Certificado 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 certificate | certificado | Certificado 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 Base64 | certificado | Informe 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."]
}
} 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:
| tipo | Document | Setup |
|---|---|---|
produto | NF-e and NFC-e | ICMS, IPI, PIS, COFINS, ISSQN and IBS/CBS per scenario. See Product class. |
servico | NFS-e | Fields defined by the layout of the NFS-e provider of the company's municipality. See Service class. |
comunicacao | NFCom | Classification, ICMS, PIS, COFINS, FUST and FUNTTEL (federal telecom funds). See Communication class. |
| URL | HTTP Verb | Function |
|---|---|---|
/2/b2b/empresas/{uuid}/classe-imposto | GET | List classes |
/2/b2b/empresas/{uuid}/classe-imposto | POST | Create a class |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | GET | Get a class |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | PUT | Edit a class |
/2/b2b/empresas/{uuid}/classe-imposto/{referencia} | DELETE | Delete a class |
In {referencia}, use the uuid of the class or the reference REF123 (upper or lower case). Any other value returns HTTP 404.
Send a single JSON object with the fields below. Any other field at the root is rejected.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo | string | --- | Required on creationprodutoThe type does not change: on edit, if sent, it must be the current type | |
descricao | string | 1-120 | Description 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 |
201; edit and delete return HTTP 200. All three return classe with uuid and referencia; delete also adds excluida: true.descricao, configuracao or both. Without configuracao, the tax rules stay exactly as they are.configuracao, the whole setup is validated again: send every required block of the type, not only what changed.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"
}
} Send a GET request to /2/b2b/empresas/{uuid}/classe-imposto. The list is sorted by reference.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
pagina | integer | --- | Page, starting at 1. Default 1 | |
limite | integer | 1-50 | Classes per page. Default 20 | |
tipo | string | --- | Filter by typeproduto | |
status | string | --- | Filter by statusativo | |
q | string | 1-120 | Free-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
} 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.
Send a DELETE request to /2/b2b/empresas/{uuid}/classe-imposto/{referencia}.
{
"sucesso": true,
"classe": {
"uuid": "UUID_DA_CLASSE",
"referencia": "REF123",
"excluida": true
}
} 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."]
}
} | Situation | Example message |
|---|---|
| Required field missing | Preencha "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 empty | Informe ao menos um item em "PIS". (Send at least one item in "PIS".) |
| Invalid percentage | informe 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 ST | Preencha "Alíquota MVA" — obrigatória para o CST 10. (Fill in "MVA rate", required for CST 10.) |
| Key outside the type | A 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 edit | O 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.
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
icms | array | 1-50 | ICMS (state sales tax) scenarios. See ICMS | |
ipi | array | 1-20 | IPI (federal manufacturing tax) scenarios. See IPI, PIS and COFINS | |
pis | array | 1-20 | PIS scenarios | |
cofins | array | 1-20 | COFINS scenarios | |
issqn | array | 0-20 | ISSQN (city service tax) scenarios. See ISSQN | |
ibs_cbs | array | 0-7 | IBS/CBS scenarios of the tax reform. See IBS/CBS | |
tributos_federais | decimal | 0-100 | Approximate percentage of federal taxes, with up to 2 decimal places | |
tributos_estaduais | decimal | 0-100 | Approximate percentage of state taxes, with up to 2 decimal places | |
informacoes_fisco | string | 1-2000 | Information for the tax authority | |
informacoes_complementares | string | 1-2000 | Additional 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").
| Field | Values |
|---|---|
cenario | saida_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_pessoa | fisica (individual), juridica (company), estrangeiro (foreigner). IPI, PIS, COFINS, ISSQN and IBS/CBS also accept padrao. |
Each icms scenario has the fields below. The other fields depend on the tax regime and on the CST/CSOSN (tax status code).
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_tributacao | string | --- | Tax regime of the scenariosimples_nacional | |
cenario | string | --- | Transaction scenario (without padrao) | |
tipo_pessoa | string | --- | Recipient type (without padrao)fisica | |
nao_contribuinte | boolean | --- | Company recipient that is not an ICMS taxpayer. With tipo_pessoa: juridica, the lookup also returns consumidor_final: true | |
codigo_cfop | string | 4 | CFOP 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 | string | 2-3 | CSOSN 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 taxation00, 02, 10, 15, 20, 30, 40, 41, 50, 51, 53, 60, 61, 70, 90 | |
aliquota | array | 0-27 | ICMS rate per state. List of {"estado", "aliquota"}. In normal taxation, it does not apply to CSTs 40, 41 and 50 | |
aliquota_fcp | array | 0-27 | FCP (poverty fund surcharge, a small extra ICMS percentage some states charge) rate per state, in the same format | |
aliquota_reducao_destino | decimal | 0-100 | Reduction percentage at destination | |
credito_presumido | array | 0-27 | ICMS presumed credit. List of {"codigo_beneficio_fiscal", "estado", "aliquota"}: code with 8 or 10 characters, state (except DF) and rate up to 100 |
Fields of the ICMS scenarios with tipo_tributacao: simples_nacional, by CSOSN.
| Field | When | Rule |
|---|---|---|
aliquota_credito | CSOSN 101 and 201 | Required. Simples Nacional credit percentage, up to 100. |
aliquota_importacao | cenario: entrada_exterior | Required. Percentage up to 100. |
aliquota_mva | CSOSN 201, 202, 203 and 900 | MVA (added value margin) per state, up to 1000. Required in CSOSN 201, 202 and 203. |
aliquota_st, aliquota_fcp_st | CSOSN 201, 202, 203 and 900 | ICMS-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_st | CSOSN 201, 202, 203 and 900 | Percentages up to 100. |
beneficio_fiscal | CSOSN 103, 203, 300, 400 and 900 | List 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. |
Fields of the ICMS scenarios with tipo_tributacao: tributacao_normal, by CST.
| Field | When | Rule |
|---|---|---|
aliquota_reducao | CST 20, 70 and 90 | Required in CSTs 20 and 70. Base reduction percentage, up to 100. |
aliquota_efetiva_icms | CST 20, 70 and 90 | Percentage up to 100. |
aliquota_mva | CST 10, 30, 70 and 90 | MVA per state, up to 1000. Required in CSTs 10, 30 and 70. |
aliquota_st, aliquota_fcp_st | CST 10, 30, 70 and 90 | ICMS-ST and FCP-ST rate per state. |
aliquota_reducao_st, aliquota_efetiva_icms_st | CST 10, 30, 70 and 90 | Percentages up to 100. |
aliquota_diferimento | CST 51 and 53 | Required in CST 51. Deferral percentage, up to 100. |
aliquota_diferimento_fcp | CST 51 | FCP deferral percentage, up to 100. |
codigo_beneficio_reducao_bc | CST 51 | Benefit code, with 8 or 10 characters. |
motivo_desoneracao | CST 20, 30, 40, 41, 50, 51, 70 and 90 | In CST 20: 3, 9, 10, 11 or 12. In the others: 3, 9 or 12. |
deducao_desoneracao | With motivo_desoneracao | 0 or 1: deducts the waived ICMS from the item value. |
motivo_desoneracao_st | CST 20, 40, 41, 50, 51, 70 and 90 | 3, 9 or 12. |
quantidade_retencao, aliquota_retencao | CST 15 | Required. Quantity and rate of the single-phase withholding. |
percentual_reducao | CST 15 | Percentage up to 100. |
motivo_reducao | CST 15 | 0 or 9. |
aliquota_importacao | cenario: entrada_exterior | Required in CSTs 00 and 90. Percentage up to 100. |
beneficio_fiscal | CST 20, 40, 41, 50, 51, 70 and 90 | List 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" }
] | Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_pessoa | string | --- | Recipient type, including padrao | |
cenario | string | --- | Transaction scenario, including padrao | |
situacao_tributaria | string | 2 | IPI CST00, 01, 02, 03, 04, 05, 49, 50, 51, 52, 53, 54, 55, 99PIS and COFINS CST01 to 09, 49 to 56, 60 to 67, 70 to 75, 98, 99 | |
codigo_enquadramento | string | 1-3 | IPI only, where it is required. Legal classification code. CST 52 does not accept 999 | |
aliquota | decimal | 0-100 | Tax rate |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_pessoa | string | --- | Recipient type, including padrao | |
cenario | string | --- | Transaction scenario, including padrao | |
codigo_cfop | string | 4 | CFOP with 4 digits | |
exigibilidade | string | 1 | ISS liability (exigibilidade)1 to 7 | |
item_servico | string | 1-5 | Item of the service list | |
incentivo_fiscal | string | 1 | Tax incentive1 (yes) | |
aliquota | decimal | 0-100 | ISSQN rate | |
municipio | string | 7 | IBGE code of the municipality | |
codigo_servico | string | 1-20 | Service code in the municipality |
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
tipo_pessoa | string | --- | Recipient type, including padrao | |
cenario | string | --- | Transaction scenario, including padrao | |
situacao_tributaria | string | 1-3 | IBS/CBS CST (padded with leading zeros, e.g. 000). Must be accepted for the NF-e | |
classificacao_tributaria | string | 1-6 | cClassTrib (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 | string | 1-3 | CST of the regular taxation. Required when the classification requires regular taxation | |
classificacao_tributaria_regular | string | 1-6 | Classification 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 |
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.
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.
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.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
codigo_servico | string | 1-9 | Service 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 | string | 1-9 | CNAE (economic activity code) of the service | |
codigo_tributacao_municipio | string | 1-20 | Taxation code of the municipality (up to 9 in the national layouts) | |
codigo_nbs | string | 9 | NBS code (Brazilian service nomenclature). In the national standard, checked against the NBS table | |
cod_indicador_operacao | string | 6 | Transaction indicator of the tax reform020101, 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 | string | 1 | Sale to a final consumer0 (no) | |
iss_retido | string | 1 | ISS withheld1 (yes) | |
responsavel_retencao | string | 1 | Party responsible for the withholding, required when iss_retido is 11 (service buyer) | |
iss | decimal | 0-100 | ISS (city service tax) rate | |
pis | decimal | 0-100 | PIS rate | |
cofins | decimal | 0-100 | COFINS rate | |
inss | decimal | 0-100 | INSS (social security) rate | |
ir | decimal | 0-100 | IR (income tax) rate | |
csll | decimal | 0-100 | CSLL (social contribution on net profit) rate |
Layout of the national issuer (Emissor Nacional), which includes the municipalities on the national NFS-e standard (Padrão Nacional) and on NotaControl:
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
codigo_servico | string | 6 | Code of the national service list (01.07.01) | |
codigo_nbs | string | 9 | NBS code, checked against the NBS table | |
consumidor_final | string | 1 | 0 or 1 | |
cod_indicador_operacao | string | 6 | Transaction indicator (list in Common fields) | |
codigo_tributacao_municipio | string | 1-9 | Taxation code of the municipality | |
codigo_interno | string | 1-20 | Internal service code | |
informacoes_complementares | string | 1-2000 | Additional information | |
tributacao_iss | string | 1 | ISSQN taxation1 (taxable) | |
tipo_imunidade | string | 1 | Read when tributacao_iss is 20 to 5 | |
iss | decimal | 0-100 | ISS rate, read when tributacao_iss is 1 | |
iss_retido | string | 1 | 1 (yes) or 2 (no) | |
responsavel_retencao | string | 1 | Required when iss_retido is 1: 1 or 2 | |
cst_pis_cofins | string | 2 | PIS/COFINS CST00 to 09, 49 to 56, 60 to 67, 70 to 75, 98, 99 | |
pis_cofins_retido | string | 1 | PIS/COFINS withholding (0 to 9). Required when cst_pis_cofins is sent and is not 00, 04, 06, 08 or 09 | |
pis | decimal | 0-100 | PIS rate, under the same conditions as pis_cofins_retido | |
cofins | decimal | 0-100 | COFINS rate, under the same conditions | |
ir | decimal | 0-100 | IR rate | |
csll | decimal | 0-100 | CSLL rate | |
cp | decimal | 0-100 | Social 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:
| Layout | Fields |
|---|---|
| Full MEI | tipo_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 MEI | codigo_servico (national list, required), codigo_nbs and discriminacao (required, up to 2,000 characters). No IBS/CBS. |
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.
| Layout | Fields |
|---|---|
| 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. |
| Thema | codigo_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 Paulo | codigo_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. |
| SIGISS | codigo_servico (required), tributacao (required: 1 to 5), codigo_nbs, cod_indicador_operacao, ISS withheld, Rates. |
| Governa | codigo_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. |
| CECAM | codigo_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. |
| DSF | codigo_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ópolis | id_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. |
| Osasco | codigo_servico (required), codigo_nbs, cod_indicador_operacao, ISS withheld, Rates. |
| EL | codigo_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ís | codigo_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. |
| CONAM | codigo_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. |
| Fortaleza | codigo_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. |
| IMA | codigo_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. |
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 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.
With tipo: comunicacao, configuracao sets the taxes on the items of the NFCom (telecom invoice).
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
codigo_classificacao | string | 7 | Classification code of the NFCom item (NFCom table, e.g. 0100101, 0600401) | |
icms | object | --- | ICMS of the item | |
icms.situacao_tributaria | string | 2 | ICMS CST00, 20, 40, 51, 60, 90 | |
icms.origem | string | 1 | Origin of the goods, from 0 to 8. Default 0 | |
icms.aliquota | decimal | 0-100 | ICMS rate, read in CSTs 00, 20 and 90 | |
icms.aliquota_fcp | decimal | 0-100 | FCP rate, read in CSTs 00 and 90 | |
icms.codigo_cfop | string | 4 | CFOP5301 to 5307, 5933, 6301 to 6307, 7301 | |
icms.percentual_reducao | decimal | 0-100 | Base 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" }
}
} 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}.
| URL | HTTP Verb | Function |
|---|---|---|
/2/b2b/empresas/{uuid}/cadastros/{tipo} | GET | List registrations |
/2/b2b/empresas/{uuid}/cadastros/{tipo} | POST | Create a registration |
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id} | PUT | Edit a registration |
/2/b2b/empresas/{uuid}/cadastros/{tipo}/{id} | DELETE | Delete a registration |
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
{tipo} | string | --- | Registration type, in the URL: customers, products, carriers or servicesclientes | |
{id} | string | 36 | UUID of the registration, returned in id. Used to edit and delete |
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.
200 with the stored registration in dados.| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
nome | string | 2-60 | Display name of the customer in the Fiscal Issuer. name is an alternative name. Indexed and searchable | |
tipo_pessoa | string | 1 | Person type of the customer1 - Individual (Pessoa Física)Indexed | |
documento | string | 11-14 | CPF or CNPJ, stored with digits only (an alphanumeric CNPJ is kept as is). Indexed and used in the search by document | |
cpfIndividual | string | 11 | CPF (individual taxpayer ID) of the customer000.000.000-00 | |
nome_completoIndividual | string | 2-60 | Full name of the individual | |
cnpjCompany | string | 14 | CNPJ (company ID) of the customer00.000.000/0000-00 | |
razao_socialCompany | string | 2-60 | Legal name of the company | |
ieCompany | string | 2-14 | State registration (Inscrição Estadual) | |
imCompany | string | 1-15 | City registration (Inscrição Municipal) | |
suframaCompany | string | 8-9 | SUFRAMA registration | |
substituto_tributarioCompany | string | --- | Marks the customer as a tax substitute | |
id_estrangeiroForeigner | string | --- | ID document of the foreign customer | |
nome_estrangeiroForeigner | string | --- | Name of the foreign customer | |
paisForeigner | 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 | string | 8 | CEP (postal code)00000-000 (with or without punctuation) | |
endereco | string | 2-60 | Street | |
numero | string | 1-60 | Street numberIf 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 | StateXX |
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"
}' | Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
nome | string | 1-120 | Product name. name is an alternative name. Indexed and searchable | |
codigo | string | 1-60 | Product code (SKU). code is an alternative name. Indexed and searchable | |
ncm | string | 8 | NCM (the 8-digit Mercosur product classification code), stored with digits only. Indexed and searchable0000.00.00 | |
valor | decimal | --- | Unit price of the product. Indexed0.00 | |
gtin | string | 8-14 | Barcode (GTIN/EAN) | |
cest | string | 7 | CEST, the 7-digit code required on goods listed for ICMS tax substitution; it is linked to the NCM | |
unidade | string | 1-6 | Sales unitUN, KG, CX, ... |
{
"nome": "Camiseta básica",
"codigo": "CAM-001",
"ncm": "61091000",
"valor": "49.90",
"gtin": "7890000000000",
"unidade": "UN"
} | Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
nome | string | 2-60 | Display name of the carrier. name is an alternative name. Indexed and searchable | |
tipo_pessoa | string | 1 | Person type1 - Individual (Pessoa Física) | |
cnpjCompany | string | 14 | CNPJ of the carrier, stored with digits only. Indexed and searchable00.000.000/0000-00 | |
razao_socialCompany | string | 2-60 | Legal name of the carrier | |
ieCompany | string | 2-14 | IE (Inscrição Estadual, state registration). Indexed and searchable | |
cpfIndividual | string | 11 | CPF of the carrier000.000.000-00 | |
nome_completoIndividual | string | 2-60 | Full name of the carrier | |
cep | string | 8 | CEP, stored with digits only. Indexed | |
endereco | string | 2-60 | Full address | |
cidade | string | 2-60 | City | |
uf | string | 2 | State | |
placa | string | 7 | Vehicle license plate | |
uf_veiculo | string | 2 | State of the vehicle | |
rntc | string | --- | National road cargo carrier registration (RNTC) | |
reboque_placa | string | 7 | Trailer license plate | |
reboque_uf_veiculo | string | 2 | State 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"
} | Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
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"
} 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"
}
}
} | Type | Indexed fields in the response |
|---|---|
clientes | nome, documento, email, telefone, tipo_pessoa |
produtos | nome, codigo, ncm, valor |
transportadoras | nome, cnpj, ie, cep |
servicos | discriminacao |
Send a GET request to /2/b2b/empresas/{uuid}/cadastros/{tipo}. The list shows the most recently changed registrations first, without pagination.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
limit | integer | 1-250 | Maximum 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"
}
}
]
} 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"
}
} | HTTP | Situation |
|---|---|
| 404 | The company is not in the account, or the registration does not exist, was already deleted or belongs to another company (recurso_nao_encontrado). |
| 422 | Invalid 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. |
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.
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.
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 KeyAPI 1.0 credential |
consumer_secret | string | Consumer SecretAPI 1.0 credential |
access_token | string | Access TokenAPI 1.0 credential |
access_token_secret | string | Access Token SecretAPI 1.0 credential |
bearer_access_token | string | Bearer Access TokenAPI 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"
}
]
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.
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). |
cnpjCompany | string | CNPJ (company ID) of the issuing company00.000.000/0000-00 |
razao_socialCompany | string | Legal name of the company |
cpfIndividual | string | CPF (individual taxpayer ID) of the issuing individual000.000.000-00 |
nome_completoIndividual | 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 |
tipo_tributacao | string | Taxation typemei |
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"
}
}
]
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.
| 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 | |
regime_tributario | string | --- | Regime tributário (tax regime): Lucro Real (actual profit) or Lucro Presumido (presumed profit)lucro_real | |
cnpjCompany | string | 14 | CNPJ (company ID) of the issuing company00.000.000/0000-00 | |
razao_socialCompany | string | 2-60 | Legal name of the company | |
cpfIndividual | string | 11 | CPF (individual taxpayer ID) of the issuing individual000.000.000-00 | |
nome_completoIndividual | 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 | |
email | string | 1-60 | Customer service email | |
telefone | string | 6-14 | Customer service phone | |
conta_bancaria_banco | string | 1-3 | Bank codeEX: 77 - BANCO INTERWhen 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 URLAllowed 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."
} 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.
| Parameter | All types | Type | Size | Description |
|---|---|---|---|---|
cep | string | 8 digits | CEP (postal code) of the company00000-000 (with or without punctuation) | |
endereco | string | 2-60 | Street address of the company | |
numero | string | 1-60 | Street numberIf 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 | StateXX |
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/ 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).
| 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 INVOICEProduction environment | |
nfe_numero_dev | integer | 1-9 | Number of the NEXT INVOICESandbox environment | |
informacoes_fisco | string | 1-2000 | Information for the tax authorityText 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 |
| 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 INVOICEProduction environment | |
nfce_id_csc | string | --- | ID of the CSC code. Learn more (in Portuguese)Production environment | |
nfce_codigo_csc | string | 36 | CSC codeProduction environment | |
nfce_numero_dev | integer | 1-9 | Number of the NEXT INVOICESandbox environment | |
nfce_id_csc_dev | string | --- | ID of the CSC code. Learn more (in Portuguese)Sandbox environment | |
nfce_codigo_csc_dev | string | 36 | CSC codeSandbox environment | |
informacoes_fisco | string | 1-2000 | Information for the tax authorityText 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.) |
| 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-eProduction environment | |
cte_number_dev | integer | 1-9 | Number of the NEXT CT-eSandbox 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 OSProduction environment | |
cte_os_number_dev | integer | 1-9 | Number of the NEXT CT-e OSSandbox environment | |
taf_cte_os | string | 12 | TAF (charter authorization, Termo de Autorização de Fretamento) for road CT-e OSDigits only | |
registro_estadual_cte_os | string | 25 | Registro Estadual (state transport registration) number for road CT-e OSDigits only |
| 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-eProduction environment | |
dce_numero_dev | integer | 1-9 | Number of the NEXT DC-eSandbox environment | |
tipo_emissor_dce | integer | 1 | Type of DC-e issuer.1 - Marketplace | |
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. |
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 IPEFProduction environment | |
ciot_ipef_numero | integer | 1-9 | Number of the NEXT CIOT IPEF, greater than zeroProduction environment | |
ciot_ipef_serie_dev | integer | 1-4 | Series number of the CIOT IPEFSandbox environment | |
ciot_ipef_numero_dev | integer | 1-9 | Number of the NEXT CIOT IPEF, greater than zeroSandbox environment |
| 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 RPSProduction 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) | |
regime_especial_nacional | string | 1 | Special tax regime Available for the national standard (Padrão Nacional) 1 - Cooperative act (Cooperative) | |
regime_especial_municipal | string | 1 | City tax regime Available for the Abrasf model 1 - City micro-enterprise 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 | |
nfse_lote_rps_numero | integer | 1-9 | Number of the NEXT RPS BATCHCheck whether the municipality allows batch issuing: see the city list. | |
nfse_rps_numero_dev | integer | 1-9 | Number of the NEXT RPSSandbox 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/ 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/ 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 | |
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 baseSTF - RE 574.706/PR | |
exclusao_difal_pis_cofins | boolean | --- | Remove DIFAL from the PIS COFINS calculation baseSEI nº 71.2025 | |
deduzir_desconto_ipi NEW | boolean | --- | Deduct the discount from the IPI calculation baseCOSIT 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 baseExceptional 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 issuing1 - Yes | |
ocultar_total_etiqueta | string | 1 | Hide the total value when printing the label DANFE (DANFE Etiqueta) 1 - Yes |
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/ 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
}
}
]
}
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.
The same entry IPs serve the whole world. Your request goes to the server closest to you, with no setup on your side.
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.
Fixed IPs for inbound and outbound traffic: allow them in your firewall and check the source of the notifications you receive.
13.248.145.9076.223.17.24034.196.69.3844.219.142.86The 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.
Reading: lookups and lists.
Creating: issuing and other submissions. See the specific limits below.
Changing and removing resources.
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.
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"
}
429, not by the text of the error field: the message can change from one endpoint to another.Retry-After header, or 1 second if the header is missing.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.
Spread your requests through a queue that respects the per-second limit of each method, instead of sending everything at once.
The endpoints require valid access credentials in the request header. Sending them incorrectly is treated as misuse of the API.
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.
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
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
The documentation is now LLM-ready: copy the page or each section as Markdown, a section index and llms.txt.