{
  "components": {
    "schemas": {
      "Alert": {
        "description": "Alert is an open alert.",
        "properties": {
          "audience": {
            "description": "emisor or both: those for Sitios alone are not shown",
            "type": "string"
          },
          "id": {
            "description": "the ledger's number for it",
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "what went wrong, e.g. report_late or cae_running_out",
            "type": "string"
          },
          "message": {
            "description": "in English",
            "type": "string"
          },
          "notice": {
            "description": "in Spanish, with what to do",
            "type": "string"
          },
          "notified_at": {
            "description": "RFC 3339, in Montevideo: when it was mailed; absent while never",
            "type": "string"
          },
          "opened_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "subject": {
            "description": "what it is about: a date, a sobre, a CFE, a CAE, a type",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "subject",
          "audience",
          "message",
          "notice",
          "opened_at"
        ],
        "type": "object"
      },
      "Alerts": {
        "description": "Alerts is the data of GET /v1/emisores/{ruc}/alerts.",
        "properties": {
          "alerts": {
            "description": "oldest first",
            "items": {
              "$ref": "#/components/schemas/Alert"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "alerts"
        ],
        "type": "object"
      },
      "Amounts": {
        "description": "Amounts are a CFE's, or a sum's, by VAT rate. In a Line they are as the CFE writes them, in its currency; in a sum and in Line.Pesos they are in pesos and signed, a credit note's negative.",
        "properties": {
          "exempt": {
            "description": "exempt or not taxed (MntNoGrv). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "export": {
            "description": "exported, without VAT (MntExpoyAsim). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "net_basic": {
            "description": "net at the basic rate, 22%. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "net_minimum": {
            "description": "net at the minimum rate, 10%. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "net_other": {
            "description": "`net_other` and `vat_other` are at another rate, which this system never issues; only CFE received may have them. The net is MntNetoIVAOtra. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "total": {
            "description": "the taxed, exempt and exported amounts with their VAT (MntTotal). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "vat_basic": {
            "description": "VAT at the basic rate (MntIVATasaBasica). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "vat_minimum": {
            "description": "VAT at the minimum rate (MntIVATasaMin). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "vat_other": {
            "description": "VAT at that other rate (MntIVAOtra); see net_other. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          }
        },
        "required": [
          "exempt",
          "export",
          "net_minimum",
          "net_basic",
          "net_other",
          "vat_minimum",
          "vat_basic",
          "vat_other",
          "total"
        ],
        "type": "object"
      },
      "AnswerRequest": {
        "additionalProperties": false,
        "description": "AnswerRequest is the body of POST /v1/emisores/{ruc}/received/{id}/answer.",
        "properties": {
          "answer": {
            "description": "accept or reject",
            "type": "string"
          },
          "reasons": {
            "description": "to reject, 1 to 10, each a code of GET /v1/rejection-reasons and maybe a detail",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "Appearance": {
        "additionalProperties": false,
        "description": "Appearance is what an emisor's printed CFE show beyond what DGI requires; package printout says where each goes. None of it is part of the CFE but Adenda, which goes with each CFE as part of its adenda (JoinAdenda). The logo is not here: it is an image the ledger keeps apart (ledger.SetLogo).",
        "properties": {
          "address": {
            "description": "`address` is an address to show under the domicilio fiscal, such as a shop's. The domicilio fiscal is printed all the same. Up to 70 characters.",
            "type": "string"
          },
          "adenda": {
            "description": "`adenda` is the text every CFE's adenda ends with, such as the bank account for transfers: up to MaxEmisorAdenda characters in at most MaxEmisorAdendaLines lines. Each CFE keeps the text in force when it was issued.",
            "type": "string"
          },
          "email": {
            "description": "a plain address, as IsEmail",
            "type": "string"
          },
          "phone": {
            "description": "up to 30 characters",
            "type": "string"
          },
          "vat_up_to_date": {
            "description": "`vat_up_to_date` prints, in the footer, the constancia of being up to date with VAT (\"I.V.A. al día\"), which [FMT-CFE] (Pie del comprobante) asks printed when it applies. Every CFE built here declares the emisor up to date, by leaving out A-C17; a Monotributo emisor must not print it.",
            "type": "boolean"
          },
          "website": {
            "description": "up to 60 characters, without spaces",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Application": {
        "description": "Application is a collection's amount applied to an invoice it pays: a record of this system, not a CFE, which counts in what the invoice owes.",
        "properties": {
          "amount": {
            "description": "`amount` is what it takes of the collection, in the collection's Currency, and `invoice_amount` the part of the invoice it covers, in the invoice's `invoice_currency`, both with two decimals: the same amount when both are in one currency, else Amount converted at Rate and rounded to cents.",
            "type": "string"
          },
          "collection": {
            "$ref": "#/components/schemas/NamedCFE",
            "description": "the collection (cobranza) whose payment is applied"
          },
          "counts": {
            "description": "`counts` says it counts in what the invoice owes and the collection has left: false once reversed, or when DGI rejected either CFE, which is then void.",
            "type": "boolean"
          },
          "currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "id": {
            "description": "`id` is the ledger's number for it, which DELETE /v1/emisores/{ruc}/applications/{id} takes.",
            "format": "int64",
            "type": "integer"
          },
          "invoice": {
            "$ref": "#/components/schemas/NamedCFE",
            "description": "the e-Factura or e-Ticket it pays"
          },
          "invoice_amount": {
            "description": "see amount",
            "type": "string"
          },
          "invoice_currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "rate": {
            "description": "`rate` is the exchange rate agreed with the buyer, in pesos per unit of the currency that is not pesos; absent when both are in one currency.",
            "type": "string"
          },
          "recorded_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "recorded_by": {
            "description": "who made it: a user's email, or operator:<name> on Sitios' server",
            "type": "string"
          },
          "reversed_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "reversed_by": {
            "description": "`reversed_by` and `reversed_at` say who undid it and when; absent while it stands.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "collection",
          "invoice",
          "amount",
          "currency",
          "invoice_amount",
          "invoice_currency",
          "recorded_by",
          "recorded_at",
          "counts"
        ],
        "type": "object"
      },
      "ApplicationRequest": {
        "additionalProperties": false,
        "description": "ApplicationRequest is the body of POST /v1/emisores/{ruc}/cfes/{type}/{series}/{number}/applications.",
        "properties": {
          "amount": {
            "description": "`amount` is what of the collection is applied, in the collection's currency: more than zero, with at most two decimals, at most what the collection has left (its unapplied) and covering at most what the invoice owes (its owed). A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "collection": {
            "$ref": "#/components/schemas/CFEName",
            "description": "`collection` is the collection (cobranza) whose payment is applied to the invoice of the path: an e-Factura or e-Ticket with collection true, to the same buyer."
          },
          "rate": {
            "description": "`rate` is the exchange rate agreed with the buyer, in pesos per unit of the other currency, when one of the two is in pesos and the other is not: the part of the invoice covered is then amount ÷ rate for an invoice in another currency, amount × rate for one in pesos, rounded to cents. Left out when both are in one currency. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          }
        },
        "type": "object"
      },
      "ApplicationResult": {
        "description": "ApplicationResult is the data of the routes that make or reverse an application: the application, and where it leaves its two CFE.",
        "properties": {
          "application": {
            "$ref": "#/components/schemas/Application",
            "description": "as it stands after the call"
          },
          "dry_run": {
            "description": "it was only worked out, and nothing was kept",
            "type": "boolean"
          },
          "owed": {
            "description": "`owed` is what the invoice still owes, in its currency, and Unapplied what of the collection is still free to apply, in its currency, both with two decimals; absent when it cannot be told.",
            "type": "string"
          },
          "unapplied": {
            "description": "see owed",
            "type": "string"
          }
        },
        "required": [
          "application"
        ],
        "type": "object"
      },
      "Awaiting": {
        "description": "Awaiting is a sobre DGI received that has CFE without a verdict.",
        "properties": {
          "cfe_count": {
            "description": "CFE of the sobre without a verdict",
            "type": "integer"
          },
          "envelope_id": {
            "description": "the ledger's number for the sobre",
            "format": "int64",
            "type": "integer"
          },
          "query_after": {
            "description": "RFC 3339: when DGI said it would have them",
            "type": "string"
          }
        },
        "required": [
          "envelope_id",
          "cfe_count"
        ],
        "type": "object"
      },
      "BillingNotification": {
        "additionalProperties": false,
        "description": "BillingNotification is the body dLocal sends to POST /v1/billing/dlocal.",
        "properties": {
          "payment_id": {
            "description": "the payment that changed; what it is now is asked of dLocal",
            "type": "string"
          }
        },
        "type": "object"
      },
      "BillingNotified": {
        "description": "BillingNotified is the data of POST /v1/billing/dlocal.",
        "properties": {
          "settled": {
            "description": "`settled` says the payment is one of the billing's charges, now recorded as Status; false for any other payment of the account, such as the one that opens the card fields.",
            "type": "boolean"
          },
          "status": {
            "description": "billing's: paid, declined, pending, unknown or refused",
            "type": "string"
          }
        },
        "required": [
          "settled"
        ],
        "type": "object"
      },
      "CAE": {
        "additionalProperties": false,
        "description": "CAE is one authorisation from DGI to number CFE of a type and series within a range, until an expiry date ([FMT-CAE]).",
        "properties": {
          "expires": {
            "description": "AAAA-MM-DD; the CAE covers documents issued up to that day",
            "type": "string"
          },
          "from": {
            "description": "first authorised number",
            "type": "integer"
          },
          "id": {
            "description": "11 digits",
            "type": "string"
          },
          "series": {
            "description": "the only series it numbers",
            "type": "string"
          },
          "to": {
            "description": "last authorised number, inclusive",
            "type": "integer"
          },
          "type": {
            "description": "the only type it numbers. Type is a CFE type code ([FMT-CFE] Tabla A).",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "CAEImport": {
        "description": "CAEImport is the data of POST /v1/emisores/{ruc}/caes.",
        "properties": {
          "added": {
            "description": "false when this very CAE was on record already",
            "type": "boolean"
          },
          "cae": {
            "$ref": "#/components/schemas/CAEUsage",
            "description": "the CAE the file holds, with what of it is used as of the import"
          }
        },
        "required": [
          "cae",
          "added"
        ],
        "type": "object"
      },
      "CAEUsage": {
        "description": "CAEUsage is a CAE on record and how much of it is used.",
        "properties": {
          "expired": {
            "description": "its expiry day has passed in Montevideo: no CFE is issued with it",
            "type": "boolean"
          },
          "expires": {
            "description": "AAAA-MM-DD, inclusive",
            "type": "string"
          },
          "from": {
            "description": "first number it authorises",
            "type": "integer"
          },
          "id": {
            "description": "DGI's number for the CAE, 11 digits",
            "type": "string"
          },
          "next": {
            "description": "the number the next CFE would get from it; 0 when none is left",
            "type": "integer"
          },
          "remaining": {
            "description": "numbers left, next included",
            "type": "integer"
          },
          "series": {
            "description": "one or two capital letters, or a digit and a letter",
            "type": "string"
          },
          "to": {
            "description": "last number it authorises, inclusive",
            "type": "integer"
          },
          "type": {
            "description": "DGI's code of the CFE type it numbers, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          },
          "used": {
            "description": "numbers of its range issued or annulled",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "type",
          "type_name",
          "series",
          "from",
          "to",
          "expires",
          "used",
          "next",
          "remaining",
          "expired"
        ],
        "type": "object"
      },
      "CFE": {
        "description": "CFE is a CFE on record.",
        "properties": {
          "adenda": {
            "description": "`adenda` is the CFE's adenda: the sale's own text, then the one the profile's appearance.adenda added when it was issued. It is not part of the signed CFE and never goes to DGI; it is printed, and goes with the CFE to a receptor that is an emisor. Absent when it has none.",
            "type": "string"
          },
          "applications": {
            "description": "`applications` are the applications (afectaciones) the CFE is part of, in the order they were made, those reversed included: for an invoice, the collections applied to it; for a collection, the invoices it is applied to. Absent when none.",
            "items": {
              "$ref": "#/components/schemas/Application"
            },
            "type": "array"
          },
          "applied": {
            "description": "`applied` is what the applications that count come to, in the CFE's currency, with two decimals: for an invoice, what they cover of it; for a collection, what they take of it. Present with applications.",
            "type": "string"
          },
          "balance": {
            "description": "see credited",
            "type": "string"
          },
          "collected": {
            "description": "`collected` is what those collections collected, in the CFE's currency, with two decimals; present with collected_by.",
            "type": "string"
          },
          "collected_by": {
            "description": "`collected_by` are the collections (cobranzas) of the CFE, in the order they were signed, each with what it collected of the CFE in amount; absent when none names it.",
            "items": {
              "$ref": "#/components/schemas/CorrectingNote"
            },
            "type": "array"
          },
          "collection": {
            "description": "`collection` marks an e-Ticket or e-Factura that documents a payment collected (a cobranza, sale.collection), printed \"e-Factura Cobranza\".",
            "type": "boolean"
          },
          "corrected_by": {
            "description": "`corrected_by` are the credit and debit notes that correct the CFE, in the order they were signed; absent when none does. A CFE is never changed or cancelled: a note is how it is corrected ([DEF] §XIII).",
            "items": {
              "$ref": "#/components/schemas/CorrectingNote"
            },
            "type": "array"
          },
          "corrects": {
            "description": "`corrects` is what a credit or debit note corrects: each CFE it names, or a global reference; absent for a CFE that is not a note.",
            "items": {
              "$ref": "#/components/schemas/CorrectedCFE"
            },
            "type": "array"
          },
          "credited": {
            "description": "Credited, Debited and Balance are what those notes did to the CFE, in its currency, with two decimals: what its credit notes took, what its debit notes added, and its total to pay with both applied. Present with corrected_by. Notes DGI rejected count for nothing.",
            "type": "string"
          },
          "debited": {
            "description": "see credited",
            "type": "string"
          },
          "dry_run": {
            "description": "issue only said what it would be",
            "type": "boolean"
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "key": {
            "description": "the caller's own identifier for the sale, as issued with it; absent without one",
            "type": "string"
          },
          "language": {
            "description": "`language` is the language the CFE's printout and its mail to the buyer also come in, beside Spanish, as its sale asked (sale.language): en. Absent for Spanish only. Language is a language a CFE's printout and its mail to the buyer come in besides Spanish, as an ISO 639-1 code. DGI requires the printed CFE in Spanish and lets it carry the same data in another language as well ([FAQ] §8.15), so there is no printout in another language alone: the zero Language, Spanish, prints in Spanish only, and any other prints both.",
            "type": "string"
          },
          "mails": {
            "description": "`mails` are the mails of the CFE to buyers, oldest first. Only the routes on one CFE by its type, series and number fill them.",
            "items": {
              "$ref": "#/components/schemas/MailState"
            },
            "type": "array"
          },
          "must_send": {
            "description": "DGI must receive it in a sobre, which the hourly sync sends",
            "type": "boolean"
          },
          "number": {
            "description": "within the series, from its CAE",
            "type": "integer"
          },
          "over_ui_threshold": {
            "description": "`over_ui_threshold` says it is an e-Ticket or an e-Ticket note whose net amount exceeds the UI threshold: it identifies its receptor and DGI must receive it in a sobre, not only in the daily report.",
            "type": "boolean"
          },
          "owed": {
            "description": "`owed` is what is still to collect of the CFE: its total to pay with its notes applied, less what its collections collected and what the collections applied to it cover (applied). Present when a note, a collection or an application names the CFE and the share of each can be told.",
            "type": "string"
          },
          "qr_url": {
            "description": "the link to DGI's check of the CFE that its printed QR code holds",
            "type": "string"
          },
          "receptor_exchange": {
            "$ref": "#/components/schemas/ReceptorExchange",
            "description": "`receptor_exchange` is where the CFE stands with its receptor when it is identified by a RUC, once DGI accepted the CFE and cfe sync decided whether it goes to it; absent before, and for a CFE without a RUC receptor."
          },
          "replayed": {
            "description": "issue returned the CFE already issued with the same key",
            "type": "boolean"
          },
          "sale": {
            "$ref": "#/components/schemas/Document",
            "description": "`sale` is the sale the CFE was made from, as POST .../cfes takes it, read back from the CFE: what a note that corrects it starts from. Only the routes on one CFE fill it."
          },
          "security_code": {
            "description": "what the printed CFE shows",
            "type": "string"
          },
          "series": {
            "description": "one or two capital letters, or a digit and a letter",
            "type": "string"
          },
          "signed_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "totals": {
            "$ref": "#/components/schemas/Totals",
            "description": "as signed, in the CFE's currency"
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          },
          "unapplied": {
            "description": "`unapplied` is, for a collection, what of it is still free to apply to an invoice, in its currency: its total to pay less what its own references name and what its applications take. Absent for any other CFE, and when it cannot be told (a reference to a CFE in another currency, or to several without an amount for each).",
            "type": "string"
          },
          "untold_collections": {
            "description": "`untold_collections` counts the collections of collected_by whose share of this CFE cannot be told: collected and owed leave them out. Absent when 0.",
            "type": "integer"
          },
          "untold_notes": {
            "description": "`untold_notes` counts the notes of corrected_by whose share of this CFE cannot be told (one that names several CFE, or is in another currency, without an amount for each): balance leaves them out. Absent when 0.",
            "type": "integer"
          },
          "verdict": {
            "description": "`verdict` is DGI's: AE accepted, BE rejected, CE or FE; empty while DGI has given none, as for a CFE it only gets in the daily report.",
            "type": "string"
          },
          "verdict_reasons": {
            "description": "`verdict_reasons` are why DGI rejected the CFE, or what it observed on it, with DGI's code and text. Only the routes on one CFE fill them.",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          },
          "warnings": {
            "description": "`warnings` are what issuing found worth a look without refusing the sale: today, a credit note that takes more of a CFE than its balance. Only POST .../cfes fills them, on a dry run too.",
            "items": {
              "$ref": "#/components/schemas/Warning"
            },
            "type": "array"
          }
        },
        "required": [
          "type",
          "type_name",
          "series",
          "number",
          "issue_date",
          "signed_at",
          "totals",
          "over_ui_threshold",
          "must_send",
          "verdict"
        ],
        "type": "object"
      },
      "CFEName": {
        "additionalProperties": false,
        "description": "CFEName names a CFE on record by its type, series and number.",
        "properties": {
          "number": {
            "description": "within the series",
            "type": "integer"
          },
          "series": {
            "description": "any case",
            "type": "string"
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "CFEs": {
        "description": "CFEs is the data of GET /v1/emisores/{ruc}/cfes.",
        "properties": {
          "cfes": {
            "description": "in the order they were signed",
            "items": {
              "$ref": "#/components/schemas/CFE"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "date": {
            "description": "AAAA-MM-DD, when listed by date",
            "type": "string"
          },
          "from": {
            "description": "see receptor; inclusive",
            "type": "string"
          },
          "receptor": {
            "description": "`receptor` is the document of the buyer the CFE were made out to, when listed by receptor, and From and To the first and last days signed it was asked for, AAAA-MM-DD; absent when not asked for.",
            "type": "string"
          },
          "receptor_name": {
            "description": "`receptor_name` is the name asked for, as given, when listed by the buyer's name; absent otherwise. From and To bound it as they bound Receptor.",
            "type": "string"
          },
          "receptors": {
            "description": "`receptors` are the distinct buyers a search by name found, ordered by name: more than one says the name is ambiguous. Absent when not listed by name, or when it found none.",
            "items": {
              "$ref": "#/components/schemas/Receptor"
            },
            "type": "array"
          },
          "to": {
            "description": "see receptor; inclusive",
            "type": "string"
          }
        },
        "required": [
          "cfes"
        ],
        "type": "object"
      },
      "CardInfo": {
        "description": "CardInfo is the card on file, without its token.",
        "properties": {
          "brand": {
            "description": "as dLocal names it: VI, MC...",
            "type": "string"
          },
          "email": {
            "description": "where its invoices and the notices of a failed charge go",
            "type": "string"
          },
          "expiry_month": {
            "type": "integer"
          },
          "expiry_year": {
            "type": "integer"
          },
          "last4": {
            "type": "string"
          },
          "saved_at": {
            "description": "RFC 3339",
            "type": "string"
          },
          "saved_by": {
            "description": "who loaded it",
            "type": "string"
          }
        },
        "required": [
          "brand",
          "last4",
          "expiry_month",
          "expiry_year",
          "email",
          "saved_at",
          "saved_by"
        ],
        "type": "object"
      },
      "CardRequest": {
        "additionalProperties": false,
        "description": "CardRequest is the body of PUT /v1/emisores/{ruc}/billing/card: the token dLocal's SmartFields made of the card in the browser, and its holder, as dLocal asks for them.",
        "properties": {
          "document": {
            "description": "`document` is the holder's cédula, its digits with the check digit, as dLocal asks for in Uruguay.",
            "type": "string"
          },
          "email": {
            "description": "`email` is the holder's: FOMAN's invoices of each month and the notices of a failed charge go there.",
            "type": "string"
          },
          "first_name": {
            "description": "the holder's, up to 128 characters",
            "type": "string"
          },
          "last_name": {
            "description": "the holder's, up to 128 characters",
            "type": "string"
          },
          "token": {
            "description": "window.dlocalGo.createCardToken's: it serves once",
            "type": "string"
          }
        },
        "type": "object"
      },
      "CardSession": {
        "description": "CardSession is the data of POST /v1/emisores/{ruc}/billing/card-session.",
        "properties": {
          "checkout_token": {
            "description": "`checkout_token` is what window.dlocalGo.initialize takes beside the SmartFields key: the token of a payment that only opens the card fields, and is never charged.",
            "type": "string"
          }
        },
        "required": [
          "checkout_token"
        ],
        "type": "object"
      },
      "Certificate": {
        "description": "Certificate describes a signing certificate, without its key.",
        "properties": {
          "days_left": {
            "description": "`days_left` is how many whole days it has left in force; negative once it ended. The emisor and Sitios are told 60 days before (cfe check).",
            "type": "integer"
          },
          "issuer": {
            "description": "the certification authority, as an RFC 2253 name",
            "type": "string"
          },
          "ruc": {
            "description": "the RUC in the subject",
            "type": "string"
          },
          "serial": {
            "description": "upper-case hexadecimal, as openssl prints it",
            "type": "string"
          },
          "subject": {
            "description": "the holder, as an RFC 2253 name",
            "type": "string"
          },
          "valid_from": {
            "description": "RFC 3339",
            "type": "string"
          },
          "valid_to": {
            "description": "RFC 3339: after it, DGI rejects what it signs",
            "type": "string"
          }
        },
        "required": [
          "subject",
          "issuer",
          "serial",
          "valid_from",
          "valid_to",
          "days_left"
        ],
        "type": "object"
      },
      "CertificateReplacement": {
        "description": "CertificateReplacement is the data of PUT /v1/emisores/{ruc}/certificate.",
        "properties": {
          "certificate": {
            "$ref": "#/components/schemas/Certificate",
            "description": "the one the emisor signs with from now on"
          },
          "dry_run": {
            "description": "it was only checked, and the certificate was not stored",
            "type": "boolean"
          },
          "previous": {
            "$ref": "#/components/schemas/Certificate",
            "description": "the one it replaced; absent when there was none"
          }
        },
        "required": [
          "certificate",
          "dry_run"
        ],
        "type": "object"
      },
      "CertificateRequest": {
        "additionalProperties": false,
        "description": "CertificateRequest is the body of PUT /v1/emisores/{ruc}/certificate.",
        "properties": {
          "password": {
            "description": "`password` is the PIN or password that opens it. It only opens it: the server stores the file under a password of its own and keeps this one nowhere.",
            "type": "string"
          },
          "pkcs12": {
            "contentEncoding": "base64",
            "description": "`pkcs12` is the certificate file with its private key, a .pfx or .p12 as the certification authority delivers it (Abitab's included), in base64. At most 1 MB of body in all.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "ChargeInfo": {
        "description": "ChargeInfo is one attempt to charge a month.",
        "properties": {
          "amount": {
            "type": "string"
          },
          "at": {
            "description": "RFC 3339: when it was sent",
            "type": "string"
          },
          "attempt": {
            "type": "integer"
          },
          "by": {
            "description": "run, or the operator who retried by hand",
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "order_id": {
            "type": "string"
          },
          "payment_id": {
            "type": "string"
          },
          "period_start": {
            "type": "string"
          },
          "status": {
            "description": "paid, declined, pending, unknown or refused",
            "type": "string"
          }
        },
        "required": [
          "period_start",
          "attempt",
          "order_id",
          "amount",
          "status",
          "at",
          "by"
        ],
        "type": "object"
      },
      "ChatDeletion": {
        "description": "ChatDeletion is the data of DELETE /v1/emisores/{ruc}/chat/messages.",
        "properties": {
          "deleted": {
            "description": "the messages deleted; 0 when the thread had none",
            "type": "integer"
          },
          "dry_run": {
            "description": "they were only counted, and nothing was deleted",
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ],
        "type": "object"
      },
      "ChatFeedback": {
        "description": "ChatFeedback is a 👎 on an answer of the assistant.",
        "properties": {
          "comment": {
            "description": "what the person said was wrong; absent when nothing",
            "type": "string"
          },
          "dry_run": {
            "description": "it was only checked, and nothing was kept",
            "type": "boolean"
          },
          "given_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "id": {
            "description": "the chat's number for the 👎",
            "format": "int64",
            "type": "integer"
          },
          "message_id": {
            "description": "the answer it is on",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "message_id",
          "given_at"
        ],
        "type": "object"
      },
      "ChatFeedbackRequest": {
        "additionalProperties": false,
        "description": "ChatFeedbackRequest is the body of POST .../chat/messages/{id}/feedback.",
        "properties": {
          "comment": {
            "description": "what was wrong, up to 4000 characters; optional",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ChatMessage": {
        "description": "ChatMessage is one message of a thread as the person sees it: their own, an answer of the assistant with text, previews or both, or a message of Sitios' team (cfe-server chat post), which only GET brings: no event streams it. The tools' answers are not shown.",
        "properties": {
          "feedback": {
            "$ref": "#/components/schemas/ChatFeedback",
            "description": "`feedback` is the 👎 the person gave the answer; absent when none."
          },
          "from": {
            "description": "`from` is person, assistant or sitios. Only an assistant's message takes a 👎.",
            "type": "string"
          },
          "id": {
            "description": "the chat's number for it: what before and .../messages/{id}/feedback take",
            "format": "int64",
            "type": "integer"
          },
          "previews": {
            "description": "`previews` are the sales the answer previewed, each with what issuing it takes; absent when none.",
            "items": {
              "$ref": "#/components/schemas/ChatPreview"
            },
            "type": "array"
          },
          "sent_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "text": {
            "description": "Markdown, in an answer and in Sitios'; may be empty in an answer that only previews",
            "type": "string"
          }
        },
        "required": [
          "id",
          "from",
          "text",
          "sent_at"
        ],
        "type": "object"
      },
      "ChatMessageRequest": {
        "additionalProperties": false,
        "description": "ChatMessageRequest is the body of POST /v1/emisores/{ruc}/chat/messages.",
        "properties": {
          "text": {
            "description": "what the person writes, 1 to 4000 characters",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ChatMessages": {
        "description": "ChatMessages is the data of GET /v1/emisores/{ruc}/chat/messages.",
        "properties": {
          "messages": {
            "description": "newest first",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "more": {
            "description": "`more` says there are older messages: ask again with before set to the id of the last one here.",
            "type": "boolean"
          }
        },
        "required": [
          "messages",
          "more"
        ],
        "type": "object"
      },
      "ChatPreview": {
        "description": "ChatPreview is a sale the assistant previewed. Issuing it is the person's to do, with POST /v1/emisores/{ruc}/cfes and {\"key\": key, \"sale\": sale}: the model never issues (docs/15 §2.1). The key makes issuing it twice answer the same CFE.",
        "properties": {
          "key": {
            "description": "chat-<thread>-<tool call id>: the key to issue the sale with",
            "type": "string"
          },
          "preview": {
            "$ref": "#/components/schemas/Preview",
            "description": "what the API answered the preview with, its totals and lines"
          },
          "sale": {
            "$ref": "#/components/schemas/Document",
            "description": "the sale as the assistant drafted it, what POST .../cfes takes"
          }
        },
        "required": [
          "key",
          "sale",
          "preview"
        ],
        "type": "object"
      },
      "CollectRequest": {
        "additionalProperties": false,
        "description": "CollectRequest is the body of POST /v1/login/collect.",
        "properties": {
          "poll_secret": {
            "description": "as POST /v1/login answered it",
            "type": "string"
          }
        },
        "type": "object"
      },
      "CorrectedCFE": {
        "description": "CorrectedCFE is one reference of a note: a CFE it corrects, or a global reference to documents that cannot be named one by one.",
        "properties": {
          "amount": {
            "description": "`amount` is what the note says it corrects of that CFE, in that CFE's Currency, when it says.",
            "type": "string"
          },
          "currency": {
            "description": "ISO 4217 of the CFE corrected; absent when it is the note's own",
            "type": "string"
          },
          "date": {
            "description": "AAAA-MM-DD of the CFE corrected, when the note gives it",
            "type": "string"
          },
          "global": {
            "description": "`global` marks a reference to documents that cannot be named one by one, which only reason explains; type, series, number and date are then absent.",
            "type": "boolean"
          },
          "number": {
            "description": "of the CFE corrected, within its series",
            "type": "integer"
          },
          "on_record": {
            "description": "`on_record` says the CFE corrected is this emisor's, on record here, and so has its own route; false for one issued elsewhere.",
            "type": "boolean"
          },
          "reason": {
            "description": "the note's free text for the reference (RazonRef), always there in a global one",
            "type": "string"
          },
          "series": {
            "description": "of the CFE corrected",
            "type": "string"
          },
          "type": {
            "description": "DGI's code of the CFE corrected",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it",
            "type": "string"
          }
        },
        "required": [
          "on_record"
        ],
        "type": "object"
      },
      "CorrectingNote": {
        "description": "CorrectingNote is a credit or debit note that corrects a CFE, or a collection that collects it.",
        "properties": {
          "amount": {
            "description": "`amount` is the part of the corrected CFE this note accounts for, in that CFE's currency; absent when it cannot be told (see untold_notes).",
            "type": "string"
          },
          "currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "key": {
            "description": "the caller's own identifier for its sale; absent without one",
            "type": "string"
          },
          "number": {
            "description": "within the series",
            "type": "integer"
          },
          "series": {
            "description": "as on record, in capitals",
            "type": "string"
          },
          "signed_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "total": {
            "description": "`total` is the note's total to pay, in Currency, with two decimals.",
            "type": "string"
          },
          "type": {
            "description": "DGI's code, e.g. 112",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. Nota de Crédito de e-Factura",
            "type": "string"
          },
          "verdict": {
            "description": "`verdict` is DGI's on the note, as in a CFE: a note DGI rejected (BE) corrects nothing and counts for nothing in the balance.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "type_name",
          "series",
          "number",
          "issue_date",
          "signed_at",
          "total",
          "currency",
          "verdict"
        ],
        "type": "object"
      },
      "Discovery": {
        "description": "Discovery is the data of GET / and GET /v1/: where a newcomer to the API goes next.",
        "properties": {
          "description": {
            "description": "what the API does, in one sentence",
            "type": "string"
          },
          "docs": {
            "description": "the guide in Spanish, in Sitios' private repository",
            "type": "string"
          },
          "health": {
            "description": "the path a monitor asks whether the API works",
            "type": "string"
          },
          "name": {
            "description": "the API's, as the `openapi` document titles it",
            "type": "string"
          },
          "openapi": {
            "description": "the path of the OpenAPI 3.1 document, which describes every endpoint",
            "type": "string"
          }
        },
        "required": [
          "name",
          "description",
          "openapi",
          "docs",
          "health"
        ],
        "type": "object"
      },
      "Document": {
        "additionalProperties": false,
        "description": "Document is the data of one CFE as a caller provides it. Amounts and quantities are decimals, written in JSON as strings (\"610.00\") or numbers.",
        "properties": {
          "adenda": {
            "description": "`adenda` is free text for the buyer that is not part of the CFE ([FMT-CFE] Zona J): it is not signed and never goes to DGI, but it goes with the CFE to a receptor electrónico and is printed in a zone titled ADENDA, before the text the emisor's Appearance adds. Up to MaxSaleAdenda characters in at most MaxSaleAdendaLines lines. Optional.",
            "type": "string"
          },
          "collection": {
            "description": "`collection` marks a CFE that documents a payment the emisor received for its own earlier sales, a cobranza propia ([FMT-CFE] A-C20): only an e-Ticket or an e-Factura, every item non_billable or non_billable_negative, and a reference to each CFE collected, whose amount is the part of it paid. It is printed with the legend \"Cobranza\" and counts nothing in the taxed totals. In a collection, an item without vat is non_billable, a payment left empty is cash, and with no items each reference with an amount becomes one line for that amount, named after the CFE it collects (\"e-Factura A 3497\").",
            "type": "boolean"
          },
          "currency": {
            "description": "`currency` is the ISO 4217 code every amount of the CFE is in; empty means UYU, pesos. An e-Remito has no amounts and leaves it empty.",
            "type": "string"
          },
          "due_date": {
            "description": "AAAA-MM-DD, optional, and only on a sale",
            "type": "string"
          },
          "exchange_rate": {
            "description": "`exchange_rate` is how many pesos one unit of Currency is worth, with at most 3 decimals: required for any currency but pesos, and absent for pesos. The ledger fills it with the fiscal rate when it is left empty. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "export": {
            "$ref": "#/components/schemas/ExportTerms",
            "description": "`export` are the clause, mode and transport of an export, required on the types 121 to 124 and absent on the others."
          },
          "foreign_currency_resale": {
            "description": "`foreign_currency_resale` marks an e-Boleta de entrada, or one of its notes, of foreign currency bought for resale against pesos (A-C21): every line foreign_currency, in UYU. With Principal, the purchase is made on behalf of another (A-C21 = 2).",
            "type": "boolean"
          },
          "internal_id": {
            "description": "the caller's own reference, up to 50 characters",
            "type": "string"
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "items": {
            "description": "1 to 700 on an e-Ticket, an e-Ticket Venta por Cuenta Ajena or their notes, to 200 on the other types; see Collection",
            "items": {
              "$ref": "#/components/schemas/Item"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "language": {
            "description": "`language` is the language the printed CFE and the mail to the buyer also come in, beside the Spanish DGI requires: en, for Spanish and English (package printout says which legends get the English). Empty, as for most sales, is Spanish only. Like Adenda, it is not part of the CFE: the ledger keeps it apart. Language is a language a CFE's printout and its mail to the buyer come in besides Spanish, as an ISO 639-1 code. DGI requires the printed CFE in Spanish and lets it carry the same data in another language as well ([FAQ] §8.15), so there is no printout in another language alone: the zero Language, Spanish, prints in Spanish only, and any other prints both.",
            "type": "string"
          },
          "mail_to": {
            "description": "`mail_to` is the buyer's email address. It is not part of the CFE: the ledger mails the CFE there once it may reach the buyer. Optional.",
            "type": "string"
          },
          "number": {
            "description": "1 to 9999999, within a CAE of Type and Series",
            "type": "integer"
          },
          "payment": {
            "description": "`payment` is \"cash\" (contado) or \"credit\" (crédito), on a sale (Type.IsSale); a remito or an e-Resguardo has none and leaves it empty.",
            "type": "string"
          },
          "payment_methods": {
            "description": "`payment_methods` are how the CFE was paid, one per method or currency (Zona E, optional on a sale, absent on the other types). They are printed, and DGI does not check that they add up to the amount to pay.",
            "items": {
              "$ref": "#/components/schemas/PaymentMethod"
            },
            "type": "array"
          },
          "prices_include_vat": {
            "description": "`prices_include_vat` says that unit prices and item amounts include VAT, as on a shelf; otherwise they are net and VAT is added on top. With VAT included, DGI's rounding may leave the total up to a cent per rate off what the items charge; the CFE then gets one more line, last, \"Redondeo\", non-billable, for the difference, so that the amount to pay is what was charged.",
            "type": "boolean"
          },
          "principal": {
            "$ref": "#/components/schemas/Principal",
            "description": "`principal` is the mandante of a sale on behalf of others, required on the types 131 to 143 (see Principal)."
          },
          "receiver": {
            "$ref": "#/components/schemas/Receiver",
            "description": "`receiver` is the buyer, or on an e-Remito who gets the goods, on an e-Resguardo who was retained and on an e-Boleta de entrada the seller; nil only on an e-Ticket, an e-Ticket Venta por Cuenta Ajena or their notes."
          },
          "references": {
            "description": "at most 40; a note needs one to the CFE it corrects (see referableTypes)",
            "items": {
              "$ref": "#/components/schemas/Reference"
            },
            "type": "array"
          },
          "series": {
            "description": "one or two capital letters, or a digit and a letter: A, AB, 1A",
            "type": "string"
          },
          "shipment": {
            "$ref": "#/components/schemas/Shipment",
            "description": "`shipment` is the kind of move of a remito, 124 or 181, required on them and absent on the others."
          },
          "type": {
            "description": "one of SupportedTypes. Type is a CFE type code ([FMT-CFE] Tabla A).",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Emisor": {
        "description": "Emisor is the data of GET /v1/emisores/{ruc}.",
        "properties": {
          "awaiting_verdicts": {
            "description": "sobres DGI received without its verdict on every CFE",
            "items": {
              "$ref": "#/components/schemas/Awaiting"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "caes": {
            "description": "in the order CFE use them",
            "items": {
              "$ref": "#/components/schemas/CAEUsage"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "cfe_to_send": {
            "description": "What is pending with DGI, which cfe sync works off every hour. CFE DGI must receive that are in no sobre yet",
            "type": "integer"
          },
          "envelopes_to_send": {
            "description": "sobres built and not answered by DGI",
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "environment": {
            "description": "`environment` is the DGI environment of the ledger this answer comes from, which it belongs to for life: testing, where nothing has fiscal effect, or production. Absent only for a ledger whose creation was cut short.",
            "type": "string"
          },
          "environments": {
            "description": "`environments` are all the DGI environments the emisor has a ledger in, testing first; for an agent token, only the one it is bound to.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "logo": {
            "$ref": "#/components/schemas/LogoInfo",
            "description": "`logo` is the emisor's logo, printed on its CFE: GET, PUT and DELETE .../profile/logo. Absent when it has none."
          },
          "profile": {
            "$ref": "#/components/schemas/Issuer",
            "description": "with its `caes`; absent until it is set"
          },
          "role": {
            "description": "the caller's",
            "type": "string"
          },
          "ruc": {
            "description": "12 digits",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "role",
          "environments",
          "caes",
          "cfe_to_send",
          "envelopes_to_send",
          "awaiting_verdicts"
        ],
        "type": "object"
      },
      "EmisorRole": {
        "description": "EmisorRole is the caller's role on one emisor.",
        "properties": {
          "role": {
            "description": "view, issue or admin, already limited by the token",
            "type": "string"
          },
          "ruc": {
            "description": "the emisor's, 12 digits",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "role"
        ],
        "type": "object"
      },
      "EmisorSummary": {
        "description": "EmisorSummary is one of the caller's emisores.",
        "properties": {
          "environments": {
            "description": "`environments` are the DGI environments the emisor has a ledger in, testing first: testing, where nothing has fiscal effect, production, or both. Empty while the emisor has none. With both, a request on the emisor says which in its CFE-Environment header. An agent token sees only the one it is bound to, which is the only one it can work in.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "name": {
            "description": "`name` is the razón social: the ledger's, or for an emisor with no ledger yet the one DGI gave its signup; absent when neither has one.",
            "type": "string"
          },
          "role": {
            "description": "the caller's: view, issue or admin",
            "type": "string"
          },
          "ruc": {
            "description": "12 digits",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "role",
          "environments"
        ],
        "type": "object"
      },
      "Emisores": {
        "description": "Emisores is the data of GET /v1/emisores.",
        "properties": {
          "emisores": {
            "description": "by RUC",
            "items": {
              "$ref": "#/components/schemas/EmisorSummary"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "emisores"
        ],
        "type": "object"
      },
      "ErrorBody": {
        "description": "errorBody is why an answer failed: a code to branch on, and words for whoever reads it.",
        "properties": {
          "code": {
            "description": "stable; the table of error codes says what each means and its HTTP status",
            "enum": [
              "already_answered",
              "application_exceeds",
              "application_invalid",
              "before_reports",
              "billing_unavailable",
              "cae_invalid",
              "card_rejected",
              "certificate_rejected",
              "certificate_unavailable",
              "chat_busy",
              "chat_limit",
              "chat_unavailable",
              "dgi_rejected",
              "dgi_unavailable",
              "dlocal_unavailable",
              "environment_mismatch",
              "environment_required",
              "exchange_rate_unknown",
              "feedback_given",
              "forbidden",
              "input_malformed",
              "internal",
              "key_reused",
              "last_admin",
              "ledger_not_found",
              "login_invalid",
              "login_pending",
              "logo_invalid",
              "mail_failed",
              "monthly_mail_unset",
              "no_numbers",
              "not_found",
              "not_on_record",
              "pki_unavailable",
              "portal_unavailable",
              "profile_incomplete",
              "profile_invalid",
              "profile_missing",
              "sale_invalid",
              "signup_exists",
              "signup_rejected",
              "signup_unavailable",
              "too_many_requests",
              "unauthenticated",
              "unhealthy",
              "usage",
              "verification_failed",
              "visitor_chat_limit"
            ],
            "type": "string"
          },
          "hint": {
            "description": "the next step; absent when there is none to give",
            "type": "string"
          },
          "message": {
            "description": "in English, for the developer and the agent; it may change, the code does not",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "ExportTerms": {
        "additionalProperties": false,
        "description": "ExportTerms are what an export CFE, types 121 to 124, says of the sale besides its lines ([FMT-CFE] A-C13 to A-C15).",
        "properties": {
          "clause": {
            "description": "`clause` is the cláusula de venta (A-C13): the Incoterm of the sale, such as FOB or CIF, 1 to 3 letters, or N/A when none applies. Required on an e-Factura de exportación and its notes, optional on an e-Remito de exportación.",
            "type": "string"
          },
          "mode": {
            "description": "`mode` is the modalidad de venta (A-C14): goods (Régimen General, exportación de bienes), consignment, revisable_price, exclave (bienes propios a exclaves aduaneros), services (exportación de servicios), principal (exportación mandante: a third party, the mandatario, makes the export; [FAQ] 4.48) or other. Required on an e-Factura de exportación and on an e-Remito de exportación; optional on the notes.",
            "type": "string"
          },
          "transport": {
            "description": "`transport` is the vía de transporte (A-C15): sea, air, land, other, or none when it does not apply (N/A). Required on every export type.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Failure": {
        "description": "Every answer that is not a success. The HTTP status follows from error.code.",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Problems",
            "description": "Sent beside sale_invalid and profile_invalid: every problem found, each with the JSON path of its field."
          },
          "error": {
            "$ref": "#/components/schemas/ErrorBody"
          },
          "ok": {
            "const": false
          }
        },
        "required": [
          "ok",
          "error"
        ],
        "type": "object"
      },
      "GrantRequest": {
        "additionalProperties": false,
        "description": "GrantRequest is the body of PUT /v1/emisores/{ruc}/members/{email}.",
        "properties": {
          "name": {
            "description": "the person's name, when new or changed",
            "type": "string"
          },
          "role": {
            "description": "view, issue or admin",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Health": {
        "description": "Health is the data of GET /v1/health.",
        "properties": {
          "status": {
            "description": "\"ok\"",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "InvoiceInfo": {
        "description": "InvoiceInfo is FOMAN's invoice of a month paid.",
        "properties": {
          "issued_at": {
            "description": "RFC 3339; absent while not issued",
            "type": "string"
          },
          "last_error": {
            "description": "why it is not issued yet",
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "period_start": {
            "type": "string"
          },
          "series": {
            "type": "string"
          },
          "type": {
            "description": "111 once issued",
            "type": "integer"
          }
        },
        "required": [
          "period_start"
        ],
        "type": "object"
      },
      "InvoicedItem": {
        "description": "InvoicedItem is one item the emisor invoiced: the equal lines of its sales (the same name, case, accents and punctuation aside, unit, vat and currency), shown as on the newest of them. Its name, description, unit, unit_price, discount and vat are a sale's line as POST .../cfes takes it.",
        "properties": {
          "currency": {
            "description": "ISO 4217 of the CFE of the newest line; UYU for pesos",
            "type": "string"
          },
          "description": {
            "description": "the newest line's; absent when it had none",
            "type": "string"
          },
          "discount": {
            "description": "see unit_price; absent when none. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "last_cfe": {
            "$ref": "#/components/schemas/ItemSource",
            "description": "`last_cfe` is the CFE it was last invoiced in, and when."
          },
          "name": {
            "description": "as on the newest line",
            "type": "string"
          },
          "prices_include_vat": {
            "description": "`prices_include_vat` is that CFE's: whether unit_price includes VAT.",
            "type": "boolean"
          },
          "times": {
            "description": "the sales read that had it, last_cfe included",
            "type": "integer"
          },
          "unit": {
            "description": "up to 4 characters; absent when the line gave none",
            "type": "string"
          },
          "unit_price": {
            "description": "`unit_price` and Discount are those of the newest line: with VAT when prices_include_vat, without it otherwise, in currency. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "vat": {
            "description": "`vat` is the line's: exempt, minimum, basic, export, non_billable or non_billable_negative, as in a sale.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "unit_price",
          "vat",
          "currency",
          "prices_include_vat",
          "times",
          "last_cfe"
        ],
        "type": "object"
      },
      "IssueRequest": {
        "additionalProperties": false,
        "description": "IssueRequest is the body of POST /v1/emisores/{ruc}/cfes.",
        "properties": {
          "key": {
            "description": "`key` is the caller's own identifier for the sale, such as an order number: issuing the same sale with the same key again returns the CFE already issued. Strongly recommended.",
            "type": "string"
          },
          "sale": {
            "$ref": "#/components/schemas/Document",
            "description": "`sale` is the CFE's data without series and number, as cfe issue takes it."
          },
          "ui_value": {
            "description": "`ui_value` is the Unidad Indexada at the close of the year before the issue date, when cfe does not know it yet, as a decimal string.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Issuer": {
        "additionalProperties": false,
        "description": "Issuer is the emisor: the data of its RUT and branch that every CFE repeats, and the CAE DGI has authorised for it.",
        "properties": {
          "address": {
            "description": "domicilio fiscal of that branch",
            "type": "string"
          },
          "alert_emails": {
            "description": "`alert_emails` are the emisor's people told about what only they can act on, such as requesting a CAE in DGI's portal. Optional: without them, Sitios is told instead.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "appearance": {
            "$ref": "#/components/schemas/Appearance",
            "description": "`appearance` is what the emisor adds to its printed CFE besides what DGI requires. Optional: the zero value adds nothing."
          },
          "branch_code": {
            "description": "código de sucursal DGI assigned to the branch issuing",
            "type": "integer"
          },
          "caes": {
            "description": "every CAE on record; Build picks the one that covers the number",
            "items": {
              "$ref": "#/components/schemas/CAE"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "city": {
            "description": "of that branch, up to 30 characters",
            "type": "string"
          },
          "department": {
            "description": "of that branch, up to 30 characters",
            "type": "string"
          },
          "exchange_mail": {
            "description": "`exchange_mail` is the emisor's mailbox for the exchange with other emisores, the one declared to DGI as its contact with them ([DEF] §II): sobres and answers arrive there by mail, and the answers that go by mail leave from it. It is on a subdomain of the emisor's own whose MX points to Amazon SES, or on intercambio.cfe.sitios.uy for an emisor without a domain (docs/05 §9). Like `mail_from`, Sitios sets it. Optional until the exchange by mail.",
            "type": "string"
          },
          "mail_from": {
            "description": "`mail_from` is the address CFE are mailed to buyers from, on the emisor's own domain, which must be verified in Sitios' Amazon SES (decision D12 in docs/05). Optional: without it they go from Sitios' address, under the emisor's name.",
            "type": "string"
          },
          "mail_reply_to": {
            "description": "`mail_reply_to` is where buyers' replies to those mails go. Optional: without it, to `mail_from`, and nowhere when that is Sitios' address.",
            "type": "string"
          },
          "monthly_mail": {
            "$ref": "#/components/schemas/MonthlyMail",
            "description": "`monthly_mail` is how the emisor's accountant gets, once a month, the summary of the month before (package monthly). Optional: without recipients nothing is mailed."
          },
          "name": {
            "description": "razón social",
            "type": "string"
          },
          "regime_entry": {
            "description": "`regime_entry` is printed as \"Fecha emisor\": the date the emisor entered the CFE regime, AAAA-MM-DD, or for one admitted by resolution, that resolution as \"Res. 123/2026\". Optional until printing.",
            "type": "string"
          },
          "reports_since": {
            "description": "`reports_since` is the first day DGI expects a daily report, AAAA-MM-DD: the day the emisor's authorization took effect. Every calendar day from then on needs one, with or without CFE ([DEF] §IX). Optional until reports are sent on a schedule.",
            "type": "string"
          },
          "ruc": {
            "description": "12 digits with a valid check digit",
            "type": "string"
          },
          "testing_mail_to": {
            "description": "`testing_mail_to` are the emisor's own addresses that get, marked as a test, the mail a sale asks for while the emisor issues in DGI's Testing, where a CFE never goes to its buyer. Optional: without them, those mails go to nobody.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "trade_name": {
            "description": "nombre comercial, optional",
            "type": "string"
          },
          "verification_url": {
            "description": "`verification_url` is the emisor's web page where buyers verify e-Tickets ([DEF] §XIV), printed on e-Tickets and their notes. Optional until an e-Ticket is printed.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Item": {
        "additionalProperties": false,
        "description": "Item is one detail line. A line of an e-Resguardo has only its Retentions, and VAT empty or annul; a line of an e-Remito has no price.",
        "properties": {
          "description": {
            "description": "up to 1000 characters",
            "type": "string"
          },
          "discount": {
            "description": "amount off the line, in the same terms as `unit_price`; only on a sale. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "name": {
            "description": "required, up to 80 characters; empty on an e-Resguardo",
            "type": "string"
          },
          "ncm": {
            "description": "`ncm` is the goods' tariff position (B-C7.1), up to 20 characters: only on the export types, and optional.",
            "type": "string"
          },
          "quantity": {
            "description": "positive, at most 3 decimals. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "retentions": {
            "description": "`retentions` are the retentions, perceptions or fiscal credits of a line of an e-Resguardo, 1 to 5; absent on the other types.",
            "items": {
              "$ref": "#/components/schemas/Retention"
            },
            "type": "array"
          },
          "unit": {
            "description": "up to 4 characters; N/A when empty",
            "type": "string"
          },
          "unit_price": {
            "description": "with VAT when PricesIncludeVAT; zero on an e-Remito and a free line. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "vat": {
            "description": "`vat` is exempt, minimum (10%) or basic (22%) for a sale, or export for an export of services, which carries no VAT and marks the whole CFE as one (ModVenta 90; see Export); non_billable for an amount that is not a sale, such as a payment collected, or non_billable_negative for one that subtracts from those ([FMT-CFE] B-C4, indicators 6 and 7). Non-billable amounts carry no VAT and add up apart from the total, as the totals' non_billable. The types beyond the minimum combo take other indicators (Type.indicators): Free, Reduce, Annul, or none, empty, on a remito's or an e-Resguardo's ordinary line; and on an e-Boleta de entrada who sold the line, NonTaxpayer, SmallTaxpayer, IMEBATaxpayer or ForeignCurrency.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "ItemSource": {
        "description": "ItemSource is the CFE an item was last invoiced in: GET .../cfes/{type}/{series}/{number} gives its whole sale.",
        "properties": {
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "number": {
            "description": "within the series",
            "type": "integer"
          },
          "receptor": {
            "$ref": "#/components/schemas/Receptor",
            "description": "its buyer, as signed; absent for a CFE made out to nobody"
          },
          "series": {
            "description": "as on record, in capitals",
            "type": "string"
          },
          "signed_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          },
          "verdict": {
            "description": "`verdict` is DGI's: AE accepted, CE or FE; empty while DGI has given none, as for an e-Ticket only reported. Never BE: a rejected CFE is void and its lines are not searched.",
            "type": "string"
          }
        },
        "required": [
          "type",
          "type_name",
          "series",
          "number",
          "issue_date",
          "signed_at",
          "verdict"
        ],
        "type": "object"
      },
      "Items": {
        "description": "Items is the data of GET /v1/emisores/{ruc}/items: the items of the emisor's newest sales that the search found.",
        "properties": {
          "items": {
            "description": "`items` are newest first, by the CFE each was last invoiced in, and then in the order of its lines; at most 30.",
            "items": {
              "$ref": "#/components/schemas/InvoicedItem"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "items_not_shown": {
            "description": "`items_not_shown` counts the items found beyond the 30 shown, all older than those in items: more words narrow the search.",
            "type": "integer"
          },
          "not_scanned": {
            "description": "`not_scanned` counts the older sales that bound left unread: an item invoiced only in those is not in items. 0 when every sale was read.",
            "type": "integer"
          },
          "q": {
            "description": "the words asked for, as given; absent when none were",
            "type": "string"
          },
          "receptor": {
            "description": "the buyer's document asked for, as given; absent when none was",
            "type": "string"
          },
          "scanned": {
            "description": "`scanned` counts the sales read, newest first: at most 500, the newest e-Tickets, e-Facturas and debit notes that are not collections and that DGI did not reject, made out to receptor when it is given.",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "scanned",
          "not_scanned",
          "items_not_shown"
        ],
        "type": "object"
      },
      "Line": {
        "description": "Line is one CFE in the summary.",
        "properties": {
          "amounts": {
            "$ref": "#/components/schemas/Amounts",
            "description": "as written, in Currency"
          },
          "collection": {
            "description": "`collection` marks a CFE that documents a payment received rather than a sale: it carries no VAT and is never summed.",
            "type": "boolean"
          },
          "counterpart": {
            "$ref": "#/components/schemas/Party",
            "description": "`counterpart` is the receptor of a CFE issued, or the emisor of one received."
          },
          "currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "effect": {
            "description": "EffectAdds, EffectSubtracts or EffectNone",
            "type": "string"
          },
          "exchange_rate": {
            "description": "`exchange_rate` is the CFE's own, pesos per unit of Currency; 1 for pesos. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "name": {
            "description": "as people name the type: e-Factura, Nota de Crédito de e-Factura, e-Factura Cobranza",
            "type": "string"
          },
          "number": {
            "description": "within Series",
            "type": "integer"
          },
          "payable": {
            "description": "`payable` is what the CFE asks to be paid (MntPagar), in Currency: for a collection, what was collected. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "payable_pesos": {
            "description": "Payable in pesos, unsigned. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "pesos": {
            "$ref": "#/components/schemas/Amounts",
            "description": "`pesos` is what the CFE adds to its sum, in pesos at `exchange_rate`: zero when it does not count, negative for a credit note."
          },
          "series": {
            "description": "Serie, such as A",
            "type": "string"
          },
          "status": {
            "description": "one of the Status constants",
            "type": "string"
          },
          "type": {
            "description": "the DGI code of [FMT-CFE] Tabla A, such as 111 for an e-Factura. Type is a CFE type code ([FMT-CFE] Tabla A).",
            "type": "integer"
          },
          "verdict": {
            "description": "DGI's, for a CFE issued: AE, BE, CE or FE",
            "type": "string"
          }
        },
        "required": [
          "type",
          "name",
          "series",
          "number",
          "issue_date",
          "counterpart",
          "currency",
          "exchange_rate",
          "amounts",
          "payable",
          "payable_pesos",
          "pesos",
          "effect",
          "status"
        ],
        "type": "object"
      },
      "LinkRequest": {
        "additionalProperties": false,
        "description": "LinkRequest is the body of /v1/login/info and /v1/login/confirm.",
        "properties": {
          "link_secret": {
            "description": "what the mailed link carries after the #",
            "type": "string"
          }
        },
        "type": "object"
      },
      "LoginInfo": {
        "description": "LoginInfo is the data of POST /v1/login/info.",
        "properties": {
          "client": {
            "description": "portal or cli",
            "type": "string"
          },
          "device": {
            "description": "as the login was started with it, at most 100 bytes; \"unknown\" if none",
            "type": "string"
          },
          "email": {
            "description": "who is logging in, in lower case",
            "type": "string"
          },
          "expires_at": {
            "description": "RFC 3339: confirm before then",
            "type": "string"
          },
          "signup": {
            "$ref": "#/components/schemas/LoginSignup",
            "description": "`signup` is the business the login signs up (POST /v1/signup): confirming makes it an emisor with the person as its admin. Absent for a login to an account."
          },
          "user_code": {
            "description": "cli only",
            "type": "string"
          }
        },
        "required": [
          "email",
          "client",
          "device",
          "expires_at"
        ],
        "type": "object"
      },
      "LoginSignup": {
        "description": "LoginSignup is the business a login signs up, for the confirmation page to name.",
        "properties": {
          "name": {
            "description": "the razón social DGI's RUT registry gave",
            "type": "string"
          },
          "ruc": {
            "description": "12 digits",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "name"
        ],
        "type": "object"
      },
      "LoginStart": {
        "description": "LoginStart is the data of POST /v1/login. It is the same whether or not the email has an account.",
        "properties": {
          "email": {
            "description": "the one asked for, trimmed and in lower case",
            "type": "string"
          },
          "expires_at": {
            "description": "RFC 3339: confirm before then",
            "type": "string"
          },
          "poll_secret": {
            "description": "cli: send it to /v1/login/collect until a token comes back",
            "type": "string"
          },
          "user_code": {
            "description": "cli: show it; the confirmation page shows the same",
            "type": "string"
          }
        },
        "required": [
          "email",
          "expires_at"
        ],
        "type": "object"
      },
      "LoginStartRequest": {
        "additionalProperties": false,
        "description": "LoginStartRequest is the body of POST /v1/login.",
        "properties": {
          "client": {
            "description": "portal or cli",
            "type": "string"
          },
          "device": {
            "description": "what the client is, e.g. a host name; names the token",
            "type": "string"
          },
          "email": {
            "description": "where the link goes; spaces and case do not matter",
            "type": "string"
          }
        },
        "type": "object"
      },
      "LogoInfo": {
        "description": "LogoInfo describes the emisor's logo, without the image.",
        "properties": {
          "bytes": {
            "description": "the size of the image file",
            "type": "integer"
          },
          "content_type": {
            "description": "image/png or image/jpeg",
            "type": "string"
          },
          "height": {
            "description": "pixels",
            "type": "integer"
          },
          "recorded_at": {
            "description": "RFC 3339: when it was set",
            "type": "string"
          },
          "width": {
            "description": "pixels",
            "type": "integer"
          }
        },
        "required": [
          "content_type",
          "width",
          "height",
          "bytes",
          "recorded_at"
        ],
        "type": "object"
      },
      "MailRequest": {
        "additionalProperties": false,
        "description": "MailRequest is the body of POST /v1/emisores/{ruc}/cfes/{type}/{series}/{number}/mail.",
        "properties": {
          "to": {
            "description": "the buyer's email address",
            "type": "string"
          }
        },
        "type": "object"
      },
      "MailState": {
        "description": "MailState is a mail of a CFE to a buyer.",
        "properties": {
          "failure": {
            "description": "why the last attempt failed, or why it was withheld",
            "type": "string"
          },
          "instead_of": {
            "description": "`instead_of` is, for a mail to testing_mail_to, the buyer's address it went in place of.",
            "type": "string"
          },
          "requested_at": {
            "description": "RFC 3339",
            "type": "string"
          },
          "requested_by": {
            "description": "`requested_by` is who asked for it: sale (its mail_to), person (an address someone typed, with a portal or cli token) or agent (a program with an agent token); absent for a mail asked for before this was recorded.",
            "type": "string"
          },
          "sent_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "status": {
            "description": "`status` is waiting (to be sent: a CFE DGI must receive goes once DGI accepted it), sent, failed (the attempts ran out and an alert says so), bounced (sent, and refused by the buyer's server; Failure says why), or withheld (never sent, on purpose: in DGI's Testing a mail to an address no person typed, the sale's or an agent's, never goes there, and goes instead to the profile's testing_mail_to, if any).",
            "type": "string"
          },
          "to": {
            "description": "the address it is for",
            "type": "string"
          }
        },
        "required": [
          "to",
          "requested_at",
          "status"
        ],
        "type": "object"
      },
      "Me": {
        "description": "Me is the data of GET /v1/me.",
        "properties": {
          "email": {
            "description": "the user the token belongs to, in lower case",
            "type": "string"
          },
          "emisores": {
            "description": "by RUC",
            "items": {
              "$ref": "#/components/schemas/EmisorRole"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "token": {
            "$ref": "#/components/schemas/Token",
            "description": "the one this request carries"
          }
        },
        "required": [
          "email",
          "token",
          "emisores"
        ],
        "type": "object"
      },
      "Member": {
        "description": "Member is a user with a role on an emisor.",
        "properties": {
          "disabled": {
            "description": "Sitios stopped the user: it can no longer log in or use tokens",
            "type": "boolean"
          },
          "email": {
            "description": "lower case: the identity a login proves",
            "type": "string"
          },
          "granted_at": {
            "description": "RFC 3339, in Montevideo: when the role was last given",
            "type": "string"
          },
          "name": {
            "description": "the user's name; absent until someone gives one",
            "type": "string"
          },
          "role": {
            "description": "view, issue or admin",
            "type": "string"
          }
        },
        "required": [
          "email",
          "role",
          "granted_at",
          "disabled"
        ],
        "type": "object"
      },
      "Members": {
        "description": "Members is the data of GET /v1/emisores/{ruc}/members.",
        "properties": {
          "members": {
            "description": "by email",
            "items": {
              "$ref": "#/components/schemas/Member"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "members"
        ],
        "type": "object"
      },
      "MonthMailAttempt": {
        "description": "MonthMailAttempt is one attempt to mail a month's summary.",
        "properties": {
          "detail": {
            "description": "summary, spreadsheet or pdfs, as sent",
            "type": "string"
          },
          "failure": {
            "description": "why it did not go; absent when it went",
            "type": "string"
          },
          "final": {
            "description": "`final` says that DGI had received the report of the month's last day; otherwise the mail said it was preliminary.",
            "type": "boolean"
          },
          "recipients": {
            "description": "the addresses it was tried to, as they were then",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "requested_by": {
            "description": "`requested_by` is schedule, or who asked for it to go: a person's email, or cli for Sitios on the server.",
            "type": "string"
          },
          "tried_at": {
            "description": "RFC 3339",
            "type": "string"
          }
        },
        "required": [
          "final",
          "requested_by",
          "recipients",
          "detail",
          "tried_at"
        ],
        "type": "object"
      },
      "MonthMailView": {
        "description": "MonthMailView is where a month's mail to the accountant stands.",
        "properties": {
          "addressees": {
            "description": "`addressees` are who the mail goes to now (monthly.Addressees): the settings' recipients, or for a ledger of DGI's Testing the profile's testing_mail_to instead. Empty: nobody gets it.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "attempts": {
            "description": "oldest first",
            "items": {
              "$ref": "#/components/schemas/MonthMailAttempt"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "sent": {
            "description": "`sent` says that the month's mail went: one sent after DGI received the report of its last day. The schedule does not send it again.",
            "type": "boolean"
          },
          "settings": {
            "$ref": "#/components/schemas/MonthlyMail",
            "description": "the profile's monthly_mail, as it is now"
          }
        },
        "required": [
          "settings",
          "addressees",
          "sent",
          "attempts"
        ],
        "type": "object"
      },
      "MonthView": {
        "description": "MonthView is where an emisor's month stands for its accountant: its summary, with the CFE received through the exchange in purchases, and its mail. It is what the API and the CLI show of a month.",
        "properties": {
          "ended": {
            "description": "`ended` says that the month is over, in Montevideo; a month under way still changes.",
            "type": "boolean"
          },
          "last_day_report": {
            "description": "`last_day_report` is DGI's answer to the latest daily report of the month's last day: AR received, BR rejected, \"\" while there is none or DGI has not answered. The month's mail goes once it is AR.",
            "type": "string"
          },
          "mail": {
            "$ref": "#/components/schemas/MonthMailView",
            "description": "where the month's mail to the accountant stands"
          },
          "summary": {
            "$ref": "#/components/schemas/Summary",
            "description": "as package monthly builds it, purchases included"
          }
        },
        "required": [
          "summary",
          "ended",
          "last_day_report",
          "mail"
        ],
        "type": "object"
      },
      "MonthlyMail": {
        "additionalProperties": false,
        "description": "MonthlyMail are the settings of the monthly mail to the emisor's accountant: who gets it and what it carries. The zero value mails nobody.",
        "properties": {
          "detail": {
            "description": "`detail` is how much the mail carries: MonthlySummary, MonthlySpreadsheet or MonthlyPDFs. Empty means MonthlySpreadsheet (Level).",
            "type": "string"
          },
          "include_collections": {
            "description": "`include_collections` lists the month's collections apart in the mail's text, never summed: they carry no VAT. The spreadsheet always has them.",
            "type": "boolean"
          },
          "include_purchases": {
            "description": "`include_purchases` adds the CFE other emisores sent through the exchange, as a partial help: not every purchase arrives that way.",
            "type": "boolean"
          },
          "to": {
            "description": "`to` are the addresses that get it, at most maxMonthlyRecipients; empty means no mail.",
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "MonthlyMailAttachment": {
        "description": "MonthlyMailAttachment is a file the monthly mail carries.",
        "properties": {
          "bytes": {
            "description": "its size",
            "type": "integer"
          },
          "name": {
            "description": "the file name the accountant sees",
            "type": "string"
          }
        },
        "required": [
          "name",
          "bytes"
        ],
        "type": "object"
      },
      "MonthlyMailReport": {
        "description": "MonthlyMailReport is a monthly mail as the API and the CLI show it, sent or as it would be on a dry run.",
        "properties": {
          "attachments": {
            "description": "the spreadsheet, and the PDFs' zip when they fit; empty for summary",
            "items": {
              "$ref": "#/components/schemas/MonthlyMailAttachment"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "detail": {
            "description": "`detail` is the level sent: the settings', or spreadsheet when the PDFs were asked for and did not fit (pdfs_left_out); the mail then says they are downloaded from the portal.",
            "type": "string"
          },
          "dry_run": {
            "description": "nothing was sent or recorded: this is the mail as it would go",
            "type": "boolean"
          },
          "final": {
            "description": "`final` says that DGI had received the report of the month's last day: this is the month's mail, and the schedule does not send it again. Otherwise the mail says it is preliminary, and the schedule still sends the final one.",
            "type": "boolean"
          },
          "pdfs_left_out": {
            "description": "the PDFs were asked for and did not fit",
            "type": "boolean"
          },
          "subject": {
            "description": "in Spanish, as the accountant reads it",
            "type": "string"
          },
          "text": {
            "description": "the mail's body, plain text in Spanish",
            "type": "string"
          },
          "to": {
            "description": "the addresses it went to, or would go to",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "final",
          "detail",
          "pdfs_left_out",
          "to",
          "subject",
          "text",
          "attachments",
          "dry_run"
        ],
        "type": "object"
      },
      "MonthlyWarning": {
        "description": "Warning is something in the month the accountant must know before using the sums.",
        "properties": {
          "kind": {
            "description": "awaiting, rejected, purchases_unread or purchases_rejected",
            "type": "string"
          },
          "message": {
            "description": "in English",
            "type": "string"
          },
          "notice": {
            "description": "in Spanish, for the accountant",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "message",
          "notice"
        ],
        "type": "object"
      },
      "NamedCFE": {
        "description": "NamedCFE is a CFE an application names.",
        "properties": {
          "number": {
            "description": "within the series",
            "type": "integer"
          },
          "series": {
            "description": "as on record, in capitals",
            "type": "string"
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          }
        },
        "required": [
          "type",
          "type_name",
          "series",
          "number"
        ],
        "type": "object"
      },
      "Owner": {
        "additionalProperties": false,
        "description": "Owner identifies the third party whose goods a remito moves (A-C6.2 to A-C6.6). Its document follows the rules of a receiver's, without the NIE.",
        "properties": {
          "country": {
            "description": "as Receiver.Country: UY by default for rut and ci",
            "type": "string"
          },
          "doc_type": {
            "description": "rut, ci, other, passport, dni or nife",
            "type": "string"
          },
          "document": {
            "description": "as Receiver.Document",
            "type": "string"
          },
          "name": {
            "description": "up to 150 characters",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Padron": {
        "description": "Padron is what DGI's padrón of emisores electrónicos says of a RUC ([WS-CON]). Testing's lists only DGI's own test RUC, 219999830019.",
        "properties": {
          "electronic": {
            "description": "`electronic` says it is an emisor electrónico today: listed, from a day already come, and not ended. As such it is also a receptor electrónico, to which the CFE made out to it go in a sobre.",
            "type": "boolean"
          },
          "exchange_mail": {
            "description": "`exchange_mail` is the mailbox that takes its sobres and answers, and `exchange_url` its web service (ws_efactura_intercambio) as it registered it; either is absent when it registered none.",
            "type": "string"
          },
          "exchange_url": {
            "description": "see `exchange_mail`",
            "type": "string"
          },
          "listed": {
            "description": "`listed` says the padrón has the RUC as an emisor electrónico, today or in the past. Without it, the fields after electronic are absent.",
            "type": "boolean"
          },
          "name": {
            "description": "its razón social, as the padrón writes it",
            "type": "string"
          },
          "since": {
            "description": "AAAA-MM-DD: when it became an emisor electrónico",
            "type": "string"
          },
          "technical_mail": {
            "description": "whom to write about its web service",
            "type": "string"
          },
          "until": {
            "description": "AAAA-MM-DD: when it stopped being one; absent while it is one",
            "type": "string"
          }
        },
        "required": [
          "listed",
          "electronic"
        ],
        "type": "object"
      },
      "Party": {
        "description": "Party is who is on the other side of a CFE: the receptor of one issued, the emisor of one received.",
        "properties": {
          "document": {
            "description": "RUT, C.I. or another document, as written",
            "type": "string"
          },
          "name": {
            "description": "razón social; \"\" when the CFE names none, as an e-Ticket below the threshold",
            "type": "string"
          }
        },
        "type": "object"
      },
      "PaymentMethod": {
        "additionalProperties": false,
        "description": "PaymentMethod is one way the CFE was paid ([FMT-CFE] E-C2 to E-C5).",
        "properties": {
          "amount": {
            "description": "`amount` is what was paid that way, with at most 2 decimals; a negative one is change given back. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "code": {
            "description": "`code` is the emisor's own code for the method, 1 to 999, or 0 for none: DGI publishes no table and does not check it.",
            "type": "integer"
          },
          "gloss": {
            "description": "`gloss` names the method as printed, such as \"Transferencia bancaria\": required, up to 100 characters.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Period": {
        "description": "Period is one month of service an emisor is charged for.",
        "properties": {
          "end": {
            "description": "AAAA-MM-DD, its last day: the day before the next starts",
            "type": "string"
          },
          "index": {
            "description": "0 for the first, counted from the anchor",
            "type": "integer"
          },
          "start": {
            "description": "AAAA-MM-DD, the day it is charged",
            "type": "string"
          }
        },
        "required": [
          "index",
          "start",
          "end"
        ],
        "type": "object"
      },
      "Preview": {
        "description": "Preview is the data of POST /v1/emisores/{ruc}/cfes/preview asked for as JSON: what the sale would become if issued now, worked out as issuing it would and without issuing it. Nothing is numbered, signed or kept.",
        "properties": {
          "adenda": {
            "description": "`adenda` is what would print as the CFE's adenda: the sale's own text, then the profile's appearance.adenda. Absent when there is none.",
            "type": "string"
          },
          "collection": {
            "description": "`collection` marks a collection (a cobranza), as a CFE's.",
            "type": "boolean"
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "language": {
            "description": "`language` is the language the CFE would also print in, beside Spanish, as the sale asks (sale.language): en. Absent for Spanish only. Language is a language a CFE's printout and its mail to the buyer come in besides Spanish, as an ISO 639-1 code. DGI requires the printed CFE in Spanish and lets it carry the same data in another language as well ([FAQ] §8.15), so there is no printout in another language alone: the zero Language, Spanish, prints in Spanish only, and any other prints both.",
            "type": "string"
          },
          "lines": {
            "description": "in the CFE's order",
            "items": {
              "$ref": "#/components/schemas/PreviewLine"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "must_send": {
            "description": "DGI would have to receive it in a sobre",
            "type": "boolean"
          },
          "no_cae": {
            "description": "`no_cae` says the emisor has no CAE in force for the sale's type, so the preview took a stand-in, series A: issuing it would answer no_numbers until an admin loads one. For a type beyond the minimum combo, DGI must first enable the type for the emisor (\"Certificar nuevo CFE\"). Absent when there is one.",
            "type": "boolean"
          },
          "over_ui_threshold": {
            "description": "as a CFE's: an e-Ticket or e-Ticket note above the UI threshold",
            "type": "boolean"
          },
          "prices_include_vat": {
            "description": "`prices_include_vat` says the lines' unit_price and amount include VAT.",
            "type": "boolean"
          },
          "references": {
            "description": "`references` are the CFE a note would correct, or a collection collect, completed from the CFE on record as issuing would: their date, currency and, when it can be told, the amount. Absent without any.",
            "items": {
              "$ref": "#/components/schemas/CorrectedCFE"
            },
            "type": "array"
          },
          "sample": {
            "description": "`sample` says no sale was sent, and this is the sample e-Factura.",
            "type": "boolean"
          },
          "totals": {
            "$ref": "#/components/schemas/Totals",
            "description": "`totals` are what the CFE would add up to, as an issued CFE's: in a currency other than pesos with the exchange_rate it would take, the sale's own or else the BCU's of the business day before the issue date, which the ledger has (or the answer is exchange_rate_unknown)."
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          }
        },
        "required": [
          "type",
          "type_name",
          "issue_date",
          "totals",
          "over_ui_threshold",
          "must_send",
          "prices_include_vat",
          "lines"
        ],
        "type": "object"
      },
      "PreviewLine": {
        "description": "PreviewLine is one line of a preview, as the CFE would write it.",
        "properties": {
          "amount": {
            "description": "`amount` is the line's amount: quantity times unit_price, less the discount, with VAT when prices_include_vat; absent on an e-Remito and an e-Resguardo.",
            "type": "string"
          },
          "description": {
            "description": "the item's, absent when the sale gives none",
            "type": "string"
          },
          "discount": {
            "description": "the amount taken off the line",
            "type": "string"
          },
          "line": {
            "description": "from 1",
            "type": "integer"
          },
          "name": {
            "description": "the item's, as the sale gives it; absent on an e-Resguardo",
            "type": "string"
          },
          "ncm": {
            "description": "the tariff position, on the export types; absent when the sale gives none",
            "type": "string"
          },
          "quantity": {
            "description": "a decimal, up to three decimals; absent on an e-Resguardo",
            "type": "string"
          },
          "retentions": {
            "description": "`retentions` are an e-Resguardo line's retentions and perceptions, as the sale gives them; absent on the other types.",
            "items": {
              "$ref": "#/components/schemas/PreviewRetention"
            },
            "type": "array"
          },
          "unit": {
            "description": "N/A when the sale gave none; absent on an e-Resguardo",
            "type": "string"
          },
          "unit_price": {
            "description": "`unit_price` is a decimal, up to six decimals, with VAT when prices_include_vat; absent on an e-Remito and an e-Resguardo.",
            "type": "string"
          },
          "vat": {
            "description": "`vat` is exempt, minimum, basic, export, non_billable or non_billable_negative on a sale of the minimum combo; export, free, non_billable or non_billable_negative on an e-Factura de exportación; free or reduce on a remito and annul on an e-Resguardo; non_taxpayer, small_taxpayer, imeba, foreign_currency, free, non_billable or non_billable_negative on an e-Boleta de entrada; absent on a remito's or an e-Resguardo's ordinary line.",
            "type": "string"
          }
        },
        "required": [
          "line"
        ],
        "type": "object"
      },
      "PreviewRequest": {
        "additionalProperties": false,
        "description": "PreviewRequest is the body of POST /v1/emisores/{ruc}/cfes/preview.",
        "properties": {
          "sale": {
            "$ref": "#/components/schemas/Document",
            "description": "`sale` is a sale as POST .../cfes takes it, without series and number. Absent, the preview is of a sample e-Factura, to see how the emisor's CFE look: its logo, its appearance and the adenda it adds."
          },
          "ui_value": {
            "description": "`ui_value` is as in POST .../cfes.",
            "type": "string"
          }
        },
        "type": "object"
      },
      "PreviewRetention": {
        "description": "PreviewRetention is one retention, perception or fiscal credit of an e-Resguardo's line, as it would be written.",
        "properties": {
          "amount": {
            "description": "what was retained or perceived",
            "type": "string"
          },
          "base": {
            "description": "the amount subject to it",
            "type": "string"
          },
          "code": {
            "description": "DGI's code: the form and its line, such as 2183211",
            "type": "string"
          },
          "info": {
            "description": "other information about it",
            "type": "string"
          },
          "rate": {
            "description": "in percent, three decimals; absent when the sale gives none",
            "type": "string"
          }
        },
        "required": [
          "code",
          "base",
          "amount"
        ],
        "type": "object"
      },
      "PriceInfo": {
        "description": "PriceInfo is the price of a month, in pesos, as decimals with two places.",
        "properties": {
          "currency": {
            "type": "string"
          },
          "net": {
            "description": "999.00",
            "type": "string"
          },
          "total": {
            "description": "1218.78: what the card is charged",
            "type": "string"
          },
          "vat": {
            "description": "219.78",
            "type": "string"
          }
        },
        "required": [
          "net",
          "vat",
          "total",
          "currency"
        ],
        "type": "object"
      },
      "Principal": {
        "additionalProperties": false,
        "description": "Principal is the mandante: the one on whose behalf a sale on behalf of others is made, named in the Complemento Fiscal ([FMT-CFE] zona K; [FAQ] 1.11, 4.18). Required on the types 131 to 143; on an e-Boleta de entrada, only with ForeignCurrencyResale, for a purchase of foreign currency made on behalf of another (A-C21 = 2); absent on the other types. It goes to DGI and to the receiver unencrypted: the encrypted zona K, which keeps the principal from the receiver, is not supported.",
        "properties": {
          "country": {
            "description": "`country` is as Receiver.Country (K-C3): UY by default for rut, ci and nie, which must be Uruguayan.",
            "type": "string"
          },
          "doc_type": {
            "description": "`doc_type` is one of rut, ci, nie, passport, dni, nife or other (K-C2); only nie, rut or nife on an e-Boleta de entrada.",
            "type": "string"
          },
          "document": {
            "description": "`document` is the number of the document, as Receiver.Document (K-C4); never the emisor's own RUC.",
            "type": "string"
          },
          "name": {
            "description": "K-C5: up to 150 characters",
            "type": "string"
          },
          "no_vat_certificate": {
            "description": "`no_vat_certificate` says the principal lacks the constancia of being up to date with VAT, which the CFE tells the receiver (A-C17 = 2, \"No IVA al día mandante\"). Only on the sales on behalf of others; false, as for most, declares the principal up to date. The emisor's own is never declared lacking: every CFE built here leaves it up to date.",
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "Problem": {
        "description": "Problem is one problem of an input, with the JSON path of its field.",
        "properties": {
          "field": {
            "description": "e.g. items[0].unit_price",
            "type": "string"
          },
          "message": {
            "description": "in English: what is wrong and what is allowed",
            "type": "string"
          }
        },
        "required": [
          "field",
          "message"
        ],
        "type": "object"
      },
      "Problems": {
        "description": "Problems is the data beside sale_invalid and profile_invalid.",
        "properties": {
          "problems": {
            "description": "every one found, not only the first",
            "items": {
              "$ref": "#/components/schemas/Problem"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "problems"
        ],
        "type": "object"
      },
      "Purchases": {
        "description": "Purchases are the CFE other emisores sent this one through the exchange in the month, by their issue date. They are a partial help: purchases on paper, from emisores that do not send through the exchange, and those from before the emisor's exchange came to this system are not here.",
        "properties": {
          "counted": {
            "description": "the CFE in Totals, by issue date",
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "excluded": {
            "description": "`excluded` are CFE received that are not summed: rejected by this emisor, collections, or of types that are not sales with VAT (an e-Remito, an e-Resguardo, an export).",
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "totals": {
            "$ref": "#/components/schemas/Amounts",
            "description": "`totals` are those of Counted, in pesos: their credit notes subtract."
          },
          "unread": {
            "description": "`unread` are the CFE in Counted whose total is not fully explained by the amounts read (exempt, net and VAT at each rate): they have amounts this package does not read, such as perceptions or VAT in suspense. Their Pesos.Total still holds the whole total. as Line.Label",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "totals",
          "counted",
          "excluded",
          "unread"
        ],
        "type": "object"
      },
      "RUT": {
        "description": "RUT is the data of GET /v1/emisores/{ruc}/rut/{other}: what DGI says of one RUC, in two parts that DGI answers apart, and the buyer a sale to it takes. A part DGI did not answer is absent, and unanswered says why.",
        "properties": {
          "environment": {
            "description": "`environment` is the DGI environment that answered, the one of the emisor's ledger: testing or production. Testing answers for a few test RUCs only (registry and padron say which), so what it says of any other says nothing of Production.",
            "type": "string"
          },
          "padron": {
            "$ref": "#/components/schemas/Padron",
            "description": "the padrón's part; absent when DGI did not answer it"
          },
          "receiver": {
            "$ref": "#/components/schemas/Receiver",
            "description": "`receiver` is the buyer as a sale takes it, from the registry's data: the RUC, its name and its domicilio fiscal, each cut to what a CFE holds. Absent when the registry gave no data."
          },
          "registry": {
            "$ref": "#/components/schemas/RUTRegistry",
            "description": "the RUT registry's part; absent when DGI did not answer it"
          },
          "ruc": {
            "description": "the one asked about",
            "type": "string"
          },
          "shortened": {
            "description": "`shortened` names the fields of receiver that were longer than a CFE holds and were cut (name, address, city, department); the registry keeps them whole. Absent when none was.",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "unanswered": {
            "description": "`unanswered` is each part DGI did not answer, and why. Absent when both answered; the lookup fails with dgi_unavailable when neither did.",
            "items": {
              "$ref": "#/components/schemas/Unanswered"
            },
            "type": "array"
          }
        },
        "required": [
          "ruc",
          "environment"
        ],
        "type": "object"
      },
      "RUTRegistry": {
        "description": "RUTRegistry is what DGI's RUT registry says of a RUC ([WS-RUT]), in its own words and capitals.",
        "properties": {
          "active": {
            "description": "`active` says its business activity is in force today (AA). Also false when DGI gave no data because it never had one, it was cancelled or it begins on a day to come (codes 10 to 12); absent when DGI said nothing of it.",
            "type": "boolean"
          },
          "activity_since": {
            "description": "AAAA-MM-DD: when its business activity began",
            "type": "string"
          },
          "activity_state": {
            "description": "`activity_state` is the state of its business activity as DGI codes it: AA active, AF active from a day to come, CC cancelled, CH cancelled today, NT never had any.",
            "type": "string"
          },
          "address": {
            "description": "`address` is the domicilio fiscal of its main premises, as a sale writes it: the street, the door number, BIS and the apartment; city is its localidad and department its departamento.",
            "type": "string"
          },
          "city": {
            "description": "see address",
            "type": "string"
          },
          "code": {
            "description": "DGI's code for why it gave no data, e.g. 10, 11, 14",
            "type": "integer"
          },
          "department": {
            "description": "see address",
            "type": "string"
          },
          "entity_type": {
            "description": "see `trade_name`",
            "type": "string"
          },
          "found": {
            "description": "`found` says the registry gave the RUC's data. Without it, code and notice say why not, and the fields after them are absent except active: in Testing, code 14 is any RUC but DGI's test ones.",
            "type": "boolean"
          },
          "name": {
            "description": "the razón social, or the person's name",
            "type": "string"
          },
          "notice": {
            "description": "DGI's text for code, in Spanish",
            "type": "string"
          },
          "postal_code": {
            "description": "of the same premises; absent when DGI has none",
            "type": "string"
          },
          "trade_name": {
            "description": "`trade_name` is its nombre de fantasía and `entity_type` the kind of entity, e.g. SOCIEDAD ANONIMA; either may be absent.",
            "type": "string"
          }
        },
        "required": [
          "found"
        ],
        "type": "object"
      },
      "Reason": {
        "additionalProperties": false,
        "description": "Reason is a reason to reject a CFE received, as DGI codes it.",
        "properties": {
          "code": {
            "description": "DGI's, e.g. E05; rejecting a CFE received takes E02 to E07, E10 to E12 or E20 to E26",
            "type": "string"
          },
          "description": {
            "description": "DGI's text for the code, in Spanish",
            "type": "string"
          },
          "detail": {
            "description": "what in particular, as whoever gave the reason wrote it",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Reasons": {
        "description": "Reasons is the data of GET /v1/rejection-reasons.",
        "properties": {
          "reasons": {
            "description": "by code",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "reasons"
        ],
        "type": "object"
      },
      "Received": {
        "description": "Received is a CFE another emisor sent, and this emisor's answer to it.",
        "properties": {
          "accepts_at": {
            "description": "RFC 3339: when cfe sync accepts it if nobody answered",
            "type": "string"
          },
          "answer": {
            "description": "`answer` is accepted or rejected; empty while there is none. `answered_by` is who gave it: a user's email, or auto for cfe sync.",
            "type": "string"
          },
          "answer_by": {
            "description": "RFC 3339: DGI's deadline for the answer",
            "type": "string"
          },
          "answer_delivery": {
            "description": "`answer_delivery` is where the answer stands on its way to the CFE's emisor: pending (tried every hour by cfe sync), sent, or failed (given up); empty while there is no answer. `answer_sent_at` is when it was sent, and `answer_failure` why the last attempt failed.",
            "type": "string"
          },
          "answer_failure": {
            "description": "see `answer_delivery`",
            "type": "string"
          },
          "answer_sent_at": {
            "description": "RFC 3339, in Montevideo; see `answer_delivery`",
            "type": "string"
          },
          "answered_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "answered_by": {
            "description": "see answer",
            "type": "string"
          },
          "currency": {
            "description": "ISO 4217",
            "type": "string"
          },
          "id": {
            "description": "this emisor's number for it, which the routes on one take",
            "format": "int64",
            "type": "integer"
          },
          "issue_date": {
            "description": "AAAA-MM-DD",
            "type": "string"
          },
          "issuer_name": {
            "description": "its razón social, as the CFE says",
            "type": "string"
          },
          "issuer_ruc": {
            "description": "the emisor that sent it, 12 digits",
            "type": "string"
          },
          "number": {
            "description": "within the series",
            "type": "integer"
          },
          "reasons": {
            "description": "why it was rejected",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          },
          "received_at": {
            "description": "RFC 3339, in Montevideo: when it was recorded here",
            "type": "string"
          },
          "series": {
            "description": "as the CFE says",
            "type": "string"
          },
          "total": {
            "description": "the amount to pay (MntPagar), as the CFE writes it",
            "type": "string"
          },
          "type": {
            "description": "DGI's code, e.g. 111",
            "type": "integer"
          },
          "type_name": {
            "description": "the type's name as DGI writes it, e.g. e-Factura",
            "type": "string"
          }
        },
        "required": [
          "id",
          "issuer_ruc",
          "issuer_name",
          "type",
          "type_name",
          "series",
          "number",
          "issue_date",
          "currency",
          "total",
          "received_at",
          "answer_by",
          "accepts_at",
          "answer"
        ],
        "type": "object"
      },
      "ReceivedList": {
        "description": "ReceivedList is the data of GET /v1/emisores/{ruc}/received.",
        "properties": {
          "date": {
            "description": "AAAA-MM-DD, when listed by date",
            "type": "string"
          },
          "received": {
            "description": "oldest first",
            "items": {
              "$ref": "#/components/schemas/Received"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "received"
        ],
        "type": "object"
      },
      "Receiver": {
        "additionalProperties": false,
        "description": "Receiver is the buyer, or the seller on an e-Boleta de entrada. An e-Factura and its notes need a RUC; an e-Ticket needs a document only above the UI threshold; an export type needs the buyer's name and full address but not a document; an e-Boleta de entrada always the seller's document, name and address ([FMT-CFE] A-C60 to A-C66.1; [FAQ] 1.14).",
        "properties": {
          "address": {
            "description": "up to 70 characters; required on an e-Factura and an e-Boleta de entrada",
            "type": "string"
          },
          "city": {
            "description": "up to 30 characters; required on an e-Factura and an e-Boleta de entrada",
            "type": "string"
          },
          "country": {
            "description": "`country` is the ISO 3166 alpha-2 code of the issuing country, or 99 if it has none. It defaults to UY for rut, ci and nie, which must be Uruguayan.",
            "type": "string"
          },
          "country_name": {
            "description": "`country_name` is the receiver's country as printed, such as Argentina (PaisRecep, A-C66.1): up to 30 characters, required on an export type.",
            "type": "string"
          },
          "department": {
            "description": "or province or state, up to 30 characters; required on an export type",
            "type": "string"
          },
          "doc_type": {
            "description": "`doc_type` is one of rut, ci, nie, passport, dni, nife or other; empty, with Document, only on an export type.",
            "type": "string"
          },
          "document": {
            "description": "`document` is the number of the document `doc_type` names, as written on it: a RUC or a cédula with its check digit and no dots or dash, up to 12 characters for rut, ci and nie and up to 20 for the others.",
            "type": "string"
          },
          "name": {
            "description": "up to 150 characters; required on an e-Factura and an e-Boleta de entrada",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Receptor": {
        "description": "Receptor is a buyer the emisor's CFE were made out to.",
        "properties": {
          "document": {
            "description": "`document` is the buyer's document as its CFE carry it: a RUC or a C.I. in digits, or a foreign document as given; absent for a buyer named without one. GET .../cfes?receptor= with it lists this buyer's alone.",
            "type": "string"
          },
          "name": {
            "description": "as signed on the latest of its CFE found",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      },
      "ReceptorExchange": {
        "description": "ReceptorExchange is the sobre that takes a CFE to its receptor, when the receptor is an emisor electrónico, and what the receptor answered ([DEF] §XVIII, docs/05 §9).",
        "properties": {
          "answer": {
            "description": "`answer` is the receptor's commercial answer to the CFE: AE accepted or BE rejected, with its reasons; absent before it came. A rejection does not annul the CFE: correcting it, if at all, takes a note.",
            "type": "string"
          },
          "answer_reasons": {
            "description": "why the receptor rejected the CFE (BE)",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          },
          "failure": {
            "description": "why the last try to send the sobre failed",
            "type": "string"
          },
          "receipt": {
            "description": "`receipt` is the receptor's acknowledgment of the sobre: AS received or BS rejected, with its reasons; absent before it came.",
            "type": "string"
          },
          "receipt_reasons": {
            "description": "why the receptor rejected the sobre (BS)",
            "items": {
              "$ref": "#/components/schemas/Reason"
            },
            "type": "array"
          },
          "reply": {
            "description": "the receptor's service's answer, e.g. \"1000 Sobre Recibido.\"",
            "type": "string"
          },
          "ruc": {
            "description": "the receptor's",
            "type": "string"
          },
          "sent_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "sent_to": {
            "description": "the service's URL, or mailto: and the mailbox",
            "type": "string"
          },
          "sobre": {
            "description": "the sobre's number (Idemisor)",
            "format": "int64",
            "type": "integer"
          },
          "status": {
            "description": "`status` is not_electronic (DGI's padrón does not list the receptor as an emisor electrónico: nothing goes), testing (issued in DGI's Testing, whose CFE go to no receptor), unsendable (the CFE could not make a sobre; Sitios has an alert), waiting (in a sobre cfe sync tries every hour, Failure saying why the last try failed), sent (the receptor's service, or the mailer, took it) or failed (given up after a day; Sitios has an alert).",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "status"
        ],
        "type": "object"
      },
      "Reference": {
        "additionalProperties": false,
        "description": "Reference identifies the CFE a note corrects or a collection collects, or explains why it cannot.",
        "properties": {
          "amount": {
            "description": "`amount` is the part of the referenced CFE being corrected, or paid by a collection, at most its total to pay. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "currency": {
            "description": "`currency` and `exchange_rate` are the referenced CFE's, which an Amount is in ([FMT-CFE] F-C9 and F-C10). Currency empty means the note's own; the rate is required for any currency but pesos. The ledger fills both for a CFE on record.",
            "type": "string"
          },
          "date": {
            "description": "AAAA-MM-DD of the referenced CFE; checked by DGI against it",
            "type": "string"
          },
          "exchange_rate": {
            "description": "see Currency. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "global": {
            "description": "`global` marks a reference to documents that cannot be identified one by one; Type, Series, Number, Date and Amount must then be empty.",
            "type": "boolean"
          },
          "number": {
            "description": "of the referenced CFE, 1 to 9999999",
            "type": "integer"
          },
          "reason": {
            "description": "required when Global",
            "type": "string"
          },
          "series": {
            "description": "of the referenced CFE",
            "type": "string"
          },
          "type": {
            "description": "of the referenced CFE. Type is a CFE type code ([FMT-CFE] Tabla A).",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Retention": {
        "additionalProperties": false,
        "description": "Retention is one retention, perception or fiscal credit of an e-Resguardo's line ([FMT-CFE] B-C20 to B-C23).",
        "properties": {
          "amount": {
            "description": "`amount` is what was retained or perceived, or the fiscal credit, more than zero, with at most 2 decimals. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "base": {
            "description": "`base` is the amount subject to it (MntSujetoaRet), more than zero, with at most 2 decimals. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          },
          "code": {
            "description": "`code` is DGI's code for it: the number of the form and of its line, such as 2183211, a code DGI must have registered for the emisor as agent; 2181 followed by the line for a fiscal credit; 9999001 to 9999999 for a tax DGI does not administer, which DGI does not check. Up to 8 digits.",
            "type": "string"
          },
          "info": {
            "description": "`info` is other information about it, up to 150 characters; a legend the law requires goes here. Optional.",
            "type": "string"
          },
          "rate": {
            "description": "`rate` is the rate in force on the CFE's date, in percent, with at most 3 decimals. Optional. A decimal number. Answers write it as a string, e.g. \"610.00\"; bodies may send a string or a number.",
            "type": [
              "string",
              "number"
            ]
          }
        },
        "type": "object"
      },
      "SavedCard": {
        "description": "SavedCard is the data of PUT /v1/emisores/{ruc}/billing/card.",
        "properties": {
          "card": {
            "$ref": "#/components/schemas/CardInfo",
            "description": "the card on file from now on"
          },
          "dry_run": {
            "description": "it was checked, and neither saved in dLocal nor kept",
            "type": "boolean"
          },
          "previous": {
            "$ref": "#/components/schemas/CardInfo",
            "description": "the one it replaced; absent when there was none"
          }
        },
        "required": [
          "card"
        ],
        "type": "object"
      },
      "Shipment": {
        "additionalProperties": false,
        "description": "Shipment is how a remito, an e-Remito or an e-Remito de exportación, moves its goods ([FMT-CFE] A-C6 to A-C6.6).",
        "properties": {
          "kind": {
            "description": "`kind` is the tipo de traslado (A-C6): sale, for goods sold, or internal, for a move between the emisor's own places.",
            "type": "string"
          },
          "owner": {
            "$ref": "#/components/schemas/Owner",
            "description": "`owner` is who the goods belong to when they are a third party's, which prints the legend \"Bienes de Terceros\" ([FMT-CFE] Formato de la representación impresa, 2; [FAQ] 4.30). nil when they are the emisor's."
          }
        },
        "type": "object"
      },
      "SignupRequest": {
        "additionalProperties": false,
        "description": "SignupRequest is the body of POST /v1/signup.",
        "properties": {
          "email": {
            "description": "where the login link goes; its holder becomes the emisor's admin",
            "type": "string"
          },
          "ruc": {
            "description": "the business's: 12 digits with a right check digit",
            "type": "string"
          }
        },
        "type": "object"
      },
      "SignupStarted": {
        "description": "SignupStarted is the data of POST /v1/signup: the link went out.",
        "properties": {
          "dry_run": {
            "description": "it was checked, DGI asked, and nothing was kept nor mailed",
            "type": "boolean"
          },
          "electronic": {
            "description": "`electronic` says DGI's padrón lists the RUC as an emisor electrónico today, so the business invoices with another provider and would migrate; absent when the padrón did not answer.",
            "type": "boolean"
          },
          "email": {
            "description": "as kept: trimmed, in lower case",
            "type": "string"
          },
          "expires_at": {
            "description": "RFC 3339: the link must be confirmed before then",
            "type": "string"
          },
          "name": {
            "description": "the razón social DGI's RUT registry gives",
            "type": "string"
          },
          "ruc": {
            "description": "as asked",
            "type": "string"
          }
        },
        "required": [
          "email",
          "ruc",
          "name",
          "expires_at"
        ],
        "type": "object"
      },
      "Status": {
        "description": "Status is an emisor's billing as the API (GET .../billing) and cfe-server billing show tell it.",
        "properties": {
          "cancelled_on": {
            "description": "the day of its cancellation (la baja)",
            "type": "string"
          },
          "card": {
            "$ref": "#/components/schemas/CardInfo"
          },
          "charges": {
            "description": "every attempt, oldest first",
            "items": {
              "$ref": "#/components/schemas/ChargeInfo"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "first_issued": {
            "description": "`first_issued` is the day its first CFE in Production was signed, from which its months count and on which the first was charged; absent before it.",
            "type": "string"
          },
          "invoices": {
            "description": "FOMAN's invoices, oldest first",
            "items": {
              "$ref": "#/components/schemas/InvoiceInfo"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "last_charge": {
            "$ref": "#/components/schemas/ChargeInfo",
            "description": "`last_charge` is the latest attempt, of any month; absent before the first."
          },
          "next_charge_on": {
            "description": "`next_charge_on` is the day the next month starts and is charged; absent before the first CFE in Production and once cancelled.",
            "type": "string"
          },
          "owed": {
            "$ref": "#/components/schemas/Period",
            "description": "`owed` is the oldest month owed and not paid, with due, settling, failing, exhausted and no_card."
          },
          "price": {
            "$ref": "#/components/schemas/PriceInfo",
            "description": "what a month costs"
          },
          "retry_on": {
            "description": "with failing: the next attempt's day",
            "type": "string"
          },
          "ruc": {
            "type": "string"
          },
          "state": {
            "description": "`state` is where it stands: not_started (no CFE in Production yet: nothing owed), current (every month owed is paid), due (a month is owed and the next run charges it), settling (dLocal has not told how a charge ended), failing (a charge failed and is retried on retry_on), exhausted (every retry failed: Sitios decides), no_card (a month is owed and there is no card) or cancelled (cancelled, and nothing owed).",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "price",
          "state",
          "charges",
          "invoices"
        ],
        "type": "object"
      },
      "Summary": {
        "description": "Summary is one month of an emisor, for its accountant.",
        "properties": {
          "collections": {
            "description": "`collections` are the month's collections, never summed: they carry no VAT. Those DGI rejected are in Rejected.",
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "counted": {
            "description": "`counted` are the CFE in Sales, by issue date, type, series and number; those still awaiting DGI's verdict among them (and in a warning).",
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "foreign": {
            "description": "`foreign` counts the CFE in Counted that are in another currency.",
            "type": "integer"
          },
          "month": {
            "description": "AAAA-MM",
            "type": "string"
          },
          "purchases": {
            "$ref": "#/components/schemas/Purchases",
            "description": "`purchases` are the CFE received through the exchange; nil unless asked for."
          },
          "rejected": {
            "description": "`rejected` are the CFE DGI rejected, void and never summed.",
            "items": {
              "$ref": "#/components/schemas/Line"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "sales": {
            "$ref": "#/components/schemas/Amounts",
            "description": "`sales` are the month's CFE that count for VAT, summed in pesos: credit notes subtract."
          },
          "types": {
            "description": "what each type adds to Sales, in typeOrder",
            "items": {
              "$ref": "#/components/schemas/TypeCount"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "warnings": {
            "description": "empty, never nil, when there is nothing to warn of",
            "items": {
              "$ref": "#/components/schemas/MonthlyWarning"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "month",
          "sales",
          "types",
          "counted",
          "collections",
          "rejected",
          "foreign",
          "warnings"
        ],
        "type": "object"
      },
      "Token": {
        "description": "Token is a token, without its secret.",
        "properties": {
          "created_at": {
            "description": "RFC 3339, in Montevideo",
            "type": "string"
          },
          "email": {
            "description": "of its user",
            "type": "string"
          },
          "environment": {
            "description": "`environment` is the DGI environment an agent token works in, for good: testing or production. Every request it makes on an emisor works in that environment's ledger. Absent for a person's login token, whose requests say which in the CFE-Environment header. A program moves to Production by being given a token made for it, at the same URLs.",
            "type": "string"
          },
          "expires_at": {
            "description": "absent for an agent token that never expires",
            "type": "string"
          },
          "id": {
            "description": "what DELETE /v1/tokens/{id} takes",
            "format": "int64",
            "type": "integer"
          },
          "kind": {
            "description": "portal, cli or agent",
            "type": "string"
          },
          "last_used_at": {
            "description": "to the hour; absent when never used",
            "type": "string"
          },
          "max_role": {
            "description": "the most it may do; absent for its user's role",
            "type": "string"
          },
          "name": {
            "description": "an agent token's purpose, as given when made; a login token's device",
            "type": "string"
          },
          "revoked": {
            "description": "true: it no longer works, whatever `expires_at` says",
            "type": "boolean"
          },
          "ruc": {
            "description": "the one emisor it may act on; absent for all of its user's",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "kind",
          "name",
          "created_at",
          "revoked"
        ],
        "type": "object"
      },
      "TokenCreated": {
        "description": "TokenCreated is the data of POST /v1/tokens.",
        "properties": {
          "secret": {
            "description": "shown only here: the program sets it as CFE_TOKEN",
            "type": "string"
          },
          "token": {
            "$ref": "#/components/schemas/Token",
            "description": "the token just made"
          }
        },
        "required": [
          "token",
          "secret"
        ],
        "type": "object"
      },
      "TokenRequest": {
        "additionalProperties": false,
        "description": "TokenRequest is the body of POST /v1/tokens.",
        "properties": {
          "environment": {
            "description": "`environment` is the DGI environment the token works in, for good: testing, where nothing has fiscal effect, or production. Required.",
            "type": "string"
          },
          "expires": {
            "description": "last day it works, AAAA-MM-DD, in Montevideo; absent: it never expires",
            "type": "string"
          },
          "name": {
            "description": "what it is for",
            "type": "string"
          },
          "role": {
            "description": "limit it to this role",
            "type": "string"
          },
          "ruc": {
            "description": "limit it to this emisor",
            "type": "string"
          }
        },
        "type": "object"
      },
      "TokenSecret": {
        "description": "TokenSecret is the data of a call that hands out a token.",
        "properties": {
          "signed_up": {
            "description": "`signed_up` is the RUC of the emisor the login's signup just made, with the person as its admin and no ledger yet; absent for a login to an account.",
            "type": "string"
          },
          "token": {
            "description": "the secret; absent when the CLI collects it instead",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Tokens": {
        "description": "Tokens is the data of GET /v1/tokens.",
        "properties": {
          "tokens": {
            "description": "newest first",
            "items": {
              "$ref": "#/components/schemas/Token"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "tokens"
        ],
        "type": "object"
      },
      "Totals": {
        "description": "Totals are a CFE's totals, in its currency, with two decimals.",
        "properties": {
          "currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "exchange_rate": {
            "description": "pesos per unit, for any currency but UYU",
            "type": "string"
          },
          "exempt": {
            "description": "not taxed (MntNoGrv)",
            "type": "string"
          },
          "export": {
            "description": "`export` is the exported goods or services, without VAT; absent when the CFE has none.",
            "type": "string"
          },
          "fiscal_credit": {
            "type": "string"
          },
          "lines": {
            "description": "how many item lines the CFE has",
            "type": "integer"
          },
          "net_basic": {
            "description": "taxed at the basic VAT rate, without its VAT",
            "type": "string"
          },
          "net_minimum": {
            "description": "taxed at the minimum VAT rate, without its VAT",
            "type": "string"
          },
          "non_billable": {
            "description": "`non_billable` is the sum of the non_billable items minus the non_billable_negative ones, which is all a collection collects; absent when the CFE has none.",
            "type": "string"
          },
          "payable": {
            "description": "`payable` is total plus non_billable: what the buyer pays, or paid in a collection; 0.00 on a remito and an e-Resguardo, which have no total to pay.",
            "type": "string"
          },
          "retained": {
            "description": "`retained` is an e-Resguardo's retentions and perceptions (MntTotRetenido), and `fiscal_credit` its fiscal credits (MntTotCredFisc); absent on the other types and when zero.",
            "type": "string"
          },
          "total": {
            "description": "the taxed, exempt and exported amounts with their VAT",
            "type": "string"
          },
          "vat_basic": {
            "description": "the VAT at the basic rate",
            "type": "string"
          },
          "vat_minimum": {
            "description": "the VAT at the minimum rate",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "exempt",
          "net_minimum",
          "net_basic",
          "vat_minimum",
          "vat_basic",
          "total",
          "payable",
          "lines"
        ],
        "type": "object"
      },
      "TypeCount": {
        "description": "TypeCount is how many CFE of one type count in a sum, and what they add.",
        "properties": {
          "count": {
            "description": "how many of the CFE in Counted are of Type",
            "type": "integer"
          },
          "name": {
            "description": "as Line.Name",
            "type": "string"
          },
          "pesos": {
            "$ref": "#/components/schemas/Amounts",
            "description": "signed, as Line.Pesos"
          },
          "type": {
            "description": "the DGI code of [FMT-CFE] Tabla A. Type is a CFE type code ([FMT-CFE] Tabla A).",
            "type": "integer"
          }
        },
        "required": [
          "type",
          "name",
          "count",
          "pesos"
        ],
        "type": "object"
      },
      "Unanswered": {
        "description": "Unanswered is a part of a RUT lookup that DGI did not answer.",
        "properties": {
          "message": {
            "description": "what went wrong, in English",
            "type": "string"
          },
          "part": {
            "description": "registry or padron",
            "type": "string"
          }
        },
        "required": [
          "part",
          "message"
        ],
        "type": "object"
      },
      "VerifiedEmisor": {
        "description": "VerifiedEmisor is the data of GET /v1/verificar/{ruc}.",
        "properties": {
          "environment": {
            "description": "`environment` is the DGI environment the emisor issues in for real: production when it has a ledger there, else testing, where its e-Tickets have no fiscal effect.",
            "type": "string"
          },
          "environments": {
            "description": "`environments` are all the DGI environments the emisor has a ledger in, testing first. With both, a printed e-Ticket may be of either: the answer to its check says which.",
            "items": {
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "name": {
            "description": "razón social",
            "type": "string"
          },
          "ruc": {
            "description": "the one asked about, 12 digits",
            "type": "string"
          }
        },
        "required": [
          "ruc",
          "name",
          "environments"
        ],
        "type": "object"
      },
      "VerifyRequest": {
        "additionalProperties": false,
        "description": "VerifyRequest is the body of POST /v1/verificar/{ruc}: what the buyer reads on the printed e-Ticket.",
        "properties": {
          "code": {
            "description": "the first 6 characters of the security code, case and all",
            "type": "string"
          },
          "number": {
            "description": "as printed, within the series",
            "type": "integer"
          },
          "series": {
            "description": "any case",
            "type": "string"
          },
          "total": {
            "description": "`total` is the amount to pay as printed or typed: 1220, 1220.50, 1.220,50 or $ 1.220,50.",
            "type": "string"
          },
          "type": {
            "description": "101, 102 or 103",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Warning": {
        "description": "Warning is something issuing found worth a look, without refusing the sale.",
        "properties": {
          "amount": {
            "description": "see balance",
            "type": "string"
          },
          "balance": {
            "description": "`balance` is what the earlier notes left of that CFE, and Amount what this note takes, both in Currency, the CFE's, with two decimals.",
            "type": "string"
          },
          "code": {
            "description": "`code` is credit_exceeds_balance: the credit note takes more of the CFE named by type, series and number than its balance. Whether DGI forbids it is not in its documents; it only bounds each note by the CFE's total.",
            "type": "string"
          },
          "currency": {
            "description": "ISO 4217; UYU for pesos",
            "type": "string"
          },
          "message": {
            "description": "in English",
            "type": "string"
          },
          "number": {
            "description": "of that CFE, within its series",
            "type": "integer"
          },
          "series": {
            "description": "of that CFE",
            "type": "string"
          },
          "type": {
            "description": "DGI's code of the CFE the note takes from",
            "type": "integer"
          }
        },
        "required": [
          "code",
          "message",
          "type",
          "series",
          "number",
          "balance",
          "amount",
          "currency"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearer": {
        "bearerFormat": "cfe_...",
        "description": "A token's secret, which starts with cfe_, as `Authorization: Bearer cfe_...`. There are three kinds: cli, from logging in with `cfe login`; portal, from logging in on Sitios' portal at https://cfe.sitios.uy; and agent, which a person makes with POST /v1/tokens for a program. An agent token acts as its person, limited if so made to one emisor and to a lesser role, and never does more than the person can, now or later; it cannot make tokens. It works in one DGI environment, testing or production, chosen when it is made (see Testing and Production above). The server keeps only a hash of each secret, so a lost one cannot be shown again: revoke it and make another. A missing, unknown, expired or revoked token answers unauthenticated.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "name": "Sitios",
      "url": "https://sitios.uy"
    },
    "description": "The HTTP API of Sitios' electronic invoicing for Uruguay. The businesses Sitios serves use it, by hand through Sitios' portal or through their own programs and AI agents, to issue the tax documents Uruguay's tax authority requires, to see what became of them, and to answer the ones other businesses send them.\n\n## The words\n\n- **DGI** (Dirección General Impositiva): Uruguay's tax authority. It sets the formats, authorises the numbers and receives the documents.\n- **RUC**: a business's tax number, 12 digits. It identifies each emisor, and is the `{ruc}` of the paths.\n- **CFE** (Comprobante Fiscal Electrónico): an electronic tax document, a signed XML with legal value. Each has a type (a DGI code), a series and a number. The types served: 101 e-Ticket (a sale to a consumer), 111 e-Factura (a sale to a business identified by its RUC), and their credit notes (102, 112) and debit notes (103, 113), which correct a CFE already issued and reference it; 121 e-Factura de exportación (an export, to a buyer abroad) with its notes 122 and 123; 124 e-Remito de exportación (moves exported goods); 131 e-Ticket and 141 e-Factura Venta por Cuenta Ajena (a sale made in the emisor's name on behalf of a principal, the mandante) with their notes 132, 133, 142 and 143; 151 e-Boleta de entrada (a purchase from a seller who does not invoice it) with its notes 152 and 153; 181 e-Remito (moves goods, without amounts); 182 e-Resguardo (documents the retentions and perceptions an agent made). Each type needs its own CAE, and DGI enables the types beyond the first six per emisor.\n- **Emisor**: a business DGI authorised to issue CFE. Sitios keeps each emisor's ledger: its numbering, its CFE and what DGI and others said of them.\n- **CAE** (Constancia de Autorización para la Emisión): DGI's authorisation to number the CFE of one type and series within a range, until an expiry date. The emisor requests it on DGI's site and an admin imports the file here; each CFE takes the next number of a CAE in force.\n- **Sale**: the data a CFE is made from (receptor, lines, prices, VAT rates), as POST /v1/emisores/{ruc}/cfes takes it. The server computes every total, numbers the CFE, signs it with the emisor's certificate and keeps it.\n- **Receptor**: the buyer. An e-Factura needs its RUC; an e-Ticket needs a document only above a threshold; an export needs the buyer's name, full address and country, its document being optional; an e-Remito who gets the goods; an e-Resguardo who was retained; an e-Boleta de entrada is the seller, always identified with name and address.\n- **UI** (Unidad Indexada): an inflation-indexed unit of account DGI's thresholds are written in. Above 5,000 UI an e-Ticket must identify its buyer, and DGI must receive it on its own.\n- **Sobre**: an envelope, the signed XML that carries 1 to 250 CFE to DGI or to another emisor. The server builds and sends them every hour on its own.\n- **Verdict**: DGI's answer on a CFE it received: AE accepted, BE rejected (a rejected CFE is void: issue the sale again, which takes another number). An e-Ticket DGI only gets in the daily report has none.\n- **Daily report** (reporte diario): the signed summary of each day's CFE, which the server sends DGI on its own.\n- **CFE received**: one another emisor sent this emisor as its buyer. It owes a commercial answer, accept or reject with DGI's reason codes, before a deadline; the server accepts it on its own shortly before if nobody answered.\n- **Security code**: the first 6 characters of the hash of the CFE's signature, printed on the e-Ticket beside a QR so that the buyer can verify it.\n\n## Using it\n\n- Every endpoint is under /v1/ and speaks JSON: a body is one JSON object of at most 1 MB, and a field the schema does not list is refused (input_malformed), so that a misspelt name never passes silently.\n- Every answer is one JSON object: `{\"ok\": true, \"data\": ...}` or `{\"ok\": false, \"error\": {\"code\", \"message\", \"hint\"}}`, sometimes with data beside the error (sale_invalid lists every problem of the sale). Branch on error.code, which is stable and decides the HTTP status; message is for people, and hint says the next step. Only the signed XML, the PDF and the export are sent as files, without the envelope.\n- Each request carries a token: `Authorization: Bearer cfe_...` (the bearer scheme says which kinds there are). A program or agent gets an agent token from its person, and calls GET /v1/me first to learn which emisores it may act on, with which role.\n- Each person has a role on each emisor: **view** (see and export), **issue** (also issue CFE, mail them and answer CFE received) or **admin** (also change the profile, import CAEs and give roles). Each operation says the role it needs.\n- **Testing and Production.** DGI has two environments: Testing, where nothing has fiscal effect, and Production. An emisor may have a ledger in each, side by side, with their own numbers, CFE and CAEs (GET /v1/emisores lists them). Every endpoint under /v1/emisores/{ruc} but the members' works in one, and its answer, success or failure once the environment is known, names it in the `CFE-Environment` header. An agent token works in the environment it was made for, so a program moves to Production by swapping its token for one made for Production, with the same URLs and code; a request that names the other one in `CFE-Environment` fails with environment_mismatch. A person's token says which with `CFE-Environment: testing` or `production`; without it, the emisor's only ledger is used, and with one in each the request fails with environment_required. Production is never chosen by default. What other emisores send goes to the emisor's Production ledger once it has one.\n- Every endpoint that changes something takes `?dry_run=true`: it does everything, answers what it would and keeps nothing.\n- Issuing is safe to retry: the same key with the same sale answers the CFE already issued (replayed), and the same key with another sale fails with key_reused.\n- Days are AAAA-MM-DD in Montevideo's time; instants are RFC 3339. Amounts are decimals, written as strings.\n- Messages are in English. What DGI writes (its reason texts) and what buyers and emisores read (alert notices, the printed CFE) is in Spanish.\n\nThis document is generated from the server's code: which routes exist and who may call them, the Go types of every body and answer with their comments, and the error codes.\n\n## Error codes\n\n| code | HTTP status | meaning |\n|---|---|---|\n| `already_answered` | 409 | the CFE received has its answer, which cannot be changed |\n| `application_exceeds` | 409 | the amount is more than the collection has left to apply (its unapplied) or than the invoice owes (its owed); the message gives both figures |\n| `application_invalid` | 422 | the collection cannot be applied to that CFE: not a collection and an invoice of the same buyer, the rate missing or out of place, an amount that is not positive cents, or a balance that cannot be told; the message says which |\n| `before_reports` | 409 | the ledger reports to DGI from a later day: nothing is issued before it |\n| `billing_unavailable` | 503 | billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works |\n| `cae_invalid` | 422 | not a CAE for this emisor, or overlapping one on record |\n| `card_rejected` | 422 | dLocal Go did not save the card: the holder's data or the card's are not what it takes; data.notice says, in Spanish, what to check. Nothing was saved |\n| `certificate_rejected` | 422 | the certificate sent cannot sign for the emisor; data.reason says why and data.notice, in Spanish, what to do. Nothing was changed |\n| `certificate_unavailable` | 409 | the emisor's certificate is not on the server, or unusable |\n| `chat_busy` | 409 | the assistant is still answering the previous message of the same chat: wait for its done event |\n| `chat_limit` | 429 | the emisor's people sent the chat messages a day allows them (200 unless Sitios set another number); it opens again at midnight in Montevideo |\n| `chat_unavailable` | 503 | the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works |\n| `dgi_rejected` | 409 | DGI rejected the CFE: it cannot be mailed, nor take part in an application |\n| `dgi_unavailable` | 503 | DGI did not answer, or answered with something that is not its answer; nothing was changed, try again later |\n| `dlocal_unavailable` | 503 | dLocal Go, which keeps the cards, did not answer as expected; nothing was saved, try again later |\n| `environment_mismatch` | 409 | the CFE-Environment header names another DGI environment than the one the agent token is bound to |\n| `environment_required` | 409 | the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment |\n| `exchange_rate_unknown` | 422 | a sale in another currency without its rate, which the ledger lacks |\n| `feedback_given` | 409 | the assistant's message already has its 👎, which cannot be changed |\n| `forbidden` | 403 | the caller's role on the emisor is not enough |\n| `input_malformed` | 400 | the body is not the JSON expected; unknown fields count |\n| `internal` | 500 | an unexpected failure on Sitios' side, which Sitios was told of; try again later |\n| `key_reused` | 409 | the key was used before for another sale |\n| `last_admin` | 409 | the change would leave the emisor without an admin |\n| `ledger_not_found` | 404 | the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up |\n| `login_invalid` | 404 | the login is unknown, expired or used |\n| `login_pending` | 409 | the person has not confirmed yet: ask again in a few seconds |\n| `logo_invalid` | 422 | not a PNG or JPEG the printed CFE can carry, or one beside which the profile's appearance no longer fits; the message says why |\n| `mail_failed` | 502 | the login mail, or the monthly summary asked for, could not be sent; try again |\n| `monthly_mail_unset` | 409 | nobody gets the monthly mail: the profile's monthly_mail has no recipients, or in DGI's Testing the profile has no testing_mail_to |\n| `no_numbers` | 409 | no CAE in force has numbers left for the type |\n| `not_found` | 404 | no such endpoint |\n| `not_on_record` | 404 | no such emisor (for this caller), CFE, CAE, application, member or token |\n| `pki_unavailable` | 503 | Uruguay's PKI could not be asked about the certificate sent; nothing was changed, try again later |\n| `portal_unavailable` | 409 | logins are not set up: there is no portal page for the links |\n| `profile_incomplete` | 409 | the profile lacks what the step needs |\n| `profile_invalid` | 422 | data.problems lists every problem of the profile |\n| `profile_missing` | 409 | the ledger has no profile yet |\n| `sale_invalid` | 422 | data.problems lists every problem of the sale; no number was used |\n| `signup_exists` | 409 | the RUC is with Sitios already (a ledger, or people with a role on it) or has a signup in course |\n| `signup_rejected` | 422 | DGI's RUT registry does not have the RUC with its business activity in force; data.reason says which (not_registered or inactive) and data.notice, in Spanish, what to do |\n| `signup_unavailable` | 503 | signups are not set up on this server: it has no certificate to ask DGI with |\n| `too_many_requests` | 429 | too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor |\n| `unauthenticated` | 401 | no token, or not one in force |\n| `unhealthy` | 503 | the API runs but cannot reach its data |\n| `usage` | 400 | a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment |\n| `verification_failed` | 404 | no e-Ticket matches what the buyer typed; it never says which datum is wrong |\n| `visitor_chat_limit` | 429 | the visitors' chat reached a limit; data.limit says which: visitor (this visitor's messages of the day), address (this address's of the hour) or all (every visitor's of the day) |\n",
    "summary": "Issue, look up and answer Uruguay's electronic tax documents (CFE) for the businesses Sitios serves.",
    "title": "cfe API",
    "version": "1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/": {
      "get": {
        "description": "Public: needs no token.",
        "operationId": "discover",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Discovery"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "Where to start: links to this document and to the guide",
        "tags": [
          "discovery"
        ]
      }
    },
    "/v1/": {
      "get": {
        "description": "Public: needs no token.",
        "operationId": "discoverV1",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Discovery"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "The same as GET /",
        "tags": [
          "discovery"
        ]
      }
    },
    "/v1/billing/dlocal": {
      "post": {
        "description": "For dLocal Go alone, as each charge's notification_url: signed with Sitios' keys in Authorization (V2-HMAC-SHA256), with the payment's id in the body. The server asks dLocal how the payment stands and records it when it is one of the billing's charges. Any other caller gets forbidden.\n\nPublic: needs no token.",
        "operationId": "notifyBilling",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingNotification"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BillingNotified"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`billing_unavailable`: billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works."
          }
        },
        "security": [],
        "summary": "dLocal Go's notice that one of Sitios' payments changed",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/emisores": {
      "get": {
        "description": "Each emisor lists the DGI environments it has a ledger in. With both, a request with a person's token says which in CFE-Environment.\n\nNeeds a token of any kind and role.",
        "operationId": "listEmisores",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Emisores"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The caller's emisores, with their names and DGI environments",
        "tags": [
          "emisores"
        ]
      }
    },
    "/v1/emisores/{ruc}": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getEmisor",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Emisor"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "An emisor: its profile, its CAEs with the numbers left, and what is pending with DGI",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/alerts": {
      "get": {
        "description": "For instance a CAE running out, or a CFE a receptor rejected. Each says what to do, in Spanish, in notice. Those only Sitios acts on are not listed.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "listAlerts",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Alerts"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The open alerts someone of the emisor must act on",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/applications/{id}": {
      "delete": {
        "description": "Records that the application is undone: it stays on record, with who undid it and when, and counts for nothing from then on, so the invoice owes again what it covered and the collection has it to apply again. Undoing it again changes nothing.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "reverseApplication",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The ledger's number for the application, as the applications of its invoice or collection give it.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApplicationResult"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Undo an application of a collection to an invoice",
        "tags": [
          "cfes"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/billing": {
      "get": {
        "description": "A month costs the same for every emisor and is charged to the card on file, by Sitios' billing run: the first on the day the emisor signs its first CFE in Production (Testing does not count), then on the same day of each month. A charge that fails is tried again 1, 3 and 7 days later, telling the emisor each time; then Sitios decides. Each month paid gets an e-Factura from Sitios (FOMAN), which reaches the emisor as any CFE. The card is the emisor's, not a ledger's, so this works in no DGI environment, also for an emisor with no ledger yet.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getBilling",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Status"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`billing_unavailable`: billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works."
          }
        },
        "summary": "What Sitios charges the emisor: the price, the card on file and where the charges stand",
        "tags": [
          "billing"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/billing/card": {
      "put": {
        "description": "The token window.dlocalGo.createCardToken made of the card, and its holder as dLocal asks for them. dLocal keeps the card and gives a reference to it, which is all the server keeps, with its brand, last four digits and expiry, and the holder's email, where Sitios' invoices and the notices of a failed charge go. Nothing is charged now. It replaces the card on file, which dLocal forgets. With dry_run it checks the fields and saves nothing, since the token serves once.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "saveCard",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SavedCard"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`card_rejected`: dLocal Go did not save the card: the holder's data or the card's are not what it takes; data.notice says, in Spanish, what to check. Nothing was saved."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`billing_unavailable`: billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works.\n\n`dlocal_unavailable`: dLocal Go, which keeps the cards, did not answer as expected; nothing was saved, try again later."
          }
        },
        "summary": "Save the card the emisor is charged to, without charging it",
        "tags": [
          "billing"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/billing/card-session": {
      "post": {
        "description": "Answers the checkout token window.dlocalGo.initialize takes, with the SmartFields key the portal has, to draw dLocal's card fields in the browser: the card's number goes from there to dLocal and never through this API. The token belongs to a payment that only opens the fields and is never charged. At most 10 an hour per emisor.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "startCardSession",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CardSession"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`billing_unavailable`: billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works.\n\n`dlocal_unavailable`: dLocal Go, which keeps the cards, did not answer as expected; nothing was saved, try again later."
          }
        },
        "summary": "Start dLocal Go's card fields to load a card",
        "tags": [
          "billing"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/caes": {
      "post": {
        "description": "Importing a CAE on record again changes nothing (added false).\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "importCAE",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/xml": {
              "schema": {
                "type": "string"
              }
            }
          },
          "description": "The CAE file as downloaded from DGI's site, as it is.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CAEImport"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`cae_invalid`: not a CAE for this emisor, or overlapping one on record."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Import a CAE file from DGI",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/certificate": {
      "get": {
        "description": "Who it is for, who issued it and until when it is in force. Both of the emisor's ledgers sign with it, so this works in no DGI environment. not_on_record while the emisor has none.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getCertificate",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Certificate"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`certificate_unavailable`: the emisor's certificate is not on the server, or unusable."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The certificate the emisor signs with",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      },
      "put": {
        "description": "The .pfx or .p12 file with the private key, as the certification authority delivers it (Abitab's included), and its PIN. Before anything is changed the server checks that the PIN opens it, that it holds one RSA key and the certificate for it, that the certificate carries the emisor's RUC, is in force for at least 7 more days and allows signing, that a test signature with it verifies and that Uruguay's PKI vouches for it; otherwise certificate_rejected, with the reason and a notice in Spanish. Then it stores the file under a password of its own, keeping the PIN nowhere, and both ledgers sign with it from that moment. Each replacement goes to Sitios' audit log with who did it and both serial numbers. At most 10 tries an hour per emisor.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "replaceCertificate",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CertificateRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CertificateReplacement"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`certificate_rejected`: the certificate sent cannot sign for the emisor; data.reason says why and data.notice, in Spanish, what to do. Nothing was changed."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`pki_unavailable`: Uruguay's PKI could not be asked about the certificate sent; nothing was changed, try again later."
          }
        },
        "summary": "Replace the certificate the emisor signs with",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/cfes": {
      "get": {
        "description": "Pass one of date, key, receptor and receptor_name. Each comes with DGI's verdict, for a receptor with a RUC where its exchange with the receptor stands, the notes that correct it with its balance after them (corrected_by, credited, debited, balance) and, for a note, what it corrects (corrects). By receptor_name, the answer's receptors are the distinct buyers found, each with its document and its name: with more than one, the name is ambiguous, and receptor with the right document lists one buyer's CFE alone.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "listCFEs",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "The day the CFE were signed, in Montevideo. Required unless key, receptor or receptor_name is given.",
            "in": "query",
            "name": "date",
            "required": false,
            "schema": {
              "format": "date",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "The key the CFE was issued with; then the list has that CFE alone.",
            "in": "query",
            "name": "key",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The document of the buyer the CFE were made out to, as the CFE carries it: a RUC or a C.I. in digits, or a foreign document as given. Lists every CFE to it, in the order they were signed; from and to bound them.",
            "in": "query",
            "name": "receptor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Words of the name of the buyer the CFE were made out to, in any order: lists every CFE whose receptor's name, as signed, has each word as the start of one of its words, in the order they were signed; from and to bound them. Case, accents and punctuation do not count, and S.R.L., S. R. L. and SRL are the same (\"cliente prueba\" finds \"Cliente de Prueba S.R.L.\"). It may find more than one buyer: see receptors in the answer.",
            "in": "query",
            "name": "receptor_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "With receptor or receptor_name: the first day signed to list, AAAA-MM-DD in Montevideo.",
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "format": "date",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "With receptor or receptor_name: the last day signed to list, AAAA-MM-DD in Montevideo, included.",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "format": "date",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CFEs"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The CFE signed on a day, the one issued with a key, or those made out to a buyer",
        "tags": [
          "cfes"
        ],
        "x-required-role": "view"
      },
      "post": {
        "description": "Takes the next number of the CAE in force for the type, builds and signs the CFE with the emisor's certificate on the server, and records it, all or nothing. The sale goes without series and number. The same key with the same sale answers the CFE already issued (replayed true), so retrying is safe. DGI receives it later, within the hour. With mail_to in the sale, the buyer is mailed the CFE once DGI allows it; for an emisor in DGI's Testing, never: the mail goes to the profile's testing_mail_to, if any, marked as a test. A note (102, 103, 112, 113, 122, 123, 132, 133, 142, 143, 152, 153) references the CFE it corrects: the simplest is to take that CFE's sale from GET .../cfes/{type}/{series}/{number}, change its type, drop series and number, keep the lines corrected and add the reference. A CFE is never changed or cancelled: a note is how it is corrected. A credit note that takes more of a CFE than the balance its earlier notes left is issued all the same, with a credit_exceeds_balance warning; the dry run shows it first. A sale in another currency takes its exchange_rate, or the BCU's of the business day before. A payment received for an invoice (a cobranza, \"e-Factura Cobranza\") is its own CFE: an e-Factura (111) to the same receiver, or an e-Ticket (101) for an e-Ticket, with collection true and references [{type, series, number, amount}], amount being what was paid of that invoice (all of it, or part: the invoice's owed says what is left); it can leave out items, which become one non-billable line per reference, and payment, which is then cash, and may add payment_methods [{gloss: \"Transferencia bancaria\", amount}]. Its totals have total 0 and the amount in non_billable and payable. An invoice issued elsewhere (another system) is referenced the same way, with its date. An export of goods is an e-Factura de exportación (121): export {clause (the Incoterm, FOB, CIF, or N/A), mode (goods, services, consignment, revisable_price, exclave, principal or other), transport (sea, air, land, other or none)}, items with vat export (or free, at no price) and an optional ncm, and a receiver with name, address, city, department and country_name, its document optional; no VAT. An e-Remito de exportación (124) moves those goods: export, shipment {kind: sale or internal} and priced items without vat, no payment. An e-Remito (181) moves goods in Uruguay: shipment (with owner when they are a third party's), items without unit_price nor vat, no payment and no currency; a line with vat reduce takes goods off an earlier e-Remito it references. An e-Resguardo (182) documents retentions made as agent: items with only retentions [{code (DGI's, form and line), rate, base, amount}], no payment, a receiver with document and name, and references to the CFE retained on, usually the supplier's; a line with vat annul annuls an earlier e-Resguardo it references. An invoice may reference the remito that moved its goods, and a remito the invoice it delivers, without amount. A sale on behalf of others is an e-Ticket (131) or an e-Factura (141) Venta por Cuenta Ajena: the sale of a 101 or a 111, without export lines, plus principal {doc_type, document, name, and no_vat_certificate true when the principal lacks the constancia of being up to date with VAT}, the one on whose behalf it sells, never the emisor itself. A purchase from someone who does not invoice it is an e-Boleta de entrada (151): the receiver is the seller, with document, name, address and city; items with vat non_taxpayer (a seller without RUC), small_taxpayer (IVA mínimo or Monotributo, by RUC) or imeba (by RUC), or free, non_billable and non_billable_negative; no VAT; and foreign_currency_resale true, every item foreign_currency and the boleta in UYU, for foreign currency bought for resale, with a principal (nie, rut or nife) when bought on behalf of another.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "issueCFE",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IssueRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CFE"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`before_reports`: the ledger reports to DGI from a later day: nothing is issued before it.\n\n`certificate_unavailable`: the emisor's certificate is not on the server, or unusable.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`key_reused`: the key was used before for another sale.\n\n`no_numbers`: no CAE in force has numbers left for the type.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`exchange_rate_unknown`: a sale in another currency without its rate, which the ledger lacks.\n\n`sale_invalid`: data.problems lists every problem of the sale; no number was used."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Issue a CFE from a sale",
        "tags": [
          "cfes"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/cfes/preview": {
      "post": {
        "description": "Builds the sale as POST .../cfes would, with the profile, logo and adenda in force, and prints it as a preview: across every page \"VISTA PREVIA - SIN VALOR\", and \"(al emitir)\" where the number, the CAE and the security code go, with an empty box for the QR. It is not a CFE: it takes no number, uses no CAE, is not signed, needs no certificate and keeps nothing; the same sale issued may differ in its number and in what changed in between. A sale with problems answers sale_invalid, as issuing it would. Without sale, it previews a sample e-Factura, to see how the emisor's CFE look. Without a CAE in force for the type, the series printed is A and the JSON answer says no_cae: issuing it would answer no_numbers until an admin loads one. Asked with `Accept: application/json`, it answers instead what the sale would add up to, worked out as issuing it would: its totals with the currency and the exchange rate it would take (the sale's, or the BCU's of the business day before, which the ledger may still lack: exchange_rate_unknown), each line with its amount, and what a note or a collection references, completed from the CFE on record. So a program or an assistant never adds up a sale itself; the profile's footer is not needed for it.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "previewCFE",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreviewRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Preview"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              },
              "application/pdf": {
                "schema": {
                  "contentMediaType": "application/pdf",
                  "type": "string"
                }
              }
            },
            "description": "The preview, named preview-<type>.pdf. With `Accept: application/json` (and not application/pdf), the JSON answer instead.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_incomplete`: the profile lacks what the step needs.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`exchange_rate_unknown`: a sale in another currency without its rate, which the ledger lacks.\n\n`sale_invalid`: data.problems lists every problem of the sale; no number was used."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "What a sale would become, as a PDF or its totals, without issuing it",
        "tags": [
          "cfes"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/cfes/{type}/{series}/{number}": {
      "get": {
        "description": "The sale is read back from the CFE, as POST .../cfes takes it: what a note that corrects the CFE starts from, and what issuing again a CFE DGI rejected starts from (a rejected CFE is void and needs no note: the same sale gets another number). verdict_reasons say why DGI rejected it. Like the list, it shows the notes that correct the CFE and its balance, and for a note what it corrects.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getCFE",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The CFE type, as DGI codes it: 101 e-Ticket, 102 and 103 its credit and debit notes, 111 e-Factura, 112 and 113 its notes, 121 e-Factura de exportación, 122 and 123 its notes, 124 e-Remito de exportación, 131 e-Ticket Venta por Cuenta Ajena, 132 and 133 its notes, 141 e-Factura Venta por Cuenta Ajena, 142 and 143 its notes, 151 e-Boleta de entrada, 152 and 153 its notes, 181 e-Remito, 182 e-Resguardo.",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "The CFE series, as its CAE gives it, e.g. A; any case.",
            "in": "path",
            "name": "series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The CFE number within its type and series.",
            "in": "path",
            "name": "number",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CFE"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "One CFE, with its sale, its mails, its verdict and its corrections",
        "tags": [
          "cfes"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/cfes/{type}/{series}/{number}/applications": {
      "post": {
        "description": "Associates part or all of a collection (a cobranza, a CFE with collection true) with the invoice of the path, an e-Factura or e-Ticket of the same buyer, whatever was issued first: a deposit (seña) is collected before the invoice exists, so its collection references it only globally, and is applied here to the invoice made at delivery; a payment may also be applied to invoices issued before it. It is a record of this system, not a CFE: nothing reaches DGI. From then on the invoice's owed counts it, and the collection's unapplied leaves it out; GET of either shows it in applications. amount is in the collection's currency, at most its unapplied, and its part of the invoice at most the invoice's owed (application_exceeds). Between pesos and another currency, rate is the rate agreed with the buyer, in pesos per unit of the other: a payment in pesos covers amount ÷ rate of an invoice in dollars, rounded to cents. A CFE DGI rejected is void and takes part in none (dgi_rejected). Nothing is ever changed: a mistake is undone with DELETE /v1/emisores/{ruc}/applications/{id}.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "applyCollection",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The CFE type, as DGI codes it: 101 e-Ticket, 102 and 103 its credit and debit notes, 111 e-Factura, 112 and 113 its notes, 121 e-Factura de exportación, 122 and 123 its notes, 124 e-Remito de exportación, 131 e-Ticket Venta por Cuenta Ajena, 132 and 133 its notes, 141 e-Factura Venta por Cuenta Ajena, 142 and 143 its notes, 151 e-Boleta de entrada, 152 and 153 its notes, 181 e-Remito, 182 e-Resguardo.",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "The CFE series, as its CAE gives it, e.g. A; any case.",
            "in": "path",
            "name": "series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The CFE number within its type and series.",
            "in": "path",
            "name": "number",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplicationRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApplicationResult"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`application_exceeds`: the amount is more than the collection has left to apply (its unapplied) or than the invoice owes (its owed); the message gives both figures.\n\n`dgi_rejected`: DGI rejected the CFE: it cannot be mailed, nor take part in an application.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`application_invalid`: the collection cannot be applied to that CFE: not a collection and an invoice of the same buyer, the rate missing or out of place, an amount that is not positive cents, or a balance that cannot be told; the message says which."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Apply a collection's payment to this invoice (afectar una cobranza)",
        "tags": [
          "cfes"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/cfes/{type}/{series}/{number}/mail": {
      "post": {
        "description": "The mail goes within minutes, from the emisor's address. Answers the CFE with its mails. For an emisor in DGI's Testing, a CFE never reaches an address a program gave: asked with an agent token, the mail is withheld (status withheld) like a sale's mail_to, and a copy marked as a test goes to the profile's testing_mail_to, if any, so a billing system that resends through this route never mails its real customers. Asked by a person (a portal or cli token), it goes to the address typed, marked as a test with no fiscal value.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "mailCFE",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The CFE type, as DGI codes it: 101 e-Ticket, 102 and 103 its credit and debit notes, 111 e-Factura, 112 and 113 its notes, 121 e-Factura de exportación, 122 and 123 its notes, 124 e-Remito de exportación, 131 e-Ticket Venta por Cuenta Ajena, 132 and 133 its notes, 141 e-Factura Venta por Cuenta Ajena, 142 and 143 its notes, 151 e-Boleta de entrada, 152 and 153 its notes, 181 e-Remito, 182 e-Resguardo.",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "The CFE series, as its CAE gives it, e.g. A; any case.",
            "in": "path",
            "name": "series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The CFE number within its type and series.",
            "in": "path",
            "name": "number",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MailRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CFE"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`dgi_rejected`: DGI rejected the CFE: it cannot be mailed, nor take part in an application.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Mail a CFE to an address, again or to another one",
        "tags": [
          "cfes"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/cfes/{type}/{series}/{number}/pdf": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getCFEPDF",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The CFE type, as DGI codes it: 101 e-Ticket, 102 and 103 its credit and debit notes, 111 e-Factura, 112 and 113 its notes, 121 e-Factura de exportación, 122 and 123 its notes, 124 e-Remito de exportación, 131 e-Ticket Venta por Cuenta Ajena, 132 and 133 its notes, 141 e-Factura Venta por Cuenta Ajena, 142 and 143 its notes, 151 e-Boleta de entrada, 152 and 153 its notes, 181 e-Remito, 182 e-Resguardo.",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "The CFE series, as its CAE gives it, e.g. A; any case.",
            "in": "path",
            "name": "series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The CFE number within its type and series.",
            "in": "path",
            "name": "number",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "contentMediaType": "application/pdf",
                  "type": "string"
                }
              }
            },
            "description": "The printed representation with its QR and security code, named <type>-<series>-<number>.pdf.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_incomplete`: the profile lacks what the step needs.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The printed CFE, the PDF the buyer gets",
        "tags": [
          "cfes"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/cfes/{type}/{series}/{number}/xml": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getCFEXML",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The CFE type, as DGI codes it: 101 e-Ticket, 102 and 103 its credit and debit notes, 111 e-Factura, 112 and 113 its notes, 121 e-Factura de exportación, 122 and 123 its notes, 124 e-Remito de exportación, 131 e-Ticket Venta por Cuenta Ajena, 132 and 133 its notes, 141 e-Factura Venta por Cuenta Ajena, 142 and 143 its notes, 151 e-Boleta de entrada, 152 and 153 its notes, 181 e-Remito, 182 e-Resguardo.",
            "in": "path",
            "name": "type",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "The CFE series, as its CAE gives it, e.g. A; any case.",
            "in": "path",
            "name": "series",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The CFE number within its type and series.",
            "in": "path",
            "name": "number",
            "required": true,
            "schema": {
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/xml": {
                "schema": {
                  "contentMediaType": "application/xml",
                  "type": "string"
                }
              }
            },
            "description": "The CFE as signed, named <type>-<series>-<number>.xml.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The signed XML of a CFE, as it is",
        "tags": [
          "cfes"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/chat/messages": {
      "delete": {
        "description": "Every message of the thread leaves it at once and is never sent to the model again. Within days, after an anonymized record of what helps improve the service is kept, their content is wiped for good. The doubts the assistant recorded and the thumbs down given stay, as the question, what was missing and the comment.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "deleteChatHistory",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatDeletion"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_busy`: the assistant is still answering the previous message of the same chat: wait for its done event.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "summary": "Delete the caller's thread's history",
        "tags": [
          "chat"
        ],
        "x-required-role": "view"
      },
      "get": {
        "description": "The person's messages and the assistant's answers with text or previews, never the tools' answers, of the caller's own thread: nobody sees another person's, admins included. A message the person deleted is not there.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "listChatMessages",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "Only messages older than this one, by id: the id of the last message of the page before.",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "How many messages, 1 to 200; 50 when left out.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatMessages"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "summary": "The caller's thread with the assistant, newest first, a page at a time",
        "tags": [
          "chat"
        ],
        "x-required-role": "view"
      },
      "post": {
        "description": "Adds the message to the caller's thread on the emisor, in the DGI environment of the request, and streams the assistant's answer. An emisor with no ledger yet, in the middle of its signup, chats in no environment, with no tool but recording a doubt. The model sees the session in course, the messages since a pause of two hours, and finds anything older with its tools. Each tool is one of this API's routes, called as the caller with the caller's token and role, so what the role does not allow fails as it would here. The model never issues: a sale it previews comes in a preview event with the key POST .../cfes issues it with. Only people chat: an agent token answers forbidden. The emisor's people may send a number of messages a day, all their threads together (chat_limit), and a thread takes one message at a time (chat_busy). Once the stream starts, the status is 200 and an answer that cannot end well says so in an error event. No dry run: it would have to ask the model.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "sendChatMessage",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "contentMediaType": "text/event-stream",
                  "type": "string"
                }
              }
            },
            "description": "Server-Sent Events, each `event: <name>` and `data: <JSON>`, in this order of kinds: `text` {text}, a piece of the answer in Markdown; `tool_started` {id, tool, label} and `tool_finished` {id, tool, label, ok, error}, a tool the model called, label saying in Spanish what it does and error the API's code when not ok; `preview` {id, key, sale, preview}, a sale the person may issue with POST .../cfes and {key, sale}; `error` {code, message}, the answer could not end well (model_failed, max_tokens, refusal, tool_rounds) and the next message starts a new session; `done` {message_id, answer_id, usage}, always last: the person's message, the answer a thumbs down goes on, and the tokens every call to the model took.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_busy`: the assistant is still answering the previous message of the same chat: wait for its done event.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_limit`: the emisor's people sent the chat messages a day allows them (200 unless Sitios set another number); it opens again at midnight in Montevideo."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "summary": "Send a message to the assistant; the answer streams as Server-Sent Events",
        "tags": [
          "chat"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/chat/messages/{id}/feedback": {
      "post": {
        "description": "For an answer that was wrong, with what was wrong if the person says it. It opens an alert for Sitios, who reads the conversation; one per answer.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "giveChatFeedback",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The answer's id: answer_id of the done event, or an id of the thread.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatFeedbackRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatFeedback"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`feedback_given`: the assistant's message already has its 👎, which cannot be changed."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "summary": "A thumbs down on an answer of the assistant",
        "tags": [
          "chat"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/export": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "exportLedger",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.sqlite3": {
                "schema": {
                  "contentMediaType": "application/vnd.sqlite3",
                  "type": "string"
                }
              }
            },
            "description": "A copy of the ledger, as an attachment named cfe-<RUC>-<environment>-<day>.sqlite.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The emisor's whole ledger, as a SQLite file",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/items": {
      "get": {
        "description": "The system keeps no products or price lists: this finds them among the emisor's own sales, read from the CFE on record. A sale is an e-Ticket, an e-Factura or a debit note of either that is not a collection and that DGI did not reject; one without a verdict yet counts. The rounding line of prices with VAT included is not an item. Equal lines are one item: the same name (case, accents and punctuation aside), unit, vat and currency; it shows the newest line's description, unit_price and discount, with prices_include_vat of its CFE, how many sales had it (times) and the CFE it was last in, with its buyer (last_cfe), whose whole sale GET .../cfes/{type}/{series}/{number} gives. Without q, every item; without receptor, every buyer's. It reads the newest 500 sales and says how many older ones it left unread (not_scanned), and shows the newest 30 items (items_not_shown counts the rest). Nothing is recorded.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "searchItems",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "Words of the line's name or description, in any order: finds the lines that have each word as the start of one of theirs. Case, accents and punctuation do not count (\"consultoria hora\" finds \"Hora de consultoría\").",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The document of a buyer, as the CFE carry it (a RUC or a C.I. in digits, or a foreign document as given): only the sales made out to it, what is usually invoiced to that buyer.",
            "in": "query",
            "name": "receptor",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Items"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The lines the emisor already invoiced: their latest price and VAT, how often and to whom",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/members": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "listMembers",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Members"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Who has a role on the emisor",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/members/{email}": {
      "delete": {
        "description": "An admin takes anyone's; any member may give up their own. The last admin cannot go.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "revokeRole",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The person's email address, which identifies them.",
            "in": "path",
            "name": "email",
            "required": true,
            "schema": {
              "format": "email",
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {},
                      "type": "object"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`last_admin`: the change would leave the emisor without an admin."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Take a person's role on the emisor away",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      },
      "put": {
        "description": "A person without an account gets one, and logs in with their email.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "grantRole",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The person's email address, which identifies them.",
            "in": "path",
            "name": "email",
            "required": true,
            "schema": {
              "format": "email",
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GrantRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Member"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`last_admin`: the change would leave the emisor without an admin."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Give a person a role on the emisor, or change it",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/months/{month}": {
      "get": {
        "description": "The CFE issued in the month, by issue date, that count for VAT: e-Tickets, e-Facturas and their debit notes add, their credit notes subtract, each in pesos at its own exchange rate. Collections carry no VAT and are listed apart, never summed; CFE DGI rejected are void and listed apart. purchases are the CFE other emisores sent through the exchange in the month, a partial help: not every purchase arrives that way. mail says where the month's mail to the accountant stands: the profile's monthly_mail settings, who gets it now and every attempt. The mail goes on its own once DGI received the daily report of the month's last day (last_day_report AR).\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getMonth",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "A calendar month, AAAA-MM: its CFE are those with an issue date in it.",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{4}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MonthView"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "A month's summary for the accountant: VAT by rate in pesos, and its mail",
        "tags": [
          "months"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/months/{month}/mail": {
      "post": {
        "description": "To the profile's monthly_mail recipients, with what its detail asks for; in DGI's Testing, to testing_mail_to instead, marked as a test. Sent after DGI received the report of the month's last day, it is the month's mail and does not go again on its own; before, it says it is preliminary, and the final one still goes on its own. The dry run answers the mail without sending it.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "mailMonth",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "A calendar month, AAAA-MM: its CFE are those with an issue date in it.",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{4}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MonthlyMailReport"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`monthly_mail_unset`: nobody gets the monthly mail: the profile's monthly_mail has no recipients, or in DGI's Testing the profile has no testing_mail_to.\n\n`profile_incomplete`: the profile lacks what the step needs.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`mail_failed`: the login mail, or the monthly summary asked for, could not be sent; try again."
          }
        },
        "summary": "Mail a month's summary to the accountant now",
        "tags": [
          "months"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/months/{month}/pdfs": {
      "get": {
        "description": "Every CFE issued in the month that DGI did not reject, collections included, as its buyer gets it.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getMonthPDFs",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "A calendar month, AAAA-MM: its CFE are those with an issue date in it.",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{4}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/zip": {
                "schema": {
                  "contentMediaType": "application/zip",
                  "type": "string"
                }
              }
            },
            "description": "A zip named comprobantes-<RUC>-<AAAA-MM>.zip, with <type>-<series>-<number>.pdf for each CFE.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_incomplete`: the profile lacks what the step needs.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The PDFs of a month's CFE, in a zip",
        "tags": [
          "months"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/months/{month}/spreadsheet": {
      "get": {
        "description": "The sums, every CFE issued in the month with its amounts in its currency and in pesos and whether it counts, and the CFE received.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getMonthSpreadsheet",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "A calendar month, AAAA-MM: its CFE are those with an issue date in it.",
            "in": "path",
            "name": "month",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{4}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
                "schema": {
                  "contentMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                  "type": "string"
                }
              }
            },
            "description": "An .xlsx workbook named resumen-<RUC>-<AAAA-MM>.xlsx.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment.\n\n`profile_missing`: the ledger has no profile yet."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "A month's spreadsheet, one row per CFE",
        "tags": [
          "months"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/profile": {
      "put": {
        "description": "The whole profile, as GET /v1/emisores/{ruc} gives it, without caes (CAEs are imported on their own). mail_from and exchange_mail are Sitios' to set once it verifies the emisor's domain: send them as they are, or the answer is forbidden. Answers the emisor as GET /v1/emisores/{ruc}.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "setProfile",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Issuer"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Emisor"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`profile_invalid`: data.problems lists every problem of the profile."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Replace the emisor's profile",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/profile/logo": {
      "delete": {
        "description": "CFE printed from now on carry none. Removing none is no error. Answers the emisor as GET /v1/emisores/{ruc}.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "removeLogo",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Emisor"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Remove the logo of the emisor's CFE",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      },
      "get": {
        "description": "The image printed in the top-left corner of the emisor's CFE. GET /v1/emisores/{ruc} describes it in logo, without the image.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getLogo",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "image/png": {
                "schema": {
                  "contentMediaType": "image/png",
                  "type": "string"
                }
              }
            },
            "description": "The logo as uploaded: a PNG, or a JPEG with type image/jpeg.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The emisor's logo, as uploaded",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      },
      "put": {
        "description": "A PNG or a JPEG (not CMYK) of at most 512 KB, at most 2000 pixels a side and at least 100 on its longer side. It prints in the top-left corner, at most 36 x 30 mm, and the emisor's identification beside it; a transparent PNG prints transparent. CFE printed from now on carry it, those already issued included when printed again. Refused with logo_invalid when beside it the profile's appearance (address, phone, email, website) no longer fits the top of the page. Each ledger has its own: to keep Testing and Production alike, set it in each. Answers the emisor as GET /v1/emisores/{ruc}.\n\nNeeds a token whose role on the emisor {ruc} is admin or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "setLogo",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "image/png": {
              "schema": {
                "type": "string"
              }
            }
          },
          "description": "The image as it is, PNG or JPEG; its content type is read from the image itself.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Emisor"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`logo_invalid`: not a PNG or JPEG the printed CFE can carry, or one beside which the profile's appearance no longer fits; the message says why."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Set the logo printed on the emisor's CFE",
        "tags": [
          "emisores"
        ],
        "x-required-role": "admin"
      }
    },
    "/v1/emisores/{ruc}/received": {
      "get": {
        "description": "Pass date or unanswered=true.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "listReceived",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "The day the CFE arrived, in Montevideo. Required unless unanswered is given.",
            "in": "query",
            "name": "date",
            "required": false,
            "schema": {
              "format": "date",
              "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
              "type": "string"
            }
          },
          {
            "description": "true lists every CFE received still without an answer, whatever the day.",
            "in": "query",
            "name": "unanswered",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ReceivedList"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The CFE received on a day, or every one still without an answer",
        "tags": [
          "received"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/received/{id}": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getReceived",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The emisor's number for the CFE received, as GET /v1/emisores/{ruc}/received gives it.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Received"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "One CFE received, and its answer",
        "tags": [
          "received"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/received/{id}/answer": {
      "post": {
        "description": "Rejecting does not void the CFE: it tells its emisor to correct it with a note. The answer goes to the CFE's emisor and cannot be changed.\n\nNeeds a token whose role on the emisor {ruc} is issue or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "answerReceived",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The emisor's number for the CFE received, as GET /v1/emisores/{ruc}/received gives it.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnswerRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Received"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`already_answered`: the CFE received has its answer, which cannot be changed.\n\n`certificate_unavailable`: the emisor's certificate is not on the server, or unusable.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Accept or reject a CFE received",
        "tags": [
          "received"
        ],
        "x-required-role": "issue"
      }
    },
    "/v1/emisores/{ruc}/received/{id}/xml": {
      "get": {
        "description": "Needs a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "getReceivedXML",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The emisor's number for the CFE received, as GET /v1/emisores/{ruc}/received gives it.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/xml": {
                "schema": {
                  "contentMediaType": "application/xml",
                  "type": "string"
                }
              }
            },
            "description": "The CFE as its emisor signed it.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The XML of a CFE received, as its emisor signed it",
        "tags": [
          "received"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/emisores/{ruc}/rut/{other}": {
      "get": {
        "description": "Asks DGI, signed with the emisor's certificate, in the DGI environment of the ledger the request works in, two things at once. Its RUT registry (registry): the name, the domicilio fiscal of the main premises and whether the business activity is in force; from it, receiver is the buyer as a sale takes it, cut to what a CFE holds (shortened says what was cut). Its padrón of emisores electrónicos (padron): whether the RUC is an emisor electrónico today and since when, and its exchange mailbox and web service, where the CFE made out to it go. A part DGI does not answer is absent and named in unanswered; with neither, dgi_unavailable. In Testing, the registry answers only for DGI's test RUCs (code 14 for any other) and the padrón lists only 219999830019, which says nothing of Production. Nothing is recorded.\n\nNeeds a token whose role on the emisor {ruc} is view or more (view < issue < admin). An emisor the caller has no role on answers not_on_record, as one that does not exist.",
        "operationId": "lookUpRUT",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The RUC to look up, 12 digits.",
            "in": "path",
            "name": "other",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          },
          {
            "description": "The DGI environment to work in: testing, where nothing has fiscal effect, or production. With an agent token, leave it out: the token's environment rules, and naming the other fails with environment_mismatch. With a person's token, it chooses; left out, the emisor's only ledger is used, and with one in each environment the request fails with environment_required. Another value fails with usage.",
            "in": "header",
            "name": "CFE-Environment",
            "required": false,
            "schema": {
              "enum": [
                "testing",
                "production"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/RUT"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`ledger_not_found`: the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up.\n\n`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`certificate_unavailable`: the emisor's certificate is not on the server, or unusable.\n\n`environment_mismatch`: the CFE-Environment header names another DGI environment than the one the agent token is bound to.\n\n`environment_required`: the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`dgi_unavailable`: DGI did not answer, or answered with something that is not its answer; nothing was changed, try again later."
          }
        },
        "summary": "What DGI says of a RUC: its RUT registry and its padrón",
        "tags": [
          "emisores"
        ],
        "x-required-role": "view"
      }
    },
    "/v1/health": {
      "get": {
        "description": "Answers ok when the API reaches its data, and unhealthy otherwise. For outside monitors; it says nothing more, since anyone may ask.\n\nPublic: needs no token.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Health"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unhealthy`: the API runs but cannot reach its data."
          }
        },
        "security": [],
        "summary": "Whether the API works",
        "tags": [
          "discovery"
        ]
      }
    },
    "/v1/login": {
      "post": {
        "description": "The person opens the mailed link, which leads to the portal's page at https://cfe.sitios.uy/ingresar/, and confirms there. Opening the link does not confirm, since mail scanners open links on their own. With client cli the answer brings a user_code, which the confirmation page shows too so that the person can compare them, and a poll_secret for POST /v1/login/collect. The answer is the same whether or not the email has an account: only one that has gets the mail. Logins are limited per email and per client address an hour.\n\nPublic: needs no token.",
        "operationId": "startLogin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginStartRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LoginStart"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`portal_unavailable`: logins are not set up: there is no portal page for the links."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`mail_failed`: the login mail, or the monthly summary asked for, could not be sent; try again."
          }
        },
        "security": [],
        "summary": "Start a login: mails the person a link",
        "tags": [
          "login"
        ]
      }
    },
    "/v1/login/collect": {
      "post": {
        "description": "Ask every 5 seconds: it answers login_pending until the person confirms, and then the token, once.\n\nPublic: needs no token.",
        "operationId": "collectLogin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CollectRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TokenSecret"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`login_invalid`: the login is unknown, expired or used."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`login_pending`: the person has not confirmed yet: ask again in a few seconds."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "Get the token of a cli login once the person confirmed",
        "tags": [
          "login"
        ]
      }
    },
    "/v1/login/confirm": {
      "post": {
        "description": "The person confirms with the secret the link carries. A portal login answers its token here; a cli login answers none, and the terminal collects it with POST /v1/login/collect. The login of a signup (POST /v1/signup) also makes its emisor, with the person as its admin and no ledger yet, and answers its RUC in signed_up; if another signup of the RUC was confirmed first, signup_exists.\n\nPublic: needs no token.",
        "operationId": "confirmLogin",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TokenSecret"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`login_invalid`: the login is unknown, expired or used."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`signup_exists`: the RUC is with Sitios already (a ledger, or people with a role on it) or has a signup in course."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "Confirm a login",
        "tags": [
          "login"
        ]
      }
    },
    "/v1/login/info": {
      "post": {
        "description": "The portal's confirmation page calls it with the secret the link carries after the #.\n\nPublic: needs no token.",
        "operationId": "getLoginInfo",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/LoginInfo"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`login_invalid`: the login is unknown, expired or used."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "What a mailed link is for, to show before confirming",
        "tags": [
          "login"
        ]
      }
    },
    "/v1/logout": {
      "post": {
        "description": "Needs a token of any kind and role.",
        "operationId": "logout",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {},
                      "type": "object"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Revoke the token the request carries",
        "tags": [
          "account"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "description": "The first call a program makes: the emisores listed are the only ones it may act on, each with its role, already limited by the token.\n\nNeeds a token of any kind and role.",
        "operationId": "getMe",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Me"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Who the token is, and its role on each emisor",
        "tags": [
          "account"
        ]
      }
    },
    "/v1/openapi.json": {
      "get": {
        "description": "Sent as it is, without the JSON envelope, so that OpenAPI tools read it.\n\nPublic: needs no token.",
        "operationId": "getOpenAPI",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "The OpenAPI 3.1 document."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "This document: every endpoint, as OpenAPI 3.1",
        "tags": [
          "discovery"
        ]
      }
    },
    "/v1/rejection-reasons": {
      "get": {
        "description": "Needs a token of any kind and role.",
        "operationId": "listRejectionReasons",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Reasons"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "DGI's codes for rejecting a CFE received, with their texts",
        "tags": [
          "received"
        ]
      }
    },
    "/v1/signup": {
      "post": {
        "description": "Checks the email and the RUC, that the RUC is not with Sitios already nor has a signup in course (signup_exists), and that DGI's RUT registry has it with its business activity in force (signup_rejected, with data.reason and data.notice). Then it keeps the signup and mails the login link, which leads to the portal's page as any login's. Nothing is made until the person confirms it there (POST /v1/login/confirm): then the business is an emisor, with them as its admin and no ledger yet, which Sitios makes once its certificate is uploaded. Each client address, and each email as its logins, may ask a number of times an hour. Browsers may call it from the portal only.\n\nPublic: needs no token.",
        "operationId": "startSignup",
        "parameters": [
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SignupStarted"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`portal_unavailable`: logins are not set up: there is no portal page for the links.\n\n`signup_exists`: the RUC is with Sitios already (a ledger, or people with a role on it) or has a signup in course."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`signup_rejected`: DGI's RUT registry does not have the RUC with its business activity in force; data.reason says which (not_registered or inactive) and data.notice, in Spanish, what to do."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "502": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`mail_failed`: the login mail, or the monthly summary asked for, could not be sent; try again."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`dgi_unavailable`: DGI did not answer, or answered with something that is not its answer; nothing was changed, try again later.\n\n`signup_unavailable`: signups are not set up on this server: it has no certificate to ask DGI with."
          }
        },
        "security": [],
        "summary": "Ask for a business's signup: mails a login link that makes it an emisor",
        "tags": [
          "signup"
        ]
      }
    },
    "/v1/signup/rut/{ruc}": {
      "get": {
        "description": "The same answer as GET /v1/emisores/{ruc}/rut/{other}, always from DGI's Production and signed with Sitios' certificate, since DGI answers signed requests only. For the business that signs up: whether DGI has it with its activity in force, and whether it is an emisor electrónico today, so it comes from another provider. Each client address, and all of them together a day, may make a number of lookups. Browsers may call it from the portal only.\n\nPublic: needs no token.",
        "operationId": "lookUpSignupRUT",
        "parameters": [
          {
            "description": "The business's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/RUT"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`dgi_unavailable`: DGI did not answer, or answered with something that is not its answer; nothing was changed, try again later.\n\n`signup_unavailable`: signups are not set up on this server: it has no certificate to ask DGI with."
          }
        },
        "security": [],
        "summary": "What DGI says of a business's RUC, before it signs up",
        "tags": [
          "signup"
        ]
      }
    },
    "/v1/tokens": {
      "get": {
        "description": "Needs a token of any kind and role.",
        "operationId": "listTokens",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Tokens"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "The person's tokens, without their secrets",
        "tags": [
          "account"
        ]
      },
      "post": {
        "description": "Only a person's own token makes one, for themselves: an agent token cannot. The secret is in this answer and nowhere else. The token works in one DGI environment for good, testing or production: to move a program to Production, make a production token and swap it; its URLs and code stay the same.\n\nNeeds a token of any kind and role.",
        "operationId": "createToken",
        "parameters": [
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TokenCreated"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Make an agent token, for a program",
        "tags": [
          "account"
        ]
      }
    },
    "/v1/tokens/{id}": {
      "delete": {
        "description": "Needs a token of any kind and role.",
        "operationId": "revokeToken",
        "parameters": [
          {
            "description": "The token's ID, as GET /v1/tokens gives it.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {},
                      "type": "object"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`unauthenticated`: no token, or not one in force."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "summary": "Revoke one of the person's tokens",
        "tags": [
          "account"
        ]
      }
    },
    "/v1/verificar/{ruc}": {
      "get": {
        "description": "Public: needs no token.",
        "operationId": "getVerifiedEmisor",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/VerifiedEmisor"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "The name and DGI environments of an emisor Sitios issues for, for the verification page",
        "tags": [
          "verify"
        ]
      },
      "post": {
        "description": "With what the buyer reads on the printed e-Ticket. Only e-Tickets and their notes: DGI verifies the other types on its own site. A check that fails never says which datum was wrong, and each client address has a limited number of checks an hour.\n\nPublic: needs no token.",
        "operationId": "verifyETicket",
        "parameters": [
          {
            "description": "The emisor's RUC, its 12-digit tax number.",
            "in": "path",
            "name": "ruc",
            "required": true,
            "schema": {
              "pattern": "^[0-9]{12}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "contentMediaType": "application/pdf",
                  "type": "string"
                }
              }
            },
            "description": "The e-Ticket's PDF. Its CFE-Environment header says whether it is of Testing, where it has no fiscal effect.",
            "headers": {
              "CFE-Environment": {
                "description": "The DGI environment of the ledger the answer comes from: testing or production.",
                "schema": {
                  "enum": [
                    "testing",
                    "production"
                  ],
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`not_on_record`: no such emisor (for this caller), CFE, CAE, application, member or token.\n\n`verification_failed`: no e-Ticket matches what the buyer typed; it never says which datum is wrong."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`too_many_requests`: too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          }
        },
        "security": [],
        "summary": "Check a printed e-Ticket and get its PDF",
        "tags": [
          "verify"
        ]
      }
    },
    "/v1/visitor/chat/messages": {
      "delete": {
        "description": "The visitor is the id their browser made, sent in the CFE-Visitor header: 22 to 64 letters, digits, - or _ (usage otherwise). No token. Browsers may call it from the portal only. As DELETE /v1/emisores/{ruc}/chat/messages, on the visitor's thread. A thread idle for weeks is deleted on its own.\n\nPublic: needs no token.",
        "operationId": "deleteVisitorHistory",
        "parameters": [
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatDeletion"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_busy`: the assistant is still answering the previous message of the same chat: wait for its done event."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "security": [],
        "summary": "Delete the visitor's thread's history",
        "tags": [
          "visitor"
        ]
      },
      "get": {
        "description": "The visitor is the id their browser made, sent in the CFE-Visitor header: 22 to 64 letters, digits, - or _ (usage otherwise). No token. Browsers may call it from the portal only. As GET /v1/emisores/{ruc}/chat/messages, on the visitor's thread.\n\nPublic: needs no token.",
        "operationId": "listVisitorMessages",
        "parameters": [
          {
            "description": "Only messages older than this one, by id: the id of the last message of the page before.",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "int64",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "How many messages, 1 to 200; 50 when left out.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatMessages"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "security": [],
        "summary": "The visitor's thread with the assistant, newest first, a page at a time",
        "tags": [
          "visitor"
        ]
      },
      "post": {
        "description": "The visitor is the id their browser made, sent in the CFE-Visitor header: 22 to 64 letters, digits, - or _ (usage otherwise). No token. Browsers may call it from the portal only. Adds the message to the visitor's thread and streams the answer, with the same events as POST /v1/emisores/{ruc}/chat/messages but preview, which there is none of. The assistant answers what the service is and costs and signs the business up; its tools are GET /v1/signup/rut/{ruc} and POST /v1/signup, called with the visitor's origin and address. A visitor, a client address an hour and all visitors together a day may send a number of messages (visitor_chat_limit, with the one reached in data.limit). No dry run.\n\nPublic: needs no token.",
        "operationId": "sendVisitorMessage",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatMessageRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "schema": {
                  "contentMediaType": "text/event-stream",
                  "type": "string"
                }
              }
            },
            "description": "Server-Sent Events, as those of POST /v1/emisores/{ruc}/chat/messages, without preview events."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_busy`: the assistant is still answering the previous message of the same chat: wait for its done event."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`visitor_chat_limit`: the visitors' chat reached a limit; data.limit says which: visitor (this visitor's messages of the day), address (this address's of the hour) or all (every visitor's of the day)."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "security": [],
        "summary": "Send a message to the public page's assistant; the answer streams as Server-Sent Events",
        "tags": [
          "visitor"
        ]
      }
    },
    "/v1/visitor/chat/messages/{id}/feedback": {
      "post": {
        "description": "The visitor is the id their browser made, sent in the CFE-Visitor header: 22 to 64 letters, digits, - or _ (usage otherwise). No token. Browsers may call it from the portal only. As POST /v1/emisores/{ruc}/chat/messages/{id}/feedback, on the visitor's thread.\n\nPublic: needs no token.",
        "operationId": "giveVisitorFeedback",
        "parameters": [
          {
            "description": "The answer's id: answer_id of the done event, or an id of the thread.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            }
          },
          {
            "description": "true checks the change and works it out to the end, answers what it would answer, and keeps nothing.",
            "in": "query",
            "name": "dry_run",
            "required": false,
            "schema": {
              "enum": [
                "true"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatFeedbackRequest"
              }
            }
          },
          "description": "One JSON object, up to 1 MB. A field the schema does not list is refused with input_malformed.",
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ChatFeedback"
                    },
                    "ok": {
                      "const": true
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`input_malformed`: the body is not the JSON expected; unknown fields count.\n\n`usage`: a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`forbidden`: the caller's role on the emisor is not enough."
          },
          "409": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`feedback_given`: the assistant's message already has its 👎, which cannot be changed."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`internal`: an unexpected failure on Sitios' side, which Sitios was told of; try again later."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Failure"
                }
              }
            },
            "description": "`chat_unavailable`: the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works."
          }
        },
        "security": [],
        "summary": "A thumbs down on an answer of the public page's assistant",
        "tags": [
          "visitor"
        ]
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "servers": [
    {
      "description": "production",
      "url": "https://cfe-api.sitios.uy"
    }
  ],
  "tags": [
    {
      "description": "Where the API describes itself, and whether it works.",
      "name": "discovery"
    },
    {
      "description": "How a person gets a token: a link mailed to them, confirmed in Sitios' portal. Programs do not log in: their person gives them an agent token.",
      "name": "login"
    },
    {
      "description": "Who the token is, and the person's own tokens.",
      "name": "account"
    },
    {
      "description": "The emisores the caller may act on: profile, CAEs, alerts, members and the whole ledger.",
      "name": "emisores"
    },
    {
      "description": "The CFE an emisor issues: issue one, list them, get one with its XML and PDF, mail it to the buyer.",
      "name": "cfes"
    },
    {
      "description": "An emisor's month for its accountant: the VAT of its CFE by rate in pesos, the spreadsheet and PDFs, and the monthly mail that carries them.",
      "name": "months"
    },
    {
      "description": "The CFE other emisores sent an emisor as their buyer, and its commercial answer to each.",
      "name": "received"
    },
    {
      "description": "The chat with Sitios' invoicing assistant, for people: one thread per person, emisor and DGI environment, whose tools are this API's own routes, called as the person.",
      "name": "chat"
    },
    {
      "description": "The chat of Sitios' public page, for a visitor without an account: one thread per id the visitor's browser makes, sent in the CFE-Visitor header; it answers what the service is and costs and signs the business up, and has nothing fiscal.",
      "name": "visitor"
    },
    {
      "description": "A business starting with Sitios, without an account: its RUC checked against DGI and a login link mailed, whose confirmation makes the emisor with the person as its admin.",
      "name": "signup"
    },
    {
      "description": "What Sitios charges each emisor a month: the card its admins load through dLocal Go's fields, where the charges stand, and dLocal's notices of them.",
      "name": "billing"
    },
    {
      "description": "The public check a buyer makes of a printed e-Ticket, behind the page at https://cfe.sitios.uy/{ruc}.",
      "name": "verify"
    }
  ],
  "x-error-codes": {
    "already_answered": {
      "meaning": "the CFE received has its answer, which cannot be changed",
      "status": 409
    },
    "application_exceeds": {
      "meaning": "the amount is more than the collection has left to apply (its unapplied) or than the invoice owes (its owed); the message gives both figures",
      "status": 409
    },
    "application_invalid": {
      "meaning": "the collection cannot be applied to that CFE: not a collection and an invoice of the same buyer, the rate missing or out of place, an amount that is not positive cents, or a balance that cannot be told; the message says which",
      "status": 422
    },
    "before_reports": {
      "meaning": "the ledger reports to DGI from a later day: nothing is issued before it",
      "status": 409
    },
    "billing_unavailable": {
      "meaning": "billing is not set up on this server (no billing database, or no dLocal Go keys); everything else works",
      "status": 503
    },
    "cae_invalid": {
      "meaning": "not a CAE for this emisor, or overlapping one on record",
      "status": 422
    },
    "card_rejected": {
      "meaning": "dLocal Go did not save the card: the holder's data or the card's are not what it takes; data.notice says, in Spanish, what to check. Nothing was saved",
      "status": 422
    },
    "certificate_rejected": {
      "meaning": "the certificate sent cannot sign for the emisor; data.reason says why and data.notice, in Spanish, what to do. Nothing was changed",
      "status": 422
    },
    "certificate_unavailable": {
      "meaning": "the emisor's certificate is not on the server, or unusable",
      "status": 409
    },
    "chat_busy": {
      "meaning": "the assistant is still answering the previous message of the same chat: wait for its done event",
      "status": 409
    },
    "chat_limit": {
      "meaning": "the emisor's people sent the chat messages a day allows them (200 unless Sitios set another number); it opens again at midnight in Montevideo",
      "status": 429
    },
    "chat_unavailable": {
      "meaning": "the chat is not set up on this server (no Anthropic API key, or no chat database); everything else works",
      "status": 503
    },
    "dgi_rejected": {
      "meaning": "DGI rejected the CFE: it cannot be mailed, nor take part in an application",
      "status": 409
    },
    "dgi_unavailable": {
      "meaning": "DGI did not answer, or answered with something that is not its answer; nothing was changed, try again later",
      "status": 503
    },
    "dlocal_unavailable": {
      "meaning": "dLocal Go, which keeps the cards, did not answer as expected; nothing was saved, try again later",
      "status": 503
    },
    "environment_mismatch": {
      "meaning": "the CFE-Environment header names another DGI environment than the one the agent token is bound to",
      "status": 409
    },
    "environment_required": {
      "meaning": "the emisor has a ledger in Testing and one in Production, and the request does not say which: send CFE-Environment",
      "status": 409
    },
    "exchange_rate_unknown": {
      "meaning": "a sale in another currency without its rate, which the ledger lacks",
      "status": 422
    },
    "feedback_given": {
      "meaning": "the assistant's message already has its 👎, which cannot be changed",
      "status": 409
    },
    "forbidden": {
      "meaning": "the caller's role on the emisor is not enough",
      "status": 403
    },
    "input_malformed": {
      "meaning": "the body is not the JSON expected; unknown fields count",
      "status": 400
    },
    "internal": {
      "meaning": "an unexpected failure on Sitios' side, which Sitios was told of; try again later",
      "status": 500
    },
    "key_reused": {
      "meaning": "the key was used before for another sale",
      "status": 409
    },
    "last_admin": {
      "meaning": "the change would leave the emisor without an admin",
      "status": 409
    },
    "ledger_not_found": {
      "meaning": "the emisor has no ledger in the DGI environment the request works in, or none yet: Sitios has not finished setting it up",
      "status": 404
    },
    "login_invalid": {
      "meaning": "the login is unknown, expired or used",
      "status": 404
    },
    "login_pending": {
      "meaning": "the person has not confirmed yet: ask again in a few seconds",
      "status": 409
    },
    "logo_invalid": {
      "meaning": "not a PNG or JPEG the printed CFE can carry, or one beside which the profile's appearance no longer fits; the message says why",
      "status": 422
    },
    "mail_failed": {
      "meaning": "the login mail, or the monthly summary asked for, could not be sent; try again",
      "status": 502
    },
    "monthly_mail_unset": {
      "meaning": "nobody gets the monthly mail: the profile's monthly_mail has no recipients, or in DGI's Testing the profile has no testing_mail_to",
      "status": 409
    },
    "no_numbers": {
      "meaning": "no CAE in force has numbers left for the type",
      "status": 409
    },
    "not_found": {
      "meaning": "no such endpoint",
      "status": 404
    },
    "not_on_record": {
      "meaning": "no such emisor (for this caller), CFE, CAE, application, member or token",
      "status": 404
    },
    "pki_unavailable": {
      "meaning": "Uruguay's PKI could not be asked about the certificate sent; nothing was changed, try again later",
      "status": 503
    },
    "portal_unavailable": {
      "meaning": "logins are not set up: there is no portal page for the links",
      "status": 409
    },
    "profile_incomplete": {
      "meaning": "the profile lacks what the step needs",
      "status": 409
    },
    "profile_invalid": {
      "meaning": "data.problems lists every problem of the profile",
      "status": 422
    },
    "profile_missing": {
      "meaning": "the ledger has no profile yet",
      "status": 409
    },
    "sale_invalid": {
      "meaning": "data.problems lists every problem of the sale; no number was used",
      "status": 422
    },
    "signup_exists": {
      "meaning": "the RUC is with Sitios already (a ledger, or people with a role on it) or has a signup in course",
      "status": 409
    },
    "signup_rejected": {
      "meaning": "DGI's RUT registry does not have the RUC with its business activity in force; data.reason says which (not_registered or inactive) and data.notice, in Spanish, what to do",
      "status": 422
    },
    "signup_unavailable": {
      "meaning": "signups are not set up on this server: it has no certificate to ask DGI with",
      "status": 503
    },
    "too_many_requests": {
      "meaning": "too many logins, verifications, signups or signup RUT lookups from this address, of the latter from all addresses today, logins for this email, or certificates or cards tried for this emisor",
      "status": 429
    },
    "unauthenticated": {
      "meaning": "no token, or not one in force",
      "status": 401
    },
    "unhealthy": {
      "meaning": "the API runs but cannot reach its data",
      "status": 503
    },
    "usage": {
      "meaning": "a parameter or field is wrong whatever is on record, such as a CFE-Environment header that names no DGI environment",
      "status": 400
    },
    "verification_failed": {
      "meaning": "no e-Ticket matches what the buyer typed; it never says which datum is wrong",
      "status": 404
    },
    "visitor_chat_limit": {
      "meaning": "the visitors' chat reached a limit; data.limit says which: visitor (this visitor's messages of the day), address (this address's of the hour) or all (every visitor's of the day)",
      "status": 429
    }
  }
}
