Stackin
v1.10.0Issue and manage Brazilian fiscal documents: NF-e for goods, NFS-e for services.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
issue_invoice
Issue a Brazilian fiscal document: NFS-e or NF-e. This produces a legal fiscal document. Confirm the data with the user before calling when you inferred any field. Send unit_price with quantity when the user quotes a price per unit, amount when they quote the line; both must agree. nfse is a service invoice, one line per document (more is 422 NFSE_SINGLE_ITEM): the address is optional and service_code (LC 116/2003 item.subitem) falls back to the company's fiscal profile. The nfse group fills the DPS (competence, ISS, federal taxes, deductions, substitution and the rest) with only what the u…
consult_invoice
Look up an invoice's current status. Read-only. After an OUTCOME_UNKNOWN issuance, consult its document_id: the dps_id of an nfse, the access_key of an nfe. A 404 on a dps_id means nothing was issued.
| Parameter | Type | Description |
|---|---|---|
document_type * | string | nfse for a service invoice, nfe for goods. |
access_key | The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so… | |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
dps_id | nfse instead of access_key: its DPS id. |
cancel_invoice
Cancel an authorized invoice. Legal cancellation, with fiscal and accounting effect, inside a window the NFS-e authorizer enforces for the municipality. Ask the human to confirm before calling; never call it speculatively. The reason reaches the tax authority verbatim and must be at least 15 characters. Pass idempotency_key to make a retry safe: repeating the same key with the same access key and reason replays the first answer instead of cancelling a second time. Reuse the key only when retrying that exact call; a genuinely new cancellation needs a new key, or none. Nothing generates one fo…
| Parameter | Type | Description |
|---|---|---|
access_key * | string | The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so… |
document_type * | string | nfse for a service invoice, nfe for goods. |
reason * | string | Why the document is cancelled, 15 to 256 characters. It reaches the tax authority verbatim, e.g. Erro no valor do servico prestado. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
idempotency_key | One per business event, e.g. order-1042. Printable ASCII up to 255, no leading or trailing space. |
get_invoice_pdf
Return the printable rendering of a document, as a PDF. Works for both types — a DANFE for nfe, a DANFSe for nfse. The PDF comes back base64-encoded in content_base64, with its size in size_bytes; the XML, not this, is the legally valid document. A PDF above 2 MB is not inlined: the answer says to download it from the API instead. A 502 from here means the authorizer is unavailable, not that the invoice is wrong.
| Parameter | Type | Description |
|---|---|---|
access_key * | string | The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so… |
document_type * | string | nfse for a service invoice, nfe for goods. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
reissue_invoice
Retry a rejected invoice after the data that caused the rejection was fixed. Takes the local invoice_id, not the access key: a rejected document never got one. Consumes a credit like a new issuance, so it takes an idempotency_key for the same reason issue_invoice does. An authorized invoice is corrected or cancelled, never reissued.
| Parameter | Type | Description |
|---|---|---|
invoice_id * | string | The local invoice id (a UUID), as list_invoices and issue_invoice return it. Not the access key. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
idempotency_key | One per business event, e.g. order-1042. Printable ASCII up to 255, no leading or trailing space. |
correct_invoice
File an electronic correction letter (CC-e) against an NF-e. NF-e only: there is no correction letter for an NFS-e, where a wrong document is cancelled and issued again. It corrects wording and non-fiscal fields only. It cannot change values, taxes, the recipient or the products — those still require cancelling and issuing again, and telling the user a CC-e will fix an amount is wrong in a way they only discover at an audit. Each letter supersedes the previous one and the SEFAZ keeps at most 20 per document. The text reaches the tax authority verbatim.
| Parameter | Type | Description |
|---|---|---|
access_key * | string | The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so… |
correction * | string | The corrected wording, 15 to 1000 characters, sent verbatim, e.g. Onde se le Rua A, leia-se Rua B. Replaces any earlier letter, so repeat what still applies. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
invalidate_numbering
Declare an NF-e numbering range reserved but never used. NF-e numbering has to be continuous, so a gap left by a failed issuance is explained to the SEFAZ with this — not with a new document. Irreversible: a number declared unused can never be used. Only for numbers that were never authorized. An authorized document is cancelled, never invalidated. Confirm the range with the user and read it back before calling: the range is inclusive, and one digit wrong burns numbers the company still needs. The SDK refuses a backwards range and a reason outside 15-255 characters before anything is tran…
| Parameter | Type | Description |
|---|---|---|
number_end * | integer | Last unused number, inclusive; equal to number_start for a single number. |
number_start * | integer | First unused number, inclusive. |
reason * | string | Why the numbers went unused, 15 to 255 characters, sent verbatim, e.g. Falha no sistema durante a emissao. |
series * | string | The NF-e series of the range, e.g. 1. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
list_invoices
List the invoices this company issued, newest first. One document type at a time: pass nfse for services or nfe for goods. A company that issues both has to be asked twice. Use it for "my last invoices", "what was rejected today", and to find a document whose access key the user does not have at hand. Read-only. An authorized document is stored as issued, which is the value the rows carry; authorized is accepted as a synonym and asks for the same thing. Every row carries both identifiers the other tools need: id, which reissue_invoice takes, and access_key, which consult_invoice, cancel_in…
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
document_type | string | nfse for a service invoice, nfe for goods. |
external_reference | Only documents with this external_reference. | |
include_items | boolean | Keep each row's item lines and fiscal_operation. Off by default: they are most of the size, and a page of 100 NF-e with them is about 130 KB. consult_invoice brings one document's lines back. |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |
status | Only rows in this state. authorized is a synonym for issued. All states when omitted. |
get_invoice_submissions
Show every attempt made for one invoice and what came back. This is the tool that answers "why was it rejected". consult_invoice gives the status; this gives the tax authority's own code, its message, and the request and response exactly as they went over the wire. Read-only. It takes the invoice_id, like reissue_invoice — a rejected document has no access key to look it up by. Get the id from list_invoices. The rows are attempts, not documents: a reissued invoice has more than one, oldest first, and only the last describes the current state. Quote the authority's message rather than para…
| Parameter | Type | Description |
|---|---|---|
invoice_id * | string | The local invoice id (a UUID), as list_invoices and issue_invoice return it. Not the access key. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
invoice_stats
Count this company's documents, and compare recent days. The answer to "how many invoices this month", "how much did I bill" and "is rejection going up": totals by document type and by status over everything, then issued and rejected counts and the amount for the last `days` beside the `days` before them, and one row per day. In the connection's environment only. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
days | integer | The window compared with the one before it, in days. 30 by default. |
list_invalidations
List the NF-e numbering ranges this company already declared unused, newest first. Read it before invalidate_numbering: a range reported twice is refused, and one that overlaps a past report means the gap was already explained. Each row has the series, the inclusive range, the reason, the SEFAZ status and its protocol. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |
validate_invoice_payload
Dry-run issue_invoice: the API runs issuance's pre-authority checks (company blockers; NCM, CEST, IBS/CBS and presumed-credit tables; layout and cross-field rules). Nothing is sent, numbered, stored or charged. Malformed fields come back first, without the API. It does not replace issuing: the authorizer can still reject what passes (recipient registration, a number already used).
| Parameter | Type | Description |
|---|---|---|
document_type * | string | nfse for a service invoice, nfe for goods. |
items * | array | As issue_invoice takes them. |
change | As in issue_invoice. | |
client_id | As in issue_invoice. | |
client_name | string | As in issue_invoice. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
contingency | boolean | As in issue_invoice. |
contingency_reason | As in issue_invoice. | |
contingency_started_at | As in issue_invoice. | |
direction | As in issue_invoice. | |
discount | As in issue_invoice. | |
export | As in issue_invoice. | |
foreign_id | As in issue_invoice. | |
foreign_id_missing_reason | As in issue_invoice. | |
intermediary | As in issue_invoice. | |
issued_at | As in issue_invoice. | |
nfse | As in issue_invoice. | |
number | As in issue_invoice. | |
payments | As in issue_invoice. | |
presence | As in issue_invoice. | |
purpose | As in issue_invoice. | |
recipient_address | As in issue_invoice. | |
recipient_municipal_registration | As in issue_invoice. | |
referenced_keys | As in issue_invoice. | |
series | As in issue_invoice. | |
tax_id | string | As in issue_invoice. |
transport | As in issue_invoice. |
list_received_invoices
List NF-e documents other companies issued against this one. The mirror of list_invoices: that one shows what this company issued, this one what it received. Read-only. It reads what the API already collected and never calls the tax authority; collection runs every six hours and sync_received_invoices asks now. Each row carries the issuer, the amount, has_full_document and, once one was filed, the manifestation; final_answer_due means only an awareness was filed. Before a manifestation the authority sends a summary only; the full document arrives after one. Past the plan's monthly allowance…
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |
sync_received_invoices
Ask the tax authority now for NF-e issued against this company. Collection already runs every six hours. After a read that finds nothing more the authority imposes a one-hour wait; inside it this is refused with the time to retry (next_sync_at, the same instant list_received_invoices reports in sync). Never retry in a loop, and never ask before that instant: asking early renews the block.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
manifest_received_invoice
Declare this company's position on a document issued against it. Legally binding and irreversible once the tax authority accepts it — ask the human to confirm before calling, and read back which document and which of the four positions is being filed. Denying a document (210220) or declaring the operation did not happen (210240) is an accusation against whoever issued it. Never pick either because the user sounds unsure — ask. 210200 confirms the operation happened, 210210 acknowledges the document exists, 210220 denies knowing it, and 210240 states the operation was not carried out. On…
| Parameter | Type | Description |
|---|---|---|
access_key * | string | The 44-character access key of the received NF-e, as list_received_invoices returns it. |
manifestation * | string | 210200 confirms the operation, 210210 acknowledges the document, 210220 denies knowing it, 210240 states the operation was not carried out. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
reason | Required with 210240 and refused with any other code, e.g. Mercadoria nao foi entregue. |
get_received_invoice_xml
Return the full XML (procNFe) of an NF-e issued against this company. Read-only and never charged. Only when list_received_invoices shows has_full_document; for a summary the answer says to manifest first. An XML above 500 KB is not inlined: the answer says to download it from the API instead.
| Parameter | Type | Description |
|---|---|---|
access_key * | string | The 44-character access key of the received NF-e, as list_received_invoices returns it. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
lookup_fiscal_code
Resolve one code of one classification, when you know both. Use this to confirm a code before putting it on a document — an NCM that does not exist is rejected by the tax authority after issuing, which costs a cancellation. A code that is not there answers 404. That means the code is wrong, not that the lookup failed; do not retry it. `metadata` differs per kind and is passed through as published: utrib on an NCM, ncm_code on a CEST, tax_type on a CST, and nothing at all on an ISS service.
| Parameter | Type | Description |
|---|---|---|
code * | string | The code itself, as published: 84716052 for an NCM, 5102 for a CFOP. Digits only, no dots. |
kind * | string | cfop, ncm, cest, cst, csosn, ... |
country | string | ISO 3166-1 alpha-2 code. A code means nothing without it, and Brazil is the default rather than a guess. |
search_fiscal_codes
Find a code from a description, or page through a table. This is the tool for "what NCM is a keyboard" — the one the user actually asks. Prefer it over guessing a code from memory: the tables change, and a plausible wrong code is worse than a lookup. Leaving `kind` unset searches every classification of that country at once, which is the most expensive call here. Set it whenever the question already names one. Rows come back ordered by kind then code; there is no sort argument, and asking for one changes nothing.
| Parameter | Type | Description |
|---|---|---|
country | string | ISO 3166-1 alpha-2 code. A code means nothing without it, and Brazil is the default rather than a guess. |
kind | Narrows to one classification. All if unset. | |
limit | integer | Rows per page. 20 by default. |
offset | integer | Rows to skip. Use it to page, not to narrow — a term is cheaper than paging to find one row. |
term | Matches the code or the description. |
list_fiscal_kinds
Which classifications this country has data for, right now. Ask this before assuming a classification exists. The answer grows as the source data does, so a name absent here is absent today rather than absent forever.
| Parameter | Type | Description |
|---|---|---|
country | string | ISO 3166-1 alpha-2 code. A code means nothing without it, and Brazil is the default rather than a guess. |
lookup_taxpayer
Look up one taxpayer by exact tax id, to confirm who it is. Use it to check a recipient's name before issuing against them. It takes the id exactly — punctuation is fine, but there is no search by name, by prefix or by state, and there will not be: the registry holds the names and addresses of real people. A 404 does not mean the company does not exist. The registry reloads monthly from the RFB's dump, so a recently registered CNPJ is simply not in it yet. Say that to the user rather than reporting the tax id as invalid, and never turn a 404 here into a validation rule.
| Parameter | Type | Description |
|---|---|---|
tax_id * | string | The exact tax id. A CNPJ is 14 characters and may carry letters in its first 12 since July 2026 (e.g. 12ABC34501DE35); a CPF is 11 digits. Punctuation is fine. |
country | string | ISO 3166-1 alpha-2 code. A code means nothing without it, and Brazil is the default rather than a guess. |
search_cities
Find a municipality's IBGE code from its name. Issuing resolves city_code from city and state by itself, so this is for the name that matches more than one city, or an address the API answered CITY_NOT_FOUND for. Returns at most 20, each with its code, name and state; ask the user which one when more than one fits. Read-only.
| Parameter | Type | Description |
|---|---|---|
name * | string | The start of the city's name, accents optional, e.g. santa rita. |
country | string | ISO 3166-1 alpha-2 code. A code means nothing without it, and Brazil is the default rather than a guess. |
state | Narrows to one UF, e.g. SP. |
calculate_ibs_cbs
Simulate IBS/CBS per item and in total. Issues nothing. Not a fiscal document: say so to the user. Rates left out use the official 2026 ones in 2026; outside 2026 they are required.
| Parameter | Type | Description |
|---|---|---|
items * | array | The items. |
operation_date * | string | YYYY-MM-DD; picks vigência and rates. |
document_type | string | Model the cClassTrib is checked for; amounts are the NF-e's. |
rate_city | pIBSMun, %. | |
rate_federal | pCBS, %. | |
rate_state | pIBSUF, %. |
suggest_nbs
List the NBS codes NFS-e Anexo VIII pairs with a service code. Suggestions, not a decision: show them to the user and put an nbs on the item only after they pick one. Each carries the cIndOp and cClassTrib Anexo VIII lists for it, which belong in the item's ibs_cbs group only when the user also confirms them. Empty when the annex lists none.
| Parameter | Type | Description |
|---|---|---|
service_code * | string | The LC 116 item.subitem as items[].service_code takes it: 1.07, 01.07.00 or 010700. |
list_authorized_companies
List the companies this connection may act for, and what it may do on each. Call it before acting when the user has more than one company, or when a tool answered that it needs a company. Each row carries the company_id (UUID) and tax_id (CNPJ or CPF) the other tools accept as company_id or company_tax_id, and the permissions granted there. One connection may cover several companies; when it covers only one, the other tools need no company at all. Read-only.
get_usage
The plan's allowances, what is used and the credit left. Read it before saying an action is free. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
get_company_readiness
Whether the company can issue right now, and if not, what to fix. Call it before a company's first document, and when issuing fails for a reason that is not the document's. ready is false with missing naming the cause; by_document_type has it per nfe and nfse, each blocker with the fields at fault and each warning a default being declared; fix_url is the dashboard screen for the first blocker. What to do with it: - address: offer to fill it in here. Read the company's own registry row with lookup_taxpayer, show the user the address, and call update_company once they confirm. - state_regi…
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
update_company
Fill in or fix the company's own address and fiscal fields — what get_company_readiness reports missing. Before calling it: read the company's own registry row with lookup_taxpayer (its CNPJ), show the user the address you are about to write, and call only after they confirm it. Never invent or guess a field; leave out what neither the registry nor the user gave. The state cannot change here. The registry row keeps street_type, street, number and neighborhood under metadata.address and the CEP as postal_code. Its city_code is the Receita's code (4 digits), not IBGE, and it has no city name…
| Parameter | Type | Description |
|---|---|---|
approximate_tax_federal_percent | Lei 12.741 approximate tax percentage, 0 to 100. | |
approximate_tax_municipal_percent | Lei 12.741 approximate tax percentage, 0 to 100. | |
approximate_tax_simples_percent | ME/EPP Simples approximate tax percentage (Lei 12.741), 0 to 99.99. | |
approximate_tax_state_percent | Lei 12.741 approximate tax percentage, 0 to 100. | |
block_activity_mismatch | Owner only. True refuses, False only warns. | |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
iss_rate | ISSQN rate in percent, above 0 and at most 5. | |
municipal_registration | Inscricao municipal (provider IM), up to 15 letters or digits. | |
municipality_code | The 7-digit IBGE code of a city in the company's state (search_cities finds it). Never the registry's 4-digit city_code, padded or not. Leave it out to send municipality_name. | |
municipality_name | The city's name; the IBGE code is found from it in the company's state. Send it or municipality_code; both must agree. | |
neighborhood | Neighborhood (bairro). | |
number | Street number, or SN when there is none. | |
service_code | Default NFS-e service code (cTribNac), e.g. 01.07.00. | |
simples_apuracao | NFS-e regApTribSN of an ME/EPP: 1, 2 or 3. | |
simples_apuracao_ibs_cbs | How an ME/EPP pays IBS/CBS: 1 in the DAS, 3 outside it; only 3 lets its NFS-e carry the IBS/CBS group in production. | |
simples_nacional | NFS-e Simples Nacional option (opSimpNac): 1 no, 2 MEI, 3 ME/EPP. | |
special_tax_regime | NFS-e regEspTrib: 0 none, 1 cooperative, 2 estimativa, 3 municipal microempresa, 4 notario/registrador, 5 autonomo, 6 sociedade de profissionais, 9 other. An MEI, and an ME/EPP with simples_apuracao 1… | |
state_registration | State registration (IE), digits or ISENTO; an NF-e needs it. | |
street | Street (logradouro). | |
tax_regime | CRT: 1 Simples, 2 Simples excesso, 3 normal, 4 MEI. | |
zip_code | CEP, 8 digits; the mask is fine. |
list_clients
Find the company's saved clients. Look a recipient up here before typing one into issue_invoice: when it is already saved, pass its id as client_id and the name, document and address come from the registry. Most recently used first unless sort_by says otherwise. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
inactive | boolean | List the deactivated clients instead of the active ones. |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |
order_by | string | asc or desc. |
search | Part of the name, or the CPF/CNPJ with or without punctuation. | |
sort_by | string | Order by. |
source | Only those saved from this source. |
get_client
Read one saved client, with its full address. Read-only.
| Parameter | Type | Description |
|---|---|---|
client_id * | string | The client's id, from list_clients. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
save_client
Save a client in the company's registry, or update a saved one. It records a recipient for later issuances; it issues nothing. A document already saved is refused with the existing client's id — call get_client or pass that id here to update it instead. Confirm the data with the user when any of it was inferred.
| Parameter | Type | Description |
|---|---|---|
name * | string | Legal name (razao social) or full name. |
address | object | null | Postal address: street, number, neighborhood, city, state (UF), zip_code and city_code (IBGE). An NF-e to this client needs all of them. |
client_id | Update this saved client instead of creating one. Only the fields sent change. | |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
email | Contact email, e.g. financeiro@empresa.com. | |
foreign_id | Passport or other document of a buyer abroad, used instead of tax_id. | |
municipal_registration | Inscricao municipal. | |
notes | Free text kept with the client. | |
phone | Contact phone with area code, e.g. 11987654321. | |
state_registration | State registration (IE), digits or ISENTO. Leave it out for a non-contributor. | |
tax_id | CPF or CNPJ. Required, except for a buyer abroad (address.state EX). |
deactivate_client
Hide a saved client; reactivate_client brings it back.
| Parameter | Type | Description |
|---|---|---|
client_id * | string | The client's id, from list_clients. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
reactivate_client
Bring a deactivated client back to the registry.
| Parameter | Type | Description |
|---|---|---|
client_id * | string | From list_clients with inactive=true. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
list_items
Find the products and services in the company's catalog. Look a line up here before typing it into issue_invoice: when it is saved, pass its id as item_id and the description, price and fiscal codes come from the catalog. Most recently used first. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
inactive | boolean | List the deactivated items instead of the active ones. |
kind | product for goods, service for services. | |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |
order_by | string | asc or desc. |
search | Part of the description, code or external reference; digits also match the NCM and GTIN. | |
sort_by | string | Order by. |
source | Only those saved from this source. |
get_item
Read one catalog item with its fiscal fields. Read-only.
| Parameter | Type | Description |
|---|---|---|
item_id * | string | The item's id, from list_items. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
save_item
Save a product or service in the catalog, or update a saved one. Without item_id it creates, or updates the item with the same external_reference (else the same code): sending it twice never makes two. Nothing fiscal is required to save; an NF-e still needs ncm and cfop when issued. It issues nothing. Confirm the data with the user when any of it was inferred.
| Parameter | Type | Description |
|---|---|---|
cest | Product: 7 digits. | |
cfop | Product: 4 digits, e.g. 5102. | |
code | SKU, unique in the company. | |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
description | What is sold: at most 120 characters for a product (NF-e), 2000 for a service. Required to create. | |
external_reference | Another system's id, unique in the company. | |
gross_weight | Product: kg per unit, NF-e only. | |
gtin | Product: 8, 12, 13 or 14 digits, checked. | |
ibs_cbs_class | IBS/CBS cClassTrib, 6 digits. | |
ibs_cbs_cst | IBS/CBS CST, 3 digits. | |
internal_code | Service: own code, up to 20 letters or digits. | |
iss_retained | Service: ISS retained by the customer. | |
item_id | Update this saved item instead of creating one. Only the fields sent change. | |
kind | product (NF-e) or service (NFS-e). Required to create; a field of the other kind is refused. | |
municipal_service_code | Service: municipal tax code, 3 digits. | |
nbs | Service: nine-digit NBS. Only from the user or a suggest_nbs row they confirmed. | |
ncm | Product: 8 digits. Only from the user or classify_item once confirmed; never inferred. | |
net_weight | Product: kg per unit, NF-e only. | |
notes | Free text kept with it. | |
origin | Product: 0 to 8; needs tax_situation. | |
service_code | Service: LC 116 code, e.g. 1.07. | |
source | Set on creation only; manual by default. | |
tax_situation | Product: ICMS CST (2 digits) or CSOSN (3). | |
unit | UN, KG, CX... | |
unit_price | Price per unit in BRL. |
deactivate_item
Hide a catalog item; reactivate_item brings it back.
| Parameter | Type | Description |
|---|---|---|
item_id * | string | The item's id, from list_items. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
reactivate_item
Bring a deactivated item back into the company's catalog.
| Parameter | Type | Description |
|---|---|---|
item_id * | string | From list_items with inactive=true. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
explain_rejection
Explain why a rejected document was refused and what to change. get_invoice_submissions has the authority's reply as sent; this reads it for someone who does not speak SEFAZ: the code, the message verbatim, what it means, the steps to fix it, the field at fault and, when there is one, a suggested value. Quote the code and the message to the user; they are what they will search for. A suggested value is confirmed with the user before reissue_invoice, never applied on its own. transient means the authority was unavailable, not the data wrong. A document that is not rejected is refused (409). R…
| Parameter | Type | Description |
|---|---|---|
invoice_id * | string | The local id of the rejected invoice, as list_invoices returns it. A rejected document has no access key. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
classify_item
Suggest an NCM, CFOP, CST/CSOSN, CEST or service code for one item. A suggestion to confirm with the user — never issue on it blindly. Every code in a candidate was read from the published tables, but the NCM and the CFOP decide the tax owed, and a plausible wrong one is authorized by the SEFAZ and only caught at an audit. Show the primary candidate, its confidence and the alternatives, say it is a suggestion, and put a code on an item only after the user confirms it — whatever the confidence. lookup_fiscal_code can confirm one code against the table. When missing_information is not empt…
| Parameter | Type | Description |
|---|---|---|
description * | string | What the item is, as the user describes it, e.g. Cerveja artesanal IPA garrafa 500ml. |
document_type * | string | nfe for goods, nfse for a service. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
contains_alcohol | Only when missing_information asked for it. | |
operation_scope | Only when missing_information asked for it. | |
origin | Resold goods (CFOP x102) or own production (x101). Only when missing_information asked for it. | |
purpose | Whether the buyer resells it or consumes it. Only when missing_information asked for it. | |
recipient_state | The buyer's UF, e.g. SP. It decides intrastate (5xxx) or interstate (6xxx) CFOP. | |
service_city_code | IBGE code of the city where the service is provided. Only when missing_information asked for it. | |
tax_retained | Whether the ISS is retained by the buyer. Only when missing_information asked for it. |
list_webhooks
List where this company's events are delivered. One row per endpoint: its id (what delete_webhook takes), URL, events and whether it is active. Secrets are never returned. Needs webhook:manage. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
create_webhook
Register a URL to receive this company's document events. Every document authorized, rejected, cancelled or corrected, and every received NF-e first stored (received_invoice.stored) or whose full XML arrived (received_invoice.full_document), is then sent there, signed with the secret. Confirm the URL with the user before calling: it is where their fiscal data goes. The API refuses a URL that is not HTTPS or points at a private network. Needs webhook:manage. Calling it twice registers two endpoints, and each receives every event: list_webhooks first.
| Parameter | Type | Description |
|---|---|---|
secret * | string | 16 to 255 characters the user chose; every delivery is signed with it. It is never shown again, so do not repeat it back. |
url * | string | Where to deliver, an https:// URL the user gave. Never one you made up. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
events | Which events to send. Every one if omitted. |
delete_webhook
Stop delivering events to one endpoint. The user's integration stops hearing about new documents from that moment, so confirm which endpoint with them first. What was already delivered stays in list_webhook_deliveries. An id this company does not have is refused (404). Needs webhook:manage.
| Parameter | Type | Description |
|---|---|---|
webhook_id * | string | The endpoint's id, from list_webhooks. |
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
list_webhook_deliveries
Show every delivery attempt, newest first. The answer to "is my webhook receiving": each row has the event, its status, how many attempts, what the endpoint answered (response_status), the last error and when it was delivered or will be tried again. Needs webhook:manage. Read-only.
| Parameter | Type | Description |
|---|---|---|
company_id | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
company_tax_id | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
limit | integer | Rows per page, 1 to 100. |
offset | integer | Rows to skip, for the next page: offset + limit. |