{
    "openapi": "3.1.2",
    "info": {
        "title": "Bridge Fiscal - API (English)",
        "version": "1.0.0",
        "description": "<!-- Hash: 6486f78bf8412240c6e10e7c4027919d: 8e171bda1389bf6a88fbb32757b77fff | e3fe6d057f44794ab6098de4ada86d80: 4f6a086bc020299bc1605cd6b8ac1cde -->\n\n**Bridge Fiscal** REST API for issuing NFC-e (model 65) and NF-e (model 55).\n\n## Authentication\nEvery route requires a token in the `Authorization: Bearer <token>` header.\nThe token is provided by Bridge Fiscal support and belongs to your system (source system).\nKeep it on your **server**; never put it in apps installed on devices.\nTest the token with `GET \/v1\/me`.\n\n## Response format\nEvery response has the same envelope:\n\n```json\n{\n  \"data\": {},\n  \"amount\": 1,\n  \"error\": null,\n  \"message\": \"Emitente encontrado.\",\n  \"now\": \"2026-11-10T14:30:00-03:00\"\n}\n```\n\n- `error` is `null` on success. On failure, it is a fixed code for your system to handle (table below).\n- `message` is a text to show to the user, in the requested language (see **Response language**).\n- Lists are paginated (`?page=2&per_page=50`, maximum 100) and also include `links` and `meta`.\n\n## HTTP codes and errors\n| HTTP | `error` | When |\n|---|---|---|\n| 200 | `null` | Query, update or delete done |\n| 201 | `null` | Record created |\n| 401 | `unauthenticated` | Missing, invalid or revoked token |\n| 403 | `forbidden` | System disabled or no access |\n| 404 | `not_found` | Record or address not found |\n| 409 | `conflict` | Duplicate record |\n| 422 | `wrong_data` | Invalid field (see `errors` with every field) |\n| 422 | `business_rule` | Business rule not met |\n| 422 | `invalid_reference` | Related record does not exist |\n| 429 | `too_many_requests` | Requests-per-minute limit exceeded |\n| 500 | `internal_server_error` \/ `database_error` | Unexpected error |\n| 503 | `service_unavailable` | Maintenance or temporary unavailability |\n\nEvery error returns `reference`: give this code to support to locate what happened.\n\n## Response language\nMessages (`message`, `errors` and business rules) follow the standard **`Accept-Language`** header: `pt-BR` (default), `en` or `es`.\nWithout the header, or with an unsupported language, the response is in Portuguese. The language used comes back in the `Content-Language` header.\nThey do not change with the language: the `error` code, the JSON keys and the stored data (e.g. `displayname` of the lookup tables).\nIn English and Spanish, invalid fields are named by their JSON key (e.g. `legalname`, `items.0.ncm`).\n\n```http\nAccept-Language: en\n```\n\n## Dates\nUse **ISO 8601 with offset**, e.g. `2026-11-10T14:30:00-03:00`. Dates without an offset are read in Bras\u00edlia time.\nResponses always include the offset (`-03:00`).\n\n## Emission\n1. Register the issuer (`POST \/issuers`) and the emission configuration (`POST \/issuerconfigs`).\n2. Send the document (`POST \/fiscaldocuments`) with a unique `empotencykey` per sale.\n3. Emission is asynchronous: query `GET \/fiscaldocuments\/{id}` until the final status (Authorized, Rejected...).\n4. Sending the same `empotencykey` again does not duplicate the document: the API returns the one already received.\n5. When the document is authorized and `clientemail` is filled, the consumer receives the DANFE (NF-e) or the DANFE NFC-e (NFC-e), in PDF, and the XML by e-mail.\n6. The NFC-e recipient is optional. With a **CPF**, `clientdocument` is enough (plus `clientname`, if you wish). With a **CNPJ** the address is required (`clientstreet`, `clientneighborhood`, `clientmunicipalitycode`, `clientmunicipality`, `clientstate`): without it SEFAZ rejects the document with the misleading message \"recipient CNPJ not registered at Receita Federal\", and the API refuses the request before a number is reserved. The recipient CNPJ must also exist in the Receita Federal base and differ from the issuer's. For a CPF the address only goes on the document when complete; a partial address is ignored. The address is checked on input: `clientstate` is a valid UF (upper case), `clientpostalcode` has 8 digits, `clientphone` 6 to 14 digits, and street, neighborhood and municipality have at least 2 characters.\n\n## Rejected document\nA rejection (status `REJECTED`) is **final** for that document: SEFAZ refused the data and the Bridge Fiscal does not try again. The `REJECTED` webhook (or `GET \/fiscaldocuments\/{id}`) carries `errorcode`, `errormessage` (the SEFAZ message) and `errorhint`, the Bridge Fiscal guidance on what to fix.\n1. Fix the cause (document data, issuer registration, certificate, CSC...).\n2. Send the document again (`POST \/fiscaldocuments`) with a **new** `empotencykey` and `reissueof` = the `id` of the rejected document (the link shows as `reissuedfromid`): sending the same key only returns the rejected document. Each rejected document can be reissued only once.\n3. Do not resend in a loop without fixing it: every rejection consumes a number of the series. The Bridge Fiscal invalidates the number of rejected documents by itself (do not call `\/fiscalinvalidations` for them).\n4. `ERROR` is not a rejection: the Bridge Fiscal keeps trying by itself, just wait. Exceptions, which need a person and raise an alert to the merchant (`errorcode`): `CERTIFICATE` (the issuer's certificate is expired or invalid: once a valid certificate is uploaded the document is reprocessed by itself), `STALLED` (SEFAZ gave no conclusive answer by the end of the transmission window: check the key at the SEFAZ portal) and `SCHEMA` or `BUILD` (document data refused before sending: fix it and reissue).\nThe sale is already paid: never block the POS because of the emission. Reissue automatically on data errors and warn the merchant when the cause is registration, certificate or CSC.\n\n## Offline contingency (NFC-e)\nWhen SEFAZ does not answer, the Bridge Fiscal issues the NFC-e in offline contingency (`emissiontype` 9) by itself, with nothing to do on your side (Settings: automatic contingency on by default).\n- An NFC-e enters contingency when it arrives while the SEFAZ of its state is down, or when it is still without an answer a few minutes after being received (5 by default). The issue date (`dhEmi`) is when the sale reached the Bridge Fiscal.\n- The document becomes `CONTINGENCY` (webhook `CONTINGENCY`), already with a valid `accesskey` and `qrcode`, and is transmitted by itself when SEFAZ is back (legal deadline of 24 h). After that the normal flow follows: `AUTHORIZED` (webhook and e-mail to the consumer) or `REJECTED`.\n- If the normal attempt was sent without an answer, the sale gets a new number in contingency and the old attempt becomes a separate record with `replacedbyid` = the `id` of your document. It is neither billed nor notified: if SEFAZ authorized it, the Bridge Fiscal cancels it by substitution; otherwise its number is invalidated. These records are not listed (`GET \/fiscaldocuments`), only returned by `id`; always use the document of the `id` you received.\n- If SEFAZ rejects a document already issued in contingency, it becomes `ERROR` with `errorcode` `CONTINGENCY_<code>` (with an alert to the merchant): the consumer already has the DANFE NFC-e, so the number is not invalidated and the document cannot be reissued with another number. Correct the data and retransmit with `POST \/fiscaldocuments\/{id}\/retransmit` (recipient `client...` fields and\/or `items` with `sequence` and `ncm`): the document keeps its number, series and key.\n## NF-e (model 55)\nUse a model 55 configuration. In addition to the NFC-e rules:\n- **Required recipient**: `clientdocument`, `clientname`, `clientieindicator` (1 taxpayer, with `clientstateregistration`; 2 exempt; 9 non-taxpayer) and the full address (`clientstreet`, `clientneighborhood`, `clientmunicipalitycode`, `clientmunicipality`, `clientstate`).\n- **Destination**: `destinationindicator` 1 when the recipient is in the same state as the issuer, 2 when in another state. The CFOP of every item follows the destination and the direction: outgoing 5xxx\/6xxx, incoming 1xxx\/2xxx.\n- **Accepted purposes**: 1 (normal) and 4 (return). The return carries the access key of the returned invoice in `references` and a single payment `paymenttype` 90 with `paid` 0.\n- **Amounts**: the total is the sum of the item subtotals + other expenses + freight + insurance + IPI + ICMS ST + FCP ST + returned IPI; `otherexpensestotal`, `freighttotal`, `insurancetotal`, `ipitotal`, `icmssttotal`, `fcpsttotal` and `ipireturntotal` are the sum of the item fields. Optional transport: carrier, vehicle and volumes.\n- **Optional per-item taxes** (fill only what the operation requires; the Bridge Fiscal does not calculate taxes, it only checks and sends them): ICMS ST (`icmsstbasemode`, `icmsstmva`, `icmsstreduction`, `icmsstbase`, `icmsstrate`, `icmsstvalue`) and FCP ST (`fcpst*`) for CST 10, 30, 70 and CSOSN 201, 202, 203; previously retained ICMS (`icmsstret*`, `fcpstret*`) for CST 60 and CSOSN 500; Simples Nacional credit (`sncreditrate`, `sncreditvalue`) for CSOSN 101 and 201; tax relief (`icmsdesonvalue` and `icmsdesonreason`); returned IPI (`ipireturnrate`, `ipireturnvalue`); and the **DIFAL** (`difalbase`, `difalrate`, `difalinterrate` 4, 7 or 12, `difalvalue`...), required for an interstate sale to a non-taxpayer final consumer.\n- **Accepted ICMS**: CSOSN 101, 102, 103, 201, 202, 203, 300, 400, 500, 900 (Simples Nacional) or CST 00, 10, 20, 30, 40, 41, 50, 60, 70, 90 (normal regime).\n- **Not accepted yet**: export, credit sale (installments) (duplicatas), supplementary and adjustment purposes.\n\n## IBS\/CBS (tax reform)\nThe IBS\/CBS group of the invoice is optional and **off by default**: the emission configuration (`POST\/PATCH \/issuerconfigs`) has `ibscbsmode` 0 (does not send; the API refuses IBS\/CBS data so it is not silently discarded), 1 (sends when the item provides it) or 2 (required on every item). Turn it on first in homologation and confirm with the accountant who is required in each phase (Simples Nacional and MEI are exempt in 2026).\n- Per item: `ibscbscst` (000 taxed, 200 reduced rate, 410 exempt\/immune\/not taxed), `ibscbsclass` (6 digits, starting with the CST), `ibscbsbase`, and per level the rate and amount: `ibsstaterate`\/`ibsstatevalue`, `ibsmunicipalrate`\/`ibsmunicipalvalue`, `cbsrate`\/`cbsvalue`. In CST 200 also send the reduction and the effective rate (`ibsstatereduction`, `ibsstateeffectiverate`, `ibsmunicipalreduction`, `ibsmunicipaleffectiverate`, `cbsreduction`, `cbseffectiverate`). CST 410 carries no amounts.\n- The Bridge Fiscal does not calculate IBS\/CBS: it checks that amount = base \u00d7 rate (1 cent tolerance) and sends it. In 2026 the IBS\/CBS does not enter the invoice total. In notes authorized in production (SP, April 2026, regular regime) the base was the item amount after discount minus PIS, COFINS and ICMS, with state IBS 0.1% and CBS 0.9% in 2026; confirm the current rule with your accountant.\n- Other CSTs (deferral, single-phase, presumed credit, Selective Tax) are not accepted yet.\n\n## Cancellation and correction letter\nRequests (`POST \/fiscaldocuments\/{id}\/cancel` and `\/correction`) are asynchronous: the event starts Pending and is transmitted to SEFAZ shortly after. Follow it with `GET \/fiscaldocuments\/{id}\/events` (status Registered, Rejected or Error, with the protocol and the reason). Once the cancellation is registered the document becomes Cancelled, the DANFE (NF-e) or DANFE NFC-e (NFC-e) is generated again with the cancelled mark and the `CANCELLED` webhook is sent. The correction letter (NF-e only, up to 20 per document) does not change the document status: the `CORRECTED` webhook is sent and the recipient receives the correction letter PDF (DAEVENTO) and the event XML by e-mail. A rejected cancellation or correction letter (for example, outside the SEFAZ deadline) sends the `CANCEL_REJECTED` and `CORRECTION_REJECTED` webhooks, and the cancellation can be requested again.\n\n## Webhooks\nInstead of polling the status, register a webhook in the panel (Integra\u00e7\u00f5es): for the system, a customer or a store. The most specific one applies (store, then customer, then system), and only the chosen events are sent (`AUTHORIZED`, `REJECTED`, `DENIED`, `CANCELLED`, `CONTINGENCY`, `ERROR` and the cancellation and correction letter results: `CANCEL_REJECTED`, `CORRECTION_REJECTED` and `CORRECTED`).\n- The URL must be HTTPS and point to a public internet address (internal or local network addresses are refused), and redirects are not followed. The webhook is optional: without it, query `GET \/fiscaldocuments\/{id}`.\n- `POST` to your HTTPS URL with the JSON `{\"event\", \"delivery\", \"sent_at\", \"document\"}`. `document` has the same format as `GET \/fiscaldocuments\/{id}` and `delivery` identifies the delivery. In the cancellation and correction letter events (`CANCELLED`, `CANCEL_REJECTED`, `CORRECTED`, `CORRECTION_REJECTED`) the JSON also carries `fiscalevent`, in the format of `GET \/fiscaldocuments\/{id}\/events`; handle repeated deliveries by `document.id`, `event` and `fiscalevent.id`.\n- Headers: `X-BridgeFiscal-Event`, `X-BridgeFiscal-Timestamp` (Unix) and `X-BridgeFiscal-Signature: sha256=<hex>`, the HMAC-SHA256 of `<timestamp>.<body>` with the secret shown at registration. Check the signature and refuse timestamps older than 5 minutes.\n- Answer with HTTP 2xx within 10 seconds. Without 2xx, it is retried after 1, 5, 15 and 60 minutes. Handle repeated deliveries by `document.id` and `event`.\n\n<!-- Hash: a1acd94f9aa84f55e775a45efebc9cc2: 6db3a0d37641ce96c2ccd86fd5c24af0 | bac953e88f6d79514b0b6fc42eb6f3b7: 43a6da8ce435f585b4e067c2b153bc99 -->\n"
    },
    "servers": [
        {
            "url": "https:\/\/api.bridgefiscal.com.br\/v1"
        }
    ],
    "security": [
        {
            "http": []
        }
    ],
    "paths": {
        "\/me": {
            "get": {
                "operationId": "me",
                "description": "Returns the source system that owns the token. Use it to test the integration.",
                "summary": "Authenticated source system",
                "tags": [
                    "Authentication"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/plans": {
            "get": {
                "operationId": "plans.index",
                "description": "Plan versions with monthly fee, document franchise and overage fee. By default only the versions that can be\ncontracted today (current=1; current=0 lists every version). These are the prices paid by your system: do not show them to your customers.",
                "summary": "List plans",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "storesizeid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "environment",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "current",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/plans\/{id}": {
            "get": {
                "operationId": "plans.show",
                "summary": "Show a plan",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/subscriptions": {
            "get": {
                "operationId": "subscriptions.index",
                "description": "Subscriptions of the issuers paid by your system. running=1 keeps only the ones in force today or scheduled.",
                "summary": "List subscriptions",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "issuerid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "document",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 14
                        }
                    },
                    {
                        "name": "running",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "environment",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "subscriptions.store",
                "description": "Starts today (issuer local time) or on a future startdate. The cycle is monthly from the start date and prepaid:\nthe first monthly fee goes to an invoice of your billing account right away. Price, franchise and overage fee\nare locked for the life of the subscription.",
                "summary": "Subscribe an issuer to a plan",
                "tags": [
                    "Billing"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/FiscalSubscriptionRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/subscriptions\/{id}": {
            "get": {
                "operationId": "subscriptions.show",
                "summary": "Show a subscription",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/subscriptions\/{id}\/usage": {
            "get": {
                "operationId": "subscriptions.usage",
                "description": "Current period by default (or periodid): franchise, billable and overage documents, projection to the end of\nthe period, not billed documents by status (reports only), invalidations, events and, when another plan would\ncost less for the projected volume, the suggested plan. Use it to decide on upgrades with your customers.",
                "summary": "Consumption of a subscription",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "periodid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "subscriptionid": {
                                                    "type": "integer"
                                                },
                                                "issuerid": {
                                                    "type": "integer"
                                                },
                                                "document": {
                                                    "type": "string"
                                                },
                                                "branchid": {
                                                    "type": "integer"
                                                },
                                                "fiscalplanid": {
                                                    "type": "integer"
                                                },
                                                "plan": {
                                                    "type": "string"
                                                },
                                                "period": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "string"
                                                        },
                                                        "periodstart": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "periodend": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "closed": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "periodstart",
                                                        "periodend",
                                                        "closed"
                                                    ]
                                                },
                                                "monthlyfee": {
                                                    "type": "number"
                                                },
                                                "overagefee": {
                                                    "type": "number"
                                                },
                                                "includeddocuments": {
                                                    "type": "integer"
                                                },
                                                "billabledocuments": {
                                                    "type": "integer"
                                                },
                                                "overagedocuments": {
                                                    "type": "integer"
                                                },
                                                "remainingdocuments": {},
                                                "usedpercent": {
                                                    "type": "number"
                                                },
                                                "overageamount": {
                                                    "type": "number"
                                                },
                                                "projecteddocuments": {
                                                    "type": "integer"
                                                },
                                                "projectedoverage": {},
                                                "notbilled": {
                                                    "type": "string"
                                                },
                                                "invalidations": {
                                                    "type": "integer"
                                                },
                                                "events": {
                                                    "type": "integer"
                                                },
                                                "suggestedplan": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "fiscalplanid": {
                                                            "type": "string"
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "displayname": {
                                                            "type": "string"
                                                        },
                                                        "monthlyfee": {
                                                            "type": "number"
                                                        },
                                                        "includeddocuments": {
                                                            "type": "string"
                                                        },
                                                        "overagefee": {
                                                            "type": "number"
                                                        },
                                                        "estimatedcost": {
                                                            "type": [
                                                                "number",
                                                                "string"
                                                            ]
                                                        },
                                                        "currentcost": {
                                                            "type": [
                                                                "number",
                                                                "string"
                                                            ]
                                                        },
                                                        "saving": {
                                                            "type": [
                                                                "number",
                                                                "string"
                                                            ]
                                                        }
                                                    },
                                                    "required": [
                                                        "fiscalplanid",
                                                        "name",
                                                        "displayname",
                                                        "monthlyfee",
                                                        "includeddocuments",
                                                        "overagefee",
                                                        "estimatedcost",
                                                        "currentcost",
                                                        "saving"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "subscriptionid",
                                                "issuerid",
                                                "document",
                                                "branchid",
                                                "fiscalplanid",
                                                "plan",
                                                "period",
                                                "monthlyfee",
                                                "overagefee",
                                                "includeddocuments",
                                                "billabledocuments",
                                                "overagedocuments",
                                                "remainingdocuments",
                                                "usedpercent",
                                                "overageamount",
                                                "projecteddocuments",
                                                "projectedoverage",
                                                "notbilled",
                                                "invalidations",
                                                "events",
                                                "suggestedplan"
                                            ]
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Consumo encontrado."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/usage": {
            "get": {
                "operationId": "usage.index",
                "description": "Current consumption of every subscription in force for the CNPJ (one per store\/branch of the CNPJ).",
                "summary": "Consumption by CNPJ",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "maxLength": 14
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            }
                                        },
                                        "amount": {
                                            "type": "integer"
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Consumo encontrado."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/invoices": {
            "get": {
                "operationId": "invoices.index",
                "description": "Invoices of your billing account. status: OPEN, OVERDUE, PAID or CANCELLED. duedatefrom\/duedateto filter the due date.",
                "summary": "List invoices",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "OPEN",
                                "OVERDUE",
                                "PAID",
                                "CANCELLED"
                            ]
                        }
                    },
                    {
                        "name": "duedatefrom",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "duedateto",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "environment",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/invoices\/{id}": {
            "get": {
                "operationId": "invoices.show",
                "description": "With its items: CNPJ, reason (PLAN_FEE, OVERAGE, PRORATA, ADJUSTMENT, DISCOUNT), period, quantity and amounts.",
                "summary": "Show an invoice",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/subscriptions\/{id}\/changeplan": {
            "post": {
                "operationId": "subscriptions.changeplan",
                "description": "Upgrade (higher monthly fee): from tomorrow; the fee difference for the remaining days of the cycle is charged\non the next invoice (PRORATA item). Downgrade: from the next cycle, without credit. A new subscription is created\nwith the same billing day; the current one gets its end date.",
                "summary": "Change the plan",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/ChangePlanRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "subscription": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "effectivedate": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "prorata": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "days": {
                                                            "type": "integer"
                                                        },
                                                        "cycledays": {
                                                            "type": "integer"
                                                        },
                                                        "dailyamount": {
                                                            "type": "number"
                                                        },
                                                        "amount": {
                                                            "type": "number"
                                                        },
                                                        "duedate": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "days",
                                                        "cycledays",
                                                        "dailyamount",
                                                        "amount",
                                                        "duedate"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "subscription",
                                                "effectivedate",
                                                "prorata"
                                            ]
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "enum": [
                                                "Plano alterado a partir de amanh\u00e3. A diferen\u00e7a proporcional vai na pr\u00f3xima fatura.",
                                                "Troca de plano agendada para o pr\u00f3ximo ciclo."
                                            ]
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/subscriptions\/{id}\/cancel": {
            "post": {
                "operationId": "subscriptions.cancel",
                "description": "The subscription ends on the last day of the current cycle, already paid (no refund). On a scheduled subscription\n(a downgrade that has not started yet) it undoes the plan change: the current subscription goes on.",
                "summary": "Cancel a subscription",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/subscriptions\/{id}\/resume": {
            "post": {
                "operationId": "subscriptions.resume",
                "description": "Undoes a cancellation while the paid cycle has not ended: the subscription goes on with the same plan, price and\nbilling day. Use it when your customer contracts the service again before the end of the cycle.",
                "summary": "Resume a cancelled subscription",
                "tags": [
                    "Billing"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/issuerconfigs": {
            "get": {
                "operationId": "issuerconfigs.index",
                "description": "Each configuration is a PDV: CNPJ x model x series x environment, with its own numbering.",
                "summary": "List emission configurations",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "issuerid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "machineid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "model",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "55",
                                "65"
                            ]
                        }
                    },
                    {
                        "name": "environment",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "issuerconfigs.store",
                "description": "model, series, environment and sequence (next number, default 1) cannot be changed later.\nTo continue the numbering of another emitter, send in sequence the next number to be used.\nThe issuer must have a valid digital certificate (sent to issuers\/{id}\/certificate) before this step.\nThe CSC belongs to the CNPJ and the environment: a new NFC-e (65) configuration inherits the CSC already registered in\nanother configuration of the same CNPJ, environment and source system (only at creation; a CSC removed later stays\nremoved). To change it, use issuerconfigs\/{id}\/csc.",
                "summary": "Create an emission configuration",
                "tags": [
                    "Emission configurations"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerConfigRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/issuerconfigs\/{id}": {
            "get": {
                "operationId": "issuerconfigs.show",
                "summary": "Show an emission configuration",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "put": {
                "operationId": "issuerconfigs.update",
                "description": "Partial update. Changing issuerid is accepted only for an issuer with the same CNPJ (e.g. POS terminal replacement).",
                "summary": "Update an emission configuration",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerConfigRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            },
            "delete": {
                "operationId": "issuerconfigs.destroy",
                "description": "Soft delete (active = false). The numbering is kept and cannot be reused.",
                "summary": "Delete an emission configuration",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/issuerconfigs\/{id}\/csc": {
            "post": {
                "operationId": "issuerconfigs.csc.store",
                "description": "Sets the CSC (identifier and token) of an NFC-e configuration (model 65). The token is never returned:\nthe configuration shows only cscconfigured = true. Use the homologation CSC for homologation configurations.",
                "summary": "Set the CSC",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerConfigCscRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            },
            "delete": {
                "operationId": "issuerconfigs.csc.destroy",
                "description": "Removes the CSC of the configuration. NFC-e emission stops until a new CSC is set.",
                "summary": "Delete the CSC",
                "tags": [
                    "Emission configurations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscalerrorlogs": {
            "post": {
                "operationId": "fiscalerrorlogs.store",
                "description": "Lets the client app record an error that happened on the device (origin \"app\").\nReturns the reference code to give to support. Works even while the API is in maintenance mode.",
                "summary": "Report an app error",
                "tags": [
                    "Error log"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/FiscalErrorLogRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "reference": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "reference"
                                            ]
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Erro registrado."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/fiscaldocuments": {
            "get": {
                "operationId": "fiscaldocuments.index",
                "description": "Paginated list (newest first). Filter dates in ISO 8601, e.g. 2026-11-10T00:00:00-03:00.",
                "summary": "List fiscal documents",
                "tags": [
                    "Fiscal documents"
                ],
                "parameters": [
                    {
                        "name": "issuerid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "issuerconfigid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "fiscalstatusid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "cartid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "empotencykey",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "accesskey",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "minLength": 44,
                            "maxLength": 44
                        }
                    },
                    {
                        "name": "documentnumber",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "format": "date-time"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "fiscaldocuments.store",
                "description": "Receives the whole document (header, items, payments and references) and queues it for emission\nwith status Pending. Emission is asynchronous: query the document to follow its status.\nIdempotency: sending the same empotencykey again returns the document already received (200), never a duplicate.",
                "summary": "Send a fiscal document for emission",
                "tags": [
                    "Fiscal documents"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/FiscalDocumentRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscaldocuments\/{id}": {
            "get": {
                "operationId": "fiscaldocuments.show",
                "description": "Returns the document with status, items, payments, referenced documents and events.",
                "summary": "Show a fiscal document",
                "tags": [
                    "Fiscal documents"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscaldocuments\/{id}\/retransmit": {
            "post": {
                "operationId": "fiscaldocuments.retransmit",
                "description": "Only for an NFC-e issued in offline contingency that SEFAZ rejected (status ERROR, errorcode CONTINGENCY_<code>). The\nconsumer already holds its DANFE NFC-e, so the document keeps its number, series and key. Send the recipient fields\n(client...) and\/or items with sequence and ncm to correct; the document is rebuilt and transmitted again.",
                "summary": "Correct and retransmit an NFC-e issued in contingency and rejected",
                "tags": [
                    "Fiscal documents"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/RetransmitRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/fiscaldocuments\/{id}\/events": {
            "get": {
                "operationId": "fiscalevents.index",
                "summary": "List the events of a document",
                "tags": [
                    "Fiscal events"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscaldocuments\/{id}\/cancel": {
            "post": {
                "operationId": "fiscalevents.cancel",
                "description": "Authorized documents only, within the cancellation deadline after the authorization (by default 30 minutes for\nNFC-e and 24 hours for NF-e). Send substituteaccesskey (another NFC-e of the same issuer) for a cancellation by\nsubstitution (NFC-e only).",
                "summary": "Cancel a fiscal document",
                "tags": [
                    "Fiscal events"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CancelRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/fiscaldocuments\/{id}\/correction": {
            "post": {
                "operationId": "fiscalevents.correction",
                "description": "Authorized NF-e (model 55) only. Up to 20 corrections per document; the last one replaces the previous ones.",
                "summary": "Send a correction letter (CC-e)",
                "tags": [
                    "Fiscal events"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/CorrectionLetterRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/issuerconfigs\/{id}\/invalidations": {
            "get": {
                "operationId": "invalidations.index",
                "summary": "List the invalidations of an emission configuration",
                "tags": [
                    "Invalidations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "invalidations.store",
                "description": "Invalidates a range of numbers that will not be used (e.g. rejected or skipped). Transmission to SEFAZ is asynchronous.",
                "summary": "Request a number range invalidation",
                "tags": [
                    "Invalidations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/FiscalInvalidationRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/invalidations\/{id}": {
            "get": {
                "operationId": "invalidations.show",
                "summary": "Show an invalidation",
                "tags": [
                    "Invalidations"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/issuers": {
            "get": {
                "operationId": "issuers.index",
                "description": "Paginated list of the issuers of the authenticated source system.",
                "summary": "List issuers",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "document",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 14
                        }
                    },
                    {
                        "name": "branchid",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "branchnickname",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 60
                        }
                    },
                    {
                        "name": "branchnumber",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "active",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "issuers.store",
                "description": "The CNPJ (document) cannot be changed later. The digital certificate is sent through its own endpoint.",
                "summary": "Create an issuer",
                "tags": [
                    "Issuers"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        },
        "\/issuers\/{id}": {
            "get": {
                "operationId": "issuers.show",
                "summary": "Show an issuer",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "put": {
                "operationId": "issuers.update",
                "description": "Partial update: send only the fields that changed.",
                "summary": "Update an issuer",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            },
            "delete": {
                "operationId": "issuers.destroy",
                "description": "Soft delete (active = false). The fiscal history is kept.",
                "summary": "Delete an issuer",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/issuers\/{id}\/certificate": {
            "get": {
                "operationId": "issuers.certificate.show",
                "description": "Public data of the A1 certificate in use (holder, CNPJ, validity). The file and the password are never returned.",
                "summary": "Show the issuer certificate",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "companyname": {
                                                    "type": "string"
                                                },
                                                "document": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "validfrom": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "validuntil": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expired": {
                                                    "type": "boolean"
                                                },
                                                "daysleft": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "companyname",
                                                "document",
                                                "validfrom",
                                                "validuntil",
                                                "expired",
                                                "daysleft"
                                            ]
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Certificado encontrado."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "post": {
                "operationId": "issuers.certificate.store",
                "description": "Send the A1 certificate (.pfx or .p12) and its password as multipart\/form-data. It replaces the current certificate.\nThe certificate must be an e-CNPJ of the same company (same CNPJ root) and must not be expired.",
                "summary": "Upload the issuer certificate",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart\/form-data": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/IssuerCertificateRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "companyname": {
                                                    "type": "string"
                                                },
                                                "document": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "validfrom": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "validuntil": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "expired": {
                                                    "type": "boolean"
                                                },
                                                "daysleft": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "companyname",
                                                "document",
                                                "validfrom",
                                                "validuntil",
                                                "expired",
                                                "daysleft"
                                            ]
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Certificado cadastrado."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            },
            "delete": {
                "operationId": "issuers.certificate.destroy",
                "description": "Removes the certificate and its password. The issuer can no longer issue documents until a new one is sent.",
                "summary": "Delete the issuer certificate",
                "tags": [
                    "Issuers"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "null"
                                        },
                                        "amount": {
                                            "type": "integer",
                                            "enum": [
                                                0,
                                                1
                                            ]
                                        },
                                        "error": {
                                            "type": "null"
                                        },
                                        "message": {
                                            "type": "string",
                                            "const": "Certificado exclu\u00eddo."
                                        },
                                        "now": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "data",
                                        "amount",
                                        "error",
                                        "message",
                                        "now"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscalstatuses": {
            "get": {
                "operationId": "fiscalstatuses.index",
                "description": "Returns the active records. 'name' is the fixed code to use in integrations; 'displayname' is the text to show users.",
                "summary": "List fiscal statuses",
                "tags": [
                    "Lookups"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/fiscalstatuses\/{id}": {
            "get": {
                "operationId": "fiscalstatuses.show",
                "summary": "Show a fiscal status",
                "tags": [
                    "Lookups"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/sefazpaymenttypes": {
            "get": {
                "operationId": "sefazpaymenttypes.index",
                "description": "Official SEFAZ table of payment means (tPag). Send 'code' in payments[].paymenttype. Codes with acceptedbyapi = false\nstay in the table for reference but are refused by this API: a document received always means a paid sale.",
                "summary": "List the SEFAZ payment means",
                "tags": [
                    "Lookups"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/sefazpaymenttypes\/{id}": {
            "get": {
                "operationId": "sefazpaymenttypes.show",
                "summary": "Show a SEFAZ payment means",
                "tags": [
                    "Lookups"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/eventtypes": {
            "get": {
                "operationId": "eventtypes.index",
                "description": "Returns the active records. 'name' is the fixed code to use in integrations; 'displayname' is the text to show users.",
                "summary": "List event types",
                "tags": [
                    "Lookups"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/eventtypes\/{id}": {
            "get": {
                "operationId": "eventtypes.show",
                "summary": "Show an event type",
                "tags": [
                    "Lookups"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/eventstatuses": {
            "get": {
                "operationId": "eventstatuses.index",
                "description": "Returns the active records. 'name' is the fixed code to use in integrations; 'displayname' is the text to show users.",
                "summary": "List event statuses",
                "tags": [
                    "Lookups"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/eventstatuses\/{id}": {
            "get": {
                "operationId": "eventstatuses.show",
                "summary": "Show an event status",
                "tags": [
                    "Lookups"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/storesizes": {
            "get": {
                "operationId": "storesizes.index",
                "description": "Store size classes used by the plans: MINIMARKET, NEIGHBORHOOD, SUPERMARKET and WAREHOUSE.",
                "summary": "List store sizes",
                "tags": [
                    "Lookups"
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/users": {
            "get": {
                "operationId": "users.index",
                "description": "Paginated list of the panel users synchronized by the authenticated source system, with their roles in force.",
                "summary": "List users",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "externalid",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 100
                        }
                    },
                    {
                        "name": "email",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "maxLength": 190
                        }
                    },
                    {
                        "name": "activated",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            }
        },
        "\/users\/{externalid}": {
            "get": {
                "operationId": "users.show",
                "description": "Searched by the user identifier in the source system (externalid).",
                "summary": "Show a user",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "externalid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "`JsonResource`",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#\/components\/schemas\/JsonResource"
                                        }
                                    },
                                    "required": [
                                        "data"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    }
                }
            },
            "put": {
                "operationId": "users.upsert",
                "description": "Upsert by the user identifier in the source system (externalid): the same request creates the user or updates it.\nName, login and password stay maintained by the source system (they cannot be changed in the panel).\n\n- `password`: SHA-512 (hexadecimal) of the password, never the password itself. Omit it to keep the current one.\n- `activated: false` disables the user and revokes all of its roles. Enabling it again restores only the login:\n  the roles must be sent again.\n- `roles`: when sent (even empty), replaces all the roles of the user. Each role has one scope: `SYSTEM_ADMIN`\n  without scope (the whole source system); `ADMIN`, `OPERATOR` or `VIEWER` with a customer (`usersid`, all of its\n  stores) or a store (`issuerid`, an issuer of this source system).",
                "summary": "Create or update a user",
                "tags": [
                    "Users"
                ],
                "parameters": [
                    {
                        "name": "externalid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application\/json": {
                            "schema": {
                                "$ref": "#\/components\/schemas\/UserSyncRequest"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#\/components\/responses\/AuthenticationException"
                    },
                    "422": {
                        "$ref": "#\/components\/responses\/ValidationException"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "http": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "CancelRequest": {
                "type": "object",
                "properties": {
                    "justification": {
                        "type": "string",
                        "minLength": 15,
                        "maxLength": 255
                    },
                    "substituteaccesskey": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[0-9]{44}$"
                    }
                },
                "required": [
                    "justification"
                ],
                "title": "CancelRequest"
            },
            "ChangePlanRequest": {
                "type": "object",
                "properties": {
                    "fiscalplanid": {
                        "type": "integer",
                        "minimum": 1
                    }
                },
                "required": [
                    "fiscalplanid"
                ],
                "title": "ChangePlanRequest"
            },
            "CorrectionLetterRequest": {
                "type": "object",
                "properties": {
                    "correction": {
                        "type": "string",
                        "minLength": 15,
                        "maxLength": 1000
                    }
                },
                "required": [
                    "correction"
                ],
                "title": "CorrectionLetterRequest"
            },
            "FiscalDocumentRequest": {
                "type": "object",
                "properties": {
                    "issuerconfigid": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "empotencykey": {
                        "type": "string",
                        "maxLength": 100
                    },
                    "reissueof": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "usersid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "cartid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "nature": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "purpose": {
                        "type": "integer",
                        "enum": [
                            "1",
                            "2",
                            "3",
                            "4"
                        ]
                    },
                    "finalconsumer": {
                        "type": "boolean"
                    },
                    "presenceindicator": {
                        "type": "integer",
                        "enum": [
                            "0",
                            "1",
                            "2",
                            "3",
                            "4",
                            "5",
                            "9"
                        ]
                    },
                    "destinationindicator": {
                        "type": "integer",
                        "enum": [
                            "1",
                            "2",
                            "3"
                        ]
                    },
                    "intermediaryindicator": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "enum": [
                            "0",
                            "1",
                            null
                        ]
                    },
                    "intermediarydocument": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Z0-9]{12}[0-9]{2}$"
                    },
                    "intermediaryid": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "additionalinfo": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 5000
                    },
                    "clientidentified": {
                        "type": "boolean"
                    },
                    "clientdocument": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^([0-9]{11}|[A-Z0-9]{12}[0-9]{2})$"
                    },
                    "clientname": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientstateregistration": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30
                    },
                    "clientieindicator": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "enum": [
                            "1",
                            "2",
                            "9",
                            null
                        ]
                    },
                    "clientemail": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 255
                    },
                    "clientphone": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\D*(\\d\\D*){6,14}$",
                        "maxLength": 14
                    },
                    "clientpostalcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\D*(\\d\\D*){8}$"
                    },
                    "clientstreet": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientnumber": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientcomplement": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientneighborhood": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientmunicipalitycode": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "clientmunicipality": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientstate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "AC",
                            "AL",
                            "AP",
                            "AM",
                            "BA",
                            "CE",
                            "DF",
                            "ES",
                            "GO",
                            "MA",
                            "MT",
                            "MS",
                            "MG",
                            "PA",
                            "PB",
                            "PR",
                            "PE",
                            "PI",
                            "RJ",
                            "RN",
                            "RS",
                            "RO",
                            "RR",
                            "SC",
                            "SP",
                            "SE",
                            "TO",
                            null
                        ]
                    },
                    "freightmode": {
                        "type": "integer",
                        "enum": [
                            "0",
                            "1",
                            "2",
                            "3",
                            "4",
                            "9"
                        ]
                    },
                    "carrierdocument": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^([0-9]{11}|[A-Z0-9]{12}[0-9]{2})$"
                    },
                    "carriername": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "carrierstateregistration": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30
                    },
                    "carrieraddress": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "carriermunicipality": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "carrierstate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "vehicleplate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 7
                    },
                    "vehiclestate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "volumequantity": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 0
                    },
                    "volumespecies": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "netweight": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "grossweight": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "productstotal": {
                        "type": "number"
                    },
                    "discounttotal": {
                        "type": "number"
                    },
                    "otherexpensestotal": {
                        "type": "number"
                    },
                    "freighttotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "insurancetotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "icmssttotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "ipitotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "fcpsttotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "ipireturntotal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "total": {
                        "type": "number"
                    },
                    "changeamount": {
                        "type": "number"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "sequence": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 990
                                },
                                "branchproductid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "productid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "measureunitid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "internalcode": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 60
                                },
                                "ean": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 14
                                },
                                "description": {
                                    "type": "string",
                                    "maxLength": 120
                                },
                                "ncm": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 10
                                },
                                "origin": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 8
                                },
                                "cest": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "cfop": {
                                    "type": "string"
                                },
                                "taxbenefitcode": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 10
                                },
                                "unit": {
                                    "type": "string",
                                    "maxLength": 6
                                },
                                "quantity": {
                                    "type": "number"
                                },
                                "price": {
                                    "type": "number"
                                },
                                "finalprice": {
                                    "type": "number"
                                },
                                "discount": {
                                    "type": "number"
                                },
                                "subtotal": {
                                    "type": "number"
                                },
                                "freight": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "insurance": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "taxean": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 14
                                },
                                "taxunit": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 6
                                },
                                "taxquantity": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "taxprice": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "icmscst": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 3
                                },
                                "icmsbasemode": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 3
                                },
                                "piscst": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 2
                                },
                                "cofinscst": {
                                    "type": "string",
                                    "minLength": 2,
                                    "maxLength": 2
                                },
                                "ipicst": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "minLength": 2,
                                    "maxLength": 2
                                },
                                "ipiframework": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "minLength": 3,
                                    "maxLength": 3
                                },
                                "ipibase": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "ipirate": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "ipivalue": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "ibscbscst": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "minLength": 3,
                                    "maxLength": 3
                                },
                                "ibscbsclass": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "minLength": 6,
                                    "maxLength": 6
                                },
                                "icmsstbasemode": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 0,
                                    "maximum": 5
                                },
                                "icmsdesonreason": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "enum": [
                                        "1",
                                        "3",
                                        "4",
                                        "5",
                                        "6",
                                        "7",
                                        "8",
                                        "9",
                                        "10",
                                        "11",
                                        "12",
                                        "16",
                                        "90",
                                        "99",
                                        null
                                    ]
                                },
                                "ipireturnrate": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "ipireturnvalue": {
                                    "type": [
                                        "number",
                                        "null"
                                    ]
                                },
                                "otherexpenses": {
                                    "type": "number"
                                },
                                "icmsbase": {
                                    "type": "number"
                                },
                                "icmsvalue": {
                                    "type": "number"
                                },
                                "fcpvalue": {
                                    "type": "number"
                                },
                                "icmsstbase": {
                                    "type": "number"
                                },
                                "icmsstvalue": {
                                    "type": "number"
                                },
                                "icmsstretbase": {
                                    "type": "number"
                                },
                                "icmssubstitutevalue": {
                                    "type": "number"
                                },
                                "icmsstretvalue": {
                                    "type": "number"
                                },
                                "pisbase": {
                                    "type": "number"
                                },
                                "pisvalue": {
                                    "type": "number"
                                },
                                "cofinsbase": {
                                    "type": "number"
                                },
                                "cofinsvalue": {
                                    "type": "number"
                                },
                                "ibscbsbase": {
                                    "type": "number"
                                },
                                "ibsstatevalue": {
                                    "type": "number"
                                },
                                "ibsmunicipalvalue": {
                                    "type": "number"
                                },
                                "cbsvalue": {
                                    "type": "number"
                                },
                                "approximatetax": {
                                    "type": "number"
                                },
                                "fcpstbase": {
                                    "type": "number"
                                },
                                "fcpstvalue": {
                                    "type": "number"
                                },
                                "icmsdesonvalue": {
                                    "type": "number"
                                },
                                "fcpstretbase": {
                                    "type": "number"
                                },
                                "fcpstretvalue": {
                                    "type": "number"
                                },
                                "sncreditvalue": {
                                    "type": "number"
                                },
                                "difalbase": {
                                    "type": "number"
                                },
                                "difalfcpbase": {
                                    "type": "number"
                                },
                                "difalfcpvalue": {
                                    "type": "number"
                                },
                                "difalvalue": {
                                    "type": "number"
                                },
                                "icmsreduction": {
                                    "type": "number"
                                },
                                "icmsrate": {
                                    "type": "number"
                                },
                                "fcprate": {
                                    "type": "number"
                                },
                                "icmsstmva": {
                                    "type": "number"
                                },
                                "icmsstrate": {
                                    "type": "number"
                                },
                                "icmsstretrate": {
                                    "type": "number"
                                },
                                "pisrate": {
                                    "type": "number"
                                },
                                "cofinsrate": {
                                    "type": "number"
                                },
                                "ibsstaterate": {
                                    "type": "number"
                                },
                                "ibsmunicipalrate": {
                                    "type": "number"
                                },
                                "cbsrate": {
                                    "type": "number"
                                },
                                "ibsstatereduction": {
                                    "type": "number"
                                },
                                "ibsstateeffectiverate": {
                                    "type": "number"
                                },
                                "ibsmunicipalreduction": {
                                    "type": "number"
                                },
                                "ibsmunicipaleffectiverate": {
                                    "type": "number"
                                },
                                "cbsreduction": {
                                    "type": "number"
                                },
                                "cbseffectiverate": {
                                    "type": "number"
                                },
                                "icmsstreduction": {
                                    "type": "number"
                                },
                                "fcpstrate": {
                                    "type": "number"
                                },
                                "fcpstretrate": {
                                    "type": "number"
                                },
                                "sncreditrate": {
                                    "type": "number"
                                },
                                "difalfcprate": {
                                    "type": "number"
                                },
                                "difalrate": {
                                    "type": "number"
                                },
                                "difalinterrate": {
                                    "type": "number"
                                },
                                "difalpartition": {
                                    "type": "number"
                                }
                            },
                            "required": [
                                "sequence",
                                "description",
                                "cfop",
                                "unit",
                                "quantity",
                                "price",
                                "finalprice",
                                "subtotal",
                                "icmscst",
                                "piscst",
                                "cofinscst"
                            ]
                        },
                        "minItems": 1,
                        "maxItems": 990,
                        "uniqueItems": true
                    },
                    "payments": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "paymentid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "paymentcartid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "paymenttype": {
                                    "type": "string"
                                },
                                "paymentmethod": {
                                    "type": "string",
                                    "maxLength": 100
                                },
                                "description": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 60
                                },
                                "paid": {
                                    "type": "number"
                                },
                                "integrationtype": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "enum": [
                                        "1",
                                        "2",
                                        null
                                    ]
                                },
                                "acquirerdocument": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "pattern": "^[A-Z0-9]{12}[0-9]{2}$"
                                },
                                "transactiondata": {
                                    "type": [
                                        "array",
                                        "null"
                                    ],
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "transactioncode": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 255
                                },
                                "transactionid": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 50
                                },
                                "cardlastdigits": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                },
                                "brand": {
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "maxLength": 50
                                },
                                "brandcode": {
                                    "type": [
                                        "string",
                                        "null"
                                    ]
                                }
                            },
                            "required": [
                                "paymenttype",
                                "paymentmethod",
                                "paid"
                            ]
                        },
                        "minItems": 1,
                        "maxItems": 100
                    },
                    "references": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "string",
                            "pattern": "^[0-9]{44}$"
                        },
                        "maxItems": 500,
                        "uniqueItems": true
                    }
                },
                "required": [
                    "issuerconfigid",
                    "empotencykey",
                    "productstotal",
                    "total",
                    "items",
                    "payments"
                ],
                "title": "FiscalDocumentRequest"
            },
            "FiscalErrorLogRequest": {
                "type": "object",
                "properties": {
                    "level": {
                        "type": "string",
                        "enum": [
                            "warning",
                            "error",
                            "critical"
                        ]
                    },
                    "machineid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "appname": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "appversion": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 50
                    },
                    "errortype": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "errorcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 50
                    },
                    "message": {
                        "type": "string",
                        "maxLength": 60000
                    },
                    "usermessage": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 500
                    },
                    "trace": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60000
                    },
                    "context": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "occurred_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                },
                "required": [
                    "message"
                ],
                "title": "FiscalErrorLogRequest"
            },
            "FiscalInvalidationRequest": {
                "type": "object",
                "properties": {
                    "startnumber": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 999999999
                    },
                    "endnumber": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 999999999
                    },
                    "justification": {
                        "type": "string",
                        "minLength": 15,
                        "maxLength": 255
                    }
                },
                "required": [
                    "startnumber",
                    "endnumber",
                    "justification"
                ],
                "title": "FiscalInvalidationRequest"
            },
            "FiscalSubscriptionRequest": {
                "type": "object",
                "properties": {
                    "issuerid": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "fiscalplanid": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "startdate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date"
                    }
                },
                "required": [
                    "issuerid",
                    "fiscalplanid"
                ],
                "title": "FiscalSubscriptionRequest"
            },
            "IssuerCertificateRequest": {
                "type": "object",
                "properties": {
                    "certificate": {
                        "type": "string",
                        "format": "binary",
                        "contentMediaType": "application\/octet-stream",
                        "description": "A1 certificate file (.pfx or .p12), up to 64 KB."
                    },
                    "password": {
                        "type": "string",
                        "description": "Certificate password.",
                        "maxLength": 255
                    }
                },
                "required": [
                    "certificate",
                    "password"
                ],
                "title": "IssuerCertificateRequest"
            },
            "IssuerConfigCscRequest": {
                "type": "object",
                "properties": {
                    "csccode": {
                        "type": "string",
                        "description": "CSC identifier (idToken) given by the SEFAZ portal, e.g. 1 or 000001.",
                        "pattern": "^[0-9]{1,6}$"
                    },
                    "csctoken": {
                        "type": "string",
                        "description": "CSC token (C\u00f3digo de Seguran\u00e7a do Contribuinte), 16 to 36 letters, digits and hyphens (some SEFAZ issue it as a hyphenated GUID, e.g. SP).",
                        "pattern": "^[A-Za-z0-9-]{16,36}$"
                    }
                },
                "required": [
                    "csccode",
                    "csctoken"
                ],
                "title": "IssuerConfigCscRequest"
            },
            "IssuerConfigRequest": {
                "type": "object",
                "properties": {
                    "issuerid": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "machineid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "model": {
                        "type": "string",
                        "enum": [
                            "55",
                            "65"
                        ]
                    },
                    "series": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 999
                    },
                    "nature": {
                        "type": "string",
                        "maxLength": 100
                    },
                    "ibscbsmode": {
                        "type": "integer",
                        "description": "Tax reform IBS\/CBS group: 0 off, 1 sent when the items inform it, 2 required in every item.",
                        "enum": [
                            "0",
                            "1",
                            "2"
                        ]
                    },
                    "sequence": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 999999999
                    },
                    "environment": {
                        "type": "boolean"
                    },
                    "active": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "issuerid",
                    "model",
                    "series",
                    "nature",
                    "environment"
                ],
                "title": "IssuerConfigRequest"
            },
            "IssuerRequest": {
                "type": "object",
                "properties": {
                    "usersid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "branchid": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "branchnickname": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Optional quick identification of the store: a nickname (e.g. condominium) and\/or a sequential number.",
                        "maxLength": 60
                    },
                    "branchnumber": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1,
                        "maximum": 999999
                    },
                    "addressid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "postalcodeid": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "minimum": 1
                    },
                    "document": {
                        "type": "string",
                        "pattern": "^[A-Z0-9]{12}[0-9]{2}$"
                    },
                    "legalname": {
                        "type": "string",
                        "maxLength": 200
                    },
                    "tradename": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 200
                    },
                    "stateregistration": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30
                    },
                    "municipalregistration": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30
                    },
                    "taxregime": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "enum": [
                            "1",
                            "2",
                            "3",
                            "4",
                            null
                        ]
                    },
                    "postalcode": {
                        "type": "string",
                        "maxLength": 50
                    },
                    "country": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "state": {
                        "type": "string",
                        "enum": [
                            "AC",
                            "AL",
                            "AP",
                            "AM",
                            "BA",
                            "CE",
                            "DF",
                            "ES",
                            "GO",
                            "MA",
                            "MT",
                            "MS",
                            "MG",
                            "PA",
                            "PB",
                            "PR",
                            "PE",
                            "PI",
                            "RJ",
                            "RN",
                            "RS",
                            "RO",
                            "RR",
                            "SC",
                            "SP",
                            "SE",
                            "TO"
                        ],
                        "minLength": 2,
                        "maxLength": 2
                    },
                    "timezone": {
                        "type": "string"
                    },
                    "municipality": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "municipalitycode": {
                        "type": "string"
                    },
                    "district": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 255
                    },
                    "neighborhood": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "street": {
                        "type": "string",
                        "maxLength": 255
                    },
                    "number": {
                        "type": "string",
                        "maxLength": 50
                    },
                    "complement": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "phone1": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "phone2": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 100
                    },
                    "latitude": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -90,
                        "maximum": 90
                    },
                    "longitude": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "minimum": -180,
                        "maximum": 180
                    },
                    "active": {
                        "type": "boolean"
                    }
                },
                "required": [
                    "branchid",
                    "document",
                    "legalname",
                    "postalcode",
                    "country",
                    "state",
                    "municipality",
                    "municipalitycode",
                    "neighborhood",
                    "street",
                    "number"
                ],
                "title": "IssuerRequest"
            },
            "JsonResource": {
                "type": "string",
                "title": "JsonResource"
            },
            "RetransmitRequest": {
                "type": "object",
                "properties": {
                    "clientdocument": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^([0-9]{11}|[A-Z0-9]{12}[0-9]{2})$"
                    },
                    "clientname": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientieindicator": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "enum": [
                            "1",
                            "2",
                            "9",
                            null
                        ]
                    },
                    "clientstateregistration": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 30
                    },
                    "clientpostalcode": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^\\D*(\\d\\D*){8}$"
                    },
                    "clientstreet": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientnumber": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientcomplement": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "maxLength": 60
                    },
                    "clientneighborhood": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientmunicipalitycode": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "clientmunicipality": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "minLength": 2,
                        "maxLength": 60
                    },
                    "clientstate": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "enum": [
                            "AC",
                            "AL",
                            "AP",
                            "AM",
                            "BA",
                            "CE",
                            "DF",
                            "ES",
                            "GO",
                            "MA",
                            "MT",
                            "MS",
                            "MG",
                            "PA",
                            "PB",
                            "PR",
                            "PE",
                            "PI",
                            "RJ",
                            "RN",
                            "RS",
                            "RO",
                            "RR",
                            "SC",
                            "SP",
                            "SE",
                            "TO",
                            null
                        ]
                    },
                    "items": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "description": "NCM correction per item.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "sequence": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 990
                                },
                                "ncm": {
                                    "type": "string",
                                    "pattern": "^[0-9]{8}$"
                                }
                            },
                            "required": [
                                "sequence",
                                "ncm"
                            ]
                        },
                        "maxItems": 990,
                        "uniqueItems": true
                    }
                },
                "title": "RetransmitRequest"
            },
            "UserSyncRequest": {
                "type": "object",
                "description": "PUT \/users\/{externalid}: full upsert of a synchronized panel user (the same body creates or updates).\n- password: SHA-512 hex of the password (as the Poupa Pre\u00e7o apps send it), never the plain password. Omit it to keep\n  the current one.\n- roles: when sent (even empty), replaces every role of the user; when omitted, the roles are kept.\nScope ownership (issuers of the token's source system) is checked in UserController.",
                "properties": {
                    "name": {
                        "type": "string",
                        "maxLength": 150
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "email",
                        "maxLength": 190
                    },
                    "username": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Za-z0-9._@-]+$",
                        "maxLength": 100
                    },
                    "password": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^[A-Fa-f0-9]{128}$"
                    },
                    "activated": {
                        "type": "boolean"
                    },
                    "language": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Language of the panel and of the e-mails of the user: pt_BR (default), en or es.",
                        "enum": [
                            "pt_BR",
                            "en",
                            "es",
                            null
                        ]
                    },
                    "roles": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "role": {
                                    "type": "string",
                                    "enum": [
                                        "SYSTEM_ADMIN",
                                        "ADMIN",
                                        "OPERATOR",
                                        "VIEWER"
                                    ]
                                },
                                "usersid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                },
                                "issuerid": {
                                    "type": [
                                        "integer",
                                        "null"
                                    ],
                                    "minimum": 1
                                }
                            },
                            "required": [
                                "role"
                            ]
                        },
                        "maxItems": 500
                    }
                },
                "required": [
                    "name"
                ],
                "title": "UserSyncRequest"
            }
        },
        "responses": {
            "AuthenticationException": {
                "description": "Unauthenticated",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "ValidationException": {
                "description": "Validation error",
                "content": {
                    "application\/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Errors overview."
                                },
                                "errors": {
                                    "type": "object",
                                    "description": "A detailed description of each field that failed validation.",
                                    "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "required": [
                                "message",
                                "errors"
                            ]
                        }
                    }
                }
            }
        }
    }
}