{"openapi":"3.0.0","paths":{"/v1/chave":{"get":{"operationId":"ChaveV1Controller_chave","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SobreChaveV1"}}}}},"security":[{"chave":[]}],"summary":"A chave em uso, os escopos e o uso por dia.","tags":["Chave"],"x-escopo":"uso:ler"}},"/v1/uso":{"get":{"operationId":"ChaveV1Controller_uso","parameters":[{"name":"de","required":false,"in":"query","description":"AAAA-MM-DD. Padrão: 30 dias atrás.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"name":"ate","required":false,"in":"query","description":"AAAA-MM-DD. Padrão: hoje.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsoV1"}}}}},"security":[{"chave":[]}],"summary":"Requisições aceitas por dia, com esta chave.","tags":["Chave"],"x-escopo":"uso:ler"}},"/v1/empresas":{"get":{"operationId":"EmpresasV1Controller_listar","parameters":[{"name":"cnpj","required":false,"in":"query","schema":{"pattern":"^\\d{14}$","type":"string"}},{"name":"limite","required":false,"in":"query","description":"Itens por página (1 a 200).","schema":{"minimum":1,"maximum":200,"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"O `proximoCursor` da página anterior.","schema":{"maxLength":100,"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginaEmpresasV1"}}}}},"security":[{"chave":[]}],"summary":"Empresas que esta chave enxerga.","tags":["Empresas"],"x-escopo":"empresas:ler"},"post":{"operationId":"EmpresasV1Controller_criar","parameters":[{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NovaEmpresaDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpresaV1"}}}}},"security":[{"chave":[]}],"summary":"Cadastra pelo CNPJ. Os dados vêm da Receita. Só com chave de todas as empresas e conta no fiscalPLUS.","tags":["Empresas"],"x-escopo":"empresas:escrever"}},"/v1/empresas/{id}":{"get":{"operationId":"EmpresasV1Controller_obter","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmpresaV1"}}}}},"security":[{"chave":[]}],"tags":["Empresas"],"x-escopo":"empresas:ler"}},"/v1/empresas/{id}/credencial":{"post":{"operationId":"EmpresasV1Controller_credencial","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredencialDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultadoCredencialV1"}}}}},"security":[{"chave":[]}],"summary":"Guarda o certificado A1 no cofre. Só escrita: nenhuma rota o devolve.","tags":["Empresas"],"x-escopo":"credenciais:escrever"}},"/v1/empresas/{id}/captura":{"get":{"operationId":"EmpresasV1Controller_estado","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapturaV1"}}}}},"security":[{"chave":[]}],"summary":"Situação da captura, fonte a fonte.","tags":["Empresas"],"x-escopo":"documentos:ler"},"post":{"operationId":"EmpresasV1Controller_pedir","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapturaV1"}}}}},"security":[{"chave":[]}],"summary":"Pede uma captura agora, uma vez por hora por empresa. Quem executa é o worker; acompanhe pelo GET.","tags":["Empresas"],"x-escopo":"documentos:escrever"}},"/v1/documentos":{"get":{"operationId":"DocumentosV1Controller_listar","parameters":[{"name":"empresaId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"chaveAcesso","required":false,"in":"query","description":"A nota exata: 44 ou 50 dígitos.","schema":{"pattern":"^(\\d{44}|\\d{50})$","type":"string"}},{"name":"emitenteDocumento","required":false,"in":"query","description":"CNPJ ou CPF do emitente.","schema":{"pattern":"^(\\d{11}|\\d{14})$","type":"string"}},{"name":"destinatarioDocumento","required":false,"in":"query","description":"CNPJ ou CPF do destinatário.","schema":{"pattern":"^(\\d{11}|\\d{14})$","type":"string"}},{"name":"direcao","required":false,"in":"query","description":"ENTRADA = a empresa recebeu; SAIDA = a empresa emitiu.","schema":{"type":"string","enum":["ENTRADA","SAIDA"]}},{"name":"tipo","required":false,"in":"query","schema":{"type":"string","enum":["NFSE","NFE","NFCE","CTE"]}},{"name":"situacao","required":false,"in":"query","schema":{"type":"string","enum":["NORMAL","CANCELADA","SUBSTITUIDA"]}},{"name":"de","required":false,"in":"query","description":"Emissão a partir deste dia (AAAA-MM-DD).","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"name":"ate","required":false,"in":"query","description":"Emissão até este dia (AAAA-MM-DD).","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"name":"atualizadoDesde","required":false,"in":"query","description":"Só o que mudou desde este momento (ISO 8601): é o jeito de sincronizar sem reler tudo.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$","type":"string"}},{"name":"limite","required":false,"in":"query","description":"Itens por página (1 a 200).","schema":{"minimum":1,"maximum":200,"type":"number"}},{"name":"cursor","required":false,"in":"query","description":"O `proximoCursor` da página anterior.","schema":{"maxLength":100,"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginaDocumentosV1"}}}}},"security":[{"chave":[]}],"summary":"Notas fiscais, da mais antiga para a mais nova. Para sincronizar, use `atualizadoDesde`.","tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/documentos/contagem":{"get":{"operationId":"DocumentosV1Controller_contagem","parameters":[{"name":"empresaId","required":false,"in":"query","schema":{"format":"uuid","type":"string"}},{"name":"chaveAcesso","required":false,"in":"query","description":"A nota exata: 44 ou 50 dígitos.","schema":{"pattern":"^(\\d{44}|\\d{50})$","type":"string"}},{"name":"emitenteDocumento","required":false,"in":"query","description":"CNPJ ou CPF do emitente.","schema":{"pattern":"^(\\d{11}|\\d{14})$","type":"string"}},{"name":"destinatarioDocumento","required":false,"in":"query","description":"CNPJ ou CPF do destinatário.","schema":{"pattern":"^(\\d{11}|\\d{14})$","type":"string"}},{"name":"direcao","required":false,"in":"query","description":"ENTRADA = a empresa recebeu; SAIDA = a empresa emitiu.","schema":{"type":"string","enum":["ENTRADA","SAIDA"]}},{"name":"tipo","required":false,"in":"query","schema":{"type":"string","enum":["NFSE","NFE","NFCE","CTE"]}},{"name":"situacao","required":false,"in":"query","schema":{"type":"string","enum":["NORMAL","CANCELADA","SUBSTITUIDA"]}},{"name":"de","required":false,"in":"query","description":"Emissão a partir deste dia (AAAA-MM-DD).","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"name":"ate","required":false,"in":"query","description":"Emissão até este dia (AAAA-MM-DD).","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}$","type":"string"}},{"name":"atualizadoDesde","required":false,"in":"query","description":"Só o que mudou desde este momento (ISO 8601): é o jeito de sincronizar sem reler tudo.","schema":{"pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContagemDocumentosV1"}}}}},"security":[{"chave":[]}],"summary":"Quantas notas há, por tipo, com os mesmos filtros da lista: confere se o que você baixou está completo.","tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/documentos/importar":{"post":{"operationId":"DocumentosV1Controller_importar","parameters":[{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["arquivos"],"properties":{"arquivos":{"type":"array","items":{"type":"string","format":"binary"}}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultadoImportacaoV1"}}}}},"security":[{"chave":[]}],"summary":"Envia XML (.xml ou .zip). É por aqui que as NF-e e NFC-e emitidas entram.","tags":["Documentos"],"x-escopo":"documentos:escrever"}},"/v1/documentos/{id}":{"get":{"operationId":"DocumentosV1Controller_obter","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentoV1"}}}}},"security":[{"chave":[]}],"tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/documentos/{id}/eventos":{"get":{"operationId":"DocumentosV1Controller_eventos","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EventoDocumentoV1"}}}}}},"security":[{"chave":[]}],"summary":"Cancelamento, substituição, carta de correção e ciência, com a data de cada um.","tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/documentos/{id}/xml":{"get":{"operationId":"DocumentosV1Controller_xml","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"chave":[]}],"summary":"XML original, como veio da fonte.","tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/documentos/{id}/pdf":{"get":{"operationId":"DocumentosV1Controller_pdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""}},"security":[{"chave":[]}],"summary":"DANFSe, DANFE ou DACTE, gerado do XML guardado.","tags":["Documentos"],"x-escopo":"documentos:ler"}},"/v1/webhooks":{"get":{"operationId":"WebhooksV1Controller_listar","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookV1"}}}}}},"security":[{"chave":[]}],"summary":"Webhooks desta chave.","tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"},"post":{"operationId":"WebhooksV1Controller_criar","parameters":[{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NovoWebhookDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCriadoV1"}}}}},"security":[{"chave":[]}],"summary":"O `segredo` aparece só nesta resposta.","tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}},"/v1/webhooks/{id}":{"get":{"operationId":"WebhooksV1Controller_obter","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookV1"}}}}},"security":[{"chave":[]}],"tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"},"patch":{"operationId":"WebhooksV1Controller_editar","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditarWebhookDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookV1"}}}}},"security":[{"chave":[]}],"tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"},"delete":{"operationId":"WebhooksV1Controller_excluir","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""}},"security":[{"chave":[]}],"tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}},"/v1/webhooks/{id}/segredo":{"post":{"operationId":"WebhooksV1Controller_segredo","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegredoV1"}}}}},"security":[{"chave":[]}],"summary":"Troca o segredo. O antigo para de valer na hora.","tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}},"/v1/webhooks/{id}/teste":{"post":{"operationId":"WebhooksV1Controller_testar","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntregaV1"}}}}},"security":[{"chave":[]}],"summary":"Envia um `webhook.teste`, assinado como um evento real.","tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}},"/v1/webhooks/{id}/entregas":{"get":{"operationId":"WebhooksV1Controller_entregas","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EntregaV1"}}}}}},"security":[{"chave":[]}],"summary":"As 50 entregas mais recentes.","tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}},"/v1/webhooks/{id}/entregas/{entregaId}/reenviar":{"post":{"operationId":"WebhooksV1Controller_reenviar","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"entregaId","required":true,"in":"path","schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","description":"Repetir o pedido com a mesma chave, em até 24 h, devolve a primeira resposta sem refazer nada.","required":false,"schema":{"type":"string"}}],"responses":{"202":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntregaV1"}}}}},"security":[{"chave":[]}],"tags":["Webhooks"],"x-escopo":"webhooks:gerenciar"}}},"info":{"title":"FISCALgov API","description":"API REST da FISCALgov. O que a tela faz, a API faz.\n\n**Autenticação:** `Authorization: Bearer fg_v1_…`. A chave é criada em Integrações e aparece uma vez.\n\n**Limite:** 120 requisições por minuto por chave (`X-RateLimit-Remaining`; 429 com `Retry-After`).\n\n**Paginação:** por cursor. Repita o pedido com `cursor=<proximoCursor>` até ele vir nulo.\n\n**Sincronização:** guarde o momento em que começou a ler e, na vez seguinte, peça `GET /v1/documentos?atualizadoDesde=<momento>`. Vêm as notas novas, as completadas e as canceladas. Os webhooks avisam na hora; esta leitura garante que nada se perdeu. `GET /v1/documentos/contagem` confere o total.\n\n**Erros:** todo erro traz `statusCode`, `codigo` e `message`. Decida pelo `codigo`, nunca pelo texto: DADOS_INVALIDOS, NAO_AUTENTICADO, PROIBIDO, NAO_ENCONTRADO, CONFLITO, PEDIDO_DIFERENTE, LIMITE_EXCEDIDO, ERRO_INTERNO, INDISPONIVEL, além de ESCOPO_INSUFICIENTE, PLANO_SEM_API, LIMITE_EXCEDIDO e MANUTENCAO. `NAO_ENCONTRADO` vale para o que não existe e para o que está fora do alcance da chave.\n\n**Repetição:** em 429, 503 e 5xx, repita com espera crescente; todo POST com `Idempotency-Key` pode ser repetido sem duplicar nada.\n\n**Arquivos:** XML e PDF saem em binário, nas rotas próprias, nunca em base64 dentro de JSON.\n\n**Idempotência:** todo POST aceita `Idempotency-Key`.\n\n**Escopos:** empresas:ler, empresas:escrever, credenciais:escrever, documentos:ler, documentos:escrever, webhooks:gerenciar, uso:ler. Cada rota diz o seu em `x-escopo`.\n\n**Webhooks:** documento.novo, documento.completado, documento.cancelado, credencial.vencendo. Cada entrega leva `X-FiscalGov-Assinatura: t=<carimbo>,v1=<hex>`, em que `v1` é o HMAC-SHA256, com o segredo, de `<carimbo>.<corpo>`. O corpo traz o id e o caminho do documento, nunca o XML. Sem resposta 2xx, há 8 tentativas em até 2 dias.","version":"v1","contact":{}},"tags":[],"servers":[],"components":{"securitySchemes":{"chave":{"scheme":"bearer","bearerFormat":"fg_v1","type":"http"}},"schemas":{"SobreChaveV1":{"type":"object","properties":{"nome":{"type":"string"},"contaId":{"type":"string"},"escopos":{"type":"array","items":{"type":"string"}},"empresaIds":{"nullable":true,"description":"Nulo: todas as empresas da conta.","type":"array","items":{"type":"string"}}},"required":["nome","contaId","escopos","empresaIds"]},"UsoDiaV1":{"type":"object","properties":{"dia":{"type":"string"},"requisicoes":{"type":"number"}},"required":["dia","requisicoes"]},"UsoV1":{"type":"object","properties":{"total":{"type":"number"},"limitePorMinuto":{"type":"number"},"dias":{"type":"array","items":{"$ref":"#/components/schemas/UsoDiaV1"}}},"required":["total","limitePorMinuto","dias"]},"CadastroEmpresaV1":{"type":"object","properties":{"situacao":{"type":"string","nullable":true,"description":"Situação na Receita Federal, como ela informou."},"data":{"type":"string","nullable":true},"motivo":{"type":"string","nullable":true},"fonte":{"type":"string"},"consultadoEm":{"format":"date-time","type":"string","nullable":true,"description":"Quando a Receita foi consultada."}},"required":["situacao","data","motivo","fonte","consultadoEm"]},"CertificadoEmpresaV1":{"type":"object","properties":{"estado":{"type":"string","description":"AUSENTE, VALIDO, VENCENDO ou VENCIDO."},"validadeFim":{"format":"date-time","type":"string","nullable":true}},"required":["estado","validadeFim"]},"EmpresaV1":{"type":"object","properties":{"id":{"type":"string"},"cnpj":{"type":"string"},"razaoSocial":{"type":"string"},"nomeFantasia":{"type":"string","nullable":true},"plano":{"type":"string","description":"NOTAS, CERTIDOES, DUO ou PLUS."},"regime":{"type":"string"},"uf":{"type":"string","nullable":true},"municipio":{"type":"string","nullable":true},"ativa":{"type":"boolean"},"cadastro":{"$ref":"#/components/schemas/CadastroEmpresaV1"},"certificado":{"$ref":"#/components/schemas/CertificadoEmpresaV1"},"criadoEm":{"format":"date-time","type":"string"},"atualizadoEm":{"format":"date-time","type":"string"}},"required":["id","cnpj","razaoSocial","nomeFantasia","plano","regime","uf","municipio","ativa","cadastro","certificado","criadoEm","atualizadoEm"]},"PaginaEmpresasV1":{"type":"object","properties":{"dados":{"type":"array","items":{"$ref":"#/components/schemas/EmpresaV1"}},"proximoCursor":{"type":"string","nullable":true,"description":"Nulo na última página."}},"required":["dados","proximoCursor"]},"NovaEmpresaDto":{"type":"object","properties":{"cnpj":{"type":"string","description":"Os demais dados vêm da Receita.","pattern":"^\\d{14}$"},"plano":{"type":"string","description":"Sem ele, vale o plano padrão da conta.","enum":["NOTAS","CERTIDOES","DUO"]}},"required":["cnpj"]},"CredencialDto":{"type":"object","properties":{"arquivoBase64":{"type":"string","description":"O certificado A1 (.pfx ou .p12) em base64. Só entra: nenhuma rota o devolve.","minLength":100,"maxLength":200000},"nomeArquivo":{"type":"string","minLength":1,"maxLength":200},"senha":{"type":"string","minLength":1,"maxLength":200}},"required":["arquivoBase64","nomeArquivo","senha"]},"ResultadoCredencialV1":{"type":"object","properties":{"titular":{"type":"string","nullable":true},"cnpjCertificado":{"type":"string","nullable":true},"validadeFim":{"format":"date-time","type":"string"},"filial":{"type":"boolean","description":"O certificado é da matriz e vale para esta filial."}},"required":["titular","cnpjCertificado","validadeFim","filial"]},"FonteCapturaV1":{"type":"object","properties":{"fonte":{"type":"string","description":"ADN, SEFAZ ou SEFAZ_CTE."},"situacao":{"type":"string","nullable":true,"description":"EXECUTANDO, SUCESSO ou ERRO. Nulo se ainda não rodou."},"pedida":{"type":"boolean"},"fim":{"format":"date-time","type":"string","nullable":true},"erro":{"type":"string","nullable":true},"proximaConsultaEm":{"format":"date-time","type":"string","nullable":true}},"required":["fonte","situacao","pedida","fim","erro","proximaConsultaEm"]},"CapturaV1":{"type":"object","properties":{"capturando":{"type":"boolean"},"ultimaCaptura":{"format":"date-time","type":"string","nullable":true},"proximaAutomatica":{"format":"date-time","type":"string","nullable":true},"disponivelEm":{"format":"date-time","type":"string","nullable":true,"description":"A partir de quando dá para pedir de novo."},"fontes":{"type":"array","items":{"$ref":"#/components/schemas/FonteCapturaV1"}}},"required":["capturando","ultimaCaptura","proximaAutomatica","disponivelEm","fontes"]},"ParteDocumentoV1":{"type":"object","properties":{"documento":{"type":"string","nullable":true,"description":"CNPJ ou CPF, só dígitos."},"nome":{"type":"string","nullable":true}},"required":["documento","nome"]},"CancelamentoV1":{"type":"object","properties":{"em":{"format":"date-time","type":"string","nullable":true},"motivo":{"type":"string","nullable":true},"chaveSubstituta":{"type":"string","nullable":true,"description":"Chave de acesso da nota que substituiu esta."}},"required":["em","motivo","chaveSubstituta"]},"FonteV1":{"type":"object","properties":{"nome":{"type":"string","description":"ADN, SEFAZ ou XML (enviado pela conta)."},"capturadoEm":{"format":"date-time","type":"string","description":"Quando a FISCALgov recebeu o documento."}},"required":["nome","capturadoEm"]},"LinksDocumentoV1":{"type":"object","properties":{"documento":{"type":"string"},"eventos":{"type":"string"},"xml":{"type":"string","nullable":true,"description":"Nulo enquanto a NF-e está só com o resumo."},"pdf":{"type":"string","nullable":true}},"required":["documento","eventos","xml","pdf"]},"DocumentoV1":{"type":"object","properties":{"id":{"type":"string"},"empresaId":{"type":"string"},"empresaCnpj":{"type":"string"},"chaveAcesso":{"type":"string","description":"44 dígitos (NF-e, NFC-e e CT-e) ou 50 (NFS-e nacional)."},"tipo":{"type":"string","description":"NFSE, NFE ou CTE. A NFC-e é NFE com modelo 65."},"modelo":{"type":"string","nullable":true},"direcao":{"type":"string","description":"ENTRADA ou SAIDA."},"numero":{"type":"string","nullable":true},"serie":{"type":"string","nullable":true},"dataEmissao":{"type":"string","nullable":true},"emitidoEm":{"format":"date-time","type":"string","nullable":true},"competencia":{"type":"string","nullable":true},"emitente":{"$ref":"#/components/schemas/ParteDocumentoV1"},"destinatario":{"$ref":"#/components/schemas/ParteDocumentoV1"},"valorBruto":{"type":"string","description":"Dinheiro em texto, com duas casas (`\"1234.50\"`): transcrito do XML, sem arredondar."},"valorLiquido":{"type":"string"},"issRetido":{"type":"boolean"},"valorIssRetido":{"type":"string"},"descricao":{"type":"string","nullable":true},"codigoServico":{"type":"string","nullable":true},"municipioIncidencia":{"type":"string","nullable":true},"situacao":{"type":"string","description":"NORMAL, CANCELADA ou SUBSTITUIDA."},"cancelamento":{"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/CancelamentoV1"}]},"resumo":{"type":"boolean","description":"Verdadeiro: a NF-e ainda não tem o XML completo."},"assinaturaValida":{"type":"boolean","nullable":true,"description":"Assinatura do XML conferida. Nulo quando não se aplica."},"fonte":{"$ref":"#/components/schemas/FonteV1"},"atualizadoEm":{"format":"date-time","type":"string","description":"Muda quando a nota é completada ou cancelada."},"links":{"$ref":"#/components/schemas/LinksDocumentoV1"}},"required":["id","empresaId","empresaCnpj","chaveAcesso","tipo","modelo","direcao","numero","serie","dataEmissao","emitidoEm","competencia","emitente","destinatario","valorBruto","valorLiquido","issRetido","valorIssRetido","descricao","codigoServico","municipioIncidencia","situacao","cancelamento","resumo","assinaturaValida","fonte","atualizadoEm","links"]},"PaginaDocumentosV1":{"type":"object","properties":{"dados":{"type":"array","items":{"$ref":"#/components/schemas/DocumentoV1"}},"proximoCursor":{"type":"string","nullable":true}},"required":["dados","proximoCursor"]},"ContagemDocumentosV1":{"type":"object","properties":{"total":{"type":"number"},"NFE":{"type":"number"},"NFCE":{"type":"number"},"CTE":{"type":"number"},"NFSE":{"type":"number"}},"required":["total","NFE","NFCE","CTE","NFSE"]},"DetalheImportacaoV1":{"type":"object","properties":{"arquivo":{"type":"string"},"motivo":{"type":"string"}},"required":["arquivo","motivo"]},"ResultadoImportacaoV1":{"type":"object","properties":{"importadas":{"type":"number"},"completadas":{"type":"number"},"repetidas":{"type":"number"},"eventos":{"type":"number"},"semEmpresa":{"type":"number"},"recusadas":{"type":"number"},"detalhes":{"type":"array","items":{"$ref":"#/components/schemas/DetalheImportacaoV1"}}},"required":["importadas","completadas","repetidas","eventos","semEmpresa","recusadas","detalhes"]},"EventoDocumentoV1":{"type":"object","properties":{"id":{"type":"string"},"codigo":{"type":"string","description":"Código do leiaute: 101101, 105102, 110111, 110112, 110110, 210210…"},"tipo":{"type":"string"},"sequencia":{"type":"number"},"em":{"format":"date-time","type":"string","nullable":true},"motivo":{"type":"string","nullable":true},"chaveSubstituta":{"type":"string","nullable":true},"fonte":{"type":"string"}},"required":["id","codigo","tipo","sequencia","em","motivo","chaveSubstituta","fonte"]},"WebhookV1":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"eventos":{"type":"array","items":{"type":"string"}},"ativa":{"type":"boolean"},"criadoEm":{"format":"date-time","type":"string"},"atualizadoEm":{"format":"date-time","type":"string"}},"required":["id","url","eventos","ativa","criadoEm","atualizadoEm"]},"NovoWebhookDto":{"type":"object","properties":{"url":{"type":"string","description":"Endereço https público.","maxLength":500,"format":"uri"},"eventos":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","enum":["documento.novo","documento.completado","documento.cancelado","credencial.vencendo"]}}},"required":["url","eventos"]},"WebhookCriadoV1":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"eventos":{"type":"array","items":{"type":"string"}},"ativa":{"type":"boolean"},"criadoEm":{"format":"date-time","type":"string"},"atualizadoEm":{"format":"date-time","type":"string"},"segredo":{"type":"string","description":"Aparece só agora. Confere a assinatura de cada entrega."}},"required":["id","url","eventos","ativa","criadoEm","atualizadoEm","segredo"]},"EditarWebhookDto":{"type":"object","properties":{"url":{"type":"string","maxLength":500,"format":"uri"},"eventos":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"string","enum":["documento.novo","documento.completado","documento.cancelado","credencial.vencendo"]}},"ativa":{"type":"boolean","description":"Falso pausa a assinatura."}}},"SegredoV1":{"type":"object","properties":{"segredo":{"type":"string"}},"required":["segredo"]},"EntregaV1":{"type":"object","properties":{"id":{"type":"string"},"eventoId":{"type":"string","description":"Igual em toda repetição do mesmo evento: use para descartar duplicata."},"tipo":{"type":"string"},"situacao":{"type":"string","description":"PENDENTE, ENTREGUE ou FALHOU."},"tentativas":{"type":"number"},"proximaTentativaEm":{"format":"date-time","type":"string"},"ultimoStatus":{"type":"number","nullable":true},"ultimoErro":{"type":"string","nullable":true},"entregueEm":{"format":"date-time","type":"string","nullable":true},"criadoEm":{"format":"date-time","type":"string"}},"required":["id","eventoId","tipo","situacao","tentativas","proximaTentativaEm","ultimoStatus","ultimoErro","entregueEm","criadoEm"]}}}}