The Webmania® REST API creates GNRE payment slips from your company's NF-e (electronic invoices for goods). The invoices can be issued by the Webmania® Fiscal Issuer, or by another issuer and imported into the Fiscal Monitor. The calculation reads the XML of each invoice, works out which slips are due and returns everything for you to review before issuing. To start, read the Quick guide.
What is the GNRE? A payment slip (guia) is the government's bill for a tax. It shows the amount due and has a barcode, a payment code (linha digitável: the barcode number you type into online banking) and, when available, a PIX code. The GNRE is the national payment slip for state taxes owed to another state (UF). Examples are the DIFAL and the FCP-DIFAL on interstate sales to final consumers (buyers who do not resell the goods). DIFAL is the interstate rate difference: the destination state's share of ICMS (the state sales tax) when a sale crosses states. FCP is the poverty fund surcharge, an extra ICMS rate that some states charge; FCP-DIFAL is the FCP charged with the DIFAL. ICMS-ST (ICMS tax substitution) is the ICMS that one company in the supply chain pays in advance for the rest of the chain. Issuing a slip does not pay the tax. You pay each slip after it is issued, at your bank or by PIX.
Brazilian tax terms you will see. They keep their Brazilian names in the payload and on the slip:
ICMS: the state sales tax on goods, calculated on each line of the NF-e with the rate of each state. The calculation reads it from the invoice XML.
DIFAL: the destination state's ICMS rate minus the interstate rate, on goods sold to a final consumer in another state. tributo = difal.
FCP: a small extra ICMS percentage some states charge, collected with the ICMS; with the DIFAL it is the FCP-DIFAL. tributo = fcp_difal.
ICMS-ST: ICMS collected in advance by one company in the chain. The calculation does not create ICMS-ST slips automatically.
SEFAZ: the state tax authority, one per state and the Federal District. The state code (UF) says which one the slip is for.
CNPJ / CPF / IE: the company ID (14 digits), the individual taxpayer ID (11 digits) and the state registration of the taxpayer on the slip.
Every term in plain English: glossary of Brazilian tax terms.
Other terms on this page. Each slip item has a revenue code (receita), a 6-digit code published for each state. It tells the receiving state which tax you are paying. SEFAZ is the state tax authority, and the Portal GNRE is the national system that receives and validates the slips. The calculation handles each invoice in one of three ways:
The invoice XML has everything the slip needs. The calculation returns the slip in guias, ready for you to review and confirm.
The slip needs a value that is not in the XML, such as an ICMS agreement or the state's product code. The calculation returns pendencias with the exact field in o_que_enviar[]. Send it in a new calculation.
If the company has a state registration (IE) in the destination state, including as a tax substitute (ICMS-ST), or a special tax regime there, the accountant pays the tax in the monthly return and no slip is generated. The API detects this from the XML or from the states marked in the company configuration. It reports the case in recusas, with acao: apuracao_periodica.
A scenario the API does not cover yet also appears in recusas, with the reason and the suggested action. Sending a parameter never unlocks a refused scenario. See the calculation refusals.
The slip type depends on the state that receives the tax: São Paulo uses the DARE-ICMS, Espírito Santo uses the DUA-e, and the other states use the GNRE. One calculation plans the slips for every state in the selected invoices, each one with the right slip type. The API never switches the slip type for you. ICMS-ST and FCP-ST for SP and ES are not generated automatically.
Send every request over encrypted HTTPS to https://api.webmania.com.br. The /2/ prefix means that we currently use version 2.0 of the API.
| URL | HTTP Verb | Function |
|---|---|---|
/2/empresa | POST | Update the company configuration |
/2/guias/importacoes | POST | Import invoices from another issuer into the Fiscal Monitor |
/2/guias/apuracoes | POST | Start a calculation |
/2/guias/apuracoes/{uuid}/confirmar | POST | Confirm issuance of the slips |
/2/guias/exportacoes | POST | Prepare an export for payment |
/2/guias/exportacoes/{uuid}/retornos | POST | Send a bank return file |
/2/gnre/emissao | POST | Issue a GNRE with amounts you provide |
/2/gnre/consulta | POST | Look up a batch by receipt |
/2/gnre/consulta-guias | POST | Request a slip lookup |
/2/gnre/consulta-guias-resultado | POST | Get the result of the request |
/2/empresa | GET | Get the company configuration |
/2/guias/apuracoes/{uuid} | GET | Get a calculation |
/2/guias/apuracoes/{uuid}/guias | GET | List the slips of a calculation |
/2/guias/apuracoes/{uuid}/pendencias | GET | Get the pending items |
/2/guias/apuracoes/{uuid}/recusas | GET | Get the refusals |
/2/guias | GET | List issued slips |
/2/guias/{uuid} | GET | Get a slip |
/2/guias/exportacoes/{uuid} | GET | Get an export |
/2/guias/exportacoes/{uuid}/arquivo | GET | Download the export file |
/2/guias/exportacoes/{uuid}/retornos/{retorno} | GET | Get a bank return and its reconciliation |
/2/gnre/status/{uuid} | GET | Get the status of a GNRE |
/2/gnre/config-uf/{uf} | GET | Get the state configuration |
Responses are in JSON. Send Authorization: Bearer YOUR_ACCESS_TOKEN in every call and Content-Type: application/json in calls with a body. See Authentication.
How to integrate batch issuing:
Already have the calculated amounts? GNRE single issuing issues one slip with the amounts you send, without a calculation. Before that, check the State Configuration to learn the revenue codes and the fields each state requires.
Before the first calculation, list the states where the company has an IE (Inscrição Estadual, the state registration of a company that pays ICMS), including as a tax substitute (ICMS-ST), or a special tax regime. In those states the accountant pays the tax in the monthly return, and the API does not generate a slip. Check the list with whoever handles the company's taxes: a missing state can generate slips that are not due.
In the Webmania® Panel, go to Configurações da empresa › Nota Fiscal › Guias de Pagamento (company settings › invoices › payment slips). If you use only the Fiscal Monitor, use the Empresa (company) tab. Through the API, send the state codes in POST /2/empresa:
{
"guias_declaracao_ufs": ["SP", "MG"]
} Send [] to mark no state. If you omit the field, the configuration does not change. GET /2/empresa returns the current configuration. Do not confuse it with the State Configuration, which only looks up the rules each state publishes for single issuing.
States and taxes that the calculation generates automatically. ICMS-ST and FCP-ST are not generated automatically in any state. São Paulo and Espírito Santo use DARE-ICMS SP and DUA-ES.
UF automatic state · UF state that needs a parameter, requested as a pending item · UF state not generated automatically
The path of each invoice inside the calculation:
Every calculation checks the configuration that each state publishes. When it requires a value that the NF-e does not have, the tax is refused with campo_configuracao_obrigatorio, and the API points you to single issuing.
Once the slips are issued, you can pay them in a batch. CNAB 240 is the Brazilian bank file standard: instead of paying one slip at a time, the API builds one CNAB 240 file for your bank. Later, it reads the bank return file and marks the slips as paid automatically.
Create the CNAB 240 remittance file with slips that are already issued: from a whole calculation or from a list of slips.
Send the file to your bank and authorize the payment. One file pays all the slips, with no need to type each code.
Send the bank return file. The API reconciles each slip and marks it as pago (paid), with a webhook notification.
Enabled by default: 001 Banco do Brasil, 033 Santander, 041 Banrisul, 237 Bradesco, 341 Itaú, 748 Sicredi and 756 Sicoob. Each bank collects GNRE only for the states where it is accredited. A slip without coverage stays out of the file, and the export reports it.
Creating the file does not pay the slips. You always authorize the payment yourself, at the bank, under your own bank agreement and account. The parameters, exclusions and error codes are in Batch payment.
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/
Test the GNRE REST API without writing a line of code, and speed up your integration with the official Webmania® tools.
To use the API resources, authenticate every request with an HTTP header. Use the Authorization header in this format:
Authorization: Bearer {Access-Token} You'll find the API 2.0 Access-Token in the Webmania® Panel. Include it in every request.
Keep your credentials safe. Never publish the Access Token or the certificate password in the source code of a website, app or system where others can easily read it.
For mobile apps (iOS and Android), we recommend that you call the API from your server (back end). The app should only send the request, and your server should do the processing.
All API responses are in JSON format. The HTTP status code indicates the result of the request. An issue request received for processing is not yet an approved slip, nor a paid one. Track each uuid with the Status lookup or the Notifications.
| HTTP | When it happens |
|---|---|
200 | The lookup was answered, or the issue request was received for processing. A received issue request is not an approved slip yet; track the uuid. |
202 | Calculation created or confirmation accepted, in Batch issuing. |
400 | Input refused in the document import, for example invalid JSON or an xml that is not base64. |
401 | Missing or invalid token. |
403 | Inactive subscription, feature not available for the account, or access not authorized. |
404 | The slip or calculation does not exist, belongs to another company or is of another type. |
409 | A slip was already generated or reserved for the obligation (guia_gerada), or there is a conflict in the calculation confirmation (for example, apuracao_expirada). |
422 | Invalid data. Read error and, when present, codigo. |
429 | Request limit exceeded. See Request limits. For issue requests in the test environment (homologação), the limit is one request per second per company, with the header Retry-After: 1. |
500 | Internal error. Keep the UUIDs you already received, and look up each slip before you request another one. |
503 | Temporarily unavailable. This failure alone does not confirm the result of an earlier request. |
In error responses, the JSON body has error. The other fields depend on the error:
| Field | Type and presence | Description |
|---|---|---|
error | string, in every error | Error message. |
codigo | string, depending on the error | Refusal code, when returned. |
error_code | string, in subscription HTTP 403 errors | Subscription status code. |
action_url | string, in subscription HTTP 403 errors | URL where the subscription can be fixed; use the value returned in the response. |
Example of invalid authentication, HTTP 401 ("Restricted access. Token missing or invalid."):
{
"error": "Acesso restrito. Token não informado ou inválido."
} Example of an inactive subscription, HTTP 403 ("Trial period expired. Activate your subscription to continue."):
{
"error": "Período de teste expirado. Ative sua assinatura para continuar.",
"error_code": "trial_expired",
"action_url": "https://webmania.com.br/"
} Example of the test environment limit, HTTP 429, with the header Retry-After: 1 (the mensagem says: limit of 1 issue request per second in the test environment; wait 1 second):
{
"error": "Too Many Requests",
"mensagem": "Limite de 1 emissão por segundo em homologação. Aguarde 1 segundo (Retry-After: 1)."
} The refusal codes and messages of each service are listed in Error codes.
An HTTP 200 response can also contain error in lookups that go to the Portal GNRE (the national GNRE portal); check the body. When the Portal limits a lookup, the API can return HTTP 503 with the Retry-After header; see Batch lookup.
Most endpoints return the first validation failure in error, with HTTP 422. The result lookups by receipt use another envelope:
| Endpoint | HTTP | Body |
|---|---|---|
POST /2/gnre/emissao, POST /2/gnre/consulta-guias, GET /2/gnre/config-uf/{uf} and the calculation and listing routes under /2/guias | 422 | {"error":"…"} |
POST /2/gnre/consulta and POST /2/gnre/consulta-guias-resultado | 422 | {"error":"validation_failed","errors":{"campo":["…"]}} |
The codes the Portal GNRE returns when it processes the batch are in GNRE error codes.
To keep your platform always up to date, Webmania® sends an automatic notification for every status change of every slip. With notifications, you do not need to poll the API for updates: wait for the webhook and update the slip in your system when it arrives.
The notification is sent by POST, in JSON, to the URL in url_notificacao. Send this URL in the issue request and also in the calculation, where it is optional. Without it, a slip generated by the calculation is not notified.
| Notified status | When it is sent |
|---|---|
pendente | The GNRE was issued and is ready for payment. |
reprovado | The issue request was refused, including by SEFAZ (the state tax authority). The body has motivos_rejeicao. |
pago | The bank return file of a CNAB 240 export confirmed that the slip was paid in full. |
What is the UUID? The UUID (Universally Unique Identifier) is a unique 36-character ID, in the format 8-4-4-4-12, that Webmania® assigns to each slip.
It is created as soon as the API accepts the request, before anything is sent to SEFAZ, and it is permanent: it does not change on retries. Use the UUID, not the position in the list or the SEFAZ receipt, to identify the slip in your database. One calculation can generate several slips, each with its own UUID and its own notification.
The POST request is sent in application/json format:
-X POST \
-H "Content-type: application/json" \ Example body sent when a slip generated by the calculation is approved and waiting for payment. The guias and declaracao blocks only appear when the details are available:
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"modelo": "gnre",
"status": "pendente",
"ambiente": 2,
"recibo": "00000000000000",
"origem": "periodo",
"guias": [{
"situacao_guia": "0",
"uf_favorecida": "GO",
"receita": "100102",
"codigo_barras": "99999999999999999999999999999999999999999999",
"linha_digitavel": "999999999999999999999999999999999999999999999999",
"pix_copia_cola": null,
"alocacao": "automatica"
}],
"declaracao": {
"ufs_com_inscricao": ["SP"],
"texto_versao": "guias-declaracao-uf/v2",
"atualizada_em": "2026-10-29T10:00:00-03:00"
}
} Example body sent for a rejection. Here the mensagem says that the slip could not be sent to SEFAZ (the state tax authority) within the retry limit, that these attempts generated no slip, and that you should send the UUID to support so they can check the communication:
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"modelo": "gnre",
"status": "reprovado",
"ambiente": 2,
"motivos_rejeicao": [
{
"codigo": "TRANSPORTE_PRE_ENVIO_ESGOTADO",
"mensagem": "Não foi possível enviar a guia à SEFAZ após o limite de tentativas. Nenhuma guia foi gerada por estas tentativas. Informe o UUID ao suporte para verificar a comunicação."
}
]
} The examples above are bodies that your integration receives, not responses from your application. For an example of an HTTP error when you look up the slip, see Status lookup.
A pago (paid) webhook is also sent when the reconciled bank return file shows that every payment instrument of the slip was paid. Scheduling, refusal, mismatch or partial payment do not generate this confirmation. The same return file does not generate a second payment notification. See Batch payment.
Excerpt of the payment webhook, based on a validated reconciliation. The UUID is replaced and the other conditional fields are left out:
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"modelo": "gnre",
"status": "pago",
"pagamento": {
"data_pagamento": "2026-11-07",
"valor": "12.00",
"banco": "237",
"autenticacao": null,
"registrado_em": "2026-11-07T00:35:37-03:00"
}
} The Presence column shows when Webmania® sends each field; these are not parameters for you to fill in.
| Field | Presence | Type and values | Description |
|---|---|---|---|
uuid | Always | string; 36-character UUID, format 8-4-4-4-12 | Individual ID of the slip. |
modelo | Always | string: gnre | Slip type. |
status | Always | string: pendente, reprovado or pago | Result of the issue request; approval does not confirm payment. |
pagamento | When pago | object | Contains data_pagamento, valor, banco, autenticacao and registrado_em; formats in Slip Status. |
ambiente | Always | integer: 1 production or 2 test environment (homologação) | Environment of the issue request. |
recibo | When available | string | SEFAZ receipt, the same recibo field as in the status lookup. |
motivos_rejeicao | When there are rejection reasons | array of objects | Reasons that can include codigo and mensagem, as strings. |
origem | In slips generated by the calculation, when available | string: periodo or chaves | How the invoices were selected. |
notas | When the details are available | array of objects | Related invoices, including the ignored ones. |
notas_ignoradas | When the available details include ignored invoices | array of objects | Subset of the invoices with an exclusion reason filled in. |
guias | When the details are available | array of objects | Individual information on each slip; it does not prove payment. |
parcelas_recusadas | When there are refused installments and the details are available | array of objects | Installments not included; check the reason and the recommended action. |
declaracao | When there is a snapshot of the calculation; may be missing | object or null | Snapshot of the company declaration used when the slip was issued. |
The invoice, slip and installment fields are described in Status lookup. When declaracao is an object, it contains ufs_com_inscricao, texto_versao (string or null) and atualizada_em (ISO 8601 string with time zone, or null). ufs_com_inscricao is an array with the codes of the states where, at issue time, the company declared a state registration (IE) or a special tax regime. Missing or null details do not prove that every installment was paid or that a declaration was met.
The webhook does not send the full resultado; look up the approved slip to get it. Whether origem, notas, notas_ignoradas, guias, parcelas_recusadas and declaracao are present depends on the information available. Their absence is not a payment confirmation.
The guias block can contain the payment data of each slip in the batch, including when you issue with amounts you provide. Slips generated by the calculation can also show details before the payment result is available. The types, formats and status of each item are in Status lookup.
Check situacao_guia for each item with an available result: an approved batch does not mean that every slip was approved. A null status is not a confirmation of success.
processando and contingencia are not notified. In these cases, do not create another issue request for the same obligation. Wait for the next notification or check the slip in the Status lookup. If the mensagem shows an uncertain result, confirm it with SEFAZ before you pay or issue the slip another way.To understand a rejection, read the reason in motivos_rejeicao. Before you issue again, confirm the result of the slip.
Batch issuing creates the payment slips from your company's NF-e (electronic invoices for goods), so you do not have to calculate any tax. The calculation (apuração) reads the XML of each invoice and returns the slips owed, the pending items and the refusals, for you to review before you confirm. One calculation plans GNRE, DARE-SP and DUA-ES slips. Issuing a slip does not pay the tax: you still have to pay each slip, for example with Batch Payment.
The invoices can come from two sources:
The calculation includes only model 55 NF-e that belong to your own company, are authorized and not canceled, have a verified authorization protocol and are in the requested environment. A summary without the full document is not enough.
All calls use the authentication described in Authentication. The common error responses (HTTP 401 and 403) are in Response format, and the refusal reasons are in Refusals. Selection dates use Brasília time.
Imports invoices issued by another issuer into your company's Fiscal Monitor, so they can be included in the calculation. The Fiscal Monitor service, the company and its digital certificate must be active. For NF-e (model 55), the authorization is confirmed with SEFAZ (the state tax authority). SEFAZ only allows this lookup for access keys issued within the last 6 months.
To import, send a POST request to /2/guias/importacoes with exactly one of the options below.
Request parameters:
| Parameter | Required | Type | Format and values |
|---|---|---|---|
xml | One of the options | string | One complete tax document encoded in base64: up to 2,097,152 encoded characters and, by default, 1 MiB after decoding. |
url_arquivo_zip | One of the options | string | A valid HTTPS URL, allowed by the security policy and up to 2,048 characters long, of a ZIP file of tax documents. |
Request example with a ZIP file:
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url_arquivo_zip": "https://exemplo.com.br/documentos.zip"
}' \
https://api.webmania.com.br/2/guias/importacoes Example HTTP 200 response for an import in progress:
{
"uuid": "a1b2c3d4-e5f6-4890-abcd-ef1234567890",
"status": "processando",
"empresa_uuid": "8f14e45f-ceea-4d3e-a2e0-123456789012",
"importados": [],
"descartados": [],
"processado": 0
} | Field | Type and presence | Description |
|---|---|---|
uuid | string, always | UUID of the import. |
status | string, always | Status of the import; initially processando (processing). |
empresa_uuid | string, always | UUID of the company in the Fiscal Monitor, taken from the token. |
importados, descartados | arrays, always | Documents imported and discarded so far. |
processado | integer, always | Number of documents already handled. |
total | integer, when available | Total number of documents found. |
erro, codigo | strings, when the ZIP fails | Error message and code. |
To track the ZIP import, repeat the same POST with the same URL. For a single document in base64, the HTTP 200 response is the Fiscal Monitor tax document. Example of the identification fields of an imported NF-e:
{
"uuid": "a1b2c3d4-e5f6-4890-abcd-ef1234567890",
"empresa_uuid": "8f14e45f-ceea-4d3e-a2e0-123456789012",
"modelo": "nfe",
"status": "aprovado",
"categoria": "emitidas",
"chave": "35260700000000000000550010000012341123456789"
} The full object follows the format of the Fiscal Monitor document.
| Document field | Type and presence | Description |
|---|---|---|
uuid, empresa_uuid | strings, when available | UUID of the document and of the company in the Fiscal Monitor. |
modelo, status, categoria | strings, when available | Document type, status and category in the Fiscal Monitor. An issued NF-e may return nfe, aprovado and emitidas. |
chave | string, when available | Access key of the tax document. |
data_emissao | string, when available | Issue date and time in YYYY-MM-DD HH:MM:SS. |
numero, serie | strings, when available | Document number and series. |
valor | number or string, when available | Document amount. |
emitente, cliente | objects, when available | Issuer and recipient data. |
fornecedor, manifestacao | object or null | Supplier data and the recipient's acknowledgment (manifestação), when available. |
| HTTP | Response |
|---|---|
400 | Invalid input, or inactive certificate or company: error. NF-e authorization not confirmed with SEFAZ: error and codigo. |
401 | Invalid token; see Response format. |
403 | Inactive subscription or no access to the company: error. |
422 | No Fiscal Monitor link available, or the document cannot be imported: error and codigo. |
HTTP 400 refusal codes when the NF-e authorization is not confirmed:
| Code | Message |
|---|---|
chave_fora_prazo_consulta | A chave de acesso tem mais de 6 meses e a SEFAZ não permite consultá-la; não foi possível confirmar a autorização da nota. The access key is more than 6 months old and SEFAZ does not allow a lookup, so the invoice authorization could not be confirmed. |
documento_sem_protocolo | A chave do documento fiscal não possui protocolo de aprovação na SEFAZ. The tax document key has no approval protocol at SEFAZ. |
Examples of HTTP 400 errors. An xml that is not base64 is refused during validation. An xml whose decoded content is empty returns O campo xml não está em base64 válido ou está vazio. (the xml field is not valid base64 or is empty).
{
"error": "O campo xml não está em base64 válido."
}
{
"error": "A chave de acesso tem mais de 6 meses e a SEFAZ não permite consultá-la; não foi possível confirmar a autorização da nota.",
"codigo": "chave_fora_prazo_consulta"
} Example HTTP 422 error (the company has no available link to the Fiscal Monitor):
{
"error": "A empresa não possui vínculo disponível com o Monitor Fiscal.",
"codigo": "empresa_sem_monitor"
} Next step: once the documents are imported, start the calculation. The reasons that can refuse an invoice are in Refusals.
Starts the calculation of the selected invoices. The API reads the XML of each invoice and plans the slips owed, the pending items and the refusals.
To start, send a POST request to /2/guias/apuracoes with exactly one way to select invoices: periodo, chaves or uuids.
Request parameters:
| Parameter | Required | Type | Format and values |
|---|---|---|---|
ambiente | Required | integer | 1 production; 2 test environment (homologação). Must match the invoices. |
periodo | One of the three options | object | data_inicio and data_fim in YYYY-MM-DD format, both included, up to 31 days. There is no limit on the number of invoices in the period. |
periodo.data_inicio | With periodo | string | First issue date in YYYY-MM-DD, included. |
periodo.data_fim | With periodo | string | Last issue date in YYYY-MM-DD, included. It must be the same as or later than the first date. |
chaves | One of the three options | array of strings | From 1 to 1,000 NF-e access keys, 44 characters each. |
uuids | One of the three options | array of strings | From 1 to 1,000 tax document UUIDs. |
url_notificacao | Optional | string | HTTPS URL of up to 500 characters for the notifications of each slip. |
data_pagamento | Conditional | string | Date in YYYY-MM-DD. Required for DUA-ES, which is issued only in production. |
inscricao_estadual | Optional | string | Pre-existing field that identifies the issuer for DARE-SP, with 12 digits. It does not declare a state registration (IE) in the destination state and does not enable ICMS-ST. The states where the company is registered are declared in guias_declaracao_ufs, in the company record. |
ufs | When requested | object | Information for this calculation, keyed by uppercase state (UF) code. See the accepted leaf fields below. |
excecoes | Optional | array | From 1 to 1,000 objects. Each one has a distinct 44-character chave and the same ICMS agreement and tax leaf fields. When you select by chaves, each exception's key must be in that list. |
In the first calculation, ambiente and the invoice selection are usually enough. You only need the ufs fields when the calculation lookup returns a pending item that asks for one of them. In that case, start a new calculation with the requested field:
| Parameter | Format | When to send it, and the question for the accountant |
|---|---|---|
ufs.PA.recolhimento | por_operacao or opcao_mensal | Did the company choose to pay the DIFAL of Pará once a month? Send por_operacao to create the DIFAL slip when the goods leave, if the other conditions of the scenario are met. Without the field, you get the pending item recolhimento_pa_nao_informado. opcao_mensal results in the refusal opcao_recolhimento_mensal_pa, with the action apuracao_periodica: the accountant pays it, outside the scope of this API. Not accepted for another state or in excecoes. |
ufs.{UF}.convenioufs.{UF}.{tributo}.convenio | string of 1 to 30 characters | Which ICMS agreement number goes on the GNRE for this state? Send it only when requested, as for the FCP-DIFAL of MG. |
ufs.{UF}.{tributo}.produto | string of 1 to 4 digits, no leading zero | Which GNRE product code of this state matches the goods? Choose only one of the options published in o_que_enviar[].opcoes. Do not invent codes. |
ufs.{UF}.{tributo}.detalhamento_receita | 6-digit string | Which published revenue detail code matches the operation? Send only the one the pending item asks for. Do not replace a revenue detail code that the XML already sets. |
{tributo} accepts only difal or fcp_difal. These parameters do not set amounts, revenue code or due date: those come from the NF-e and from the rule of the enabled scenario.
In excecoes[], the tax leaf field takes precedence over the exception's own ICMS agreement, then over the tax leaf field in ufs, and finally over the state's agreement. Precedence applies leaf by leaf; a state never lends its agreement to another state. Exceptions with no selected invoice are counted in estatisticas.excecoes_nao_aplicadas.
Request by period in the test environment (homologação):
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ambiente": 2,
"periodo": {
"data_inicio": "2026-10-01",
"data_fim": "2026-10-10"
}
}' \
https://api.webmania.com.br/2/guias/apuracoes A new calculation for the same period, after the lookup returned pending items for the DIFAL of Pará and the FCP-DIFAL of Minas Gerais. Send the per-operation payment for PA and the ICMS agreement requested for MG. Replace CONVENIO_DO_CONTADOR with the agreement provided by whoever handles your taxes. Send only the fields that apply to the selected invoices.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ambiente": 2,
"periodo": {
"data_inicio": "2026-10-01",
"data_fim": "2026-10-10"
},
"ufs": {
"PA": {"recolhimento": "por_operacao"},
"MG": {"convenio": "CONVENIO_DO_CONTADOR"}
}
}' \
https://api.webmania.com.br/2/guias/apuracoes HTTP 202 response: calculation created. Use the returned uuid in the next requests.
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000"
} Repeating an identical request while the calculation is processando returns HTTP 200 with the same UUID. If a temporary error occurs when you start, repeat the same request to recover the calculation in progress.
| HTTP | Response |
|---|---|
200 | Identical repeat during processing: the same uuid. |
202 | Calculation created: uuid. |
401 | Invalid authentication; see Response format. |
403 | Calculation not available for the account, or inactive subscription. |
422 | error with the first validation failure. |
Examples of HTTP 422 errors (period longer than 31 days; not exactly one selection criterion):
{
"error": "O período deve abranger no máximo 31 dias."
}
{
"error": "Informe exatamente um critério: periodo, chaves ou uuids."
} A root-level ICMS agreement (convenio) is no longer accepted: HTTP 422, {"error":"O campo convenio foi substituído por ufs.{UF}.convenio (ex.: ufs.MG.convenio)."} (the convenio field was replaced by ufs.{UF}.convenio). An unknown key also returns its path: {"error":"O campo ufs.SP.recolhimento não é permitido."} or {"error":"O campo ufs.PA.inscricao_estadual não é permitido."} (the field is not allowed).
Example HTTP 403 error (slip calculation is not available for this account):
{
"error": "A apuração de guias não está disponível para esta conta.",
"codigo": "apuracao_indisponivel"
} Next step: get the calculation until it is no longer processando.
Returns the status and the statistics of the calculation. The calculation goes through the states below:
To get it, send a GET request to /2/guias/apuracoes/{uuid}, with the UUID you received when you started the calculation.
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.webmania.com.br/2/guias/apuracoes/00000000-aaaa-0000-aaaa-000000000000 Example HTTP 200 response with the calculation awaiting confirmation; the values are illustrative:
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"status": "aguardando_confirmacao",
"ambiente": 2,
"estatisticas": {
"notas": {"analisadas": 2, "com_guia": 1, "sem_guia": 1, "com_pendencia": 0},
"guias": {
"quantidade": 1,
"valor_total": "10.00",
"por_tipo": {
"gnre": {"quantidade": 1, "valor": "10.00"},
"dare": {"quantidade": 0, "valor": "0.00"},
"dua": {"quantidade": 0, "valor": "0.00"}
}
},
"por_uf": [],
"por_tributo": [],
"recusas": {"itens": 1, "valor_total": "0.00", "por_motivo": [{"motivo": "sem_icms_st_nem_difal", "acao": "apuracao_periodica", "itens": 1, "valor": "0.00"}], "fora_do_escopo": {"itens": 0, "valor_total": "0.00"}},
"pendencias": {"itens": 0, "valor_total": "0.00", "por_motivo": []},
"excecoes_nao_aplicadas": 0,
"dare": {"modo": "consolidado_mensal", "referencias": []}
},
"confirmacao": null,
"expira_em": "2026-10-11T10:00:00-03:00",
"contadores": {"planejadas": 1},
"codigo_erro": null,
"criado_em": "2026-10-10T10:00:00-03:00",
"finalizada_em": "2026-10-10T10:00:05-03:00"
} | Field | Description |
|---|---|
uuid, ambiente | UUID and environment of the calculation: 1 production or 2 test environment (homologação). |
status | processando, aguardando_confirmacao, emitindo, concluida, expirada, substituida or falhou. |
estatisticas | Summary of invoices, slips, pending items, amounts and refusals, described below. |
confirmacao | null, or an object with confirmada_em, guias_confirmadas, reservadas, divergentes, recusadas_na_confirmacao and pendentes. |
expira_em | Confirmation deadline in ISO 8601, or null. |
contadores | Integer counters. When available: planejadas, reservadas, ja_reservadas, ignoradas, recusadas, declaracao_empresa_ausente and declaracao_empresa_nao_confirmada, plus one counter per reason. Other integer counters may appear. |
codigo_erro | null, assinatura_inativa or erro_interno. |
criado_em, finalizada_em | Dates in ISO 8601; finalizada_em may be null. |
In estatisticas, quantities are integers and money amounts are strings with two decimal places.
| Statistics field | Description |
|---|---|
notas.analisadas, notas.com_guia, notas.sem_guia | Number of invoices analyzed, with a slip and without a slip. |
guias.quantidade, guias.valor_total | Number and total amount of the planned slips. |
guias.por_tipo.gnre, guias.por_tipo.dare, guias.por_tipo.dua | Each type reports quantidade and valor. For DARE, the count is estatisticas.guias.por_tipo.dare.quantidade. |
por_uf[] | Per state: uf, notas, guias and valor. |
por_tributo[] | tributo (difal or fcp_difal), guias and valor. |
recusas.itens, recusas.valor_total, recusas.por_motivo[] | Refusal totals and, per reason, motivo, acao, itens and valor. |
notas.com_pendencia | Invoices with missing information. They may also have another component with a slip. |
pendencias.itens, pendencias.valor_total, pendencias.por_motivo[] | Pending totals; each reason reports motivo, acao, itens and valor. |
recusas.fora_do_escopo.itens, recusas.fora_do_escopo.valor_total | The subset of refusals with the reasons empresa_inscrita_na_uf, regime_recolhimento_nao_certificado or opcao_recolhimento_mensal_pa. Slips already created and invoices with no eligible tax are not part of this total. |
excecoes_nao_aplicadas | Exceptions whose key was not found among the selected invoices. |
dare.modo, dare.referencias[] | Mode consolidado_mensal (consolidated by month). Each reference reports referencia, notas, difal.valor, difal.guias, fecoep.valor and fecoep.guias. |
processando changes to aguardando_confirmacao when there are slips to review, or to concluida when no slip is planned. After you confirm, it changes to emitindo and then to concluida. A calculation can also become expirada after expira_em (the confirmation deadline), substituida when an identical request completes a newer plan, or falhou, with a codigo_erro, from processando or emitindo.
| HTTP | Response |
|---|---|
401, 403 | Invalid token or inactive subscription; see Response format. |
404 | The calculation does not exist, is invalid or belongs to another company: {"error":"Apuração não encontrada."} (calculation not found). On the /guias, /recusas and /confirmar routes, this body applies to a UUID that does not exist or belongs to another company. Always send a valid UUID in {uuid}. |
Lists the slips that the calculation planned, with amounts and due dates, so you can review them before you confirm issuance.
To list them, send a GET request to /2/guias/apuracoes/{uuid}/guias. Use the cursor you receive to get the next page.
| Optional filter | Format and values |
|---|---|
limite | Integer from 1 to 500; default 100. |
cursor | Opaque string returned on the previous page, up to 2,048 characters. |
uf, tipo, situacao | Receiving state, type (gnre, dare, dua) and status of the planned slip. |
Example HTTP 200 response; the values are illustrative:
{
"guias": [{
"id": "0000000000000000000000000000000000000000000000000000000000000000",
"tipo": "gnre",
"uf": "GO",
"tributo": "difal",
"receita": "100102",
"valor": "10.00",
"data_vencimento": "2026-10-10",
"confirmar_ate": "2026-10-10T23:59:59-03:00",
"chave": "35261000000000000000550010000000011000000010",
"situacao": "planejada",
"guia_uuid": null,
"motivo": null,
"detalhes": {
"uf_favorecida": "GO",
"tipo_gnre": 0,
"quantidade_notas": 1,
"receita": "100102",
"valor": "10.00",
"data_vencimento": "2026-10-10",
"chave": "35261000000000000000550010000000011000000010",
"receitas": ["100102"]
}
}],
"cursor": null
} | Field | Description |
|---|---|
guias, cursor | List of planned slips, and the cursor of the next page or null. |
guias[].id | ID of the planned slip, with 64 hexadecimal characters. Use it to confirm. |
tipo, uf, tributo, receita | Type, state, tax and revenue code of the slip. |
valor, data_vencimento, confirmar_ate | Amount and due date. confirmar_ate is the earlier of expira_em and 23:59:59 Brasília time on the due date, or null. |
chave, guia_uuid, motivo | Invoice access key, slip UUID and reason, when they apply. |
situacao | planejada, confirmada, nao_confirmada, reservada, divergente, recusada_na_confirmacao or expirada. |
detalhes | May contain receita, valor, data_vencimento, chave and receitas[]. For GNRE: uf_favorecida, tipo_gnre and quantidade_notas. For DARE: codigo_servico_dare, receita_codigo and referencia. For DUA: codigo_servico and data_referencia. |
consolidado, referencia, notas | In a consolidated DARE: consolidado: true, the reference period and the number of invoices. chave is null, and detalhes includes codigo_servico_dare and descricao. |
An invalid cursor returns HTTP 422: {"error":"Cursor inválido."} (invalid cursor).
Lists what is missing to create the slip of a scenario that is already enabled. Each pending item gives the exact field to send in o_que_enviar[]. Send it in a new calculation, with the same selection criteria.
To get them, send a GET request to /2/guias/apuracoes/{uuid}/pendencias. It accepts limite (1 to 500, default 100), cursor (up to 2,048 characters), uf, tipo (gnre, dare, dua) and motivo (up to 64 characters), with the same pagination as the refusals. A UUID that does not exist or belongs to another company returns HTTP 404; an invalid cursor returns 422.
Example of an MG FCP-DIFAL without an ICMS agreement; the values and identifiers are illustrative:
{
"pendencias": [{
"chave": "31261100000000000000550010000000011000000010",
"uf": "MG",
"tipo": "gnre",
"tributo": "fcp_difal",
"valor": "2.00",
"data_vencimento": "2026-11-12",
"motivo": "convenio_obrigatorio",
"acao": "enviar_complementos",
"mensagem": "Informe o convênio para esta UF e refaça a apuração.",
"o_que_enviar": [{
"campo": "ufs.MG.fcp_difal.convenio",
"tipo": "string",
"formato": "1 a 30 caracteres",
"obrigatorio": true,
"opcoes": [],
"descricao": "Convênio exigido para esta receita.",
"pergunta_contador": "Qual o número do convênio a informar na GNRE desta UF?",
"origem_exigencia": "configuracao_uf",
"aceita_por_documento": true
}]
}],
"cursor": null
} | Field | Description |
|---|---|
pendencias[] | Each item contains chave, uf, tipo, tributo, valor, data_vencimento, motivo, acao, mensagem and o_que_enviar. |
o_que_enviar[].campo | Exact path of the parameter to send in the new calculation. |
tipo, formato, obrigatorio, descricao | Type, format, whether it is required, and an explanation of the requested information. |
opcoes[] | Options with codigo and descricao. When there is a list, use only a published code. |
pergunta_contador | A question that helps whoever handles your taxes choose the right value. |
origem_exigencia | regra_uf or configuracao_uf. |
aceita_por_documento | When true, the matching leaf field is allowed in excecoes[]. The Pará payment option is set per state only. |
cursor | Cursor of the next page, or null. |
How to complete: ask your accountant, then start a new calculation with the same period, or with the pending keys, and the requested fields. The previous calculation stays available for audit; you cannot edit its plan. A component already linked to a slip returns guia_gerada: review the existing slip and do not pay it again. Only items from guias can be confirmed.
Limit: the DIFAL of Pará is created with ufs.PA.recolhimento = por_operacao, if the other conditions of the scenario are met. ICMS-ST and FCP-ST are not created automatically. If the state configuration is unavailable, that is a dependency failure (HTTP 503), never a response that you must complete.
Lists the invoices and taxes for which the calculation does not create a slip. Each refusal has a mensagem (message) and an acao (action) that gives the next step:
acao | What it means | What to do |
|---|---|---|
enviar_complementos | The slip needs a value that is not in the XML. | Send the field requested in o_que_enviar[] in a new calculation. See Pending items. |
apuracao_periodica | The accountant pays the tax in the monthly tax return, or there is no slip to generate. | No action in this API. Read the mensagem to learn which case applies. |
configurar_empresa | The company configuration prevents issuing. | Review the company configuration and run the calculation again. |
emissao_individual | The calculation does not generate this slip automatically. | Issue it through single issuing, with amounts checked by your accountant. |
usar_outra_api | The invoice or the state uses another type of slip. | Issue it through the documentation named in the mensagem (GNRE, DARE-SP or DUA-ES). |
recolher_fora_da_webmania | The tax is paid through a channel that Webmania does not issue. | Pay it through the channel named in the mensagem. |
revisar_com_contador | The scenario is not handled automatically. | Check the payment with your accountant before you issue the slip another way. |
aguardar_liberacao | The scenario is not released in this API yet. | No slip was generated. Check the payment with your accountant. |
To get them, send a GET request to /2/guias/apuracoes/{uuid}/recusas. It accepts limite, cursor, uf, tipo and motivo (up to 64 characters). Pagination uses the same formats as the planned slip list.
Example HTTP 200 response; the values are illustrative:
{
"recusas": [{
"chave": "35261000000000000000550010000000011000000010",
"uf": "SP",
"tipo": "dare",
"componente": null,
"parcela": null,
"valor": "0.00",
"motivo": "perfil_emitente_incompleto",
"acao": "configurar_empresa",
"mensagem": "A inscrição estadual do emitente necessária ao DARE de São Paulo não foi informada ou é inválida. Confira a configuração e refaça a apuração.",
"guia_indicado": null
}],
"cursor": null
} | Field | Description |
|---|---|
recusas[] | Each refusal reports chave, uf, tipo, componente, parcela, valor, motivo, acao, mensagem and guia_indicado. What to do for each acao is in the table at the start of Refusals. |
cursor | Cursor of the next page, or null. |
Next step: review the three lists, complete the pending items that apply and confirm only the planned slips.
Confirms issuance of the planned slips. Confirm only after you review the amounts and the refusals. Selecting a consolidated DARE confirms the whole slip.
To confirm, send a POST request to /2/guias/apuracoes/{uuid}/confirmar with exactly one selection: all slips, with the JSON boolean true, or a list of 1 to 1,000 distinct IDs taken from /guias.
| Field | Format | Description |
|---|---|---|
todas | boolean true | Confirms all slips. Do not combine with guias. |
guias | array of strings | From 1 to 1,000 distinct IDs of planned slips. Do not combine with todas. |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"todas": true
}' \
https://api.webmania.com.br/2/guias/apuracoes/00000000-aaaa-0000-aaaa-000000000000/confirmar HTTP 202 response: confirmation accepted and issuing started.
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"status": "emitindo",
"guias_confirmadas": 1
} | HTTP | Response |
|---|---|
200 | Same selection sent again: summary of the calculation, in the format of Get a calculation. |
202 | uuid, status: emitindo and guias_confirmadas. |
401 | Invalid token; see Response format. |
403 | Inactive subscription or apuracao_indisponivel. |
404 | The calculation does not exist or belongs to another company. |
409 | Conflict with the status or with an earlier selection: error and codigo. |
422 | Invalid selection: error and, when it applies, codigo. |
HTTP 409: code | Message in error |
|---|---|
apuracao_ja_confirmada | Esta apuração já foi confirmada com outra seleção de guias. This calculation was already confirmed with another selection of slips. |
apuracao_nao_confirmavel | Esta apuração não está disponível para confirmação. This calculation is not available for confirmation. |
apuracao_expirada | O prazo de confirmação desta apuração expirou. Refaça a apuração. The confirmation deadline of this calculation has passed. Run the calculation again. |
apuracao_substituida | Esta apuração foi substituída. Consulte a nova apuração. This calculation was replaced. Get the new calculation. |
Example HTTP 409 error:
{
"error": "O prazo de confirmação desta apuração expirou. Refaça a apuração.",
"codigo": "apuracao_expirada"
} HTTP 422: codigo | Message in error |
|---|---|
guia_prevista_invalida | Uma ou mais guias não pertencem ao plano desta apuração. Guias inválidas: followed by the refused IDs, separated by commas, and a period. One or more slips are not part of the plan of this calculation. Invalid slips: … |
selecao_obrigatoria | Informe "todas": true ou a lista "guias" para confirmar a apuração. Send "todas": true or the "guias" list to confirm the calculation. |
selecao_ambigua | Informe apenas um critério de seleção: "todas" ou "guias", não os dois. Send only one selection criterion: "todas" or "guias", not both. |
no codigo | O campo todas deve ser verdadeiro ou falso. Returned for a value that is not boolean, such as "sim".The todas field must be true or false. |
no codigo | O campo todas deve ser o booleano true. Returned for false, 0 or 1. Send todas only as the JSON boolean true.The todas field must be the boolean true. |
Example HTTP 422 error with no selection. error has the message and codigo has the stable code:
{
"error": "Informe \"todas\": true ou a lista \"guias\" para confirmar a apuração.",
"codigo": "selecao_obrigatoria"
} Neither confirming nor completing the calculation proves that each slip was approved. Next step: list the slips by the calculation UUID, and track each one by UUID or notification.
Lists the slips issued by the company. All filters are optional; when you send one, it must have a valid value.
To list them, send a GET request to /2/guias. To track the slips of a confirmed calculation, send its UUID: /2/guias?apuracao_uuid={uuid}.
| Parameter | Required | Type | Format and values |
|---|---|---|---|
apuracao_uuid | Optional | string | UUID of the calculation. |
tipo | Optional | string | gnre, dare or dua. |
status | Optional | string | processando, pendente, pago, contingencia or reprovado. See Slip status and payment. |
ambiente | Optional | integer | 1 production or 2 test environment (homologação). |
chave | Optional | string | Access key of the invoice, 44 characters. |
data_inicio, data_fim | Optional | string | Creation dates in YYYY-MM-DD, Brasília time, both included. The end date cannot be before the start date. |
cursor | Optional | string | Opaque value returned on the previous page, up to 2,048 characters. Copy it as is, without parsing it. |
limite | Optional | integer | From 1 to 100 slips per page; default 100. |
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
"https://api.webmania.com.br/2/guias?ambiente=2&limite=1" Example HTTP 200 response with an approved GNRE. Replace the illustrative cursor with the value you receive in the response:
{
"guias": [{
"uuid": "a1b2c3d4-e5f6-4890-abcd-ef1234567890",
"tipo": "gnre",
"status": "pendente",
"ambiente": 2,
"recibo": "00000000000000",
"valor_total": "10.00",
"uf_favorecida": "GO",
"receita": "100102",
"data_vencimento": "2026-10-03",
"data_pagamento": "2026-10-01",
"criado_em": "2026-10-01T10:00:00-03:00",
"aprovado_em": "2026-10-01T10:01:00-03:00"
}],
"cursor": "CURSOR_RETORNADO_PELA_API"
} Example HTTP 200 response with no slips for the filters you sent:
{
"guias": [],
"cursor": null
} | Field | Type and presence | Description |
|---|---|---|
guias | array of objects, always | Summary of the slips found; may be empty. |
cursor | string or null, always | Opaque value of the next page, or null on the last page. Send the value received in cursor to continue. |
guias[].uuid, tipo, status | strings | UUID, type and status of the slip, with the values of the filters above. |
guias[].ambiente | integer | Environment of the slip, 1 or 2. |
guias[].recibo | string, when available | ID assigned by the issuing service (GNRE receipt). |
guias[].valor_total | decimal string, when available | Total amount of the slip in reais (BRL), with two decimal places. |
guias[].uf_favorecida, receita | strings, when available | Receiving state code and revenue code. |
guias[].data_vencimento, data_pagamento | strings, when available | Dates in YYYY-MM-DD. |
guias[].criado_em, aprovado_em | ISO 8601 strings, when available | Creation date and issue date of the slip. |
| HTTP | Response |
|---|---|
401, 403 | Invalid token or inactive subscription; see Response format. |
422 | Invalid filter or cursor: error. |
Example HTTP 422 error for an invalid cursor:
{
"error": "Cursor inválido."
} Returns one of the company's slips. The response has the same format as the status lookup of the slip type.
To get it, send a GET request to /2/guias/{uuid}, with the UUID of the slip.
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.webmania.com.br/2/guias/a1b2c3d4-e5f6-4890-abcd-ef1234567890 Example HTTP 200 response for a slip that is still processing:
{
"status": "processando",
"uuid": "a1b2c3d4-e5f6-4890-abcd-ef1234567890",
"recibo": null
} | Field | Type and presence | Description |
|---|---|---|
status, uuid | strings, always | Status and UUID of the slip. The status values are in the filter table above. |
recibo | string or null, always | ID assigned by the issuing service, when available (GNRE receipt). |
resultado | object, in pendente or pago | Response of the issue request. The data depends on the slip type and on the result. |
motivos_rejeicao | array, in reprovado | Reasons returned. The rejection code is in motivos_rejeicao[].codigo. |
pagamento | object, when pago | Payment data found in a bank return file, as described in Slip status and payment. |
mensagem | string, when it applies | Guidance about processing, a communication failure or contingency. |
origem | string, when it applies | How the invoices were selected, such as periodo or chaves. |
notas, notas_ignoradas | arrays of objects, when available | Details of the invoices and, if any, of the ignored invoices. Each item may report chave, valor_icms_st, valor_difal, motivo_ignorado and receita. |
guias | array of objects, when available | Details of each slip, including payment data when available. |
parcelas_recusadas | array of objects, if any | Installments not included in the slip, with ID, amount, reason and guidance when available. |
declaracao | object or null, when available | Declaration applied to the slip. It may be missing when there is no linked plan. |
declaracao.ufs_com_inscricao | array of strings | States where the company declared a state registration (IE) or a special tax regime at the time of issue. |
declaracao.texto_versao, declaracao.atualizada_em | string or null | Version of the declaration text, and update date in ISO 8601. |
A slip that is waiting for a safe retry is returned with status: contingencia. The mensagem field says that the attempt created no slip and that the same request will be tried again. Keep tracking the same UUID and do not create another issue request for the same obligation. This slip does not appear in GET /2/guias?status=processando.
If mensagem reports an uncertain result, the slip may have been issued. Check with SEFAZ and with support before you pay it or issue it again by another channel.
| HTTP | Response |
|---|---|
401, 403 | Invalid token or inactive subscription; see Response format. |
404 | The slip does not exist or belongs to another company. |
Example HTTP 404 error (slip not found):
{
"error": "Guia não encontrada."
}Batch payment puts slips that are already issued into one file for your bank. Later, it reads the bank return file to mark each slip as paid. The API does not issue the slips again, does not recalculate taxes and does not move money: you always authorize the payment yourself, at your bank.
The export has two formats:
For review or integration. For each slip, it gives the barcode, the payment code (linha digitável, the numeric code of the slip) and the PIX code, when available.
Remittance file for the bank (.rem) in CNAB 240, the Brazilian bank file standard, with a JSON manifest. After the payment, the API reconciles the bank return file.
Available banks. The export is active by default; your account does not need to be enabled. Each bank collects only some slip types and states:
| Bank | GNRE | DARE-SP | DUA-ES |
|---|---|---|---|
Banco do Brasil001 | All 25 states | ✓ | ✓ |
Bradesco237 | 24 states | ✓ | ✓ |
Itaú341 | 22 states | ✓ | ✓ |
Santander033 | 20 states | ✓ | ✓ |
Sicoob756 | 12 states | ✓ | ✓ |
Sicredi748 | AL, GO, PR, RS, SC | — | — |
Banrisul041 | RS, SC | — | — |
An operational restriction may shorten this list. In that case, the refusal lists the banks accepted at that moment. The states of each bank are in Banks by Slip Type and State.
Layout change. If the bank changed its file layout before you created the file, request a new export. A file that was already created is still reconciled in the original export.
This status applies to issuing, lookup, listing and the slip webhook. It is not the status of the calculation or of the export.
| Status | Meaning and action |
|---|---|
processando | The issue request is still processing. Track the UUID and do not issue again. |
pendente | Slip issued, with no full payment found in a bank return file. It does not mean that the slip was never paid through another channel. |
pago | Payment found in an imported bank return file and reconciled for every payment instrument of the slip. The slip detail and the webhook include pagamento. |
contingencia | The issue request is awaiting communication or has an uncertain result. Read mensagem, and check with SEFAZ and with support before you issue it again or pay by another channel. |
reprovado | The issue request was refused, including by SEFAZ. Review motivos_rejeicao and the guidance you received. |
When the slip is pago, the lookup and the webhook include the pagamento object:
| Field | Type | Description |
|---|---|---|
data_pagamento | string | Payment date, in YYYY-MM-DD format. |
valor | string | Decimal amount paid. |
banco | string | Three-digit COMPE bank code (the Brazilian bank number). |
autenticacao | string or null | Bank authentication code, when available. |
registrado_em | string | Date and time of the record, in ISO 8601. |
For slips with several payment instruments, the object summarizes the last record that completed the payment. Check each instrument in the return file. A reversal can move the slip back to pendente, and a partial payment does not produce pago.
Prepares the payment file of slips that are already issued: json for review or cnab240 for the bank.
To prepare it, send a POST request to /2/guias/exportacoes with exactly one selector: the UUID of a completed calculation whose issue requests are finished, or a list of UUIDs of your company's slips. Do not send IDs of planned slips.
Request parameters:
| Parameter | Required | Type and format |
|---|---|---|
apuracao_uuid | One of the options | UUID string. Do not combine with guias. |
guias | One of the options | array of 1 to 1,000 distinct UUIDs. Do not combine with apuracao_uuid. |
formato | Yes | string: json or cnab240. This export has no CSV or PDF. |
banco | With cnab240 | string with exactly three COMPE digits, keeping leading zeros. See Banks and restrictions. |
data_pagamento | With cnab240 | string YYYY-MM-DD, today or a future date in Brasília time. Optional for JSON. |
numero_remessa | With cnab240 | Positive JSON integer, within the width of the bank profile. You set this sequence with your bank. |
confirmar_conferencia_bancaria | With cnab240 | Only the JSON boolean true. A string or a number does not replace the confirmation. |
pagador | With cnab240 | Object with the fields below. The CNPJ (company ID) must be the authenticated company's own, never a third party's. |
pagador.cnpj, pagador.razao_social | With pagador | strings. A valid numeric 14-digit CNPJ without punctuation, and a legal company name without control characters. |
pagador.endereco | With pagador | Object: logradouro, numero, cidade, cep and uf are required; complemento is optional. All strings. An eight-digit CEP (postal code) and a valid uppercase state code. |
conta_bancaria | With cnab240 | Object: agencia and conta; it may contain agencia_dv, conta_dv, dac and convenio. All strings, keeping leading zeros. Requirements and widths depend on the bank. For Bradesco (237), also send agencia_dv and dac. For Sicredi (748), conta_dv must contain one numeric digit; the dac field is not used in the file. |
JSON review example, based on a validated request. Replace the UUIDs with your company's slips. Available by default, subject to the account permissions:
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"guias":["00000000-aaaa-0000-aaaa-000000000000","00000000-bbbb-0000-bbbb-000000000000"],"formato":"json"}' \
https://api.webmania.com.br/2/guias/exportacoes Example CNAB request body, validated in a test environment, with replaced identifiers. It does not prove that the bank imported or paid anything. Replace the date with a valid date, and the bank details with the setup you confirmed with your bank:
{
"guias": ["00000000-aaaa-0000-aaaa-000000000000"],
"formato": "cnab240",
"banco": "237",
"data_pagamento": "2026-11-07",
"numero_remessa": 556225,
"confirmar_conferencia_bancaria": true,
"pagador": {
"cnpj": "12345678000195",
"razao_social": "EMPRESA EXEMPLO LTDA",
"endereco": {"logradouro":"RUA EXEMPLO","numero":"1","complemento":"","cidade":"CURITIBA","cep":"80010000","uf":"PR"}
},
"conta_bancaria": {"agencia":"01234","agencia_dv":"0","conta":"000000012345","conta_dv":"1","dac":"0","convenio":"TESTE"}
} HTTP 202 creates the export. HTTP 200 returns the same export for an identical request that is still valid. The first response body contains uuid, status and expira_em; get the other fields in Get an export. Track the export by the returned UUID.
| HTTP | Refusal |
|---|---|
401 | Missing or invalid authentication. |
403 | Account not enabled: exportacao_indisponivel. The subscription or the permissions can also block access. |
404 | selecao_invalida: the selection does not exist or belongs to another company. The response does not reveal who owns it. |
409 | Issue requests still in progress: emissao_em_andamento. Wait for the results. |
422 | dados_invalidos (body validation), selecao_invalida (invalid selector, UUIDs or payer CNPJ), banco_nao_habilitado or banco_nao_suportado (bank refused), limite_exportacao (the selection exceeds the preparation limit) or nenhuma_guia_elegivel when no issued slip is found in the selection. Check codigo_erro and mensagem. |
503 | dependencia_indisponivel. Try again later. |
After you send it:
concluida or falhou. The HTTP 202 acceptance does not guarantee that a bank file will be created.uuid, if it is still valid.data_pagamento before today in Brasília time is refused with HTTP 422.Example HTTP 403 refusal (slip export is not available for this account):
{
"codigo_erro": "exportacao_indisponivel",
"mensagem": "A exportação de guias não está disponível para esta conta."
} Returns the status of the export, the files created and the slips left out.
To get it, send a GET request to /2/guias/exportacoes/{uuid}. Example HTTP 200 response, with replaced UUIDs and hashes:
{
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"status": "concluida",
"quantidade_guias": 2,
"valor_total": "12.00",
"arquivos": [{
"nome": "guias_pagamento.zip",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"valor_total": "12.00",
"tipo_conteudo": "application/zip",
"quantidade_guias": 2
}, {
"nome": "guias_237_789026.rem",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"valor_total": "12.00",
"tipo_conteudo": "text/plain",
"quantidade_guias": 2
}, {
"nome": "manifesto.json",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"valor_total": "12.00",
"tipo_conteudo": "application/json",
"quantidade_guias": 2
}],
"avisos": [],
"mensagem": "Exportação disponível para download.",
"motivo": null,
"exclusoes": [],
"codigo_erro": null,
"expira_em": "2026-11-07T20:06:30-03:00",
"gerado_em": "2026-11-06T20:06:30-03:00"
} | Field | Type and meaning |
|---|---|
uuid, status | strings. Status processando, concluida, falhou or expirada. |
quantidade_guias, valor_total | Integer number of payment instruments included, and a decimal string. They are not proof of a debit. |
arquivos[] | File descriptors: nome, tipo_conteudo and sha256 (strings), quantidade_guias (integer), valor_total (decimal string). Empty before completion or after expiration. It contains no public URL. |
avisos[] | Payment instruments left out of a completed export, each with guia_uuid, indice_guia, codigo and mensagem. The codes are in Export exclusions. |
mensagem | String in Portuguese about the export status. |
motivo | String with the refusal reason: instrumento_conflitante, nenhuma_guia_elegivel or leiaute_bancario_alterado. null when there is no refusal reason. |
exclusoes[] | Details of the export refusal, each with guia_uuid (UUID string), indice_guia (integer or null), codigo and mensagem (strings). Empty array when there are no refusal details. |
codigo_erro | null; exportacao_falhou when status is falhou; or exportacao_expirada when status is expirada. |
expira_em, gerado_em | ISO 8601 strings. gerado_em may be null before completion. JSON is valid for 24 hours. CNAB expires at the earlier of 24 hours after creation and the end of the payment day in Brasília time. |
Each export uses a fixed snapshot of the slips. The manifest contains uuid, formato, gerado_em, data_pagamento, banco, quantidade_guias, valor_total, instrumentos, exclusoes, anomalias and arquivos. The payment instruments report identificador, guia_uuid, indice_guia, tipo, ambiente, uf_favorecida, receita, valor, data_vencimento, valido_ate, data_pagamento, codigo_barras, linha_digitavel, pix_copia_cola, situacao_pagamento and elegivel_cnab. Unavailable data may be null. situacao_pagamento: nao_verificada does not mean that there was no payment through another channel.
The CNAB file leaves out payment instruments that are:
Inconsistent financial data in an issued payment instrument blocks the CNAB file. The API does not fill in amounts or fix codes by guessing. The JSON can record anomalies with null data for review, without making those instruments payable. A GNRE batch can contain several payment instruments: the approval of the batch is not enough to include all of them. Dates are not moved to the next business day automatically.
Each slip left out of the file appears in avisos[], with one of the codes below. For CNAB, these exclusions do not block the file for the other slips.
instrumento_conflitante, or the same payment instrument in two slips of the selection, refuses the whole export: status: falhou, codigo_erro: exportacao_falhou, motivo: instrumento_conflitante and arquivos: [], with the details in exclusoes[]. Review the slips and split the selection, or use JSON for review.| Code | Message |
|---|---|
guia_rejeitada | A guia foi rejeitada e não pode ser incluída no pagamento. The slip was rejected and cannot be included in the payment. |
homologacao_nao_pagavel | Guias de homologação não podem ser pagas. Slips from the test environment cannot be paid. |
situacao_nao_confirmada | A emissão deste instrumento não está confirmada. Issuance of this payment instrument is not confirmed. |
codigo_barras_invalido | O código de arrecadação está ausente, inválido ou divergente. The collection code is missing, invalid or does not match. |
valor_referencia_nao_suportado | O código contém um valor de referência, não um valor em reais. The code contains a reference value, not an amount in reais. |
valor_ausente | Não há um valor exato e positivo confirmado para este instrumento. There is no confirmed exact, positive amount for this payment instrument. |
valor_divergente | Os valores informados para este instrumento não conferem. The amounts given for this payment instrument do not match. |
vencimento_desconhecido | O vencimento nominal ou a validade do instrumento não é conhecido de forma inequívoca. The nominal due date or the validity of the payment instrument is not known for certain. |
fora_validade | O instrumento está fora do período permitido para esta data de pagamento. The payment instrument is outside the period allowed for this payment date. |
pagamento_ja_identificado | Já existe um pagamento identificado para este instrumento. A payment was already identified for this payment instrument. |
banco_nao_arrecadador | O banco não possui cobertura confirmada para o tipo de guia e a UF favorecida. The bank has no confirmed coverage for the slip type and the receiving state. |
duplicada_na_selecao | Este instrumento já está presente na seleção. This payment instrument is already in the selection. |
instrumento_conflitante | Existem informações conflitantes para o mesmo instrumento. There is conflicting information for the same payment instrument. |
Guidance. For banco_nao_arrecadador, see the coverage table. For this exclusion only, use the PIX code or the barcode of the slip itself, when available, after you check whether the slip was already paid. For pagamento_ja_identificado and duplicada_na_selecao, do not pay again. For a duplicate, review the entry that is already included.
Downloads the export file, with authentication and no public URL. For json, you get the JSON manifest. For cnab240, you get a ZIP with the .rem file and manifesto.json.
.rem file into your bank.To download it, send a GET request to /2/guias/exportacoes/{uuid}/arquivo. If the remittance is split, the split follows the bank's documented limit, not a generic split per thousand slips. The file may contain more than one batch, according to the bank's rules; the slip IDs are preserved.
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-o exportacao.json \
https://api.webmania.com.br/2/guias/exportacoes/00000000-aaaa-0000-aaaa-000000000000/arquivo For CNAB, use exportacao.zip as the local file name. An identical request made after expiration creates a new export, with another uuid, if it is still valid.
| HTTP | Meaning |
|---|---|
409 | exportacao_em_andamento: the file is not finished yet; or exportacao_falhou: the preparation failed. |
410 | The export has expired. |
404 | The UUID does not exist or belongs to another company. |
503 | File or dependency unavailable. |
The arquivo_pagamento field that may come in a GNRE batch lookup is the original file from the GNRE Portal. It is separate from this export. Do not assume that it has the same layout, or that any bank can concatenate or import it.
Each bank has its own CNAB 240 file profile, chosen by the banco field: the three-digit COMPE code, as a string. There is no generic profile. Before you import the remittance file, check the layout, the bank agreement and your account data with your bank.
| Status | Banks | API response |
|---|---|---|
| Available by default | Banco do Brasil (001), Santander (033), Banrisul (041), Bradesco (237), Itaú (341), Sicredi (748) and Sicoob (756) | CNAB file created for the eligible slips, following the slip types and states that each bank collects. |
| No layout in this export | Banco do Nordeste (004), Inter (077), Caixa (104), BTG Pactual (208), Nubank (260), C6 Bank (336), Cora (403), Safra (422) and all other codes | HTTP 422, banco_nao_suportado. |
403, exportacao_indisponivel, before the bank is validated.The table lists the banks named in the official collection sources checked on November 15, 2026, and used to select banks in this export: GNRE Portal (in Portuguese), SEFAZ-SP (in Portuguese) and SEFAZ-ES (in Portuguese). A bank's presence on the list does not confirm that it accepts every slip by CNAB. Check the channel, the collection agreement and your account contract with the bank.
| Bank | GNRE | DARE-SP | DUA-ES |
|---|---|---|---|
Banco do Brasil001 | AC, AL, AM, AP, BA, CE, DF, GO, MA, MG, MS, MT, PA, PB, PE, PI, PR, RJ, RN, RO, RR, RS, SC, SE, TO | ✓ | ✓ |
Bradesco237 | AL, AM, AP, BA, CE, DF, GO, MA, MG, MS, MT, PA, PB, PE, PI, PR, RJ, RN, RO, RR, RS, SC, SE, TO | ✓ | ✓ |
Itaú341 | AL, AM, AP, BA, CE, DF, GO, MA, MG, MT, PA, PB, PE, PI, PR, RJ, RN, RO, RS, SC, SE, TO | ✓ | ✓ |
Santander033 | AL, AM, AP, BA, CE, DF, GO, MA, MG, MT, PA, PB, PE, PI, PR, RJ, RN, RS, SC, SE | ✓ | ✓ |
Sicoob756 | AL, BA, CE, DF, GO, MA, PA, PB, PE, PI, RJ, RS | ✓ | ✓ |
Sicredi748 | AL, GO, PR, RS, SC | — | — |
Banrisul041 | RS, SC | — | — |
Santander and GNRE. MS and RR appear in Santander's PAGFOR agreement list (in Portuguese), but not in the GNRE Portal list that was checked. These states stay out of the coverage of this export until this is clarified.
How to read the table. ✓ or a listed state: the official source has a record. —: nothing was found in the check. The listing does not prove that the bank accepts the slip by file under your agreement.
GNRE. Each bank collects GNRE only for the listed states. A slip for a state that is not listed for the chosen bank is left out of the file, with banco_nao_arrecadador in avisos[]. After you check whether it was already paid, pay it with the PIX code or the barcode of the slip itself, when available. The bank list does not enable automatic issuing of any tax.
DARE-SP and DUA-ES. DARE-SP exists only for SP, and DUA-ES only for ES. Banrisul and Sicredi collect neither of them. A bank that is not on the channel's list leaves the slip out with banco_nao_arrecadador.
When in doubt, the slip is left out: unknown coverage for the slip type and the state also results in banco_nao_arrecadador, never in an assumed payment instruction.
Receives the return file from the bank and reconciles the payment of each slip of the export. Only exports in the cnab240 format accept a return file. For a json export, the API returns HTTP 422, arquivo_invalido.
To upload it, send a POST request to /2/guias/exportacoes/{uuid}/retornos. Use multipart/form-data with one arquivo field, with the .ret or .txt extension, up to 10 MB. Records must have 240 bytes, with LF or CRLF line endings, in ASCII or ISO-8859-1. The file must be a return file, not a remittance file.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "arquivo=@retorno.ret" \
https://api.webmania.com.br/2/guias/exportacoes/00000000-aaaa-0000-aaaa-000000000000/retornos Do not set the Content-Type: application/json header; curl builds the multipart body. HTTP 202 for a new file; 200 for the same bytes already received in the same export. The body contains only uuid (of the return file), exportacao_uuid and status (processando, concluido or falhou). Store both UUIDs.
| HTTP | Code and meaning |
|---|---|
403 | exportacao_indisponivel: same account enablement as the export. |
404 | exportacao_nao_encontrada: the export does not exist or belongs to another company. |
409 | exportacao_nao_concluida: wait until the export is completed. |
413 | arquivo_muito_grande: larger than 10 MB. |
422 | arquivo_invalido (file missing or without a valid structure, or an export that is not CNAB 240), retorno_nao_e_retorno (the file sent is not a bank return file), banco_divergente (a different bank from the export's) or pagador_divergente (a different payer from the export's). No reconciliation is done for a refused file. |
422 | leiaute_bancario_alterado: unsupported layout version. Supported versions of files already created are still reconciled in the original export. Do not send a payment again just to reconcile its return file. If the remittance file was not created yet, request a new export. |
503 | retorno_falhou or dependencia_indisponivel, including when the export snapshot is unavailable. |
Errors use codigo_erro and mensagem. The expiration of the remittance download does not block sending a return file, but the snapshot of the completed export must still be available.
Returns the reconciliation result: how each line of the return file was classified (paid, scheduled, rejected, not recognized) and whether the payment was recorded on the slip.
To get it, send a GET request to /2/guias/exportacoes/{uuid}/retornos/{retorno}. The only pagination filter is cursor (opaque string, up to 4,096 characters), taken from the cursor field of the response. Each page has up to 500 items.
HTTP 200 example, based on a validated response, with replaced UUIDs. Processing is complete, but the bank entry is only a scheduled payment, not a payment:
{
"uuid": "00000000-bbbb-0000-bbbb-000000000000",
"exportacao_uuid": "00000000-aaaa-0000-aaaa-000000000000",
"status": "concluido",
"banco": "237",
"recebido_em": "2026-11-07T02:14:36-03:00",
"processado_em": "2026-11-07T02:14:36-03:00",
"quantidade_registros": 1,
"pagos": 0,
"agendados": 1,
"rejeitados": 0,
"divergentes": 0,
"estornados": 0,
"nao_correspondentes": 0,
"nao_reconhecidos": 0,
"itens": [{
"linha": 3,
"guia_uuid": "00000000-cccc-0000-cccc-000000000000",
"identificador": "XXXXXXXXXXXXXXXXXXXX",
"situacao": "agendado",
"ocorrencias": [{"codigo":"BD","descricao":"Inclusão efetuada com sucesso"}],
"valor_pago": "0.90",
"data_pagamento": "2026-11-07",
"autenticacao": null,
"registro": null,
"webhook": null
}],
"cursor": null,
"codigo_erro": null,
"mensagem": "O retorno bancário foi processado."
} | Field | Type and meaning |
|---|---|
uuid, exportacao_uuid, status | strings. Processing status of the return file: processando, concluido or falhou. Completion does not mean that every item was paid. |
itens | array; empty until processing is complete. Each item gives the classification of one line. |
itens[].linha, guia_uuid, identificador | Integer line number, and strings, or null when there is no match. |
itens[].situacao | pago, agendado, rejeitado, divergente, estornado, nao_correspondente or nao_reconhecido. These are bank classifications, different from the public status of the slip. |
itens[].ocorrencias | array of objects with the strings codigo and descricao. Their meaning depends on the bank profile. |
itens[].valor_pago, data_pagamento, autenticacao | Strings or null: decimal amount, YYYY-MM-DD date and the authentication given by the bank, never created by the API. |
itens[].registro | String or null. Tells whether the line was saved in the payment history of the slip. Values in Record and webhook. It is not a payment order. |
itens[].webhook | String or null. Status of the payment notification. Values in Record and webhook. |
cursor, codigo_erro, mensagem | Cursor and code are strings or null; the message is a string. Copy the cursor to the next call. codigo_erro is retorno_falhou when processing fails, or leiaute_bancario_alterado when the layout version of the export is not supported (see below). |
banco, recebido_em, processado_em | COMPE code as a string; ISO 8601 dates. processado_em may be null. |
quantidade_registros, pagos, agendados, rejeitados, divergentes, estornados, nao_correspondentes, nao_reconhecidos | Integers with the totals of the whole return file, not only of the current page. They are zero until processing is complete. |
A payment is recorded only when:
A scheduled payment, a bank test, a refusal, a mismatch or a reversal does not prove payment. The same file never records the same fact twice.
200 with status falhou, codigo_erro leiaute_bancario_alterado, mensagem "Não foi possível processar o retorno bancário." (the bank return file could not be processed) and an empty itens. No item is reconciled in this result, and sending the same file again does not change the refusal. Supported versions of files already created are still reconciled in the original export. Do not pay again, and do not send the remittance file to the bank again, just to reconcile a return file. If the version is refused, contact support with the UUIDs of the export and of the return file.| Field | Value | Meaning |
|---|---|---|
itens[].registro | registrado | The line was saved in the payment history of the slip. |
ja_registrado | The same fact was already in the history; nothing was saved again. | |
log_pagamento_cheio | The payment history of the slip reached its limit, and the line was not saved. | |
guia_indisponivel | The slip was not available for saving, and the line was not saved. | |
null | The line does not create a payment record. Only pago items, and estornado items with a valid date and amount, are saved. | |
itens[].webhook | enviado | The payment notification of this slip was sent. |
pendente | The payment notification was attempted, but delivery was not confirmed. | |
null | No payment notification: the item is not pago, the slip is not fully paid yet, or the slip has no notification set up. |
A reversal does not trigger a webhook. An estornado (reversed) item can be saved in the history and move the slip back to pendente, but the API sends no reversal notification: webhook is always null for that item. Get the slip by UUID to see its current status.
HTTP 404 for a return file that does not exist or belongs to another company; 422 with cursor_invalido; 410 with retorno_expirado 24 hours after it was received; 503 when the result is unavailable. The expiration of the remittance file is not the expiration of the return file. Get the slip by UUID to see its current status and the pagamento object.
Issues one GNRE slip with the data and amounts that you provide, without going through the calculation. In this mode the API does not calculate taxes: the revenue code, the due date and the amounts come from your integration. SEFAZ (the state tax authority) validates the slip before it approves it.
The API reads the NF-e and calculates the slips. Use it for the scenarios the calculation covers. See GNRE Batch Issuing.
You send the revenue code, the amounts and the due date. Use it when you already have the amounts, checked with your accountant, or when the calculation refuses the invoice with acao: emissao_individual.
How to issue a single slip:
To issue, send a POST request to /2/gnre/emissao. Issuing is asynchronous: the response returns the slip's uuid with status: processando, and the result arrives by notification.
Returns the settings that SEFAZ (the state tax authority) publishes for a state (UF): enabled revenue codes, required fields, accepted slip types and maximum quantities. It is the first step of single issuing: it shows how to build the slip for the receiving state. It does not declare the company's states (see Configure the Company).
This lookup does not mean that automatic issuing is supported. It returns the published configuration for any state that GNRE accepts, including the states that do not have automatic batch issuing yet. The state groups and the CNAB export coverage are in Covered States and CNAB 240 Export.
To get the configuration of a state, send a GET request to /2/gnre/config-uf/{uf}.
GET /2/gnre/config-uf/SP?ambiente=2, the API returns HTTP 422 with only {"error":"SP não é aceito na API GNRE. Utilize a API DARE-ICMS SP (/2/dare)."}, without the fields of the success response. The message says that SP is not accepted in the GNRE API and that you should use the DARE-ICMS SP API. | Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
uf (path) | Required | string | 2 | Valid two-letter state code, for example MG, RJ or BA; SP and ES are not accepted in this API. |
ambiente (query) | Required | integer | 1 | Environment of the lookup.1 = Production |
receita (query) | Optional | string | 1-6 | Filter by one revenue code: a string of 1 to 6 numeric digits, keeping the leading zeros. |
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
"https://api.webmania.com.br/2/gnre/config-uf/MG?ambiente=2" Response (an example of the structure, not a revenue code configuration in force):
{
"ambiente": 2,
"uf": "MG",
"situacao_consulta": {
"codigo": 450,
"descricao": "Consulta realizada com sucesso"
},
"receitas": [
{
"codigo": "100102",
"descricao": "ICMS Consumidor Final",
"exige_detalhamento_receita": "N",
"exige_documento_origem": "S",
"aceita_pg_pix": "N"
}
],
"qtd_maximas": {"guias_por_lote": "50", "itens_por_guia": "100", "itens_por_lote": "300", "qtd_consultas": "30"},
"versoes": [],
"tipos_gnre_da_uf": {"tipo_gnre": ["0", "1"]}
} The response has the full configuration of the state. Top-level fields:
| Field | Type | Description |
|---|---|---|
ambiente | integer | Environment of the lookup (echo of the request).1 = Production |
uf | string | State you looked up (echo of the request). |
situacao_consulta | object | Result of the lookup: codigo (integer) and descricao (string). 450 = lookup completed successfully |
receitas | array | Configuration of each revenue code enabled in the state (fields in the table below). |
qtd_maximas | object or empty array | When published, guias_por_lote, itens_por_guia, itens_por_lote and qtd_consultas are numeric strings with the limits published by SEFAZ. |
versoes | object or empty array | Versions provided in the response, when present. |
tipos_gnre_da_uf | object or empty array | When provided, the key tipo_gnre contains one value or a list of values that the state accepts (see the difference below). |
Each entry of receitas describes the requirements of that revenue code in the state you looked up. The optional fields depend on the SEFAZ response: the list below gathers the possible fields; it does not make them required in every entry. The scalar values of the revenue codes are strings. Collections keep the container object: the child is an object when there is a single item and an array when there are several; empty containers can return []. In versao and tipo_gnre, the child is a string or an array of strings.
| Field | Type | Description |
|---|---|---|
codigo | string | Revenue code (6 digits). |
descricao | string | Description of the revenue code in the GNRE. |
courier | string | S/N flag of a courier revenue code, when SEFAZ provides it. |
exige_contribuinte_emitente | string | S/N: if S, the slip requires the data of the issuing taxpayer. |
exige_detalhamento_receita | string | S/N: if S, the slip requires detalhamento_receita; the accepted values come in detalhamentos_receita. |
detalhamentos_receita | object/array | Optional container with detalhamento_receita (object or array of objects), each item with codigo and descricao (strings), to select the revenue detail code. |
exige_produto | string | S/N: if S, the slip requires the product code, with the options in produtos. |
produtos | object/array | Optional container with produto (object or array of objects); each accepted product has codigo and descricao (strings). |
exige_periodo_referencia | string | S/N: if S, the slip requires the reference period. |
exige_periodo_apuracao | string | S/N: when present and equal to S, it requires the tax period (período de apuração); options in periodos_apuracao. |
periodos_apuracao | object/array | Optional container with periodo_apuracao (object or array of objects), each item with codigo and descricao (strings) of the accepted period. |
exige_parcela | string | S/N: when present and equal to S, the slip requires the installment number. |
valor_exigido | string | Which tax amounts the revenue code requires (legend below). |
exige_documento_origem | string | S/N: if S, the slip requires the source document. |
tipos_documentos_origem | object/array | Optional container with campo (string) and tipo_documento_origem (object or array of objects with codigo and descricao, strings) of the accepted documents. |
versoes_xml_doc_origem | object/array | Optional container with versao (string or array of strings, 1.00/2.00); it tells in which XML versions the source documents of the revenue code are shown. |
exige_contribuinte_destinatario | string | N = not shown; S = required; O = optional. |
exige_data_vencimento | string | S/N: if S, the slip requires data_vencimento. |
exige_data_pagamento | string | S/N: if S, the slip requires the payment date. |
exige_convenio | string | N/S/O: N = not required, S = optional (accepted, never required), O = required. Only O makes convenio (the ICMS agreement) required on the slip. |
exige_valor_fecp | string | N/S/O: N = not required, S = optional (accepted, never required), O = required. Only O makes the FECP (poverty fund) amount required on the slip. |
exige_campos_adicionais | string | S/N: if S, issuing requires campos_extras (at most 3 fields, with an integer codigo and a valor of up to 100 characters). |
campos_adicionais | object/array | Optional container with campo_adicional (object or array of objects) that describes the extra fields: campo, obrigatorio (S/N), codigo, tipo (T = text, N = numeric, D = date), titulo and, when provided, tamanho and casas_decimais (all strings). Each item can contain versoes_xml_campo_adicional, an object with versao (string or array of strings). |
aceita_pg_pix | string | S/N: if S, the slip can be paid by PIX (instant payment). |
tipos_gnre | object/array | Container with tipo_gnre (string or array of strings) of the slip types accepted for this revenue code in this state (see the difference below). |
Legend of the requirement fields: S = Sim, yes (the revenue code requires or accepts the field), N = Não, no. exige_contribuinte_destinatario, exige_convenio and exige_valor_fecp also accept O, but each field uses the meaning described in the table above. Values of valor_exigido:
P = PrincipalT = TotalA = Both (Ambos)N = None (Nenhum)PO = Principal or Other (Outros)TO = Total or OtherAO = Both or Othertipos_gnre × tipos_gnre_da_uf: tipos_gnre (inside each revenue code) tells which slip types that revenue code accepts. tipos_gnre_da_uf (at the top level) is the allow list of the state. When you issue, each slip is validated against the union of the two lists, and the batch against the limits in qtd_maximas. Values: 0 = Simple GNRE (slip with a single item)
1 = Multiple documents slip (several source items, same revenue code)
2 = Multiple revenue codes slip
Example of a validation error, HTTP 422: for the call GET /2/gnre/config-uf/SP?ambiente=2, the API responds:
{
"error": "SP não é aceito na API GNRE. Utilize a API DARE-ICMS SP (/2/dare)."
} When the Portal GNRE (the national GNRE portal) is unavailable or limits requests, the response can be HTTP 503 with the Retry-After header (1 to 600 seconds). Example with Retry-After: 60. The message says that the Portal GNRE is temporarily unavailable or has limited the number of requests, that nothing was changed, and that you can try again in 60 seconds:
{
"error": "O Portal GNRE está temporariamente indisponível ou limitou o número de requisições. Nada foi alterado. Tente novamente em 60 segundos."
} Other temporary failures return HTTP 503 or 500 with {"error":"Não foi possível consultar o Portal GNRE no momento. Tente novamente em instantes."}, which means that the Portal GNRE could not be reached and you should try again shortly. A refusal returned by the service can come with HTTP 200 and error; check the body as well as the HTTP code.
The request body has three fields: the environment, the URL that receives the notifications and the list of slips.
| Parameter | Required | Type | Format and values |
|---|---|---|---|
ambiente | Required | integer | 1 production or 2 test environment (homologação). |
url_notificacao | Required | string | Valid webhook URL, up to 500 characters. |
guias | Required | array of objects | From 1 to 100 slips. |
Limits of each request:
| Limit | Maximum |
|---|---|
| Slips per request | 100 |
| Items per slip | 100 |
| Items across all slips of the request | 1,000 |
| Amounts per item | 10 |
| Extra fields per item | 3 |
| Issue requests per second, in the test environment | 1 per company (above that, HTTP 429 with Retry-After: 1) |
SP and ES do not use GNRE: do not send these states as receiving states. Use the DARE-ICMS SP and the DUA-ES.
Each object in guias is one slip: the state that receives the tax, the slip type, who pays it and the items to be paid. Choose the revenue code from the State Configuration.
| Parameter | Required | Type | Format and values |
|---|---|---|---|
guias[].uf_favorecida | Required | string | Code of the receiving state, for example MG; SP and ES are not accepted by GNRE. |
guias[].tipo_gnre | Required | integer | 0 simple; 1 multiple documents; 2 multiple revenue codes. |
guias[].contribuinte_emitente | Required | object | Taxpayer identification; see issuer. |
guias[].itens | Required | array of objects | From 1 to 100 items; see items. |
guias[].valor_gnre | Optional | decimal | Total amount you provide for the slip, from 0 to 9999999999.99. When you issue with amounts you provide, the API does not calculate this field from the sum of the items. If omitted or equal to zero, it is not sent in the XML. |
guias[].data_pagamento | Optional | string | Payment date in YYYY-MM-DD (year-month-day). |
guias[].identificador_guia | Optional | string | External ID, from 1 to 10 characters. |
Slip types accepted in tipo_gnre. Which types are available depends on the state and the revenue code: check the State Configuration.
| Value | Type | Use |
|---|---|---|
0 | Simple | One revenue code for one source document. |
1 | Multiple documents | The same revenue code for several source documents. |
2 | Multiple revenue codes | Several revenue codes on the same slip. |
Each slip is an independent payment document.
The issuing taxpayer is the party that pays the tax, usually your company. Fields of the required object contribuinte_emitente:
| Parameter | Required | Type | Format and values |
|---|---|---|---|
tipo_identificacao | Required | integer | 1 CNPJ (the 14-digit company ID); 2 CPF (the 11-digit individual taxpayer ID). |
cnpj | Required: if tipo_identificacao is 1 | string | Valid CNPJ, preferably without punctuation. |
cpf | Required: if tipo_identificacao is 2 | string | Valid CPF, preferably without punctuation. |
inscricao_estadual | Optional | string | IE (Inscrição Estadual, state registration), from 2 to 16 characters. |
razao_social | Optional | string | Legal name, up to 60 characters. |
endereco | Optional | string | Address, up to 60 characters. |
municipio | Optional | string | Last five digits of the city's IBGE code (the official city code), without the 2-digit state prefix; for example, 50308 for São Paulo (full code 3550308). |
uf | Optional | string | Valid state code. |
cep | Optional | string | Postal code (CEP), exactly 8 digits. |
telefone | Optional | string | Phone number, from 6 to 11 digits. |
Each item is an amount to pay for one revenue code of the state, with a due date and amounts. Below are the fields of each object in guias[].itens. The objects documento_origem, referencia, valores, contribuinte_destinatario and campos_extras are detailed in the next sections.
| Parameter | Required | Type | Format and values |
|---|---|---|---|
receita | Required | string | Revenue code of exactly 6 digits, published for the state. |
detalhamento_receita | Optional | string | Revenue detail code: exactly 6 digits, including leading zeros, when applicable. |
documento_origem | Optional | object | Related document; see source document. |
produto | Optional | string | Product code: a number of 1 to 4 digits, with no leading zero. |
referencia | Optional | object | Reference period; see reference. |
data_vencimento | Required | string | Due date in YYYY-MM-DD (year-month-day), from 2000-01-01 to 2099-12-31. |
valores | Required | array of objects | From 1 to 10 amounts; see amounts. |
convenio | Optional | string | ICMS agreement or protocol, up to 30 characters, when applicable. |
contribuinte_destinatario | Optional | object | Identification of the recipient, when required; see recipient. |
campos_extras | Optional | array of objects | Up to 3 fields of the state; see extra fields. |
numero_controle | Optional | string | Control number of the item, from 1 to 20 characters. |
numero_controle_fecp | Optional | string | FECP (poverty fund) control number, from 1 to 20 characters. |
The document that created the debt, such as the NF-e. The accepted type depends on the state and is listed in the State Configuration.
Parameter in documento_origem | Required | Type | Format and values |
|---|---|---|---|
numero | Required: if the object is sent | string | Up to 18 digits, a 44-character access key, or a DUIMP (import declaration) in the format AABR followed by 11 digits. |
tipo | Required: if the object is sent | string | 2-digit code published for the state in the State Configuration. |
The period that the payment refers to, when the revenue code requires it.
Parameter in referencia | Required | Type | Format and values |
|---|---|---|---|
periodo | Optional | integer | 0 monthly; 1/2 first/second half of the month; 3/4/5 first/second/third ten-day period. |
mes | Optional | integer | Month, from 1 to 12. |
ano | Optional | integer | Year with 4 digits, from 1000. |
parcela | Optional | integer | Installment, from 1 to 999. |
Each item has from 1 to 10 amounts, one per type. The type combines what is being paid with the tax:
| Amount | ICMS | FCP |
|---|---|---|
| Principal amount | 11 | 12 |
| Total | 21 | 22 |
| Fine | 31 | 32 |
| Interest | 41 | 42 |
| Monetary adjustment | 51 | 52 |
Fields of each object in valores:
| Parameter | Required | Type | Format and values |
|---|---|---|---|
tipo | Required | integer | One of the codes in the table above. |
valor | Required | decimal | Amount of money, from 0 to 9999999999.99. |
The recipient taxpayer is the party that receives the goods. Send it only when the state requires it. Fields of contribuinte_destinatario:
| Parameter | Required | Type | Format and values |
|---|---|---|---|
tipo_identificacao | Required: if the object is sent | integer | 1 CNPJ; 2 CPF. |
cnpj | Required: if tipo_identificacao is 1 | string | Valid CNPJ. |
cpf | Required: if tipo_identificacao is 2 | string | Valid CPF. |
inscricao_estadual | Optional | string | IE (Inscrição Estadual, state registration), from 2 to 16 characters. |
razao_social | Optional | string | Legal name, up to 60 characters. |
municipio | Optional | string | Five digits of the city's IBGE code. |
Some states ask for additional information, identified by a code. The accepted codes are in the State Configuration. Send up to 3 objects in campos_extras.
| Parameter | Required | Type | Format and values |
|---|---|---|---|
codigo | Required | integer | Code published for the field, at most 2147483647. |
valor | Required | string | Value of the field, up to 100 characters. |
Send a POST request in JSON to /2/gnre/emissao. The revenue code and the data must match the current requirements of the state; check the State Configuration.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ambiente": 2,
"url_notificacao": "https://seudominio.com.br/webhook/gnre",
"guias": [ ... ]
}' \
https://api.webmania.com.br/2/gnre/emissao Example request body:
{
"ambiente": 2,
"url_notificacao": "https://seudominio.com.br/webhook/gnre",
"guias": [{
"uf_favorecida": "MG",
"tipo_gnre": 0,
"contribuinte_emitente": {
"tipo_identificacao": 1,
"cnpj": "12345678000195"
},
"itens": [{
"receita": "100102",
"data_vencimento": "2026-12-20",
"valores": [{
"tipo": 11,
"valor": 100.00
}]
}],
"data_pagamento": "2026-12-20"
}]
} Example HTTP 200 response:
{
"status": "processando",
"uuid": "00000000-aaaa-0000-aaaa-000000000000"
} Keep the uuid to track the slip through the status. Example HTTP 422 validation error when you leave out the environment (the message says that the ambiente field is required):
{
"error": "O campo ambiente é obrigatório."
} If the issue request cannot be queued, the response is HTTP 503 (the message says that queuing the GNRE issue request failed and asks you to try again):
{
"error": "Falha ao enfileirar emissão da GNRE. Tente novamente."
} If a response includes a UUID and says that the result is uncertain, track the slip and follow the message before you request a new issue. The other error responses are in Response format. Next step: track the slip in Status lookup.
Returns the current status of a GNRE slip by its UUID, for the authenticated company only. Track slips day to day through notifications; use this lookup to get the full result of an issued slip, in the resultado field, or to spot-check a single slip.
Each slip has one of the statuses below:
| Status | What it means | What to do |
|---|---|---|
processando | The slip is being issued. | Wait for the notification. Do not issue again. |
pendente | The slip was issued and is waiting for payment. | Pay it with the payment code (linha digitável, the numeric code of the slip), by PIX, or in a batch with CNAB 240. |
pago | The bank return file confirmed payment of the whole slip. | Nothing to do. |
reprovado | The issue request was refused, including by SEFAZ (the state tax authority). | Read motivos_rejeicao before you issue again. |
contingencia | The issue request is waiting for a retry, or its result is uncertain. | Read mensagem; see Processing and Contingency. |
To look up a slip, send a GET request to /2/gnre/status/{uuid}.
Request parameters:
| Parameter | Required | Type and format | Description |
|---|---|---|---|
uuid | Yes | string; 36-character UUID in the format 8-4-4-4-12 | ID of the slip, in the URL path. |
Authorization | Yes | string header; Bearer followed by the company token | Authenticates the lookup. |
Request example:
curl -X GET \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://api.webmania.com.br/2/gnre/status/00000000-aaaa-0000-aaaa-000000000000 Example HTTP 200 response, with the slip being processed:
{
"status": "processando",
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"recibo": null
} Example HTTP 404, for a slip that does not exist, belongs to another company or is of another type (the message means "Slip not found."):
{
"error": "Guia não encontrada."
} Example HTTP 200 response for a rejected slip; the reason is an example of a platform code:
{
"status": "reprovado",
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"recibo": null,
"motivos_rejeicao": [
{
"codigo": "TRANSPORTE_PRE_ENVIO_ESGOTADO",
"mensagem": "Não foi possível enviar a guia à SEFAZ após o limite de tentativas. Nenhuma guia foi gerada por estas tentativas. Informe o UUID ao suporte para verificar a comunicação."
}
]
} error is a string with the message. HTTP 401 means that authentication failed. HTTP 403 can mean that the access or the subscription lacks permission. See the examples in Response format.
The Presence column shows when the API returns each field; these are not request parameters. The details depend on the issue request and on the information available.
| Field | Presence | Type and values | Description |
|---|---|---|---|
status | Always | string: processando, pendente, pago, contingencia or reprovado | State of the issue request. Approval does not confirm payment. |
uuid | Always | string; 36-character UUID | ID of the slip you looked up. |
recibo | Always | string or null | Receipt provided by SEFAZ, when available. |
resultado | When pendente or pago | object or array | Public result of the issue request; its structure depends on the SEFAZ response available. It can contain ambiente, situacao_process, guias (with the fields of Batch Lookup • Result), pdf_guias, arquivo_pagamento, noticias and status. |
motivos_rejeicao | When reprovado | array of objects; can be empty | Reasons returned, including codigo and mensagem when available. |
pagamento | When pago | object | data_pagamento, valor, banco, autenticacao and registrado_em, as described in Slip status and payment. It does not appear on a slip that was only issued. |
mensagem | In specific processing, contingency or communication situations | string | Guidance on the state and the next steps. |
origem | In slips generated by the calculation, when available | string: periodo or chaves | How the invoices were selected. |
notas | When the invoice details are available | array of objects | Invoices related to the slip, including the ignored ones. |
notas_ignoradas | When the available details include ignored invoices | array of objects | Subset of notas with motivo_ignorado filled in. |
guias | When the details are available | array of objects | Information on each slip. Check the individual result before you pay. |
parcelas_recusadas | When there are refused installments and the details are available | array of objects | Installments not included in the slip; their refusal does not mean they were paid. |
declaracao | When there is a snapshot of the calculation; may be missing | object or null | Snapshot of the declaration used when the slip was issued, not the company's current configuration. |
| Field | Presence | Type and format | Description |
|---|---|---|---|
notas[].chave | Per invoice | string with the NF-e access key, or null | Identifies the invoice, when available. |
notas[].valor_icms_st, notas[].valor_difal | Per invoice | decimal string with two places, or null | Invoice totals. They can repeat for different revenue codes; do not add up the rows. |
notas[].motivo_ignorado | Per invoice | string or null | Reason, when the invoice was ignored. |
notas[].receita | Per invoice | string or null | Revenue code linked to the row, when available. |
guias[].situacao_guia | When the slip result is available | code from 0 to 4 | Individual status; 0 is success, 1 or 2 mean invalidation, 3 a communication error and 4 a pending item. |
guias[].uf_favorecida, guias[].receita | When the slip result is available | string or null | State code and revenue code, when available; the revenue code can be null if there is more than one. |
guias[].codigo_barras, guias[].codigo_barra_48, guias[].linha_digitavel, guias[].pix_copia_cola | When the slip result is available | string or null | Payment data provided for the slip (barcode, payment code), including PIX when available. |
guias[].alocacao | Conditional | string: automatica | Shows that the slip was allocated automatically. |
guias[].classe, guias[].complementos_aplicados | Conditional | string or null; array or null, respectively | Class and applied complements, when available. |
parcelas_recusadas[].chave, parcelas_recusadas[].receita | Per installment | strings; the revenue code can be empty | NF-e access key and revenue code linked to the installment. |
parcelas_recusadas[].parcela, parcelas_recusadas[].motivo | Per installment | strings; the reason can be null | Installment, and the code of the reason it was refused. |
parcelas_recusadas[].valor | Per installment | decimal string or null | Amount not included, in reais (BRL). |
parcelas_recusadas[].componente, parcelas_recusadas[].mensagem, parcelas_recusadas[].acao, parcelas_recusadas[].guia_indicado | Conditional | strings; acao can be null | Component, explanation, action and indicated slip, when available. The indication does not confirm issuing or payment. |
Missing details do not prove that every installment was paid. The same blocks can come with the notification.
When available, the snapshot records the states where, at issue time, the company declared a state registration (IE) or a special tax regime. To set up the company, see the Quick guide.
| Field | Presence | Type and format | Description |
|---|---|---|---|
declaracao.ufs_com_inscricao | When declaracao is an object | array of strings; state codes in upper case | States where, at issue time, the company declared a state registration (IE) or a special tax regime; can be empty. |
declaracao.texto_versao | When declaracao is an object | string or null | Version of the declaration text, when available. |
declaracao.atualizada_em | When declaracao is an object | ISO 8601 string with time zone, or null | Date and time the declaration was updated, when available. |
If the detail is missing or is null, do not assume that the declaration was met.
While the slip is in processando or contingencia, no notification is sent. In these cases:
processando: issuing is in progress. Wait, and do not create another issue request for the same obligation.contingencia with a new attempt: the previous attempt did not generate a slip, and the same request will be repeated automatically, as the mensagem says. Track the same UUID and do not issue again. This slip does not appear in GET /2/guias?status=processando.contingencia with an uncertain result: the slip may have been issued before a communication failure. Check with SEFAZ and, if needed, send the UUID to support before you pay or issue by other means.Example HTTP 200 with an uncertain result. The message says that the slip may have been issued before the communication failure, that you should check with SEFAZ manually, and that you should not send the issue request again before that, to avoid a duplicate tax document:
{
"status": "contingencia",
"uuid": "00000000-aaaa-0000-aaaa-000000000000",
"recibo": null,
"mensagem": "Status incerto. A guia pode ter sido emitida antes da falha de comunicação. Consulte a SEFAZ manualmente. Não reenvie a emissão antes dessa confirmação, para evitar um documento fiscal em duplicidade."
} Returns the processing result of a batch of GNRE slips, using the SEFAZ receipt number. Because issuing is asynchronous, the immediate response no longer includes the receipt. The receipt is in the recibo field of the webhook and in the recibo field of GET /2/gnre/status/{uuid}.
To get the result of a batch, send a POST request to /2/gnre/consulta.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
ambiente | Required | integer | 1 | Environment of the lookup.1 = Production |
recibo | Required | string | 10/14 | SEFAZ receipt number with 10 or 14 digits. Use exactly the value you received (the recibo field of the webhook or of the status), without removing or adding zeros. |
incluir_pdf_guias | Optional | string | 1 | Include the PDF of the slips.S = Yes If omitted, it is not included. |
incluir_arquivo_pagamento | Optional | string | 1 | Include the payment file: S = yes; N = no. If omitted, it is not included. |
incluir_noticias | Optional | string | 1 | Include news: S = yes; N = no. If omitted, it is not included. |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }' \
https://api.webmania.com.br/2/gnre/consulta Example request body:
{
"ambiente": 2,
"recibo": "12345678901234",
"incluir_pdf_guias": "S"
} The receipt must belong to the authenticated company and to the environment you send. If it is not found, the response is HTTP 404 (the message means "Slip not found."):
{
"error": "Guia não encontrada."
} For {"ambiente":2,"recibo":"12"}, validation returns HTTP 422 with the validation_failed envelope (see Validation envelope by endpoint). The message says that the recibo field has an invalid format:
{
"error": "validation_failed",
"errors": {"recibo": ["O campo recibo tem um formato inválido."]}
} If the Portal GNRE (the national GNRE portal) is unavailable or limits requests, wait for the time in the Retry-After header, from 1 to 600 seconds. Example HTTP 503, with Retry-After: 60:
{
"error": "O Portal GNRE está temporariamente indisponível ou limitou o número de requisições. Nada foi alterado. Tente novamente em 60 segundos."
} Other failures return HTTP 503 or 500 with {"error":"Não foi possível consultar o Portal GNRE no momento. Tente novamente em instantes."}. A rejection can return HTTP 200 with error; always check the response body.
The response contains the processing status and the result of each slip in the batch.
| Parameter | Type | Description |
|---|---|---|
situacao_process.codigo | integer | Code of the processing status. The full list is in GNRE error codes. |
situacao_process.descricao | string | Description of the status. |
ambiente | integer | Environment of the lookup: 1 = production; 2 = test environment (homologação). |
guias | array | List of the slips returned. It can be empty while the batch is being processed (situacao_process.codigo = 401). |
guias[].situacao_guia | code from 0 to 4 | Slip status:0 = Processed successfully1 = Invalidated on the portal2 = Invalidated by the state3 = Communication error4 = Pending item |
guias[].versao | string | Slip version provided by the tax authority, when present. |
guias[].uf_favorecida | string | Code of the receiving state, when the response provides it. |
guias[].valor_gnre | string | Slip amount in decimal format, when provided. |
guias[].contribuinte_emitente | object | Issuer data, when present, including identificacao and razao_social. |
guias[].linha_digitavel | string | Payment code (linha digitável, the numeric code of the slip), when provided. |
guias[].codigo_barras | string | Barcode (44 positions), when provided. |
guias[].pix_copia_cola | string | PIX payload for payment, when available. |
guias[].motivos_rejeicao | object | Rejection reasons, when available. |
pdf_guias | string | PDF of the slips in base64 (when incluir_pdf_guias=S). |
arquivo_pagamento | string | Payment file, when available. |
noticias | array | News returned by the tax authority. |
Response example:
{
"ambiente": 2,
"situacao_process": {"codigo": 402, "descricao": "Lote processado com sucesso"},
"guias": [
{
"versao": "2.00",
"situacao_guia": "0",
"uf_favorecida": "PE",
"contribuinte_emitente": {
"identificacao": {"cnpj": "12345678000195"},
"razao_social": "Empresa Exemplo"
},
"valor_gnre": "4.31",
"codigo_barras": "99999999999999999999999999999999999999999999"
}
]
} When the slip is processed successfully, the lookup can return:
linha_digitavel: 48-position payment code (linha digitável), payable at any bank.codigo_barras: 44-position barcode.pix_copia_cola: PIX payload (copy and paste), when the state or the revenue code accepts payment by PIX.pdf_guias: the slip in PDF format, base64-encoded, when incluir_pdf_guias=S.incluir_pdf_guias=S only when needed. Looks up GNRE slips that were already issued, by barcode, control number or source document.
To look them up, send a POST request to /2/gnre/consulta-guias.
SP and ES do not issue through GNRE. São Paulo uses the DARE-ICMS SP API and Espírito Santo uses the DUA-ES API. HTTP validation requires cod_barras for tipo_consulta=C, num_controle for N and doc_origem for D. For CD and ND, send both matching identifiers; HTTP validation does not make them required automatically. Whether the query is accepted, and its result, depend on SEFAZ (the state tax authority).
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
ambiente | Required | integer | 1 | Environment of the lookup.1 = Production |
consultas | Required | array | 1-50 | List of queries (up to 50). |
consultas[].uf | Required | string | 2 | Valid code of the slip's state, such as MG or PE; SP and ES are not accepted in this API. |
consultas[].tipo_consulta | Required | string | 1-2 | Query type.C = Barcode |
consultas[].cod_barras | Required by HTTP validation when tipo_consulta = C | string | 44/48 | Slip identifier: the barcode (44 digits) or the payment code (linha digitável, 48 digits). Both lengths are accepted. |
consultas[].num_controle | Required by HTTP validation when tipo_consulta = N | string | 10-16 | Control number of the slip (10 to 16 digits, without removing or adding zeros). |
consultas[].doc_origem | Required by HTTP validation when tipo_consulta = D | object | - | Source document of the slip. |
consultas[].doc_origem.numero | Required when doc_origem is sent | string | 1-44 | Up to 18 digits, a 44-character access key, or a DUIMP (import declaration) in the format AABR followed by 11 digits. |
consultas[].doc_origem.tipo | Required when doc_origem is sent | string | 2 | Type of the source document, with 2 digits (for example, 01). The codes for each state are in tipos_documentos_origem in the state configuration. |
consultas[].emitente_id | Optional | object | — | Issuer identification. If you omit it, the API uses the document of the authenticated company. If you send it, it must contain the issuer's CNPJ (company ID) or CPF (individual taxpayer ID). |
consultas[].emitente_id.cnpj | Conditional | string | 14 | Valid CNPJ of the authenticated company, without punctuation; required if the issuer is identified by CNPJ. |
consultas[].emitente_id.cpf | Conditional | string | 11 | Valid CPF of the authenticated company, without punctuation; required if the issuer is identified by CPF. |
consultas[].emitente_id.ie | Optional | string | 2-16 | State registration (IE) of the issuer; it does not replace the CNPJ or CPF. |
consultas[].id_consulta | Optional | string | 1-10 | Numeric ID of the query, with 1 to 10 digits. |
The CR and NR types of the GNRE standard (combinations with the revenue code) are not supported by this API: the request has no revenue code field.
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }' \
https://api.webmania.com.br/2/gnre/consulta-guias Example request body:
{
"ambiente": 2,
"consultas": [
{
"uf": "MG",
"tipo_consulta": "C",
"cod_barras": "12345678901234567890123456789012345678901234"
}
]
} The HTTP 200 response confirms that the batch was received, but it does not contain the result of each query yet. status is processando. recibo is a string of 10 or 14 digits that you use to get the result. data_hora_recibo is the date and time returned by the tax authority, and tempo_estimado_proc is the estimated time in seconds. The last three values can be null if the tax authority does not provide them.
{
"status": "processando",
"recibo": "12345678901234",
"data_hora_recibo": "2026-08-24T14:32:10-03:00",
"tempo_estimado_proc": 5
} If emitente_id does not identify the authenticated company, the response is HTTP 404. Example request with a document that is not the account holder's:
{
"ambiente": 2,
"consultas": [{
"uf": "PE",
"tipo_consulta": "N",
"num_controle": "1234567890",
"emitente_id": {"cnpj": "12345678000195"}
}]
} Response, when this CNPJ belongs to another company (the message means "Slip not found."):
{
"error": "Guia não encontrada."
} Example request that results in an HTTP 422 validation error because uf is SP. The message says that SP is not accepted in the GNRE API and that you should use the DARE-ICMS SP API (/2/dare):
{
"ambiente": 2,
"consultas": [{
"uf": "SP",
"tipo_consulta": "N",
"num_controle": "1234567890"
}]
}
{
"error": "SP não é aceito na API GNRE. Utilize a API DARE-ICMS SP (/2/dare)."
} When the Portal GNRE (the national GNRE portal) is unavailable or limits requests, the API can return HTTP 503 with Retry-After between 1 and 600 seconds. Example with Retry-After: 60:
{
"error": "O Portal GNRE está temporariamente indisponível ou limitou o número de requisições. Nada foi alterado. Tente novamente em 60 segundos."
} Other failures return HTTP 503 or 500 with {"error":"Não foi possível consultar o Portal GNRE no momento. Tente novamente em instantes."}. The service can also reject a query with HTTP 200 and an error field; check the response body.
You get the result of the queries later, with POST /2/gnre/consulta-guias-resultado; see Slip Lookup • Result.
Returns the processing result of a batch of slip queries, using the receipt returned when you sent the batch. Send a POST request to /2/gnre/consulta-guias-resultado.
| Parameter | Required | Type | Size | Description |
|---|---|---|---|---|
ambiente | Required | integer | 1 | Environment of the lookup.1 = Production |
recibo | Required | string | 10/14 | Receipt returned when you sent the batch of queries: 10 or 14 digits, without removing or adding zeros. |
incluir_pdf_guias | Optional | string | 1 | S = yes; N = no. Accepted in the request, but it does not change the slip result lookup. |
incluir_arquivo_pagamento | Optional | string | 1 | S = yes; N = no. Accepted in the request, but it does not change this lookup. |
incluir_noticias | Optional | string | 1 | S = yes; N = no. Accepted in the request, but it does not change this lookup. |
curl -X POST \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ ... }' \
https://api.webmania.com.br/2/gnre/consulta-guias-resultado Example request body:
{
"ambiente": 2,
"recibo": "12345678901234"
} Example HTTP 200 response for a processed batch, with one slip that belongs to the company:
{
"ambiente": "2",
"numero_recibo": "12345678901234",
"situacao_process": {"codigo": "402"},
"resultado": {
"guia": {
"versao": "2.00",
"situacao_guia": "0",
"uf_favorecida": "PE",
"contribuinte_emitente": {"identificacao": {"cnpj": "12345678000195"}, "razao_social": "Empresa Exemplo"},
"valor_gnre": "4.31",
"codigo_barras": "99999999999999999999999999999999999999999999"
}
}
} ambiente is a numeric string (1 production, 2 test environment). numero_recibo is a string of 10 or 14 digits that identifies the batch. In situacao_process, codigo is a string with the status, and descricao, when present, describes it. resultado.guia, when present, can be an object for one slip or a list for several. Only slips of the authenticated company are returned, and the list can be empty. Each slip can include versao (string), situacao_guia (code from 0 to 4), uf_favorecida (state code), contribuinte_emitente (object), valor_gnre (decimal string), codigo_barras (44-digit string) and other data provided by the tax authority, as described in Batch Lookup • Result. When situacao_process.codigo is 401, the batch is still being processed.
For {"ambiente":2,"recibo":"12"}, validation returns HTTP 422:
{
"error": "validation_failed",
"errors": {
"recibo": [
"O campo recibo tem um formato inválido."
]
}
} The same unavailability handling described above applies: HTTP 503 with Retry-After when the Portal provides it, or HTTP 503/500 with a generic message. A rejection can also come with HTTP 200 and error. Example of unavailability with Retry-After: 60:
{
"error": "O Portal GNRE está temporariamente indisponível ou limitou o número de requisições. Nada foi alterado. Tente novamente em 60 segundos."
} This section collects the error codes mentioned elsewhere on this page. For what to do about each calculation refusal, see Refusals. For the general format of error responses, see Response format.
The tax authority returns the codes below in the field situacao_recepcao.codigo (receipt of the batch) or situacao_process.codigo (processing). The text in parentheses is the original Portuguese description of each code:
| Code | Description | Recommended action |
|---|---|---|
100 | Batch received successfully (Lote recebido com sucesso). | Track the result at GET /2/gnre/status/{uuid} or in the webhook. |
101 | Batch already registered (Lote já cadastrado). | The batch was already received. Get the result with the receipt that was returned. |
102 | Batch with invalid syntax (Lote com sintaxe inválida). | Review the structure of the batch you sent and send it again, corrected. |
103 | Batch exceeds the maximum allowed size (Lote ultrapassa o tamanho máximo permitido). | Split the batch into smaller parts and send them again. |
104 | Batch with invalid encoding (Lote com encoding inválido). | Send the batch again in UTF-8. |
105 | Batch with invalid schema (Lote com schema inválido). | Review the fields against this documentation and send it again. |
106 | Batch with invalid schema version (Lote com versão do schema inválida). | Review the schema version and send it again. |
107 | Batch with invalid data version (Lote com versão dos dados inválida). | Review the data formats against this documentation and send it again. |
108 | Batch with invalid environment ID (Lote com identificação do ambiente inválida). | Use ambiente 1 (production) or 2 (test environment, homologação). |
401 | Batch being processed (Lote em processamento). | Wait a few moments and look it up again. |
402 | Batch processed successfully (Lote processado com sucesso). | Review the individual result of each slip in guias[]. |
403 | Batch processed with pending items (Lote processado com pendência). | Check the slips with pending items in guias[] and follow their outcome. |
404 | Batch not found (Lote não localizado). | Check the receipt number you sent. |
450 | Error processing the batch (Erro no processamento do lote). | Review the batch data and send it again. |
501 | Error in the batch schema (Erro no schema do lote). | Review the batch structure and send it again. |
502 | Error in how the batch was built (Erro na formação do lote). | Review the batch data and send it again. |
503 | Processing error (Erro no processamento). | Wait and try again. This is a temporary processing failure. |
504 | Connection error (Erro de conexão). | Communication with the tax authority failed. Try again. |
601 | Error in the result schema (Erro no schema do resultado). | Try to look up the result again. |
602 | Receipt number not registered (Número do recibo não cadastrado). | Check the receipt number you sent. |
603 | Error processing the result (Erro no processamento do resultado). | Look it up again in a few moments. |
604 | Connection error in the result (Erro de conexão no resultado). | Communication failed. Try again. |
situacao_recepcao.codigo (receipt) and situacao_process.codigo (processing). Do not confuse them with the field situacao_consulta, which only GET /2/gnre/config-uf/{uf} returns. There, the codes 450–455 describe the result of the configuration lookup (for example, 450 = lookup completed successfully). In this table, 450 means an error processing the batch. The situacao_consulta codes are listed in the State Configuration section. The lookup that returns the codes of this table is in Batch Lookup • Result. A summary of the stable codes in the error responses of Confirm a calculation (fields error and codigo) and Batch payment (fields codigo_erro and mensagem). The full messages are in the linked sections.
| Code | HTTP | Where |
|---|---|---|
apuracao_ja_confirmada, apuracao_nao_confirmavel, apuracao_expirada, apuracao_substituida | 409 | Confirm a calculation |
guia_prevista_invalida, selecao_obrigatoria, selecao_ambigua | 422 | Confirm a calculation |
exportacao_indisponivel | 403 | Prepare an export |
emissao_em_andamento | 409 | Prepare an export |
exportacao_em_andamento, exportacao_falhou | 409 | Download the file |
selecao_invalida | 404 (selection does not exist or belongs to another company) | Prepare an export |
dados_invalidos, selecao_invalida, banco_nao_habilitado, banco_nao_suportado, limite_exportacao, nenhuma_guia_elegivel | 422 | Prepare an export and Banks and restrictions |
exportacao_falhou, exportacao_expirada | 200 (field codigo_erro) | Get an export |
exportacao_expirada | 410 | Download the file |
banco_nao_arrecadador and the other exclusion codes | no HTTP error | Export exclusions |
exportacao_nao_encontrada | 404 | Send the bank return file |
retorno_nao_encontrado | 404 | Get a bank return |
exportacao_nao_concluida | 409 | Send the bank return file |
arquivo_muito_grande | 413 | Send the bank return file |
arquivo_invalido, retorno_nao_e_retorno, banco_divergente, pagador_divergente, cursor_invalido | 422 | Send the bank return file and Get a bank return |
leiaute_bancario_alterado | 422 when sending; 200 (field codigo_erro) when getting | Send the bank return file and Get a bank return |
retorno_expirado | 410 | Get a bank return |
retorno_falhou, dependencia_indisponivel | 503 | Send the bank return file and Get a bank return |
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 |
|---|---|---|
| Issuing in the sandbox (homologação) | 1 request per second | Test environment for your integration. |
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. The API sends the message in Portuguese; it means “Request limit reached. Try again in a few seconds.”:
{
"error": "Limite de requisições atingido. Tente novamente em alguns segundos."
}
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 payment slip PDF.
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.
Right after the introduction, the documentation now shows a notice that the API is in beta, with a link to the Changelog.
Changed section: introducao
Payment slip calculation (apuração de guias) now brings together the parameters per state and per invoice, pending items, refusals, certified coverage and batch payment. Single issuing is still available.
Changed sections: emissao-por-lote, apuracao-pendencias, gnre-cobertura-uf, pagamento-lote
The documentation is now LLM-ready: copy the page or each section as Markdown, a section index and llms.txt.