{
  "openapi": "3.1.0",
  "info": {
    "title": "FISCO API",
    "version": "1.0.0",
    "description": "Emissão de NFS-e (padrão nacional), NF-e, CT-e e MDF-e. Autenticação: `Authorization: Bearer <chave de API>`. Toda emissão leva `?ref=` (idempotência). Valores monetários e quantidades vão como texto com ponto decimal (\"1500.00\"). Limite de uso por chave com cabeçalhos RateLimit-* e 429 com Retry-After."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "chaveApi": []
    }
  ],
  "tags": [
    {
      "name": "Saúde"
    },
    {
      "name": "NFS-e"
    },
    {
      "name": "NF-e"
    },
    {
      "name": "CT-e"
    },
    {
      "name": "CT-e OS"
    },
    {
      "name": "GTV-e"
    },
    {
      "name": "MDF-e"
    },
    {
      "name": "Arquivo e distribuição"
    },
    {
      "name": "Conta"
    },
    {
      "name": "Webhook"
    }
  ],
  "paths": {
    "/v1/saude": {
      "get": {
        "tags": [
          "Saúde"
        ],
        "summary": "O processo está no ar",
        "operationId": "getV1Saude",
        "security": [],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/saude/pronto": {
      "get": {
        "tags": [
          "Saúde"
        ],
        "summary": "O processo consegue atender (o banco responde); 503 se não",
        "operationId": "getV1SaudePronto",
        "security": [],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/openapi.json": {
      "get": {
        "tags": [
          "Saúde"
        ],
        "summary": "Esta documentação (OpenAPI 3.1)",
        "operationId": "getV1Openapijson",
        "security": [],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/docs": {
      "get": {
        "tags": [
          "Saúde"
        ],
        "summary": "Esta documentação, em página",
        "operationId": "getV1Docs",
        "security": [],
        "responses": {
          "200": {
            "description": "Sucesso"
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/docs/app.js": {
      "get": {
        "tags": [
          "Saúde"
        ],
        "summary": "Script da página de documentação",
        "operationId": "getV1DocsAppjs",
        "security": [],
        "responses": {
          "200": {
            "description": "Sucesso"
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse": {
      "post": {
        "tags": [
          "NFS-e"
        ],
        "summary": "Emite NFS-e (padrão nacional)",
        "description": "O servidor decide série, número, data e ambiente. 201 autorizada; 202 sem resposta conclusiva (a API reconcilia sozinha e avisa pelo webhook); 422 rejeitada ou recusada antes do envio, sem gastar número.",
        "operationId": "postV1Nfse",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "formato",
            "in": "query",
            "required": false,
            "description": "\"api-fiscal\" (padrão, corpo EntradaDps) ou \"focus\" (o JSON da Focus para /v2/nfsen)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaDps"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse/previa": {
      "post": {
        "tags": [
          "NFS-e"
        ],
        "summary": "Prévia: monta, assina e valida sem enviar nem gastar número",
        "operationId": "postV1NfsePrevia",
        "parameters": [
          {
            "name": "formato",
            "in": "query",
            "required": false,
            "description": "\"api-fiscal\" ou \"focus\"",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaDps"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse/{ref}": {
      "get": {
        "tags": [
          "NFS-e"
        ],
        "summary": "Situação da NFS-e",
        "operationId": "getV1NfseRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "NFS-e"
        ],
        "summary": "Cancela a NFS-e",
        "operationId": "deleteV1NfseRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "motivo",
                  "justificativa"
                ],
                "properties": {
                  "motivo": {
                    "type": "string",
                    "enum": [
                      "1",
                      "2",
                      "9"
                    ],
                    "description": "1 erro na emissão · 2 serviço não prestado · 9 outros"
                  },
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse/{ref}/xml": {
      "get": {
        "tags": [
          "NFS-e"
        ],
        "summary": "XML da NFS-e autorizada",
        "operationId": "getV1NfseRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse/{ref}/danfse": {
      "get": {
        "tags": [
          "NFS-e"
        ],
        "summary": "DANFSe (PDF)",
        "operationId": "getV1NfseRefDanfse",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfse/{ref}/substituicao": {
      "post": {
        "tags": [
          "NFS-e"
        ],
        "summary": "Substitui a NFS-e por outra (a original é cancelada pela Sefin)",
        "operationId": "postV1NfseRefSubstituicao",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "ref da NFS-e nova",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "motivo",
                  "nfse"
                ],
                "properties": {
                  "motivo": {
                    "type": "string",
                    "enum": [
                      "01",
                      "02",
                      "03",
                      "04",
                      "05",
                      "99"
                    ]
                  },
                  "descricao": {
                    "type": "string"
                  },
                  "nfse": {
                    "$ref": "#/components/schemas/EntradaDps"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Emite NF-e (modelo 55)",
        "description": "Numeração própria por empresa e série. Com o autorizador fora, sai em contingência (SVC, ou EPEC se a empresa aceitar).",
        "operationId": "postV1Nfe",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "substitui",
            "in": "query",
            "required": false,
            "description": "ref de uma NF-e sem resposta (indefinida) cuja operação esta nota cobre: a primeira é abandonada e regularizada",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaNfe"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/previa": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Prévia da NF-e",
        "operationId": "postV1NfePrevia",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaNfe"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/inutilizacao": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Inutiliza uma faixa de números da série",
        "operationId": "postV1NfeInutilizacao",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "inicio",
                  "fim",
                  "justificativa"
                ],
                "properties": {
                  "empresa": {
                    "type": "string",
                    "description": "CNPJ"
                  },
                  "inicio": {
                    "type": "integer"
                  },
                  "fim": {
                    "type": "integer"
                  },
                  "justificativa": {
                    "type": "string",
                    "minLength": 15
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/{ref}": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "Situação da NF-e",
        "operationId": "getV1NfeRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "NF-e"
        ],
        "summary": "Cancela a NF-e",
        "operationId": "deleteV1NfeRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "justificativa"
                ],
                "properties": {
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/{ref}/xml": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "nfeProc (NF-e autorizada)",
        "operationId": "getV1NfeRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/{ref}/danfe": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "DANFE (PDF), também em EPEC",
        "operationId": "getV1NfeRefDanfe",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/{ref}/cce": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Carta de correção",
        "operationId": "postV1NfeRefCce",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "correcao"
                ],
                "properties": {
                  "correcao": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/recebidas": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "NF-e e eventos recebidos pela empresa (distribuição do Ambiente Nacional), em ordem de NSU",
        "description": "O destinatário recebe o resumo da NF-e até se manifestar; depois da ciência, da confirmação ou da operação não realizada, a NF-e completa. A API consulta o AN sozinha, no ritmo da NT 2014.002 (1 hora quando não há nada novo).",
        "operationId": "getV1NfeRecebidas",
        "parameters": [
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF da empresa do cliente",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apos",
            "in": "query",
            "required": false,
            "description": "NSU a partir do qual listar",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limite",
            "in": "query",
            "required": false,
            "description": "1 a 500 (padrão 100)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/recebidas/{chave}/xml": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "NF-e completa recebida (procNFe); 409 se só o resumo chegou",
        "operationId": "getV1NfeRecebidasChaveXml",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/recebidas/{chave}/manifestacoes": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "Manifestações registradas pela empresa para a chave",
        "operationId": "getV1NfeRecebidasChaveManifestacoes",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/recebidas/{chave}/manifestacao": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Manifestação do destinatário (ciência, confirmação, desconhecimento ou operação não realizada)",
        "description": "Vai ao Ambiente Nacional. Prazos: ciência em 10 dias e manifestação conclusiva em 90 dias da autorização (Ajuste SINIEF 14/26); cada conclusiva pode ser registrada até 2 vezes, vale a última.",
        "operationId": "postV1NfeRecebidasChaveManifestacao",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "tipo"
                ],
                "properties": {
                  "empresa": {
                    "type": "string"
                  },
                  "tipo": {
                    "type": "string",
                    "enum": [
                      "ciencia",
                      "confirmacao",
                      "desconhecimento",
                      "naoRealizada"
                    ]
                  },
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255,
                    "description": "só na operação não realizada (obrigatória)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/eventos-reforma": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Evento da Reforma Tributária (IBS/CBS, NT 2025.002): do emitente, do destinatário ou da sucessora, sobre NF-e própria ou de terceiro",
        "description": "Códigos: 112110 a 112150 (emitente), 211110 a 211150 (destinatário; o 211110 também pelo emitente), 212110 e 212120 (sucessora) e 110001 (cancela um deles). Vai à SVRS, um por lote. A sequência, quando não vem, é a próxima do mesmo código para a chave.",
        "operationId": "postV1NfeEventosreforma",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "chave",
                  "papel",
                  "detalhe"
                ],
                "properties": {
                  "empresa": {
                    "type": "string",
                    "description": "CNPJ ou CPF do autor (empresa do cliente)"
                  },
                  "chave": {
                    "type": "string",
                    "description": "chave da NF-e modelo 55"
                  },
                  "papel": {
                    "type": "string",
                    "enum": [
                      "emitente",
                      "destinatario",
                      "sucessora"
                    ]
                  },
                  "sequencia": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  },
                  "detalhe": {
                    "type": "object",
                    "required": [
                      "codigo"
                    ],
                    "description": "o detalhe do evento (src/nfe/eventos-rtc.ts, DetalheEventoRtc)",
                    "properties": {
                      "codigo": {
                        "type": "string",
                        "enum": [
                          "110001",
                          "112110",
                          "112120",
                          "112130",
                          "112140",
                          "112150",
                          "211110",
                          "211124",
                          "211128",
                          "211130",
                          "211140",
                          "211150",
                          "212110",
                          "212120"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/eventos-reforma/{chave}": {
      "get": {
        "tags": [
          "NF-e"
        ],
        "summary": "Eventos da Reforma registrados pela API para uma chave, com o procEventoNFe",
        "operationId": "getV1NfeEventosreformaChave",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/nfe/{ref}/abandonar": {
      "post": {
        "tags": [
          "NF-e"
        ],
        "summary": "Desiste de uma NF-e sem resposta (a API cancela ou inutiliza o número)",
        "operationId": "postV1NfeRefAbandonar",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "substituidaPor": {
                    "type": "string",
                    "description": "ref da nota que saiu no lugar"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/recebidos": {
      "get": {
        "tags": [
          "CT-e"
        ],
        "summary": "CT-e e eventos recebidos pela empresa (distribuição de DF-e de interesse), em ordem de NSU",
        "description": "CT-e, CT-e OS, GTV-e e CT-e simplificado de terceiros em que a empresa é remetente, destinatária, expedidora, recebedora, tomadora ou autXML; ficam no Ambiente Nacional por 3 meses. A API consulta sozinha, no ritmo da NT 2015.002 (1 hora quando não há nada novo).",
        "operationId": "getV1CteRecebidos",
        "parameters": [
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF da empresa do cliente",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apos",
            "in": "query",
            "required": false,
            "description": "NSU a partir do qual listar",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limite",
            "in": "query",
            "required": false,
            "description": "1 a 500 (padrão 100)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/recebidos/{chave}/xml": {
      "get": {
        "tags": [
          "CT-e"
        ],
        "summary": "XML do CT-e recebido (com o protocolo)",
        "operationId": "getV1CteRecebidosChaveXml",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Emite CT-e (modelo 57): normal, complementar (`complementa`) ou substituto (`substitui`)",
        "operationId": "postV1Cte",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaCte"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/previa": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Prévia do CT-e",
        "operationId": "postV1CtePrevia",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaCte"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}": {
      "get": {
        "tags": [
          "CT-e"
        ],
        "summary": "Situação do CT-e",
        "operationId": "getV1CteRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "CT-e"
        ],
        "summary": "Cancela o CT-e",
        "operationId": "deleteV1CteRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "justificativa"
                ],
                "properties": {
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/xml": {
      "get": {
        "tags": [
          "CT-e"
        ],
        "summary": "cteProc (CT-e autorizado)",
        "operationId": "getV1CteRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/dacte": {
      "get": {
        "tags": [
          "CT-e"
        ],
        "summary": "DACTE (PDF), também em contingência off-line",
        "operationId": "getV1CteRefDacte",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/desacordo": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Tomador: registra a prestação do serviço em desacordo num CT-e recebido (evento 610110)",
        "operationId": "postV1CteDesacordo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "chave",
                  "observacao"
                ],
                "properties": {
                  "empresa": {
                    "type": "string",
                    "description": "CNPJ do tomador (empresa do cliente)"
                  },
                  "chave": {
                    "type": "string",
                    "description": "chave de acesso do CT-e"
                  },
                  "observacao": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  },
                  "sequencia": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/desacordo/cancelamento": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Tomador: cancela o evento de desacordo (610111)",
        "operationId": "postV1CteDesacordoCancelamento",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "chave",
                  "protocolo"
                ],
                "properties": {
                  "empresa": {
                    "type": "string"
                  },
                  "chave": {
                    "type": "string"
                  },
                  "protocolo": {
                    "type": "string",
                    "description": "protocolo do evento de desacordo"
                  },
                  "sequencia": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/cce": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Carta de correção do CT-e",
        "operationId": "postV1CteRefCce",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "correcoes"
                ],
                "properties": {
                  "correcoes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/CorrecaoCte"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/comprovante-entrega": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Comprovante de entrega (evento 110180): quem recebeu, quando, onde e a imagem capturada (só o hash vai à SEFAZ)",
        "operationId": "postV1CteRefComprovanteentrega",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dataHoraEntrega",
                  "documentoRecebedor",
                  "nomeRecebedor"
                ],
                "properties": {
                  "dataHoraEntrega": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "documentoRecebedor": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20
                  },
                  "nomeRecebedor": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 60
                  },
                  "latitude": {
                    "type": "string",
                    "description": "-90.000000 a 90.000000"
                  },
                  "longitude": {
                    "type": "string",
                    "description": "-180.000000 a 180.000000"
                  },
                  "imagem": {
                    "type": "string",
                    "description": "imagem capturada (assinatura, foto), em base64; a API calcula o hash"
                  },
                  "hash": {
                    "type": "string",
                    "description": "ou o hash pronto: Base64(SHA-1(chave + base64 da imagem))"
                  },
                  "nfes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "NF-e entregues (serviço normal)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/comprovante-entrega/cancelamento": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Cancela um comprovante de entrega (evento 110181)",
        "operationId": "postV1CteRefComprovanteentregaCancelamento",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "protocolo"
                ],
                "properties": {
                  "protocolo": {
                    "type": "string",
                    "description": "protocolo do comprovante"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte/{ref}/registro-multimodal": {
      "post": {
        "tags": [
          "CT-e"
        ],
        "summary": "Registros do multimodal (evento 110160), no CT-e do OTM",
        "operationId": "postV1CteRefRegistromultimodal",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "texto"
                ],
                "properties": {
                  "texto": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 1000
                  },
                  "documento": {
                    "type": "string",
                    "description": "até 44 dígitos"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Emite CT-e OS (modelo 67: pessoas, valores ou excesso de bagagem): normal, complementar ou substituto",
        "operationId": "postV1Cteos",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaCteOs"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/previa": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Prévia do CT-e OS",
        "operationId": "postV1CteosPrevia",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaCteOs"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/{ref}": {
      "get": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Situação do CT-e OS",
        "operationId": "getV1CteosRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Cancela o CT-e OS",
        "operationId": "deleteV1CteosRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "justificativa"
                ],
                "properties": {
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/{ref}/xml": {
      "get": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "cteOSProc (CT-e OS autorizado)",
        "operationId": "getV1CteosRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/{ref}/dacte": {
      "get": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "DACTE OS (PDF), também em contingência off-line",
        "operationId": "getV1CteosRefDacte",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/desacordo": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Tomador: registra a prestação do serviço em desacordo num CT-e OS recebido (evento 610110)",
        "operationId": "postV1CteosDesacordo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "chave",
                  "observacao"
                ],
                "properties": {
                  "empresa": {
                    "type": "string",
                    "description": "CNPJ do tomador (empresa do cliente)"
                  },
                  "chave": {
                    "type": "string",
                    "description": "chave de acesso do CT-e OS"
                  },
                  "observacao": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  },
                  "sequencia": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/desacordo/cancelamento": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Tomador: cancela o evento de desacordo (610111)",
        "operationId": "postV1CteosDesacordoCancelamento",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "empresa",
                  "chave",
                  "protocolo"
                ],
                "properties": {
                  "empresa": {
                    "type": "string"
                  },
                  "chave": {
                    "type": "string"
                  },
                  "protocolo": {
                    "type": "string",
                    "description": "protocolo do evento de desacordo"
                  },
                  "sequencia": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/{ref}/cce": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Carta de correção do CT-e OS",
        "operationId": "postV1CteosRefCce",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "correcoes"
                ],
                "properties": {
                  "correcoes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/CorrecaoCte"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/cte-os/{ref}/gtv": {
      "post": {
        "tags": [
          "CT-e OS"
        ],
        "summary": "Informações das GTV em papel do transporte de valores (evento 110170), até 45 dias da autorização",
        "operationId": "postV1CteosRefGtv",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "gtvs"
                ],
                "properties": {
                  "gtvs": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/gtve": {
      "post": {
        "tags": [
          "GTV-e"
        ],
        "summary": "Emite GTV-e (modelo 64, guia de transporte de valores)",
        "operationId": "postV1Gtve",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaGtve"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/gtve/previa": {
      "post": {
        "tags": [
          "GTV-e"
        ],
        "summary": "Prévia da GTV-e",
        "operationId": "postV1GtvePrevia",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaGtve"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/gtve/{ref}": {
      "get": {
        "tags": [
          "GTV-e"
        ],
        "summary": "Situação da GTV-e",
        "operationId": "getV1GtveRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "GTV-e"
        ],
        "summary": "Cancela a GTV-e",
        "operationId": "deleteV1GtveRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "justificativa"
                ],
                "properties": {
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/gtve/{ref}/xml": {
      "get": {
        "tags": [
          "GTV-e"
        ],
        "summary": "GTVeProc (GTV-e autorizada)",
        "operationId": "getV1GtveRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/recebidos": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "MDF-e e eventos recebidos pela empresa (distribuição de DF-e de interesse), em ordem de NSU",
        "description": "MDF-e de terceiros em que a empresa é contratante, proprietária do veículo (RNTRC diferente do emitente) ou autXML, com cancelamento, encerramento e inclusão de condutor; ficam disponíveis por 6 meses. A API consulta sozinha, no ritmo da NT 2015.002 (1 hora quando não há nada novo).",
        "operationId": "getV1MdfeRecebidos",
        "parameters": [
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF da empresa do cliente",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apos",
            "in": "query",
            "required": false,
            "description": "NSU a partir do qual listar",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limite",
            "in": "query",
            "required": false,
            "description": "1 a 500 (padrão 100)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/recebidos/{chave}/xml": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "XML do MDF-e recebido (com o protocolo)",
        "operationId": "getV1MdfeRecebidosChaveXml",
        "parameters": [
          {
            "name": "chave",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "empresa",
            "in": "query",
            "required": false,
            "description": "CNPJ ou CPF",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe": {
      "post": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Emite MDF-e (modelo 58, rodoviário)",
        "operationId": "postV1Mdfe",
        "parameters": [
          {
            "name": "ref",
            "in": "query",
            "required": true,
            "description": "Sua referência única para o documento (1 a 64: letras, números, \".\", \"_\", \"-\"). É ela que impede documento duplicado: o mesmo ref devolve o mesmo documento.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaMdfe"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "202": {
            "description": "Aceito, sem desfecho ainda (acompanhe pelo GET ou pelo webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/previa": {
      "post": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Prévia do MDF-e",
        "operationId": "postV1MdfePrevia",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EntradaMdfe"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/nao-encerrados": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "MDF-e autorizados e não encerrados do emitente (direto na SVRS)",
        "operationId": "getV1MdfeNaoencerrados",
        "parameters": [
          {
            "name": "empresa",
            "in": "query",
            "required": true,
            "description": "CNPJ/CPF do emitente",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Situação do MDF-e",
        "operationId": "getV1MdfeRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Cancela o MDF-e",
        "operationId": "deleteV1MdfeRef",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "justificativa"
                ],
                "properties": {
                  "justificativa": {
                    "type": "string",
                    "minLength": 15,
                    "maxLength": 255
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}/xml": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "mdfeProc (MDF-e autorizado)",
        "operationId": "getV1MdfeRefXml",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}/damdfe": {
      "get": {
        "tags": [
          "MDF-e"
        ],
        "summary": "DAMDFE (PDF), também em contingência off-line",
        "operationId": "getV1MdfeRefDamdfe",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}/encerramento": {
      "post": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Encerra o MDF-e",
        "operationId": "postV1MdfeRefEncerramento",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cUF",
                  "codigoMunicipio"
                ],
                "properties": {
                  "cUF": {
                    "type": "string",
                    "description": "código IBGE da UF (99 = exterior)"
                  },
                  "codigoMunicipio": {
                    "type": "string",
                    "description": "IBGE, 7 dígitos (9999999 no exterior)"
                  },
                  "data": {
                    "type": "string",
                    "format": "date",
                    "description": "padrão: hoje"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}/condutor": {
      "post": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Inclui condutor",
        "operationId": "postV1MdfeRefCondutor",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "nome",
                  "cpf"
                ],
                "properties": {
                  "nome": {
                    "type": "string"
                  },
                  "cpf": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/mdfe/{ref}/dfe": {
      "post": {
        "tags": [
          "MDF-e"
        ],
        "summary": "Inclusão de DF-e (MDF-e com carregamento posterior)",
        "operationId": "postV1MdfeRefDfe",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "carregamento",
                  "documentos"
                ],
                "properties": {
                  "carregamento": {
                    "type": "object",
                    "properties": {
                      "codigo": {
                        "type": "string"
                      },
                      "nome": {
                        "type": "string"
                      }
                    }
                  },
                  "documentos": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "descarregamento": {
                          "type": "object",
                          "properties": {
                            "codigo": {
                              "type": "string"
                            },
                            "nome": {
                              "type": "string"
                            }
                          }
                        },
                        "chaveNfe": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumoDocumento"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/arquivo": {
      "get": {
        "tags": [
          "Arquivo e distribuição"
        ],
        "summary": "XML guardados (5 anos) para uma chave de acesso",
        "operationId": "getV1Arquivo",
        "parameters": [
          {
            "name": "chave",
            "in": "query",
            "required": true,
            "description": "chave de acesso",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/arquivo/{id}/xml": {
      "get": {
        "tags": [
          "Arquivo e distribuição"
        ],
        "summary": "Um XML guardado",
        "operationId": "getV1ArquivoIdXml",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/distribuicao": {
      "get": {
        "tags": [
          "Arquivo e distribuição"
        ],
        "summary": "NFS-e e eventos de terceiros recebidos pelo ADN para a empresa, por NSU",
        "operationId": "getV1Distribuicao",
        "parameters": [
          {
            "name": "empresa",
            "in": "query",
            "required": true,
            "description": "CNPJ/CPF",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "aposNsu",
            "in": "query",
            "required": false,
            "description": "o último NSU já lido (0 no começo)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limite",
            "in": "query",
            "required": false,
            "description": "1 a 500",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/distribuicao/{empresa}/{nsu}/xml": {
      "get": {
        "tags": [
          "Arquivo e distribuição"
        ],
        "summary": "XML de um documento recebido",
        "operationId": "getV1DistribuicaoEmpresaNsuXml",
        "parameters": [
          {
            "name": "empresa",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "nsu",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/documentos": {
      "get": {
        "tags": [
          "Conta"
        ],
        "summary": "Os documentos do cliente, os mais recentes primeiro",
        "operationId": "getV1Documentos",
        "parameters": [
          {
            "name": "tipo",
            "in": "query",
            "required": false,
            "description": "nfse (padrão), nfe, cte, cteos, gtve ou mdfe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "situacao",
            "in": "query",
            "required": false,
            "description": "filtra pela situação",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limite",
            "in": "query",
            "required": false,
            "description": "1 a 200 (padrão 50)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/uso": {
      "get": {
        "tags": [
          "Conta"
        ],
        "summary": "Documentos autorizados no mês (a base da cobrança)",
        "operationId": "getV1Uso",
        "parameters": [
          {
            "name": "mes",
            "in": "query",
            "required": false,
            "description": "AAAA-MM; padrão: o mês corrente em Brasília",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    },
    "/v1/webhook": {
      "put": {
        "tags": [
          "Webhook"
        ],
        "summary": "Configura o endereço que recebe os avisos (o segredo aparece só nesta resposta)",
        "operationId": "putV1Webhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "get": {
        "tags": [
          "Webhook"
        ],
        "summary": "Endereço configurado",
        "operationId": "getV1Webhook",
        "responses": {
          "200": {
            "description": "Sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhook"
        ],
        "summary": "Remove o webhook",
        "operationId": "deleteV1Webhook",
        "responses": {
          "204": {
            "description": "Feito"
          },
          "400": {
            "$ref": "#/components/responses/Erro"
          },
          "401": {
            "$ref": "#/components/responses/Erro"
          },
          "404": {
            "$ref": "#/components/responses/Erro"
          },
          "409": {
            "$ref": "#/components/responses/Erro"
          },
          "422": {
            "$ref": "#/components/responses/Erro"
          },
          "429": {
            "$ref": "#/components/responses/Erro"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "chaveApi": {
        "type": "http",
        "scheme": "bearer",
        "description": "Chave de API do cliente (af_…)"
      }
    },
    "responses": {
      "Erro": {
        "description": "Erro",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Erro"
            }
          }
        }
      }
    },
    "schemas": {
      "Substituicao": {
        "type": "object",
        "properties": {
          "chave": {
            "type": "string",
            "description": "chSubstda: chave (50) da NFS-e substituída"
          },
          "motivo": {
            "type": "string",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "99"
            ],
            "description": "cMotivo: 01 a 05 ou 99"
          },
          "descricao": {
            "type": "string",
            "description": "xMotivo: 15 a 255 caracteres"
          }
        },
        "required": [
          "chave",
          "motivo"
        ],
        "additionalProperties": false
      },
      "Prestador": {
        "type": "object",
        "properties": {
          "caepf": {
            "type": "string",
            "description": "CAEPF (14 dígitos)"
          },
          "inscricaoMunicipal": {
            "type": "string",
            "description": "IM: inscrição municipal"
          },
          "endereco": {
            "$ref": "#/components/schemas/Endereco"
          },
          "telefone": {
            "type": "string",
            "description": "fone: só dígitos, 6 a 20"
          },
          "email": {
            "type": "string"
          },
          "documento": {
            "$ref": "#/components/schemas/Documento"
          },
          "nome": {
            "type": "string",
            "description": "xNome: opcional para o prestador (a Sefin pega do cadastro)"
          },
          "regime": {
            "$ref": "#/components/schemas/RegimeTributario"
          }
        },
        "required": [
          "documento",
          "regime"
        ],
        "additionalProperties": false
      },
      "Endereco": {
        "anyOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "municipio": {
                "type": "string",
                "description": "cMun: código IBGE do município (7 dígitos)"
              },
              "cep": {
                "type": "string",
                "description": "CEP (8 dígitos)"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "tipo": {
                "type": "string",
                "const": "nacional"
              }
            },
            "required": [
              "bairro",
              "cep",
              "logradouro",
              "municipio",
              "numero",
              "tipo"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "pais": {
                "type": "string",
                "description": "cPais: código ISO de 2 letras"
              },
              "codigoPostal": {
                "type": "string"
              },
              "cidade": {
                "type": "string"
              },
              "estadoProvinciaRegiao": {
                "type": "string"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "tipo": {
                "type": "string",
                "const": "exterior"
              }
            },
            "required": [
              "bairro",
              "cidade",
              "codigoPostal",
              "estadoProvinciaRegiao",
              "logradouro",
              "numero",
              "pais",
              "tipo"
            ]
          }
        ]
      },
      "Documento": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "CNPJ"
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "CPF"
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "NIF"
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "semNif"
              },
              "motivo": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2"
                ]
              }
            },
            "required": [
              "tipo",
              "motivo"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Identificação de pessoa. `semNif`: motivo da ausência de NIF do estrangeiro (cNaoNIF 0, 1 ou 2)."
      },
      "RegimeTributario": {
        "type": "object",
        "properties": {
          "opcaoSimplesNacional": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "opSimpNac: 1 não optante · 2 MEI · 3 ME/EPP"
          },
          "regimeApuracaoSimples": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "regApTribSN: regime de apuração do Simples (1, 2 ou 3). Obrigatório quando opSimpNac = 3"
          },
          "regimeEspecial": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "9"
            ],
            "description": "regEspTrib: 0 nenhum · 1 ato cooperado · 2 estimativa · 3 ME municipal · 4 notário · 5 autônomo · 6 sociedade de profissionais · 9 outros"
          }
        },
        "required": [
          "opcaoSimplesNacional",
          "regimeEspecial"
        ],
        "additionalProperties": false
      },
      "Pessoa": {
        "type": "object",
        "properties": {
          "documento": {
            "$ref": "#/components/schemas/Documento"
          },
          "caepf": {
            "type": "string",
            "description": "CAEPF (14 dígitos)"
          },
          "inscricaoMunicipal": {
            "type": "string",
            "description": "IM: inscrição municipal"
          },
          "nome": {
            "type": "string",
            "description": "xNome"
          },
          "endereco": {
            "$ref": "#/components/schemas/Endereco"
          },
          "telefone": {
            "type": "string",
            "description": "fone: só dígitos, 6 a 20"
          },
          "email": {
            "type": "string"
          }
        },
        "required": [
          "documento",
          "nome"
        ],
        "additionalProperties": false
      },
      "Servico": {
        "type": "object",
        "properties": {
          "localPrestacao": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "municipio": {
                    "type": "string"
                  }
                },
                "required": [
                  "municipio"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "pais": {
                    "type": "string"
                  }
                },
                "required": [
                  "pais"
                ],
                "additionalProperties": false
              }
            ],
            "description": "locPrest: município (IBGE) ou país (ISO) da prestação"
          },
          "codigoTributacaoNacional": {
            "type": "string",
            "description": "cTribNac: 6 dígitos (item, subitem e desdobro da lista nacional)"
          },
          "codigoTributacaoMunicipal": {
            "type": "string",
            "description": "cTribMun: 3 dígitos na Sefin; no ISSnet, obrigatório e inteiro de até 10 dígitos"
          },
          "descricao": {
            "type": "string",
            "description": "xDescServ: até 2000 caracteres"
          },
          "nbs": {
            "type": "string",
            "description": "cNBS: 9 dígitos. Obrigatório quando o grupo IBS/CBS é informado (E0322)"
          },
          "codigoInterno": {
            "type": "string",
            "description": "cIntContrib: código interno do contribuinte"
          },
          "comercioExterior": {
            "$ref": "#/components/schemas/ComercioExterior",
            "description": "comExt: comércio exterior. Obrigatório quando o prestador emite e o tomador, o intermediário ou o local da prestação está no exterior, ou o ISS é de exportação (E0330); e quando o tomador ou o intermediário emitem e o prestador ou o local da prestação está no exterior (importação, E0331)."
          },
          "obra": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "processoMunicipal": {
                    "type": "string",
                    "description": "nProcessoObra: número do processo da obra no cadastro municipal, 1 a 20 caracteres. Só no ISSnet"
                  },
                  "codigoObra": {
                    "type": "string"
                  },
                  "inscricaoImobiliaria": {
                    "type": "string"
                  }
                },
                "required": [
                  "codigoObra"
                ]
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "processoMunicipal": {
                    "type": "string",
                    "description": "nProcessoObra: número do processo da obra no cadastro municipal, 1 a 20 caracteres. Só no ISSnet"
                  },
                  "cib": {
                    "type": "string"
                  },
                  "inscricaoImobiliaria": {
                    "type": "string"
                  }
                },
                "required": [
                  "cib"
                ]
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "processoMunicipal": {
                    "type": "string",
                    "description": "nProcessoObra: número do processo da obra no cadastro municipal, 1 a 20 caracteres. Só no ISSnet"
                  },
                  "endereco": {
                    "$ref": "#/components/schemas/EnderecoSimples"
                  },
                  "inscricaoImobiliaria": {
                    "type": "string"
                  }
                },
                "required": [
                  "endereco"
                ]
              }
            ],
            "description": "obra: código da obra (CNO etc.), CIB ou endereço"
          },
          "evento": {
            "$ref": "#/components/schemas/AtividadeEvento",
            "description": "atvEvento"
          },
          "informacoesComplementares": {
            "type": "string",
            "description": "infoCompl/xInfComp"
          }
        },
        "required": [
          "localPrestacao",
          "codigoTributacaoNacional",
          "descricao"
        ],
        "additionalProperties": false
      },
      "ComercioExterior": {
        "type": "object",
        "properties": {
          "modoPrestacao": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "mdPrestacao: 1 transfronteiriço · 2 consumo no Brasil · 3 presença comercial no exterior · 4 movimento temporário de pessoas físicas"
          },
          "vinculo": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "9"
            ],
            "description": "vincPrest: 0 sem vínculo · 1 controlada · 2 controladora · 3 coligada · 4 matriz · 5 filial ou sucursal · 6 outro · 9 desconhecido"
          },
          "moeda": {
            "type": "string",
            "description": "tpMoeda: código da moeda na tabela do BACEN (3 dígitos)"
          },
          "valorMoeda": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vServMoeda: valor do serviço na moeda estrangeira"
          },
          "mecanismoPrestador": {
            "type": "string",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08"
            ],
            "description": "mecAFComexP: 01 nenhum · 02 ACC · 03 ACE · 04/05 BNDES-Exim · 06 FGE · 07/08 PROEX"
          },
          "mecanismoTomador": {
            "type": "string",
            "description": "mecAFComexT: 01 nenhum · 02 a 26 conforme o leiaute (TSMecAFComExToma)"
          },
          "movimentacaoTemporaria": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "movTempBens: 1 não · 2 vinculada a declaração de importação · 3 vinculada a declaração de exportação"
          },
          "declaracaoImportacao": {
            "type": "string",
            "description": "nDI: obrigatório com movTempBens 2 (E0352)"
          },
          "registroExportacao": {
            "type": "string",
            "description": "nRE: obrigatório com movTempBens 3 (E0356)"
          },
          "enviarMdic": {
            "type": "boolean",
            "description": "mdic: compartilhar a NFS-e com a Secretaria de Comércio Exterior"
          }
        },
        "required": [
          "modoPrestacao",
          "vinculo",
          "moeda",
          "valorMoeda",
          "mecanismoPrestador",
          "mecanismoTomador",
          "movimentacaoTemporaria",
          "enviarMdic"
        ],
        "additionalProperties": false,
        "description": "TCComExterior. Os códigos 0/00 (\"desconhecido, não informado na nota de origem\") são recusados pela Sefin"
      },
      "Decimal": {
        "type": [
          "string",
          "number"
        ]
      },
      "EnderecoSimples": {
        "anyOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "cep": {
                "type": "string"
              },
              "municipio": {
                "type": "string"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              }
            },
            "required": [
              "bairro",
              "cep",
              "logradouro",
              "numero"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "exterior": {
                "type": "object",
                "properties": {
                  "codigoPostal": {
                    "type": "string"
                  },
                  "cidade": {
                    "type": "string"
                  },
                  "estadoProvinciaRegiao": {
                    "type": "string"
                  },
                  "pais": {
                    "type": "string"
                  }
                },
                "required": [
                  "codigoPostal",
                  "cidade",
                  "estadoProvinciaRegiao"
                ],
                "additionalProperties": false
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              }
            },
            "required": [
              "bairro",
              "exterior",
              "logradouro",
              "numero"
            ]
          }
        ],
        "description": "Endereço de obra, evento ou imóvel. Na Sefin (TCEnderObraEvento) é CEP nacional OU endereço no exterior, sem município. No ISSnet (TCEndereco) o município (cMun) e o país (cPais) são obrigatórios: por isso os dois existem aqui como opcionais, e a Sefin os ignora."
      },
      "AtividadeEvento": {
        "type": "object",
        "properties": {
          "nome": {
            "type": "string"
          },
          "inicio": {
            "type": "string",
            "description": "AAAA-MM-DD"
          },
          "fim": {
            "type": "string"
          },
          "local": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "codigo": {
                    "type": "string"
                  }
                },
                "required": [
                  "codigo"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "endereco": {
                    "$ref": "#/components/schemas/EnderecoSimples"
                  }
                },
                "required": [
                  "endereco"
                ],
                "additionalProperties": false
              }
            ],
            "description": "idAtvEvt (código do evento na prefeitura) OU endereço"
          }
        },
        "required": [
          "nome",
          "inicio",
          "fim",
          "local"
        ],
        "additionalProperties": false
      },
      "Valores": {
        "type": "object",
        "properties": {
          "servico": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vServ"
          },
          "recebidoIntermediario": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vReceb: valor recebido pelo intermediário"
          },
          "descontoIncondicionado": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vDescIncond"
          },
          "descontoCondicionado": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vDescCond"
          },
          "deducaoReducao": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "percentual": {
                    "$ref": "#/components/schemas/Decimal"
                  }
                },
                "required": [
                  "percentual"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "valor": {
                    "$ref": "#/components/schemas/Decimal"
                  }
                },
                "required": [
                  "valor"
                ],
                "additionalProperties": false
              }
            ],
            "description": "vDedRed: percentual (pDR) ou valor (vDR). Dedução por documentos ainda não suportada"
          }
        },
        "required": [
          "servico"
        ],
        "additionalProperties": false
      },
      "TributacaoIss": {
        "type": "object",
        "properties": {
          "tributacao": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "tribISSQN: 1 tributável · 2 imunidade · 3 exportação · 4 não incidência"
          },
          "paisResultado": {
            "type": "string",
            "description": "cPaisResult: país do resultado (exportação)"
          },
          "tipoImunidade": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5"
            ],
            "description": "tpImunidade: 0 a 5"
          },
          "exigibilidadeSuspensa": {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "enum": [
                  "1",
                  "2"
                ]
              },
              "processo": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "processo"
            ],
            "additionalProperties": false,
            "description": "exigSusp"
          },
          "beneficioMunicipal": {
            "type": "object",
            "properties": {
              "numero": {
                "type": "string"
              },
              "reducaoBaseValor": {
                "$ref": "#/components/schemas/Decimal"
              },
              "reducaoBasePercentual": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "numero"
            ],
            "additionalProperties": false,
            "description": "BM: benefício municipal"
          },
          "retencao": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "tpRetISSQN: 1 não retido · 2 retido pelo tomador · 3 retido pelo intermediário"
          },
          "aliquota": {
            "$ref": "#/components/schemas/Decimal",
            "description": "pAliq: alíquota do ISS (0 a 9.99)"
          }
        },
        "required": [
          "tributacao",
          "retencao"
        ],
        "additionalProperties": false
      },
      "TributacaoFederal": {
        "type": "object",
        "properties": {
          "pisCofins": {
            "type": "object",
            "properties": {
              "cst": {
                "type": "string",
                "description": "CST de PIS/COFINS (00 a 99, conforme a tabela do XSD)"
              },
              "base": {
                "$ref": "#/components/schemas/Decimal"
              },
              "aliquotaPis": {
                "$ref": "#/components/schemas/Decimal"
              },
              "aliquotaCofins": {
                "$ref": "#/components/schemas/Decimal"
              },
              "valorPis": {
                "$ref": "#/components/schemas/Decimal"
              },
              "valorCofins": {
                "$ref": "#/components/schemas/Decimal"
              },
              "tipoRetencao": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2",
                  "3",
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9"
                ],
                "description": "tpRetPisCofins"
              }
            },
            "required": [
              "cst"
            ],
            "additionalProperties": false
          },
          "retencaoContribuicaoPrevidenciaria": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vRetCP"
          },
          "retencaoIrrf": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vRetIRRF"
          },
          "retencaoCsll": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vRetCSLL"
          }
        },
        "additionalProperties": false
      },
      "TotalTributos": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "valor"
              },
              "federal": {
                "$ref": "#/components/schemas/Decimal"
              },
              "estadual": {
                "$ref": "#/components/schemas/Decimal"
              },
              "municipal": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "federal",
              "estadual",
              "municipal"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "percentual"
              },
              "federal": {
                "$ref": "#/components/schemas/Decimal"
              },
              "estadual": {
                "$ref": "#/components/schemas/Decimal"
              },
              "municipal": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "federal",
              "estadual",
              "municipal"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "naoInformado"
              }
            },
            "required": [
              "tipo"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "simplesNacional"
              },
              "percentual": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "percentual"
            ],
            "additionalProperties": false
          }
        ],
        "description": "totTrib: valor aproximado dos tributos (Lei 12.741/2012), em uma das quatro formas do leiaute"
      },
      "IbsCbs": {
        "type": "object",
        "properties": {
          "finalidade": {
            "type": "string",
            "const": "0",
            "description": "finNFSe: 0 = NFS-e regular"
          },
          "consumidorFinal": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "indFinal: 0 não · 1 sim (consumidor final)"
          },
          "indicadorOperacao": {
            "type": "string",
            "description": "cIndOp: 6 dígitos, tabela do Anexo C/VII"
          },
          "tipoOperacao": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4",
              "5"
            ],
            "description": "tpOper"
          },
          "tipoEnteGovernamental": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "tpEnteGov"
          },
          "indicadorDestinatario": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "indDest: 0 o destinatário é o tomador · 1 há destinatário diferente (grupo dest)"
          },
          "destinatario": {
            "$ref": "#/components/schemas/Pessoa",
            "description": "dest: obrigatório quando indDest = 1"
          },
          "imovel": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cib": {
                    "type": "string"
                  },
                  "inscricaoImobiliaria": {
                    "type": "string"
                  }
                },
                "required": [
                  "cib"
                ]
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "endereco": {
                    "$ref": "#/components/schemas/EnderecoSimples"
                  },
                  "inscricaoImobiliaria": {
                    "type": "string"
                  }
                },
                "required": [
                  "endereco"
                ]
              }
            ],
            "description": "imovel: cCIB ou endereço (código de obra não vale aqui)"
          },
          "cst": {
            "type": "string",
            "description": "CST do IBS/CBS (3 dígitos). Vem do cadastro; nunca tem padrão"
          },
          "classificacaoTributaria": {
            "type": "string",
            "description": "cClassTrib (6 dígitos). Os 3 primeiros dígitos são o CST (E0959)"
          },
          "creditoPresumido": {
            "type": "string",
            "description": "cCredPres"
          },
          "tributacaoRegular": {
            "type": "object",
            "properties": {
              "cst": {
                "type": "string"
              },
              "classificacaoTributaria": {
                "type": "string"
              }
            },
            "required": [
              "cst",
              "classificacaoTributaria"
            ],
            "additionalProperties": false,
            "description": "gTribRegular"
          },
          "diferimento": {
            "type": "object",
            "properties": {
              "uf": {
                "$ref": "#/components/schemas/Decimal"
              },
              "municipio": {
                "$ref": "#/components/schemas/Decimal"
              },
              "cbs": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "uf",
              "municipio",
              "cbs"
            ],
            "additionalProperties": false,
            "description": "gDif: percentuais de diferimento"
          }
        },
        "required": [
          "finalidade",
          "indicadorOperacao",
          "indicadorDestinatario",
          "cst",
          "classificacaoTributaria"
        ],
        "additionalProperties": false
      },
      "EntradaDps": {
        "type": "object",
        "properties": {
          "competencia": {
            "type": "string",
            "description": "dCompet: data do fato gerador, AAAA-MM-DD"
          },
          "emitente": {
            "type": "string",
            "enum": [
              "prestador",
              "tomador",
              "intermediario"
            ],
            "description": "tpEmit: quem emite a DPS (padrão do leiaute: prestador)"
          },
          "municipioEmissor": {
            "type": "string",
            "description": "cLocEmi: IBGE do município emissor"
          },
          "substituicao": {
            "$ref": "#/components/schemas/Substituicao"
          },
          "prestador": {
            "$ref": "#/components/schemas/Prestador"
          },
          "tomador": {
            "$ref": "#/components/schemas/Pessoa"
          },
          "intermediario": {
            "$ref": "#/components/schemas/Pessoa"
          },
          "servico": {
            "$ref": "#/components/schemas/Servico"
          },
          "valores": {
            "$ref": "#/components/schemas/Valores"
          },
          "iss": {
            "$ref": "#/components/schemas/TributacaoIss"
          },
          "federal": {
            "$ref": "#/components/schemas/TributacaoFederal"
          },
          "totalTributos": {
            "$ref": "#/components/schemas/TotalTributos"
          },
          "ibsCbs": {
            "$ref": "#/components/schemas/IbsCbs"
          }
        },
        "required": [
          "competencia",
          "emitente",
          "municipioEmissor",
          "prestador",
          "servico",
          "valores",
          "iss",
          "totalTributos"
        ],
        "additionalProperties": false,
        "description": "Entrada no formato próprio: o servidor decide ambiente, data de emissão, versão, série e número."
      },
      "Emitente": {
        "type": "object",
        "properties": {
          "documento": {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "enum": [
                  "CNPJ",
                  "CPF"
                ]
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          },
          "nome": {
            "type": "string"
          },
          "nomeFantasia": {
            "type": "string"
          },
          "endereco": {
            "$ref": "#/components/schemas/EnderecoNfe"
          },
          "inscricaoEstadual": {
            "type": "string",
            "description": "IE: ausente só para contribuinte exclusivo de IBS/CBS (NT 2026.007, autoriza só na SVRS)"
          },
          "regime": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "CRT: 1 Simples · 2 Simples com excesso de sublimite · 3 regime normal · 4 MEI"
          }
        },
        "required": [
          "documento",
          "nome",
          "endereco",
          "regime"
        ],
        "additionalProperties": false
      },
      "EnderecoNfe": {
        "type": "object",
        "properties": {
          "logradouro": {
            "type": "string"
          },
          "numero": {
            "type": "string"
          },
          "complemento": {
            "type": "string"
          },
          "bairro": {
            "type": "string"
          },
          "municipio": {
            "type": "string",
            "description": "cMun: IBGE (7 dígitos)"
          },
          "nomeMunicipio": {
            "type": "string",
            "description": "xMun"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          },
          "cep": {
            "type": "string"
          },
          "telefone": {
            "type": "string"
          }
        },
        "required": [
          "logradouro",
          "numero",
          "bairro",
          "municipio",
          "nomeMunicipio",
          "uf",
          "cep"
        ],
        "additionalProperties": false
      },
      "Uf": {
        "type": "string",
        "enum": [
          "RO",
          "AC",
          "AM",
          "RR",
          "PA",
          "AP",
          "TO",
          "MA",
          "PI",
          "CE",
          "RN",
          "PB",
          "PE",
          "AL",
          "SE",
          "BA",
          "MG",
          "ES",
          "RJ",
          "SP",
          "PR",
          "SC",
          "RS",
          "MS",
          "MT",
          "GO",
          "DF"
        ]
      },
      "Destinatario": {
        "type": "object",
        "properties": {
          "documento": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "tipo": {
                    "type": "string",
                    "enum": [
                      "CNPJ",
                      "CPF"
                    ]
                  },
                  "numero": {
                    "type": "string"
                  }
                },
                "required": [
                  "tipo",
                  "numero"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "tipo": {
                    "type": "string",
                    "const": "estrangeiro"
                  },
                  "numero": {
                    "type": "string"
                  }
                },
                "required": [
                  "tipo",
                  "numero"
                ],
                "additionalProperties": false
              }
            ],
            "description": "estrangeiro: idEstrangeiro (passaporte ou documento do país; 5 a 20 caracteres, ou vazio)"
          },
          "nome": {
            "type": "string",
            "description": "Em homologação é substituído pelo texto obrigatório (regra E04-20)"
          },
          "endereco": {
            "$ref": "#/components/schemas/EnderecoDestinatario"
          },
          "indicadorIe": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "9"
            ],
            "description": "indIEDest: 1 contribuinte · 2 isento · 9 não contribuinte"
          },
          "inscricaoEstadual": {
            "type": "string"
          },
          "email": {
            "type": "string"
          }
        },
        "required": [
          "documento",
          "nome",
          "indicadorIe"
        ],
        "additionalProperties": false
      },
      "EnderecoDestinatario": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "uf": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Uf"
              },
              {
                "type": "string",
                "const": "EX"
              }
            ]
          },
          "cep": {
            "type": "string",
            "description": "Obrigatório no Brasil; não vai no exterior"
          },
          "pais": {
            "type": "object",
            "properties": {
              "codigo": {
                "type": "string"
              },
              "nome": {
                "type": "string"
              }
            },
            "required": [
              "codigo",
              "nome"
            ],
            "additionalProperties": false,
            "description": "cPais (código do BACEN, até 4 dígitos) e xPais. Ausente = Brasil (1058)"
          },
          "logradouro": {
            "type": "string"
          },
          "numero": {
            "type": "string"
          },
          "complemento": {
            "type": "string"
          },
          "bairro": {
            "type": "string"
          },
          "municipio": {
            "type": "string",
            "description": "cMun: IBGE (7 dígitos)"
          },
          "nomeMunicipio": {
            "type": "string",
            "description": "xMun"
          },
          "telefone": {
            "type": "string"
          }
        },
        "required": [
          "bairro",
          "logradouro",
          "municipio",
          "nomeMunicipio",
          "numero",
          "uf"
        ],
        "description": "Endereço do destinatário. No exterior (operação com o exterior, idDest 3): UF \"EX\", município 9999999 com nome EXTERIOR e o país da tabela do BACEN (cPais/xPais), diferente de 1058; CEP não vai. No Brasil o país é 1058."
      },
      "Item": {
        "type": "object",
        "properties": {
          "codigo": {
            "type": "string"
          },
          "gtin": {
            "type": "string",
            "description": "cEAN/cEANTrib. Ausente → \"SEM GTIN\" (literal do leiaute para produto sem código de barras)"
          },
          "descricao": {
            "type": "string"
          },
          "ncm": {
            "type": "string"
          },
          "cest": {
            "type": "string"
          },
          "cfop": {
            "type": "string"
          },
          "unidade": {
            "type": "string"
          },
          "quantidade": {
            "$ref": "#/components/schemas/Decimal"
          },
          "valorUnitario": {
            "$ref": "#/components/schemas/Decimal"
          },
          "valorTotal": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vProd. Conferido contra quantidade × valor unitário (tolerância de 1 centavo)"
          },
          "icms": {
            "$ref": "#/components/schemas/Icms",
            "description": "Obrigatório para emitente com IE. PROIBIDO para emitente sem IE (contribuinte exclusivo de IBS/CBS, NT 2026.007, regra N01-10), que em compensação precisa do grupo IBS/CBS em todo item (UB12-11)."
          },
          "tributosAproximados": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vTotTrib do item: valor aproximado dos tributos (Lei 12.741/2012, Decreto 8.264/2014), de quem chama (a fonte do número, por exemplo a tabela do IBPT, é de quem emite). Opcional; o total da nota é a soma dos itens (rejeição 685)"
          },
          "desconto": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vDesc: desconto incondicional do item; sai da base do ICMS, do PIS/COFINS e do IBS/CBS e do vNF (rejeição 483)"
          },
          "devolucao": {
            "type": "object",
            "properties": {
              "percentual": {
                "$ref": "#/components/schemas/Decimal"
              },
              "ipiDevolvido": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "percentual",
              "ipiDevolvido"
            ],
            "additionalProperties": false,
            "description": "impostoDevol: só na devolução (finNFe 4, rejeição 354). Percentual da mercadoria devolvida (pDevol, até 100) e o IPI devolvido (vIPIDevol), que entra no vNF (regra W16-10)"
          },
          "referenciado": {
            "type": "object",
            "properties": {
              "chave": {
                "type": "string"
              },
              "item": {
                "type": "number"
              }
            },
            "required": [
              "chave",
              "item"
            ],
            "additionalProperties": false,
            "description": "DFeReferenciado: a nota e o item que este item referencia (NT 2025.002). Na devolução, substitui o NFref do cabeçalho (a nota da Biomundo autorizada em homologação veio só assim); os dois juntos são recusados (1010)"
          },
          "codigoBeneficioFiscal": {
            "type": "string",
            "description": "cBenef: código de benefício fiscal da tabela da UF (regra N12-84, a critério da UF); nunca tem padrão"
          },
          "ipi": {
            "$ref": "#/components/schemas/IpiItem"
          },
          "pis": {
            "$ref": "#/components/schemas/PisCofins"
          },
          "cofins": {
            "$ref": "#/components/schemas/PisCofins"
          },
          "ibsCbs": {
            "$ref": "#/components/schemas/IbsCbsItem"
          },
          "exportacao": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "drawback": {
                  "type": "string"
                },
                "indireta": {
                  "type": "object",
                  "properties": {
                    "registroExportacao": {
                      "type": "string",
                      "description": "nRE: registro de exportação (até 12 dígitos; vazio quando não há)"
                    },
                    "chaveNfe": {
                      "type": "string"
                    },
                    "quantidade": {
                      "$ref": "#/components/schemas/Decimal",
                      "description": "qExport: quantidade exportada; a soma das indiretas do item é a quantidade comercial (regra I55-10)"
                    }
                  },
                  "required": [
                    "chaveNfe",
                    "quantidade"
                  ],
                  "additionalProperties": false,
                  "description": "exportInd (exportação indireta, CFOP 3503 e 7501): a NF-e que recebeu a mercadoria com fim específico de exportação, que também precisa estar entre as referenciadas da nota (regra I54-40)"
                }
              },
              "additionalProperties": false
            },
            "description": "Grupo detExport (I50, até 500), só na operação com o exterior: número do ato concessório de drawback (nDraw; obrigatório nos CFOP 7127 e 7211) e a exportação indireta (exportInd; obrigatória nos CFOP 3503 e 7501)."
          },
          "tributavel": {
            "type": "object",
            "properties": {
              "unidade": {
                "type": "string"
              },
              "quantidade": {
                "$ref": "#/components/schemas/Decimal"
              },
              "valorUnitario": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "unidade",
              "quantidade",
              "valorUnitario"
            ],
            "additionalProperties": false,
            "description": "Unidade, quantidade e valor unitário tributáveis (uTrib, qTrib, vUnTrib) quando diferem dos comerciais. Na exportação a unidade tributável é a da tabela de NCM × uTrib do comércio exterior (regra I14-10)."
          },
          "difal": {
            "type": "object",
            "properties": {
              "aliquotaInternaDestino": {
                "$ref": "#/components/schemas/Decimal",
                "description": "pICMSUFDest: alíquota interna da UF de destino, sem o FCP"
              },
              "aliquotaFcpDestino": {
                "$ref": "#/components/schemas/Decimal",
                "description": "pFCPUFDest: adicional do Fundo de Combate à Pobreza da UF de destino (até 2 pontos, ADCT art. 82, §1º)"
              }
            },
            "required": [
              "aliquotaInternaDestino"
            ],
            "additionalProperties": false,
            "description": "DIFAL (grupo ICMSUFDest, NA01): venda interestadual a consumidor final não contribuinte (idDest 2, indFinal 1, indIEDest 9), emitente do regime normal com ICMS CST 00. Base única = valor da operação (Convênio ICMS 236/2021, cláusula segunda, §1º); a alíquota interestadual é a do próprio ICMS do item (4, 7 ou 12). As alíquotas da UF de destino vêm de quem chama: a API não sabe a legislação de cada UF."
          },
          "medicamento": {
            "$ref": "#/components/schemas/Medicamento",
            "description": "Grupo med (K01): obrigatório para NCM de medicamento, 3001 a 3006 (regra K01-10, NT 2021.004)"
          },
          "rastreabilidade": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Lote"
            },
            "description": "Grupo rastro (I80, até 500): lotes do produto; obrigatório com o grupo med (regra K01-20, NT 2016.002)"
          },
          "informacoesAdicionais": {
            "type": "string"
          }
        },
        "required": [
          "codigo",
          "descricao",
          "ncm",
          "cfop",
          "unidade",
          "quantidade",
          "valorUnitario",
          "valorTotal",
          "pis",
          "cofins"
        ],
        "additionalProperties": false
      },
      "Icms": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "simples"
              },
              "origem": {
                "type": "string"
              },
              "csosn": {
                "type": "string",
                "enum": [
                  "102",
                  "103",
                  "300",
                  "400"
                ]
              }
            },
            "required": [
              "tipo",
              "origem",
              "csosn"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "normal00"
              },
              "origem": {
                "type": "string"
              },
              "modalidadeBase": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2",
                  "3"
                ]
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "origem",
              "modalidadeBase",
              "aliquota"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "normal41"
              },
              "origem": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "origem"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "isenta40"
              },
              "origem": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "origem"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "diferimento51"
              },
              "origem": {
                "type": "string"
              },
              "modalidadeBase": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2",
                  "3"
                ]
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              },
              "percentualDiferimento": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "origem",
              "modalidadeBase",
              "aliquota",
              "percentualDiferimento"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "simples900"
              },
              "origem": {
                "type": "string"
              },
              "modalidadeBase": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2",
                  "3"
                ]
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              },
              "valor": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vICMS informado. Na devolução é o ICMS proporcional da nota de compra, que nem sempre é base × alíquota (na devolução da Biomundo, 15 de 70 itens); ausente, a API calcula base × alíquota"
              }
            },
            "required": [
              "tipo",
              "origem",
              "modalidadeBase",
              "aliquota"
            ],
            "additionalProperties": false
          }
        ]
      },
      "IpiItem": {
        "type": "object",
        "properties": {
          "enquadramento": {
            "type": "string"
          },
          "naoTributado": {
            "type": "object",
            "properties": {
              "cst": {
                "type": "string",
                "enum": [
                  "01",
                  "02",
                  "03",
                  "04",
                  "05",
                  "51",
                  "52",
                  "53",
                  "54",
                  "55"
                ]
              }
            },
            "required": [
              "cst"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "enquadramento",
          "naoTributado"
        ],
        "additionalProperties": false,
        "description": "IPI do item (grupo O): código de enquadramento legal (cEnq, Tabela 8-6 do MOC, NT 2020.002) e o CST do IPI não tributado (IPINT: 01 a 05 na entrada, 51 a 55 na saída). O IPI tributado (IPITrib, CST 00/49/50/99) ainda não é montado. Só vai quando o emitente é contribuinte do IPI (industrial ou equiparado); o grupo é opcional no leiaute."
      },
      "PisCofins": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "aliquota"
              },
              "cst": {
                "type": "string",
                "enum": [
                  "01",
                  "02"
                ]
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "cst",
              "aliquota"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "naoTributado"
              },
              "cst": {
                "type": "string",
                "enum": [
                  "04",
                  "05",
                  "06",
                  "07",
                  "08",
                  "09"
                ]
              }
            },
            "required": [
              "tipo",
              "cst"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "outros"
              },
              "cst": {
                "type": "string"
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "cst",
              "aliquota"
            ],
            "additionalProperties": false
          }
        ]
      },
      "IbsCbsItem": {
        "type": "object",
        "properties": {
          "cst": {
            "type": "string",
            "description": "CST do IBS/CBS (3 dígitos)"
          },
          "classificacaoTributaria": {
            "type": "string",
            "description": "cClassTrib (6 dígitos); os 3 primeiros dígitos são o CST (rejeição 1024)"
          },
          "aliquotaIbsUf": {
            "$ref": "#/components/schemas/Decimal",
            "description": "Alíquotas em % (em 2026: CBS 0,9 e IBS 0,1, mas sempre informadas por quem chama). Obrigatórias quando o CST leva o grupo gIBSCBS; o CST cujo indicador não permite o grupo (ind_gIBSCBS = 0, ex.: 410 imunidade, usado na exportação) vai só com CST e cClassTrib, e as alíquotas não são informadas (regras UB13-20 e UB13-30)."
          },
          "aliquotaIbsMunicipio": {
            "$ref": "#/components/schemas/Decimal"
          },
          "aliquotaCbs": {
            "$ref": "#/components/schemas/Decimal"
          }
        },
        "required": [
          "cst",
          "classificacaoTributaria"
        ],
        "additionalProperties": false
      },
      "Medicamento": {
        "type": "object",
        "properties": {
          "codigoAnvisa": {
            "type": "string",
            "description": "cProdANVISA: registro na ANVISA (11 ou 13 dígitos) ou o literal ISENTO"
          },
          "motivoIsencao": {
            "type": "string",
            "description": "xMotivoIsencao: motivo da isenção do registro, quando o código é ISENTO"
          },
          "precoMaximoConsumidor": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vPMC: preço máximo ao consumidor"
          }
        },
        "required": [
          "codigoAnvisa",
          "precoMaximoConsumidor"
        ],
        "additionalProperties": false
      },
      "Lote": {
        "type": "object",
        "properties": {
          "numero": {
            "type": "string",
            "description": "nLote (1 a 20 caracteres)"
          },
          "quantidade": {
            "$ref": "#/components/schemas/Decimal",
            "description": "qLote: quantidade do lote (até 3 casas)"
          },
          "fabricacao": {
            "type": "string",
            "description": "dFab e dVal, AAAA-MM-DD"
          },
          "validade": {
            "type": "string"
          },
          "codigoAgregacao": {
            "type": "string",
            "description": "cAgreg: código de agregação (1 a 20 caracteres)"
          }
        },
        "required": [
          "numero",
          "quantidade",
          "fabricacao",
          "validade"
        ],
        "additionalProperties": false
      },
      "Pagamento": {
        "type": "object",
        "properties": {
          "meio": {
            "type": "string",
            "description": "tPag: 01 dinheiro, 03 cartão de crédito, 15 boleto, 17 PIX, 90 sem pagamento, 99 outros…"
          },
          "descricao": {
            "type": "string",
            "description": "xPag: obrigatório quando tPag = 99"
          },
          "valor": {
            "$ref": "#/components/schemas/Decimal"
          }
        },
        "required": [
          "meio",
          "valor"
        ],
        "additionalProperties": false
      },
      "ResponsavelTecnico": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": "string"
          },
          "contato": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "telefone": {
            "type": "string"
          },
          "csrt": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "codigo": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "codigo"
            ],
            "additionalProperties": false,
            "description": "Só onde a UF exige CSRT (hoje o PR)"
          }
        },
        "required": [
          "cnpj",
          "contato",
          "email",
          "telefone"
        ],
        "additionalProperties": false
      },
      "EntradaNfe": {
        "type": "object",
        "properties": {
          "naturezaOperacao": {
            "type": "string",
            "description": "natOp"
          },
          "tipoOperacao": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "tpNF: 0 entrada · 1 saída"
          },
          "destinoOperacao": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "idDest: 1 interna · 2 interestadual · 3 exterior"
          },
          "municipioFatoGerador": {
            "type": "string",
            "description": "cMunFG"
          },
          "finalidade": {
            "type": "string",
            "enum": [
              "1",
              "4"
            ],
            "description": "finNFe: 1 normal · 4 devolução de mercadoria (CFOP de devolução, referência à nota devolvida por item em `referenciado` ou em `referenciadas`, pagamento 90). Complementar, ajuste, crédito e débito ainda não"
          },
          "consumidorFinal": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "indFinal"
          },
          "presenca": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5",
              "9"
            ],
            "description": "indPres: 0 não se aplica · 1 presencial · 2 internet · 3 teleatendimento · 9 outros…"
          },
          "intermediador": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "indIntermed: 0 sem intermediador · 1 em site de terceiro. Obrigatório quando indPres é 2, 3, 4 ou 9"
          },
          "emitente": {
            "$ref": "#/components/schemas/Emitente"
          },
          "destinatario": {
            "$ref": "#/components/schemas/Destinatario"
          },
          "itens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          },
          "modalidadeFrete": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "9"
            ],
            "description": "modFrete: 0 emitente · 1 destinatário · 2 terceiros · 3/4 próprio · 9 sem frete"
          },
          "pagamentos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Pagamento"
            }
          },
          "informacoesComplementares": {
            "type": "string"
          },
          "exportacao": {
            "type": "object",
            "properties": {
              "ufEmbarque": {
                "$ref": "#/components/schemas/Uf",
                "description": "UFSaidaPais: UF de embarque ou de transposição da fronteira"
              },
              "localEmbarque": {
                "type": "string",
                "description": "xLocExporta: local de embarque ou de transposição da fronteira (1 a 60)"
              },
              "localDespacho": {
                "type": "string",
                "description": "xLocDespacho: recinto alfandegado do despacho (1 a 60)"
              }
            },
            "required": [
              "ufEmbarque",
              "localEmbarque"
            ],
            "additionalProperties": false,
            "description": "Grupo exporta (ZA): obrigatório na saída para o exterior (regra ZA01-10) e proibido fora dela (ZA01-20)"
          },
          "responsavelTecnico": {
            "$ref": "#/components/schemas/ResponsavelTecnico"
          },
          "referenciadas": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "NFref/refNFe: chaves de acesso de NF-e (55), NFC-e (65) ou CF-e SAT (59) referenciadas, até 500. Obrigatória na venda presencial fora do estabelecimento (indPres 5) e na exportação indireta; NFC-e não pode ser referenciada na saída normal (regra BA02-35)."
          }
        },
        "required": [
          "naturezaOperacao",
          "tipoOperacao",
          "destinoOperacao",
          "municipioFatoGerador",
          "finalidade",
          "consumidorFinal",
          "presenca",
          "emitente",
          "itens",
          "modalidadeFrete",
          "pagamentos"
        ],
        "additionalProperties": false,
        "description": "Entrada da API: o servidor decide ambiente, data de emissão, versão, série, número e código numérico."
      },
      "MunicipioCte": {
        "type": "object",
        "properties": {
          "codigo": {
            "type": "string",
            "description": "código IBGE (7 dígitos)"
          },
          "nome": {
            "type": "string"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          }
        },
        "required": [
          "codigo",
          "nome",
          "uf"
        ],
        "additionalProperties": false
      },
      "TomadorCte": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "papel": {
                "type": "string",
                "enum": [
                  "remetente",
                  "expedidor",
                  "recebedor",
                  "destinatario"
                ]
              }
            },
            "required": [
              "papel"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "papel": {
                "type": "string",
                "const": "outros"
              },
              "pessoa": {
                "$ref": "#/components/schemas/PessoaCte"
              }
            },
            "required": [
              "papel",
              "pessoa"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Quem paga o frete. toma3: um dos atores do CT-e; toma4: outra pessoa."
      },
      "PessoaCte": {
        "type": "object",
        "properties": {
          "documento": {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "enum": [
                  "CNPJ",
                  "CPF"
                ]
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          },
          "inscricaoEstadual": {
            "type": "string"
          },
          "nome": {
            "type": "string"
          },
          "nomeFantasia": {
            "type": "string"
          },
          "telefone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "endereco": {
            "$ref": "#/components/schemas/EnderecoCte"
          }
        },
        "required": [
          "documento",
          "nome",
          "endereco"
        ],
        "additionalProperties": false
      },
      "EnderecoCte": {
        "type": "object",
        "properties": {
          "logradouro": {
            "type": "string"
          },
          "numero": {
            "type": "string"
          },
          "complemento": {
            "type": "string"
          },
          "bairro": {
            "type": "string"
          },
          "municipio": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "cep": {
            "type": "string"
          }
        },
        "required": [
          "logradouro",
          "numero",
          "bairro",
          "municipio"
        ],
        "additionalProperties": false
      },
      "EmitenteCte": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": "string"
          },
          "inscricaoEstadual": {
            "type": "string",
            "description": "IE do emitente: obrigatória (regra G105)"
          },
          "nome": {
            "type": "string"
          },
          "nomeFantasia": {
            "type": "string"
          },
          "endereco": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "telefone": {
                "type": "string"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "municipio": {
                "$ref": "#/components/schemas/MunicipioCte"
              },
              "cep": {
                "type": "string"
              }
            },
            "required": [
              "bairro",
              "logradouro",
              "municipio",
              "numero"
            ]
          },
          "regime": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "CRT: 1 Simples · 2 Simples com excesso de sublimite · 3 regime normal · 4 MEI"
          }
        },
        "required": [
          "cnpj",
          "inscricaoEstadual",
          "nome",
          "endereco",
          "regime"
        ],
        "additionalProperties": false
      },
      "IcmsCte": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "normal"
              },
              "aliquota": {
                "$ref": "#/components/schemas/Decimal"
              },
              "base": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "tipo",
              "aliquota"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "isento"
              },
              "cst": {
                "type": "string",
                "enum": [
                  "40",
                  "41",
                  "51"
                ]
              }
            },
            "required": [
              "tipo",
              "cst"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "simples"
              }
            },
            "required": [
              "tipo"
            ],
            "additionalProperties": false
          }
        ]
      },
      "IbsCbsCte": {
        "type": "object",
        "properties": {
          "cst": {
            "type": "string"
          },
          "classificacaoTributaria": {
            "type": "string"
          },
          "base": {
            "$ref": "#/components/schemas/Decimal",
            "description": "base de cálculo do IBS/CBS: informada por quem chama (a lei define, o sistema não deduz)"
          },
          "aliquotaIbsUf": {
            "$ref": "#/components/schemas/Decimal"
          },
          "aliquotaIbsMunicipio": {
            "$ref": "#/components/schemas/Decimal"
          },
          "aliquotaCbs": {
            "$ref": "#/components/schemas/Decimal"
          }
        },
        "required": [
          "cst",
          "classificacaoTributaria",
          "base",
          "aliquotaIbsUf",
          "aliquotaIbsMunicipio",
          "aliquotaCbs"
        ],
        "additionalProperties": false
      },
      "QuantidadeCarga": {
        "type": "object",
        "properties": {
          "unidade": {
            "type": "string",
            "enum": [
              "00",
              "01",
              "02",
              "03",
              "04",
              "05"
            ],
            "description": "cUnid: 00 M3 · 01 KG · 02 TON · 03 UNIDADE · 04 LITROS · 05 MMBTU"
          },
          "tipoMedida": {
            "type": "string",
            "description": "tpMed: texto livre, ex. \"PESO BRUTO\", \"VOLUMES\""
          },
          "quantidade": {
            "$ref": "#/components/schemas/Decimal"
          }
        },
        "required": [
          "unidade",
          "tipoMedida",
          "quantidade"
        ],
        "additionalProperties": false
      },
      "DocumentoAnteriorCte": {
        "type": "object",
        "properties": {
          "emitente": {
            "type": "object",
            "properties": {
              "documento": {
                "type": "object",
                "properties": {
                  "tipo": {
                    "type": "string",
                    "enum": [
                      "CNPJ",
                      "CPF"
                    ]
                  },
                  "numero": {
                    "type": "string"
                  }
                },
                "required": [
                  "tipo",
                  "numero"
                ],
                "additionalProperties": false
              },
              "inscricaoEstadual": {
                "type": "string",
                "description": "IE do emissor do documento anterior, só dígitos (TIe)"
              },
              "uf": {
                "$ref": "#/components/schemas/Uf"
              },
              "nome": {
                "type": "string"
              }
            },
            "required": [
              "documento",
              "inscricaoEstadual",
              "uf",
              "nome"
            ],
            "additionalProperties": false
          },
          "ctes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "chaves dos CT-e anteriores (idDocAntEle)"
          },
          "papel": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tipo": {
                  "type": "string",
                  "enum": [
                    "07",
                    "08",
                    "09",
                    "10",
                    "11",
                    "12",
                    "13"
                  ]
                },
                "serie": {
                  "type": "string"
                },
                "subserie": {
                  "type": "string"
                },
                "numero": {
                  "type": "string"
                },
                "emissao": {
                  "type": "string"
                }
              },
              "required": [
                "tipo",
                "serie",
                "numero",
                "emissao"
              ],
              "additionalProperties": false
            },
            "description": "documentos anteriores em papel (idDocAntPap): 07 ATRE · 08 DTA · 09 conhecimento aéreo internacional · 10 carta de porte internacional · 11 conhecimento avulso · 12 TIF · 13 BL"
          }
        },
        "required": [
          "emitente"
        ],
        "additionalProperties": false
      },
      "NfeTransportada": {
        "type": "object",
        "properties": {
          "chave": {
            "type": "string"
          },
          "previsaoEntrega": {
            "type": "string",
            "description": "dPrev: data prevista de entrega, AAAA-MM-DD"
          }
        },
        "required": [
          "chave"
        ],
        "additionalProperties": false
      },
      "ModalCte": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "rodoviario"
              },
              "rntrc": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "rntrc"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "aereo"
              },
              "minuta": {
                "type": "string",
                "description": "nMinu: 9 dígitos"
              },
              "numeroOperacional": {
                "type": "string",
                "description": "nOCA: número operacional do conhecimento aéreo, 11 dígitos"
              },
              "dataPrevistaEntrega": {
                "type": "string",
                "description": "dPrevAereo, AAAA-MM-DD"
              },
              "dimensao": {
                "type": "string",
                "description": "xDime: 1234X1234X1234 (cm)"
              },
              "manuseio": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "01",
                    "02",
                    "03",
                    "04",
                    "05",
                    "06",
                    "07",
                    "08"
                  ]
                },
                "description": "cInfManu: 01 a 08 (ver XSD cteModalAereo)"
              },
              "tarifa": {
                "type": "object",
                "properties": {
                  "classe": {
                    "type": "string",
                    "enum": [
                      "M",
                      "G",
                      "E"
                    ]
                  },
                  "codigo": {
                    "type": "string"
                  },
                  "valor": {
                    "$ref": "#/components/schemas/Decimal"
                  }
                },
                "required": [
                  "classe",
                  "valor"
                ],
                "additionalProperties": false,
                "description": "CL: M mínima · G geral · E específica"
              },
              "perigosos": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "onu": {
                      "type": "string"
                    },
                    "volumes": {
                      "type": "string"
                    },
                    "quantidade": {
                      "$ref": "#/components/schemas/Decimal"
                    },
                    "unidade": {
                      "type": "string",
                      "enum": [
                        "1",
                        "2",
                        "3",
                        "4",
                        "5"
                      ]
                    }
                  },
                  "required": [
                    "onu",
                    "volumes",
                    "quantidade",
                    "unidade"
                  ],
                  "additionalProperties": false
                },
                "description": "artigos perigosos (ONU)"
              }
            },
            "required": [
              "tipo",
              "dataPrevistaEntrega",
              "tarifa"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "aquaviario"
              },
              "baseAfrmm": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vPrest: valor da prestação base de cálculo do AFRMM"
              },
              "afrmm": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vAFRMM"
              },
              "navio": {
                "type": "string"
              },
              "balsas": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "até 3"
              },
              "viagem": {
                "type": "string"
              },
              "direcao": {
                "type": "string",
                "enum": [
                  "N",
                  "L",
                  "S",
                  "O"
                ],
                "description": "N norte · L leste · S sul · O oeste"
              },
              "irin": {
                "type": "string",
                "description": "IRIN do navio"
              },
              "navegacao": {
                "type": "string",
                "enum": [
                  "0",
                  "1"
                ],
                "description": "tpNav: 0 interior · 1 cabotagem"
              }
            },
            "required": [
              "tipo",
              "baseAfrmm",
              "afrmm",
              "navio",
              "direcao",
              "irin"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "ferroviario"
              },
              "trafego": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2",
                  "3"
                ],
                "description": "tpTraf: 0 próprio · 1 mútuo · 2 rodoferroviário · 3 rodoviário"
              },
              "fluxo": {
                "type": "string",
                "description": "fluxo ferroviário (contrato com o cliente), até 10 caracteres"
              },
              "trafegoMutuo": {
                "type": "object",
                "properties": {
                  "responsavelFaturamento": {
                    "type": "string",
                    "enum": [
                      "1",
                      "2"
                    ],
                    "description": "respFat e ferrEmi: 1 ferrovia de origem · 2 de destino"
                  },
                  "ferroviaEmitente": {
                    "type": "string",
                    "enum": [
                      "1",
                      "2"
                    ]
                  },
                  "valorFrete": {
                    "$ref": "#/components/schemas/Decimal"
                  },
                  "chaveCteOrigem": {
                    "type": "string",
                    "description": "obrigatório quando a ferrovia de destino fatura (G031)"
                  },
                  "ferrovias": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "cnpj": {
                          "type": "string"
                        },
                        "codigoInterno": {
                          "type": "string"
                        },
                        "inscricaoEstadual": {
                          "type": "string"
                        },
                        "nome": {
                          "type": "string"
                        },
                        "endereco": {
                          "type": "object",
                          "properties": {
                            "logradouro": {
                              "type": "string"
                            },
                            "numero": {
                              "type": "string"
                            },
                            "complemento": {
                              "type": "string"
                            },
                            "bairro": {
                              "type": "string"
                            },
                            "municipio": {
                              "$ref": "#/components/schemas/MunicipioCte"
                            },
                            "cep": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "logradouro",
                            "municipio",
                            "cep"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "cnpj",
                        "nome",
                        "endereco"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "responsavelFaturamento",
                  "ferroviaEmitente",
                  "valorFrete"
                ],
                "additionalProperties": false,
                "description": "obrigatório no tráfego mútuo (G029)"
              }
            },
            "required": [
              "tipo",
              "trafego",
              "fluxo"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "multimodal",
                "description": "modal 06, do OTM (Operador de Transporte Multimodal)"
              },
              "cotm": {
                "type": "string",
                "description": "COTM: número do certificado do OTM (até 20)"
              },
              "negociavel": {
                "type": "boolean"
              },
              "seguro": {
                "type": "object",
                "properties": {
                  "seguradora": {
                    "type": "string"
                  },
                  "cnpjSeguradora": {
                    "type": "string"
                  },
                  "apolice": {
                    "type": "string"
                  },
                  "averbacao": {
                    "type": "string"
                  }
                },
                "required": [
                  "seguradora",
                  "cnpjSeguradora",
                  "apolice",
                  "averbacao"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "tipo",
              "cotm",
              "negociavel"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "dutoviario"
              },
              "tarifa": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vTar: até 9 inteiros e 6 decimais"
              },
              "inicio": {
                "type": "string",
                "description": "AAAA-MM-DD"
              },
              "fim": {
                "type": "string"
              },
              "classe": {
                "type": "string",
                "enum": [
                  "1",
                  "2",
                  "3"
                ],
                "description": "1 gasoduto · 2 mineroduto · 3 oleoduto"
              },
              "contratacao": {
                "type": "string",
                "enum": [
                  "0",
                  "1",
                  "2"
                ],
                "description": "só gasoduto: 0 ponta a ponta · 1 capacidade de entrada · 2 capacidade de saída"
              },
              "pontoEntrada": {
                "type": "string"
              },
              "pontoSaida": {
                "type": "string"
              },
              "contrato": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "inicio",
              "fim"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Grupo específico de cada modal (infModal), conforme os XSD cteModal*_v4.00"
      },
      "EntradaCte": {
        "type": "object",
        "properties": {
          "cfop": {
            "type": "string"
          },
          "naturezaOperacao": {
            "type": "string"
          },
          "municipioEnvio": {
            "$ref": "#/components/schemas/MunicipioCte",
            "description": "município de onde o CT-e é transmitido (cMunEnv)"
          },
          "inicio": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "fim": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "tipoServico": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4"
            ],
            "description": "tpServ: 0 normal · 1 subcontratação · 2 redespacho · 3 redespacho intermediário · 4 serviço vinculado a multimodal"
          },
          "recebedorRetira": {
            "type": "boolean",
            "description": "o recebedor retira no aeroporto, filial, porto ou estação de destino?"
          },
          "detalheRetira": {
            "type": "string"
          },
          "indicadorIeTomador": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "9"
            ],
            "description": "indIEToma: 1 contribuinte do ICMS · 2 isento de inscrição · 9 não contribuinte"
          },
          "tomador": {
            "$ref": "#/components/schemas/TomadorCte"
          },
          "emitente": {
            "$ref": "#/components/schemas/EmitenteCte"
          },
          "remetente": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "expedidor": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "recebedor": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "destinatario": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "valores": {
            "type": "object",
            "properties": {
              "total": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vTPrest"
              },
              "receber": {
                "$ref": "#/components/schemas/Decimal",
                "description": "vRec (≤ vTPrest, regra G048)"
              },
              "componentes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "nome": {
                      "type": "string"
                    },
                    "valor": {
                      "$ref": "#/components/schemas/Decimal"
                    }
                  },
                  "required": [
                    "nome",
                    "valor"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "total",
              "receber"
            ],
            "additionalProperties": false
          },
          "icms": {
            "$ref": "#/components/schemas/IcmsCte"
          },
          "tributosAproximados": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vTotTrib: valor aproximado dos tributos da prestação (Lei 12.741/2012, Decreto 8.264/2014), de quem chama (a fonte do número, por exemplo a tabela do IBPT, é de quem emite). Opcional no leiaute"
          },
          "ibsCbs": {
            "$ref": "#/components/schemas/IbsCbsCte"
          },
          "complementa": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "CT-e complementar (tpCTe 1): chaves dos CT-e complementados (1 a 10, do mesmo emitente). Complementa valor da prestação ou imposto; atores, UFs e tipo de serviço precisam ser os do complementado (G168–G176)."
          },
          "substitui": {
            "type": "object",
            "properties": {
              "chave": {
                "type": "string"
              },
              "alteraTomador": {
                "type": "boolean"
              }
            },
            "required": [
              "chave"
            ],
            "additionalProperties": false,
            "description": "CT-e substituto (tpCTe 3): a chave do CT-e substituído e, na troca de tomador, `alteraTomador` (indAlteraToma). Leva tudo do CT-e normal; atores, IE, UFs, NF-e e tipo de serviço são os do substituído (G086–G095), e o substituído precisa ter o evento de desacordo do tomador (G084)."
          },
          "modalComplementado": {
            "anyOf": [
              {
                "type": "string",
                "const": "rodoviario"
              },
              {
                "type": "string",
                "const": "aereo"
              },
              {
                "type": "string",
                "const": "aquaviario"
              },
              {
                "type": "string",
                "const": "ferroviario"
              },
              {
                "type": "string",
                "const": "multimodal",
                "description": "modal 06, do OTM (Operador de Transporte Multimodal)"
              },
              {
                "type": "string",
                "const": "dutoviario"
              }
            ],
            "description": "CT-e complementar: o modal do CT-e complementado (vai no ide; obrigatório com `complementa`)"
          },
          "carga": {
            "type": "object",
            "properties": {
              "valor": {
                "$ref": "#/components/schemas/Decimal"
              },
              "produtoPredominante": {
                "type": "string"
              },
              "outrasCaracteristicas": {
                "type": "string"
              },
              "quantidades": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/QuantidadeCarga"
                }
              }
            },
            "required": [
              "produtoPredominante",
              "quantidades"
            ],
            "additionalProperties": false,
            "description": "obrigatório no CT-e normal; o complementar não leva"
          },
          "documentosAnteriores": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentoAnteriorCte"
            },
            "description": "Documentos de transporte anteriores (docAnt): obrigatórios na subcontratação e no redespacho (G059), proibidos no serviço normal (G060). Um item por emissor do documento anterior, com os CT-e (eletrônicos) e/ou os de papel."
          },
          "ctesMultimodais": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Serviço vinculado a multimodal (tpServ 4): chaves dos CT-e multimodais emitidos pelo OTM (infServVinc, G057/G058). O OTM é o tomador (G075)."
          },
          "nfes": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/NfeTransportada"
                }
              ]
            },
            "description": "NF-e transportadas: a chave, ou a chave com a data prevista de entrega (dPrev, AAAA-MM-DD)"
          },
          "notasPapel": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "modelo": {
                  "type": "string",
                  "enum": [
                    "01",
                    "04"
                  ]
                },
                "serie": {
                  "type": "string"
                },
                "numero": {
                  "type": "string"
                },
                "emissao": {
                  "type": "string",
                  "description": "AAAA-MM-DD"
                },
                "base": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "icms": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "baseSt": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "st": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "produtos": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "total": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "cfop": {
                  "type": "string",
                  "description": "CFOP predominante da NF"
                },
                "peso": {
                  "$ref": "#/components/schemas/Decimal",
                  "description": "peso em kg (até 3 decimais)"
                },
                "pin": {
                  "type": "string",
                  "description": "PIN SUFRAMA"
                },
                "previsaoEntrega": {
                  "type": "string"
                },
                "romaneio": {
                  "type": "string"
                },
                "pedido": {
                  "type": "string"
                }
              },
              "required": [
                "modelo",
                "serie",
                "numero",
                "emissao",
                "base",
                "icms",
                "baseSt",
                "st",
                "produtos",
                "total",
                "cfop"
              ],
              "additionalProperties": false
            },
            "description": "NF modelo 1/1A (01) ou de produtor (04)"
          },
          "outrosDocumentos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tipo": {
                  "type": "string",
                  "enum": [
                    "00",
                    "10",
                    "59",
                    "65",
                    "99"
                  ]
                },
                "descricao": {
                  "type": "string"
                },
                "numero": {
                  "type": "string"
                },
                "emissao": {
                  "type": "string"
                },
                "valor": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "previsaoEntrega": {
                  "type": "string"
                }
              },
              "required": [
                "tipo"
              ],
              "additionalProperties": false
            },
            "description": "00 declaração · 10 dutoviário · 59 CF-e SAT · 65 NFC-e · 99 outros"
          },
          "dces": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "chaves das DC-e (Declaração de Conteúdo eletrônica)"
          },
          "veiculosNovos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "chassi": {
                  "type": "string"
                },
                "codigoCor": {
                  "type": "string"
                },
                "cor": {
                  "type": "string"
                },
                "modelo": {
                  "type": "string"
                },
                "valorUnitario": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "frete": {
                  "$ref": "#/components/schemas/Decimal"
                }
              },
              "required": [
                "chassi",
                "codigoCor",
                "cor",
                "modelo",
                "valorUnitario",
                "frete"
              ],
              "additionalProperties": false
            },
            "description": "veículos novos transportados (veicNovos): chassi (17), cor, modelo, valor unitário e frete"
          },
          "globalizado": {
            "type": "object",
            "properties": {
              "observacao": {
                "type": "string"
              }
            },
            "required": [
              "observacao"
            ],
            "additionalProperties": false,
            "description": "CT-e globalizado (indGlobalizado + infGlobalizado): várias NF-e de um remetente (ou para um destinatário) num CT-e só, no regime especial da UF. `observacao` (15 a 256): a legislação do regime. Regras G197–G205."
          },
          "cobranca": {
            "type": "object",
            "properties": {
              "fatura": {
                "type": "object",
                "properties": {
                  "numero": {
                    "type": "string"
                  },
                  "valorOriginal": {
                    "$ref": "#/components/schemas/Decimal"
                  },
                  "desconto": {
                    "$ref": "#/components/schemas/Decimal"
                  },
                  "valorLiquido": {
                    "$ref": "#/components/schemas/Decimal"
                  }
                },
                "additionalProperties": false
              },
              "duplicatas": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "numero": {
                      "type": "string"
                    },
                    "vencimento": {
                      "type": "string"
                    },
                    "valor": {
                      "$ref": "#/components/schemas/Decimal"
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false,
            "description": "cobrança (cobr): fatura e duplicatas"
          },
          "rodoviario": {
            "type": "object",
            "properties": {
              "rntrc": {
                "type": "string"
              }
            },
            "required": [
              "rntrc"
            ],
            "additionalProperties": false,
            "description": "modal rodoviário (CT-e normal); o mesmo que `modal: { tipo: 'rodoviario', rntrc }`"
          },
          "modal": {
            "$ref": "#/components/schemas/ModalCte",
            "description": "modal do CT-e normal: rodoviário, aéreo, aquaviário, ferroviário ou dutoviário (um dos dois: este ou `rodoviario`)"
          },
          "observacoes": {
            "type": "string"
          },
          "responsavelTecnico": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string"
              },
              "contato": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "telefone": {
                "type": "string"
              }
            },
            "required": [
              "cnpj",
              "contato",
              "email",
              "telefone"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "cfop",
          "naturezaOperacao",
          "municipioEnvio",
          "inicio",
          "fim",
          "tipoServico",
          "recebedorRetira",
          "indicadorIeTomador",
          "tomador",
          "emitente",
          "valores",
          "icms"
        ],
        "additionalProperties": false
      },
      "EntradaCteOs": {
        "type": "object",
        "properties": {
          "cfop": {
            "type": "string"
          },
          "naturezaOperacao": {
            "type": "string"
          },
          "municipioEnvio": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "tipoServico": {
            "type": "string",
            "enum": [
              "6",
              "7",
              "8"
            ],
            "description": "tpServ: 6 transporte de pessoas · 7 transporte de valores · 8 excesso de bagagem"
          },
          "inicio": {
            "$ref": "#/components/schemas/MunicipioCte",
            "description": "obrigatórios no transporte de pessoas (H019, H020)"
          },
          "fim": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "percurso": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Uf"
            },
            "description": "UFs entre o início e o fim, na ordem da viagem (infPercurso, até 25)"
          },
          "indicadorIeTomador": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "9"
            ]
          },
          "tomador": {
            "$ref": "#/components/schemas/PessoaCte",
            "description": "obrigatório no transporte de pessoas e de valores (H022); opcional no excesso de bagagem"
          },
          "emitente": {
            "$ref": "#/components/schemas/EmitenteCte"
          },
          "descricaoServico": {
            "type": "string",
            "description": "obrigatória no CT-e OS normal; o complementar não leva"
          },
          "quantidade": {
            "$ref": "#/components/schemas/Decimal",
            "description": "passageiros (pessoas) ou volumes/malotes (valores e bagagem)"
          },
          "valores": {
            "type": "object",
            "properties": {
              "total": {
                "$ref": "#/components/schemas/Decimal"
              },
              "receber": {
                "$ref": "#/components/schemas/Decimal"
              },
              "componentes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "nome": {
                      "type": "string"
                    },
                    "valor": {
                      "$ref": "#/components/schemas/Decimal"
                    }
                  },
                  "required": [
                    "nome",
                    "valor"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "total",
              "receber"
            ],
            "additionalProperties": false
          },
          "icms": {
            "$ref": "#/components/schemas/IcmsCte"
          },
          "tributosAproximados": {
            "$ref": "#/components/schemas/Decimal",
            "description": "vTotTrib: valor aproximado dos tributos da prestação (Lei 12.741/2012, Decreto 8.264/2014), de quem chama (a fonte do número, por exemplo a tabela do IBPT, é de quem emite). Opcional no leiaute"
          },
          "tributosFederais": {
            "type": "object",
            "properties": {
              "pis": {
                "$ref": "#/components/schemas/Decimal"
              },
              "cofins": {
                "$ref": "#/components/schemas/Decimal"
              },
              "ir": {
                "$ref": "#/components/schemas/Decimal"
              },
              "inss": {
                "$ref": "#/components/schemas/Decimal"
              },
              "csll": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "additionalProperties": false,
            "description": "infTribFed. INSS é obrigatório no transporte de pessoas com tomador pessoa jurídica (H057)"
          },
          "ibsCbs": {
            "$ref": "#/components/schemas/IbsCbsCte"
          },
          "substitui": {
            "type": "object",
            "properties": {
              "chave": {
                "type": "string"
              }
            },
            "required": [
              "chave"
            ],
            "additionalProperties": false,
            "description": "CT-e OS substituto (tpCTe 3): a chave do CT-e OS substituído (H059–H075)"
          },
          "complementa": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "CT-e OS complementar (tpCTe 1): chaves dos CT-e OS complementados (1 a 10); ver DadosCte.complementa (H101–H114)"
          },
          "gtves": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "chave": {
                  "type": "string"
                },
                "componentes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "tipo": {
                        "type": "string",
                        "enum": [
                          "1",
                          "2",
                          "3",
                          "4",
                          "5",
                          "6"
                        ]
                      },
                      "valor": {
                        "$ref": "#/components/schemas/Decimal"
                      },
                      "nome": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "tipo",
                      "valor"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "chave",
                "componentes"
              ],
              "additionalProperties": false
            },
            "description": "Transporte de valores: as GTV-e (modelo 64) da prestação, com os componentes do valor de cada uma (1 custódia · 2 embarque · 3 tempo de espera · 4 malote · 5 ad valorem · 6 outros, com o nome). A soma dos componentes de todas é o valor da prestação (H053)."
          },
          "documentosReferenciados": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "chaveBpe": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "chaveBpe"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "numero": {
                      "type": "string"
                    },
                    "serie": {
                      "type": "string"
                    },
                    "subserie": {
                      "type": "string"
                    },
                    "emissao": {
                      "type": "string"
                    },
                    "valor": {
                      "$ref": "#/components/schemas/Decimal"
                    }
                  },
                  "required": [
                    "numero",
                    "emissao"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "documentos referenciados: obrigatório no excesso de bagagem (H028)"
          },
          "seguro": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "responsavel": {
                  "type": "string",
                  "enum": [
                    "emitente",
                    "tomador"
                  ]
                },
                "seguradora": {
                  "type": "string"
                },
                "apolice": {
                  "type": "string"
                }
              },
              "required": [
                "responsavel"
              ],
              "additionalProperties": false
            }
          },
          "rodoviario": {
            "type": "object",
            "properties": {
              "taf": {
                "type": "string",
                "description": "TAF (12 dígitos, ANTT): obrigatório no transporte de pessoas interestadual (H024)"
              },
              "registroEstadual": {
                "type": "string",
                "description": "Número do Registro Estadual (25 dígitos): obrigatório no transporte de pessoas interno (H023)"
              },
              "veiculo": {
                "type": "object",
                "properties": {
                  "placa": {
                    "type": "string"
                  },
                  "renavam": {
                    "type": "string"
                  },
                  "uf": {
                    "$ref": "#/components/schemas/Uf"
                  }
                },
                "required": [
                  "placa"
                ],
                "additionalProperties": false
              },
              "fretamento": {
                "type": "object",
                "properties": {
                  "tipo": {
                    "type": "string",
                    "enum": [
                      "eventual",
                      "continuo"
                    ]
                  },
                  "dataHoraViagem": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "tipo"
                ],
                "additionalProperties": false,
                "description": "obrigatório no transporte de pessoas (H025); eventual (1) exige a data da viagem (H026)"
              }
            },
            "additionalProperties": false,
            "description": "modal rodoviário: obrigatório para pessoas e bagagem, proibido para valores (H015, H018)"
          },
          "observacoes": {
            "type": "string"
          },
          "responsavelTecnico": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string"
              },
              "contato": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "telefone": {
                "type": "string"
              }
            },
            "required": [
              "cnpj",
              "contato",
              "email",
              "telefone"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "cfop",
          "naturezaOperacao",
          "municipioEnvio",
          "tipoServico",
          "indicadorIeTomador",
          "emitente",
          "valores",
          "icms"
        ],
        "additionalProperties": false
      },
      "EntradaGtve": {
        "type": "object",
        "properties": {
          "cfop": {
            "type": "string"
          },
          "naturezaOperacao": {
            "type": "string"
          },
          "municipioEnvio": {
            "$ref": "#/components/schemas/MunicipioCte"
          },
          "modal": {
            "type": "string",
            "enum": [
              "rodoviario",
              "multimodal"
            ],
            "description": "01 rodoviário · 06 multimodal"
          },
          "indicadorIeTomador": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "9"
            ]
          },
          "saidaOrigem": {
            "type": "string",
            "format": "date-time"
          },
          "chegadaDestino": {
            "type": "string",
            "format": "date-time"
          },
          "tomador": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "papel": {
                    "type": "string",
                    "enum": [
                      "remetente",
                      "destinatario"
                    ]
                  }
                },
                "required": [
                  "papel"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "papel": {
                    "type": "string",
                    "const": "outros"
                  },
                  "pessoa": {
                    "$ref": "#/components/schemas/PessoaCte"
                  }
                },
                "required": [
                  "papel",
                  "pessoa"
                ],
                "additionalProperties": false
              }
            ],
            "description": "toma: remetente ou destinatário; tomaTerceiro: outra pessoa (que não seja remetente nem destinatário, I53)"
          },
          "emitente": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string"
              },
              "inscricaoEstadual": {
                "type": "string",
                "description": "IE do emitente: obrigatória (regra G105)"
              },
              "nome": {
                "type": "string"
              },
              "nomeFantasia": {
                "type": "string"
              },
              "endereco": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "telefone": {
                    "type": "string"
                  },
                  "logradouro": {
                    "type": "string"
                  },
                  "numero": {
                    "type": "string"
                  },
                  "complemento": {
                    "type": "string"
                  },
                  "bairro": {
                    "type": "string"
                  },
                  "municipio": {
                    "$ref": "#/components/schemas/MunicipioCte"
                  },
                  "cep": {
                    "type": "string"
                  }
                },
                "required": [
                  "bairro",
                  "logradouro",
                  "municipio",
                  "numero"
                ]
              }
            },
            "required": [
              "cnpj",
              "inscricaoEstadual",
              "nome",
              "endereco"
            ],
            "additionalProperties": false,
            "description": "a GTV-e não tem CRT"
          },
          "remetente": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "destinatario": {
            "$ref": "#/components/schemas/PessoaCte"
          },
          "origem": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "telefone": {
                "type": "string"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "municipio": {
                "$ref": "#/components/schemas/MunicipioCte"
              },
              "cep": {
                "type": "string"
              }
            },
            "required": [
              "bairro",
              "logradouro",
              "municipio",
              "numero"
            ],
            "description": "endereços de origem e de destino do transporte, quando diferentes dos de remetente e destinatário"
          },
          "destino": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "telefone": {
                "type": "string"
              },
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "municipio": {
                "$ref": "#/components/schemas/MunicipioCte"
              },
              "cep": {
                "type": "string"
              }
            },
            "required": [
              "bairro",
              "logradouro",
              "municipio",
              "numero"
            ]
          },
          "especies": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tipo": {
                  "type": "string",
                  "enum": [
                    "1",
                    "2",
                    "3",
                    "4"
                  ]
                },
                "valor": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "estrangeiro": {
                  "type": "boolean"
                },
                "moedaEstrangeira": {
                  "type": "string"
                }
              },
              "required": [
                "tipo",
                "valor"
              ],
              "additionalProperties": false
            },
            "description": "infEspecie: 1 cédula · 2 cheque · 3 moeda · 4 outros"
          },
          "quantidade": {
            "$ref": "#/components/schemas/Decimal",
            "description": "qCarga: quantidade de volumes/malotes"
          },
          "veiculos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "placa": {
                  "type": "string"
                },
                "uf": {
                  "$ref": "#/components/schemas/Uf"
                },
                "rntrc": {
                  "type": "string"
                }
              },
              "required": [
                "placa"
              ],
              "additionalProperties": false
            }
          },
          "observacoes": {
            "type": "string"
          },
          "responsavelTecnico": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string"
              },
              "contato": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "telefone": {
                "type": "string"
              }
            },
            "required": [
              "cnpj",
              "contato",
              "email",
              "telefone"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "cfop",
          "naturezaOperacao",
          "municipioEnvio",
          "modal",
          "indicadorIeTomador",
          "saidaOrigem",
          "chegadaDestino",
          "tomador",
          "emitente",
          "remetente",
          "destinatario",
          "especies",
          "quantidade",
          "veiculos"
        ],
        "additionalProperties": false
      },
      "MunicipioMdfe": {
        "type": "object",
        "properties": {
          "codigo": {
            "type": "string",
            "description": "código IBGE (7 dígitos)"
          },
          "nome": {
            "type": "string"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          }
        },
        "required": [
          "codigo",
          "nome",
          "uf"
        ],
        "additionalProperties": false
      },
      "EmitenteMdfe": {
        "type": "object",
        "properties": {
          "documento": {
            "$ref": "#/components/schemas/DocumentoMdfe",
            "description": "CPF só para carga própria (tpEmit 2), com série de 920 a 969"
          },
          "inscricaoEstadual": {
            "type": "string",
            "description": "IE do emitente: obrigatória (regra F72)"
          },
          "nome": {
            "type": "string"
          },
          "nomeFantasia": {
            "type": "string"
          },
          "endereco": {
            "type": "object",
            "properties": {
              "logradouro": {
                "type": "string"
              },
              "numero": {
                "type": "string"
              },
              "complemento": {
                "type": "string"
              },
              "bairro": {
                "type": "string"
              },
              "municipio": {
                "$ref": "#/components/schemas/MunicipioMdfe"
              },
              "cep": {
                "type": "string"
              },
              "telefone": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "required": [
              "logradouro",
              "numero",
              "bairro",
              "municipio"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "documento",
          "inscricaoEstadual",
          "nome",
          "endereco"
        ],
        "additionalProperties": false
      },
      "DocumentoMdfe": {
        "type": "object",
        "properties": {
          "tipo": {
            "type": "string",
            "enum": [
              "CNPJ",
              "CPF"
            ]
          },
          "numero": {
            "type": "string"
          }
        },
        "required": [
          "tipo",
          "numero"
        ],
        "additionalProperties": false
      },
      "DescarregamentoMdfe": {
        "type": "object",
        "properties": {
          "municipio": {
            "$ref": "#/components/schemas/MunicipioMdfe"
          },
          "ctes": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/DocumentoVinculadoMdfe"
                }
              ]
            },
            "description": "CT-e (prestador de serviço de transporte, tpEmit 1): a chave, ou a chave com os detalhes"
          },
          "nfes": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/DocumentoVinculadoMdfe"
                }
              ]
            },
            "description": "NF-e (carga própria, tpEmit 2, ou CT-e globalizado, tpEmit 3)"
          },
          "mdfes": {
            "type": "array",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/DocumentoVinculadoMdfe"
                }
              ]
            },
            "description": "MDF-e referenciados (infMDFeTransp): só no aquaviário com carregamento ou descarregamento em AM ou AP (F43/F44)"
          }
        },
        "required": [
          "municipio"
        ],
        "additionalProperties": false
      },
      "DocumentoVinculadoMdfe": {
        "type": "object",
        "properties": {
          "chave": {
            "type": "string"
          },
          "reentrega": {
            "type": "boolean"
          },
          "unidadesTransporte": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnidadeTransporteMdfe"
            }
          },
          "perigosos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PerigosoMdfe"
            }
          },
          "entregaParcial": {
            "type": "object",
            "properties": {
              "total": {
                "$ref": "#/components/schemas/Decimal"
              },
              "parcial": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "total",
              "parcial"
            ],
            "additionalProperties": false,
            "description": "só CT-e e só no modal aéreo (F34): quantidade total de volumes e a enviada neste MDF-e"
          },
          "prestacaoParcial": {
            "type": "object",
            "properties": {
              "nfes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "nfes"
            ],
            "additionalProperties": false,
            "description": "só CT-e: prestação parcial, com as NF-e do CT-e que vão neste MDF-e"
          }
        },
        "required": [
          "chave"
        ],
        "additionalProperties": false,
        "description": "Documento vinculado ao município de descarregamento, com os detalhes do leiaute"
      },
      "UnidadeTransporteMdfe": {
        "type": "object",
        "properties": {
          "tipo": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7"
            ],
            "description": "1 rodoviário tração · 2 rodoviário reboque · 3 navio · 4 balsa · 5 aeronave · 6 vagão · 7 outros"
          },
          "id": {
            "type": "string"
          },
          "lacres": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unidadesCarga": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tipo": {
                  "type": "string",
                  "enum": [
                    "1",
                    "2",
                    "3",
                    "4"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "lacres": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "quantidadeRateada": {
                  "$ref": "#/components/schemas/Decimal"
                }
              },
              "required": [
                "tipo",
                "id"
              ],
              "additionalProperties": false
            },
            "description": "1 container · 2 ULD · 3 pallet · 4 outros"
          },
          "quantidadeRateada": {
            "$ref": "#/components/schemas/Decimal"
          }
        },
        "required": [
          "tipo",
          "id"
        ],
        "additionalProperties": false
      },
      "PerigosoMdfe": {
        "type": "object",
        "properties": {
          "onu": {
            "type": "string"
          },
          "nomeEmbarque": {
            "type": "string"
          },
          "classeRisco": {
            "type": "string"
          },
          "grupoEmbalagem": {
            "type": "string"
          },
          "quantidadeTotal": {
            "type": "string",
            "description": "quantidade total por produto, com a unidade (texto, até 20)"
          },
          "volumes": {
            "type": "string",
            "description": "quantidade e tipo de volumes (texto, até 60)"
          }
        },
        "required": [
          "onu",
          "quantidadeTotal"
        ],
        "additionalProperties": false,
        "description": "Produto perigoso (ONU) do documento"
      },
      "SeguroMdfe": {
        "type": "object",
        "properties": {
          "responsavel": {
            "type": "string",
            "enum": [
              "1",
              "2"
            ],
            "description": "respSeg: 1 emitente do MDF-e · 2 contratante do transporte"
          },
          "documentoResponsavel": {
            "$ref": "#/components/schemas/DocumentoMdfe",
            "description": "CNPJ/CPF do responsável: obrigatório quando o responsável é o contratante (regra F93)"
          },
          "seguradora": {
            "type": "object",
            "properties": {
              "nome": {
                "type": "string"
              },
              "cnpj": {
                "type": "string"
              }
            },
            "required": [
              "nome",
              "cnpj"
            ],
            "additionalProperties": false
          },
          "apolice": {
            "type": "string"
          },
          "averbacoes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "responsavel",
          "seguradora",
          "apolice",
          "averbacoes"
        ],
        "additionalProperties": false
      },
      "ProdutoPredominanteMdfe": {
        "type": "object",
        "properties": {
          "tipoCarga": {
            "type": "string",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06",
              "07",
              "08",
              "09",
              "10",
              "11",
              "12"
            ],
            "description": "tpCarga: 01 granel sólido … 05 carga geral … 12 granel pressurizada (NT 2025.001)"
          },
          "descricao": {
            "type": "string"
          },
          "gtin": {
            "type": "string"
          },
          "ncm": {
            "type": "string",
            "description": "NCM: obrigatório quando o MDF-e leva um único DF-e (NT 2025.001, rejeição 301)"
          },
          "lotacao": {
            "type": "object",
            "properties": {
              "carregamento": {
                "$ref": "#/components/schemas/LocalLotacao"
              },
              "descarregamento": {
                "$ref": "#/components/schemas/LocalLotacao"
              }
            },
            "required": [
              "carregamento",
              "descarregamento"
            ],
            "additionalProperties": false,
            "description": "infLotacao: obrigatório quando o MDF-e leva um único DF-e (regra F55, rejeição 726)"
          }
        },
        "required": [
          "tipoCarga",
          "descricao"
        ],
        "additionalProperties": false
      },
      "LocalLotacao": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "cep": {
                "type": "string"
              }
            },
            "required": [
              "cep"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "latitude": {
                "type": "string"
              },
              "longitude": {
                "type": "string"
              }
            },
            "required": [
              "latitude",
              "longitude"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Local de carregamento ou descarregamento da carga lotação: CEP ou coordenada"
      },
      "RodoviarioMdfe": {
        "type": "object",
        "properties": {
          "rntrc": {
            "type": "string"
          },
          "ciot": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "codigo": {
                  "type": "string"
                },
                "responsavel": {
                  "$ref": "#/components/schemas/DocumentoMdfe"
                }
              },
              "required": [
                "responsavel"
              ],
              "additionalProperties": false
            },
            "description": "infCIOT: obrigatório para tpEmit 1 e 3 (e 2 com tpTransp) pela NT 2026.001"
          },
          "valePedagio": {
            "$ref": "#/components/schemas/ValePedagioMdfe"
          },
          "contratantes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "nome": {
                  "type": "string"
                },
                "identificacao": {
                  "$ref": "#/components/schemas/IdentificacaoMdfe"
                },
                "contrato": {
                  "type": "object",
                  "properties": {
                    "numero": {
                      "type": "string"
                    },
                    "valorGlobal": {
                      "$ref": "#/components/schemas/Decimal"
                    }
                  },
                  "required": [
                    "numero",
                    "valorGlobal"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "identificacao"
              ],
              "additionalProperties": false
            }
          },
          "pagamentos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PagamentoMdfe"
            }
          },
          "tracao": {
            "$ref": "#/components/schemas/VeiculoTracao"
          },
          "reboques": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VeiculoMdfe"
            }
          },
          "lacres": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "tracao"
        ],
        "additionalProperties": false
      },
      "ValePedagioMdfe": {
        "type": "object",
        "properties": {
          "dispositivos": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "cnpjFornecedor": {
                  "type": "string"
                },
                "responsavelPagamento": {
                  "$ref": "#/components/schemas/DocumentoMdfe"
                },
                "numeroCompra": {
                  "type": "string",
                  "description": "IDVPO, identificador do vale-pedágio obrigatório (NT 2025.001): só dígitos, até 20"
                },
                "valor": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "tipo": {
                  "type": "string",
                  "enum": [
                    "01",
                    "04"
                  ],
                  "description": "tpValePed: 01 TAG · 04 leitura de placa (NT 2025.001: 02 e 03 deixaram de valer)"
                }
              },
              "required": [
                "cnpjFornecedor",
                "valor"
              ],
              "additionalProperties": false
            }
          },
          "categoriaCombinacaoVeicular": {
            "type": "string",
            "enum": [
              "02",
              "04",
              "06",
              "07",
              "08",
              "10",
              "11",
              "12",
              "13",
              "14"
            ],
            "description": "categCombVeic: obrigatória com vale-pedágio (regra F95)"
          }
        },
        "required": [
          "dispositivos",
          "categoriaCombinacaoVeicular"
        ],
        "additionalProperties": false
      },
      "IdentificacaoMdfe": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/DocumentoMdfe"
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "estrangeiro"
              },
              "numero": {
                "type": "string"
              }
            },
            "required": [
              "tipo",
              "numero"
            ],
            "additionalProperties": false
          }
        ]
      },
      "PagamentoMdfe": {
        "type": "object",
        "properties": {
          "nome": {
            "type": "string"
          },
          "responsavel": {
            "$ref": "#/components/schemas/IdentificacaoMdfe"
          },
          "componentes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tipo": {
                  "type": "string",
                  "enum": [
                    "01",
                    "02",
                    "03",
                    "04",
                    "99"
                  ]
                },
                "valor": {
                  "$ref": "#/components/schemas/Decimal"
                },
                "descricao": {
                  "type": "string"
                }
              },
              "required": [
                "tipo",
                "valor"
              ],
              "additionalProperties": false
            },
            "description": "tpComp: 01 vale-pedágio · 02 impostos, taxas e contribuições · 03 despesas · 04 frete · 99 outros"
          },
          "valorContrato": {
            "$ref": "#/components/schemas/Decimal"
          },
          "altoDesempenho": {
            "type": "boolean"
          },
          "forma": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "indPag: 0 à vista · 1 a prazo"
          },
          "adiantamento": {
            "$ref": "#/components/schemas/Decimal"
          },
          "antecipaAdiantamento": {
            "type": "boolean"
          },
          "parcelas": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "vencimento": {
                  "type": "string"
                },
                "valor": {
                  "$ref": "#/components/schemas/Decimal"
                }
              },
              "required": [
                "vencimento",
                "valor"
              ],
              "additionalProperties": false
            },
            "description": "parcelas, só no pagamento a prazo; numeradas na ordem (001, 002…)"
          },
          "antecipacao": {
            "type": "string",
            "enum": [
              "0",
              "1"
            ],
            "description": "tpAntecip: 0 não permite · 1 permite antecipar as parcelas. O Anexo I ainda lista o 2 (com confirmação), mas o XSD do PL 3.00b só aceita 0 e 1; vale o XSD."
          },
          "banco": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "codigoBanco": {
                    "type": "string"
                  },
                  "agencia": {
                    "type": "string"
                  }
                },
                "required": [
                  "codigoBanco",
                  "agencia"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "cnpjIpef": {
                    "type": "string"
                  }
                },
                "required": [
                  "cnpjIpef"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "pix": {
                    "type": "string"
                  }
                },
                "required": [
                  "pix"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "responsavel",
          "componentes",
          "valorContrato",
          "forma",
          "banco"
        ],
        "additionalProperties": false
      },
      "VeiculoTracao": {
        "type": "object",
        "properties": {
          "codigoInterno": {
            "type": "string"
          },
          "placa": {
            "type": "string"
          },
          "renavam": {
            "type": "string"
          },
          "taraKg": {
            "type": "number",
            "description": "tara em kg (inteiro)"
          },
          "capacidadeKg": {
            "type": "number"
          },
          "capacidadeM3": {
            "type": "number"
          },
          "proprietario": {
            "$ref": "#/components/schemas/ProprietarioVeiculo",
            "description": "só quando o veículo não é do emitente"
          },
          "tipoCarroceria": {
            "type": "string",
            "enum": [
              "00",
              "01",
              "02",
              "03",
              "04",
              "05"
            ],
            "description": "tpCar: 00 não aplicável · 01 aberta · 02 fechada/baú · 03 graneleira · 04 porta contêiner · 05 sider"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          },
          "condutores": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "nome": {
                  "type": "string"
                },
                "cpf": {
                  "type": "string"
                }
              },
              "required": [
                "nome",
                "cpf"
              ],
              "additionalProperties": false
            }
          },
          "tipoRodado": {
            "type": "string",
            "enum": [
              "01",
              "02",
              "03",
              "04",
              "05",
              "06"
            ],
            "description": "tpRod: 01 truck · 02 toco · 03 cavalo mecânico · 04 van · 05 utilitário · 06 outros"
          }
        },
        "required": [
          "condutores",
          "placa",
          "taraKg",
          "tipoCarroceria",
          "tipoRodado"
        ],
        "additionalProperties": false
      },
      "ProprietarioVeiculo": {
        "type": "object",
        "properties": {
          "documento": {
            "$ref": "#/components/schemas/DocumentoMdfe"
          },
          "rntrc": {
            "type": "string"
          },
          "nome": {
            "type": "string"
          },
          "inscricaoEstadual": {
            "type": "string",
            "description": "IE e UF do proprietário: vão juntas ou nenhuma das duas (sequência opcional do leiaute)"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          },
          "tipo": {
            "type": "string",
            "enum": [
              "0",
              "1",
              "2"
            ],
            "description": "tpProp: 0 TAC agregado · 1 TAC independente · 2 outros"
          }
        },
        "required": [
          "documento",
          "rntrc",
          "nome",
          "tipo"
        ],
        "additionalProperties": false
      },
      "VeiculoMdfe": {
        "type": "object",
        "properties": {
          "codigoInterno": {
            "type": "string"
          },
          "placa": {
            "type": "string"
          },
          "renavam": {
            "type": "string"
          },
          "taraKg": {
            "type": "number",
            "description": "tara em kg (inteiro)"
          },
          "capacidadeKg": {
            "type": "number"
          },
          "capacidadeM3": {
            "type": "number"
          },
          "proprietario": {
            "$ref": "#/components/schemas/ProprietarioVeiculo",
            "description": "só quando o veículo não é do emitente"
          },
          "tipoCarroceria": {
            "type": "string",
            "enum": [
              "00",
              "01",
              "02",
              "03",
              "04",
              "05"
            ],
            "description": "tpCar: 00 não aplicável · 01 aberta · 02 fechada/baú · 03 graneleira · 04 porta contêiner · 05 sider"
          },
          "uf": {
            "$ref": "#/components/schemas/Uf"
          }
        },
        "required": [
          "placa",
          "taraKg",
          "tipoCarroceria"
        ],
        "additionalProperties": false
      },
      "ModalMdfe": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "aereo"
              },
              "nacionalidade": {
                "type": "string",
                "description": "nac: marca da nacionalidade da aeronave (até 4)"
              },
              "matricula": {
                "type": "string",
                "description": "matr: marca de matrícula (até 6)"
              },
              "voo": {
                "type": "string",
                "description": "nVoo: AB1234 (5 a 9)"
              },
              "aerodromoEmbarque": {
                "type": "string",
                "description": "cAerEmb / cAerDes: código IATA (3) ou OACI (4)"
              },
              "aerodromoDestino": {
                "type": "string"
              },
              "dataVoo": {
                "type": "string",
                "description": "AAAA-MM-DD"
              }
            },
            "required": [
              "tipo",
              "nacionalidade",
              "matricula",
              "voo",
              "aerodromoEmbarque",
              "aerodromoDestino",
              "dataVoo"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "aquaviario"
              },
              "irin": {
                "type": "string"
              },
              "tipoEmbarcacao": {
                "type": "string",
                "description": "tpEmb: código da Tabela de Tipo de Embarcação (2 dígitos)"
              },
              "codigoEmbarcacao": {
                "type": "string"
              },
              "nomeEmbarcacao": {
                "type": "string"
              },
              "viagem": {
                "type": "string"
              },
              "portoEmbarque": {
                "type": "string",
                "description": "códigos da Tabela de Portos (até 5)"
              },
              "portoDestino": {
                "type": "string"
              },
              "portoTransbordo": {
                "type": "string"
              },
              "navegacao": {
                "type": "string",
                "enum": [
                  "0",
                  "1"
                ],
                "description": "tpNav: 0 interior · 1 cabotagem"
              },
              "terminaisCarregamento": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "codigo": {
                      "type": "string"
                    },
                    "nome": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "codigo",
                    "nome"
                  ],
                  "additionalProperties": false
                },
                "description": "até 5 de cada"
              },
              "terminaisDescarregamento": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "codigo": {
                      "type": "string"
                    },
                    "nome": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "codigo",
                    "nome"
                  ],
                  "additionalProperties": false
                }
              },
              "comboio": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "codigoEmbarcacao": {
                      "type": "string"
                    },
                    "balsa": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "codigoEmbarcacao",
                    "balsa"
                  ],
                  "additionalProperties": false
                },
                "description": "embarcações do comboio (até 30)"
              },
              "mmsi": {
                "type": "string",
                "description": "9 dígitos (ANATEL)"
              },
              "unidadesCargaVazias": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string",
                      "enum": [
                        "1",
                        "2",
                        "3",
                        "4"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "tipo"
                  ],
                  "additionalProperties": false
                },
                "description": "unidades de carga vazias (1 container · 2 ULD · 3 pallet · 4 outros)"
              },
              "unidadesTransporteVazias": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "tipo": {
                      "type": "string",
                      "enum": [
                        "1",
                        "2"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "tipo"
                  ],
                  "additionalProperties": false
                },
                "description": "unidades de transporte vazias (1 rodoviário tração · 2 rodoviário reboque)"
              }
            },
            "required": [
              "tipo",
              "irin",
              "tipoEmbarcacao",
              "codigoEmbarcacao",
              "nomeEmbarcacao",
              "viagem",
              "portoEmbarque",
              "portoDestino"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "tipo": {
                "type": "string",
                "const": "ferroviario"
              },
              "trem": {
                "type": "object",
                "properties": {
                  "prefixo": {
                    "type": "string"
                  },
                  "liberacao": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "origem": {
                    "type": "string",
                    "description": "siglas das estações (até 3)"
                  },
                  "destino": {
                    "type": "string"
                  },
                  "vagoesCarregados": {
                    "type": "number"
                  }
                },
                "required": [
                  "prefixo",
                  "origem",
                  "destino",
                  "vagoesCarregados"
                ],
                "additionalProperties": false
              },
              "vagoes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "pesoBaseCalculo": {
                      "$ref": "#/components/schemas/Decimal",
                      "description": "toneladas, até 999.999"
                    },
                    "pesoReal": {
                      "$ref": "#/components/schemas/Decimal"
                    },
                    "tipo": {
                      "type": "string",
                      "description": "3 caracteres"
                    },
                    "serie": {
                      "type": "string"
                    },
                    "numero": {
                      "type": "string"
                    },
                    "sequencia": {
                      "type": "number"
                    },
                    "toneladaUtil": {
                      "$ref": "#/components/schemas/Decimal",
                      "description": "tonelada útil"
                    }
                  },
                  "required": [
                    "pesoBaseCalculo",
                    "pesoReal",
                    "serie",
                    "numero",
                    "toneladaUtil"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "tipo",
              "trem",
              "vagoes"
            ],
            "additionalProperties": false
          }
        ],
        "description": "Aéreo, aquaviário e ferroviário, conforme os XSD mdfeModal*_v3.00"
      },
      "EntradaMdfe": {
        "type": "object",
        "properties": {
          "tipoEmitente": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "tpEmit: 1 prestador de serviço de transporte · 2 carga própria · 3 prestador que emitirá CT-e globalizado"
          },
          "tipoTransportador": {
            "type": "string",
            "enum": [
              "1",
              "2",
              "3"
            ],
            "description": "tpTransp: 1 ETC · 2 TAC · 3 CTC. Só quando o veículo de tração tem proprietário (regras F18–F20)"
          },
          "ufInicio": {
            "$ref": "#/components/schemas/Uf"
          },
          "ufFim": {
            "$ref": "#/components/schemas/Uf"
          },
          "carregamento": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MunicipioMdfe"
            }
          },
          "carregamentoPosterior": {
            "type": "boolean",
            "description": "Carregamento posterior (indCarregaPosterior 1): carga própria que coleta ao longo do percurso. O MDF-e sai sem documentos e eles entram depois, por evento de inclusão de DF-e (110115). Regras F21–F27: um só município de carregamento e um de descarregamento, iguais, dentro da UF; tpEmit 2; modal rodoviário."
          },
          "percurso": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Uf"
            },
            "description": "UFs de passagem, na ordem da viagem, sem a de início e a de fim"
          },
          "dataHoraInicioViagem": {
            "type": "string",
            "format": "date-time"
          },
          "emitente": {
            "$ref": "#/components/schemas/EmitenteMdfe"
          },
          "descarregamentos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DescarregamentoMdfe"
            }
          },
          "seguros": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SeguroMdfe"
            }
          },
          "produtoPredominante": {
            "$ref": "#/components/schemas/ProdutoPredominanteMdfe"
          },
          "totais": {
            "type": "object",
            "properties": {
              "valorCarga": {
                "$ref": "#/components/schemas/Decimal"
              },
              "unidade": {
                "type": "string",
                "enum": [
                  "01",
                  "02"
                ],
                "description": "cUnid: 01 kg · 02 tonelada"
              },
              "pesoBruto": {
                "$ref": "#/components/schemas/Decimal"
              }
            },
            "required": [
              "valorCarga",
              "unidade",
              "pesoBruto"
            ],
            "additionalProperties": false
          },
          "lacres": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "autorizadosXml": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentoMdfe"
            }
          },
          "informacoesFisco": {
            "type": "string"
          },
          "observacoes": {
            "type": "string"
          },
          "responsavelTecnico": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string"
              },
              "contato": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "telefone": {
                "type": "string"
              }
            },
            "required": [
              "cnpj",
              "contato",
              "email",
              "telefone"
            ],
            "additionalProperties": false
          },
          "rodoviario": {
            "$ref": "#/components/schemas/RodoviarioMdfe",
            "description": "modal rodoviário; os outros modais vão em `modal` (um dos dois)"
          },
          "modal": {
            "$ref": "#/components/schemas/ModalMdfe"
          }
        },
        "required": [
          "tipoEmitente",
          "ufInicio",
          "ufFim",
          "carregamento",
          "emitente",
          "descarregamentos",
          "totais"
        ],
        "additionalProperties": false
      },
      "CorrecaoCte": {
        "type": "object",
        "properties": {
          "grupo": {
            "type": "string"
          },
          "campo": {
            "type": "string"
          },
          "valor": {
            "type": "string"
          },
          "item": {
            "type": "number",
            "description": "item do grupo, quando o grupo se repete (01 a 99)"
          }
        },
        "required": [
          "grupo",
          "campo",
          "valor"
        ],
        "additionalProperties": false
      },
      "Erro": {
        "type": "object",
        "required": [
          "erro"
        ],
        "properties": {
          "erro": {
            "type": "object",
            "required": [
              "codigo",
              "mensagem"
            ],
            "properties": {
              "codigo": {
                "type": "string"
              },
              "mensagem": {
                "type": "string"
              },
              "detalhes": {
                "description": "problemas (lista de textos), erros do XSD, ou o que o fisco respondeu"
              }
            }
          }
        }
      },
      "ResumoDocumento": {
        "type": "object",
        "description": "Resumo do documento (NFS-e, NF-e, CT-e ou MDF-e); os campos dependem do tipo e da situação",
        "properties": {
          "ref": {
            "type": "string"
          },
          "situacao": {
            "type": "string",
            "description": "processando · autorizada · rejeitada · indefinida · cancelada · e, conforme o documento, substituida, denegada, epec, inutilizada, encerrada, contingencia"
          },
          "chave": {
            "type": "string"
          },
          "chaveAcesso": {
            "type": "string"
          },
          "serie": {},
          "numero": {
            "type": "integer"
          },
          "protocolo": {
            "type": "string"
          },
          "cStat": {
            "type": "string"
          },
          "xMotivo": {
            "type": "string"
          },
          "erros": {
            "type": "array",
            "description": "NFS-e rejeitada: cada erro da Sefin classificado pelos anexos oficiais",
            "items": {
              "type": "object"
            }
          },
          "erro": {
            "type": "object",
            "description": "NF-e, CT-e ou MDF-e rejeitado ou denegado: o cStat classificado pelas tabelas de regras dos MOC. Código fora do catálogo vem com reenviarResolve \"incerto\"",
            "properties": {
              "codigo": {
                "type": "string"
              },
              "mensagem": {
                "type": "string",
                "description": "mensagem oficial do manual"
              },
              "grupo": {
                "type": "string",
                "enum": [
                  "duplicidade",
                  "servico_indisponivel",
                  "formato_xml",
                  "certificado_assinatura",
                  "cadastro_sefaz",
                  "prazo",
                  "pendencia",
                  "evento",
                  "documento",
                  "desconhecido"
                ]
              },
              "acao": {
                "type": "string",
                "enum": [
                  "corrigir_dados",
                  "regularizar_cadastro",
                  "consultar_situacao",
                  "verificar_certificado",
                  "reenviar_depois",
                  "fora_do_prazo",
                  "resolver_pendencia",
                  "suporte"
                ]
              },
              "reenviarResolve": {
                "type": "string",
                "enum": [
                  "sim",
                  "nao",
                  "incerto"
                ]
              },
              "orientacao": {
                "type": "string"
              },
              "fonte": {
                "type": "string",
                "description": "manual e regras de onde veio, ex. \"MOC CT-e 4.00, Anexo I, regras G157, H098\""
              }
            }
          },
          "criadaEm": {
            "type": "string",
            "format": "date-time"
          },
          "atualizadaEm": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    }
  }
}
