{"openapi":"3.1.0","paths":{"/health":{"get":{"operationId":"HealthController_health","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Saúde do serviço (sem autenticação)","tags":["health"],"security":[]}},"/v1/tenants/me":{"get":{"operationId":"TenantsController_me","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Dados da empresa autenticada, pendências para emitir (readiness) e integrações","tags":["empresas"]},"patch":{"operationId":"TenantsController_update","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"legalName":{"type":"string","minLength":1},"tradeName":{"type":"string"},"municipalRegistration":{"type":"string","minLength":1},"taxRegime":{"type":"string","enum":["MEI","SIMPLES_NACIONAL","SIMPLES_NACIONAL_EXCESSO","LUCRO_PRESUMIDO","LUCRO_REAL"]},"simplesNacionalApuration":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2},{"type":"number","const":3}]},"simplesNacionalTaxRateBps":{"type":"integer","minimum":0,"maximum":3300,"description":"Alíquota efetiva do Simples em pontos-base (6% = 600; 6,25% = 625)"},"specialTaxRegime":{"type":"string","enum":["NONE","COOPERATIVE","ESTIMATE","MICROENTERPRISE_MUNICIPAL","NOTARY","PROFESSIONAL_SOCIETY"]},"sendMunicipalRegistration":{"type":"boolean"},"email":{"type":"string"},"phone":{"type":"string"},"address":{"type":"object","properties":{"street":{"type":"string","minLength":1},"number":{"type":"string","minLength":1},"complement":{"type":"string"},"district":{"type":"string","minLength":1},"cityCode":{"type":"string","pattern":"^\\d{7}$"},"zipCode":{"type":"string","minLength":8}},"required":["street","number","district","cityCode","zipCode"]},"notifications":{"type":"object","properties":{"email":{"type":"boolean"},"whatsapp":{"type":"boolean"}}},"approximateTaxes":{"description":"Valor aproximado dos tributos (Lei 12.741)","type":"object","properties":{"rateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Percentual simplificado em pontos-base (IBPT 15,53% = 1553)"},"federalRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Pontos-base"},"stateRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Pontos-base"},"municipalRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Pontos-base"},"source":{"type":"string"},"descriptionTemplate":{"description":"Texto na discriminação. Tags [ValorTributos] e [PercentualTributos]","type":"string","maxLength":300}}},"culturalIncentive":{"type":"boolean"},"businessType":{"type":"string","enum":["INFOPRODUCER","MICROSAAS","CUSTOM"],"description":"O que a empresa vende: INFOPRODUCER (cursos, treinamentos, mentorias), MICROSAAS (assinaturas de software) ou CUSTOM (outro serviço: o usuário define a tributação padrão em defaultService e confirma cada produto)"},"issRateBps":{"type":"integer","minimum":200,"maximum":500,"description":"Alíquota de ISS da empresa em pontos-base (2% = 200; 2,01% = 201; 5% = 500)"},"defaultService":{"anyOf":[{"type":"object","properties":{"taxProfile":{"type":"object","properties":{"nationalServiceCode":{"type":"string","description":"Código de tributação nacional (cTribNac), 6 dígitos. Ex.: 010701"},"municipalServiceCode":{"description":"cTribMun, 3 dígitos (se o município exigir)","type":"string"},"nbsCode":{"description":"Código NBS, 9 dígitos","type":"string"},"issRateBps":{"description":"Alíquota de ISS em pontos-base, inteiro (2% = 200; 2,01% = 201; 5% = 500). Obrigatória se o ISS for retido","type":"integer","minimum":200,"maximum":500},"issTaxation":{"type":"string","enum":["TAXABLE","IMMUNE","EXPORT","NOT_LEVIED"]},"issRetention":{"type":"string","enum":["NONE","TOMADOR","INTERMEDIARIO"]},"approximateTaxRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Percentual aproximado de tributos (Lei 12.741) em pontos-base: 15,53% = 1553"},"federalRetentions":{"type":"object","properties":{"irrfRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"csllRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"pisRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"cofinsRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"inssRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"}}},"ibsCbs":{"type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string","description":"cIndOp (6 dígitos)"}},"required":["cst","cClassTrib","operationIndicator"]},"foreignTreatment":{"description":"Venda a tomador no exterior: EXPORT (padrão, exportação de serviço) ou TAXABLE","type":"string","enum":["EXPORT","TAXABLE"]},"foreignIbsCbs":{"description":"IBS/CBS para vendas ao exterior","type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string"}},"required":["cst","cClassTrib","operationIndicator"]},"localServiceCode":{"description":"Código do serviço no sistema da prefeitura (ABRASF/Ginfes), ex.: 8.02/103911/1551","type":"string"}},"required":["nationalServiceCode"]},"serviceDescription":{"type":"string","maxLength":2000}},"required":["taxProfile"]},{"type":"null"}],"description":"Tributação padrão da empresa: vira sugestão em cada produto (null remove)"}}}}}},"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Atualiza dados cadastrais e fiscais da empresa","tags":["empresas"]}},"/v1/tenants/me/api-key/rotate":{"post":{"operationId":"TenantsController_rotate","parameters":[],"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Gera nova API key e invalida a anterior","tags":["empresas"]}},"/v1/tenants/me/numbering":{"put":{"operationId":"TenantsController_numbering","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"issuesElsewhere":{"description":"Já emite NFS-e por outro sistema? true → usa série exclusiva do açaínfe (900) se a série não for informada","type":"boolean"},"series":{"description":"Série do DPS (1 a 5 dígitos)","type":"string"},"nextNumber":{"description":"Próximo número de nota nesta série","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}}}}}},"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Série e próximo número das notas. Já emite por outro sistema? Use issuesElsewhere=true (série exclusiva 900) ou informe série/próximo número livres.","tags":["empresas"]}},"/v1/tenants/me/integrations/abacatepay":{"post":{"operationId":"TenantsController_enableAbacatePay","parameters":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"type":"string","minLength":10,"description":"API key do AbacatePay com PRODUCT:READ, WEBHOOK:CREATE, CHECKOUT:READ, TRANSPARENT:READ, SUBSCRIPTION:READ e CUSTOMER:READ"},"scanPastSales":{"description":"Buscar pagamentos antigos sem nota (padrão: true). Só mostra a prévia, não emite","type":"boolean"},"monthsBack":{"description":"Quantos meses para trás buscar (0 = só o mês atual; padrão 3; máximo 12)","type":"integer","minimum":0,"maximum":12}},"required":["apiKey"]}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Conecta o AbacatePay. Com apiKey: cria o webhook, importa os produtos e busca os pagamentos antigos sem nota (prévia). Sem corpo: só devolve a URL do webhook para cadastrar manualmente","tags":["empresas"]}},"/v1/tenants/me/integrations/abacatepay/webhook":{"post":{"operationId":"TenantsController_recreateAbacatePayWebhook","parameters":[],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"description":"API key do AbacatePay (WEBHOOK:CREATE). Omita para usar a key já conectada","type":"string","minLength":10}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cria um webhook novo no AbacatePay apontando para a URL atual da API (usa a key conectada ou a informada)","tags":["empresas"]}},"/v1/tenants/me/integrations/abacatepay/default-product":{"put":{"operationId":"TenantsController_setDefaultProduct","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"description":"Produto (id no açaínfe) da nota quando o pagamento não informa o produto. null = nenhum: não gera nota"}},"required":["productId"]}}}},"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Produto da nota quando o pagamento não informa o produto (Pix transparente sem itens). null = nenhum","tags":["empresas"]}},"/v1/tenants/me/logo":{"put":{"operationId":"LogoController_set","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Define o logo exibido no PDF da nota: multipart \"file\" ou JSON {imageBase64 | imageUrl}","tags":["empresas"]},"get":{"operationId":"LogoController_get","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Logo da empresa usada no PDF da nota","tags":["empresas"]},"delete":{"operationId":"LogoController_remove","parameters":[],"responses":{"204":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Remove a logo da empresa","tags":["empresas"]}},"/v1/certificates":{"post":{"operationId":"CertificatesController_upload","parameters":[],"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Envia o certificado A1 (.pfx). multipart/form-data com campos \"file\" e \"password\", ou JSON {pfxBase64, password}","tags":["certificados"]}},"/v1/certificates/current":{"get":{"operationId":"CertificatesController_current","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Situação do certificado A1 ativo (validade, titular e emissor; nunca o arquivo)","tags":["certificados"]}},"/v1/certificates/upload-link":{"post":{"operationId":"CertificateUploadController_link","parameters":[],"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Gera link temporário (30 min) de uma página para enviar o certificado A1","tags":["certificados"]}},"/v1/products":{"post":{"operationId":"ProductsController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"externalId":{"description":"Id do produto no seu sistema/gateway (ex.: id do produto no AbacatePay)","type":"string"},"serviceDescription":{"description":"Discriminação do serviço na nota","type":"string","maxLength":2000},"defaultPriceCents":{"type":"integer","minimum":0,"maximum":9007199254740991},"taxProfile":{"description":"Tributação. Omita para aplicar o perfil fiscal padrão da empresa (businessType)","type":"object","properties":{"nationalServiceCode":{"type":"string","description":"Código de tributação nacional (cTribNac), 6 dígitos. Ex.: 010701"},"municipalServiceCode":{"description":"cTribMun, 3 dígitos (se o município exigir)","type":"string"},"nbsCode":{"description":"Código NBS, 9 dígitos","type":"string"},"issRateBps":{"description":"Alíquota de ISS em pontos-base, inteiro (2% = 200; 2,01% = 201; 5% = 500). Obrigatória se o ISS for retido","type":"integer","minimum":200,"maximum":500},"issTaxation":{"type":"string","enum":["TAXABLE","IMMUNE","EXPORT","NOT_LEVIED"]},"issRetention":{"type":"string","enum":["NONE","TOMADOR","INTERMEDIARIO"]},"approximateTaxRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Percentual aproximado de tributos (Lei 12.741) em pontos-base: 15,53% = 1553"},"federalRetentions":{"type":"object","properties":{"irrfRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"csllRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"pisRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"cofinsRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"inssRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"}}},"ibsCbs":{"type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string","description":"cIndOp (6 dígitos)"}},"required":["cst","cClassTrib","operationIndicator"]},"foreignTreatment":{"description":"Venda a tomador no exterior: EXPORT (padrão, exportação de serviço) ou TAXABLE","type":"string","enum":["EXPORT","TAXABLE"]},"foreignIbsCbs":{"description":"IBS/CBS para vendas ao exterior","type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string"}},"required":["cst","cClassTrib","operationIndicator"]},"localServiceCode":{"description":"Código do serviço no sistema da prefeitura (ABRASF/Ginfes), ex.: 8.02/103911/1551","type":"string"}},"required":["nationalServiceCode"]}},"required":["name"]}}}},"responses":{"201":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cadastra produto/serviço com sua própria tributação (código de serviço, alíquota, retenções)","tags":["produtos"]},"get":{"operationId":"ProductsController_list","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPage"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Lista os produtos/serviços e a tributação de cada um","tags":["produtos"]}},"/v1/products/{id}":{"get":{"operationId":"ProductsController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Um produto e a tributação dele","tags":["produtos"]},"patch":{"operationId":"ProductsController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"externalId":{"description":"Id do produto no seu sistema/gateway (ex.: id do produto no AbacatePay)","type":"string"},"serviceDescription":{"description":"Discriminação do serviço na nota","type":"string","maxLength":2000},"defaultPriceCents":{"type":"integer","minimum":0,"maximum":9007199254740991},"taxProfile":{"type":"object","properties":{"nationalServiceCode":{"type":"string","description":"Código de tributação nacional (cTribNac), 6 dígitos. Ex.: 010701"},"municipalServiceCode":{"description":"cTribMun, 3 dígitos (se o município exigir)","type":"string"},"nbsCode":{"description":"Código NBS, 9 dígitos","type":"string"},"issRateBps":{"description":"Alíquota de ISS em pontos-base, inteiro (2% = 200; 2,01% = 201; 5% = 500). Obrigatória se o ISS for retido","type":"integer","minimum":200,"maximum":500},"issTaxation":{"type":"string","enum":["TAXABLE","IMMUNE","EXPORT","NOT_LEVIED"]},"issRetention":{"type":"string","enum":["NONE","TOMADOR","INTERMEDIARIO"]},"approximateTaxRateBps":{"type":"integer","minimum":0,"maximum":10000,"description":"Percentual aproximado de tributos (Lei 12.741) em pontos-base: 15,53% = 1553"},"federalRetentions":{"type":"object","properties":{"irrfRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"csllRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"pisRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"cofinsRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"},"inssRateBps":{"type":"integer","minimum":0,"maximum":3000,"description":"Retenção em pontos-base (1,5% = 150)"}}},"ibsCbs":{"type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string","description":"cIndOp (6 dígitos)"}},"required":["cst","cClassTrib","operationIndicator"]},"foreignTreatment":{"description":"Venda a tomador no exterior: EXPORT (padrão, exportação de serviço) ou TAXABLE","type":"string","enum":["EXPORT","TAXABLE"]},"foreignIbsCbs":{"description":"IBS/CBS para vendas ao exterior","type":"object","properties":{"cst":{"type":"string"},"cClassTrib":{"type":"string"},"operationIndicator":{"type":"string"}},"required":["cst","cClassTrib","operationIndicator"]},"localServiceCode":{"description":"Código do serviço no sistema da prefeitura (ABRASF/Ginfes), ex.: 8.02/103911/1551","type":"string"}}}}}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Atualiza nome, descrição, preço ou tributação de um produto","tags":["produtos"]},"delete":{"operationId":"ProductsController_deactivate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Desativa um produto (novas vendas com ele são recusadas)","tags":["produtos"]}},"/v1/service-codes":{"get":{"operationId":"ProductsController_serviceCodes","parameters":[{"name":"limit","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Busca códigos de tributação nacional (cTribNac) por texto","tags":["produtos"]}},"/v1/municipal-params/{nationalServiceCode}":{"get":{"operationId":"ProductsController_municipalParams","parameters":[{"name":"nationalServiceCode","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Alíquota parametrizada pelo município para o código (consulta ADN com o certificado da empresa)","tags":["produtos"]}},"/v1/customers":{"post":{"operationId":"CustomersController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"foreign":{"type":"object","properties":{"countryCode":{"type":"string","minLength":2,"maxLength":2,"description":"País ISO de 2 letras (ex.: US, PT)"},"nif":{"description":"Identificação fiscal no país de origem","type":"string"},"noNifReason":{"description":"Sem NIF: 0 não informado, 1 dispensado, 2 não exigido","type":"string","enum":["0","1","2"]},"address":{"type":"object","properties":{"street":{"type":"string"},"number":{"type":"string"},"complement":{"type":"string"},"district":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"}},"required":["street","number","district","city","region","postalCode"]}},"required":["countryCode"],"description":"Tomador no exterior (em vez de CPF/CNPJ)"},"externalId":{"description":"Id do cliente no seu sistema/gateway","type":"string"},"taxId":{"description":"CPF ou CNPJ do tomador (opcional para consumidor final)","type":"string"},"name":{"type":"string"},"email":{"description":"Se informado, a nota é enviada por e-mail","type":"string"},"phone":{"description":"WhatsApp com DDD; se informado, a nota é enviada por WhatsApp","type":"string"},"address":{"type":"object","properties":{"street":{"type":"string","minLength":1},"number":{"type":"string","minLength":1},"complement":{"type":"string"},"district":{"type":"string","minLength":1},"cityCode":{"type":"string","pattern":"^\\d{7}$"},"zipCode":{"type":"string","minLength":8}},"required":["street","number","district","cityCode","zipCode"]}}}}}},"responses":{"201":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cadastra cliente (tomador). Vendas com dados novos também cadastram automaticamente.","tags":["clientes"]},"get":{"operationId":"CustomersController_list","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPage"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Lista os clientes (tomadores) cadastrados","tags":["clientes"]}},"/v1/customers/{id}":{"get":{"operationId":"CustomersController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Um cliente (tomador)","tags":["clientes"]},"patch":{"operationId":"CustomersController_update","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"foreign":{"type":"object","properties":{"countryCode":{"type":"string","minLength":2,"maxLength":2,"description":"País ISO de 2 letras (ex.: US, PT)"},"nif":{"description":"Identificação fiscal no país de origem","type":"string"},"noNifReason":{"description":"Sem NIF: 0 não informado, 1 dispensado, 2 não exigido","type":"string","enum":["0","1","2"]},"address":{"type":"object","properties":{"street":{"type":"string"},"number":{"type":"string"},"complement":{"type":"string"},"district":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"}},"required":["street","number","district","city","region","postalCode"]}},"required":["countryCode"],"description":"Tomador no exterior (em vez de CPF/CNPJ)"},"externalId":{"description":"Id do cliente no seu sistema/gateway","type":"string"},"taxId":{"description":"CPF ou CNPJ do tomador (opcional para consumidor final)","type":"string"},"name":{"type":"string"},"email":{"description":"Se informado, a nota é enviada por e-mail","type":"string"},"phone":{"description":"WhatsApp com DDD; se informado, a nota é enviada por WhatsApp","type":"string"},"address":{"type":"object","properties":{"street":{"type":"string","minLength":1},"number":{"type":"string","minLength":1},"complement":{"type":"string"},"district":{"type":"string","minLength":1},"cityCode":{"type":"string","pattern":"^\\d{7}$"},"zipCode":{"type":"string","minLength":8}},"required":["street","number","district","cityCode","zipCode"]}}}}}},"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Atualiza os dados de um cliente","tags":["clientes"]},"delete":{"operationId":"CustomersController_remove","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Remove um cliente","tags":["clientes"]}},"/v1/sales":{"post":{"operationId":"SalesController_create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"description":"Id da venda/pedido na origem — garante idempotência"},"customerId":{"description":"Cliente já cadastrado (veja list_customers)","type":"string"},"customer":{"description":"Dados do tomador; novos clientes são cadastrados automaticamente","type":"object","properties":{"foreign":{"type":"object","properties":{"countryCode":{"type":"string","minLength":2,"maxLength":2,"description":"País ISO de 2 letras (ex.: US, PT)"},"nif":{"description":"Identificação fiscal no país de origem","type":"string"},"noNifReason":{"description":"Sem NIF: 0 não informado, 1 dispensado, 2 não exigido","type":"string","enum":["0","1","2"]},"address":{"type":"object","properties":{"street":{"type":"string"},"number":{"type":"string"},"complement":{"type":"string"},"district":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"}},"required":["street","number","district","city","region","postalCode"]}},"required":["countryCode"],"description":"Tomador no exterior (em vez de CPF/CNPJ)"},"externalId":{"description":"Id do cliente no seu sistema/gateway","type":"string"},"taxId":{"description":"CPF ou CNPJ do tomador (opcional para consumidor final)","type":"string"},"name":{"type":"string"},"email":{"description":"Se informado, a nota é enviada por e-mail","type":"string"},"phone":{"description":"WhatsApp com DDD; se informado, a nota é enviada por WhatsApp","type":"string"},"address":{"type":"object","properties":{"street":{"type":"string","minLength":1},"number":{"type":"string","minLength":1},"complement":{"type":"string"},"district":{"type":"string","minLength":1},"cityCode":{"type":"string","pattern":"^\\d{7}$"},"zipCode":{"type":"string","minLength":8}},"required":["street","number","district","cityCode","zipCode"]}}},"items":{"minItems":1,"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"productExternalId":{"type":"string"},"quantity":{"description":"Quantidade inteira (padrão 1)","type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"unitPriceCents":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalCents":{"type":"integer","minimum":0,"maximum":9007199254740991},"description":{"type":"string","maxLength":2000}}}},"totalCents":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"competenceDate":{"description":"Data de competência (padrão: hoje)","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["externalId","items"]}}}},"responses":{"202":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaleResult"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Registra uma venda e agenda a emissão (assíncrona). Itens com tributações diferentes geram notas diferentes.","tags":["vendas"]}},"/v1/sales/{id}":{"get":{"operationId":"SalesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Uma venda com as notas geradas (uma por tributação) e a situação de estorno","tags":["vendas"]}},"/v1/sales/{id}/refund":{"post":{"operationId":"RefundsController_refund","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reasonCode":{"description":"Motivo do cancelamento: 1 = erro na emissão, 2 = serviço não prestado (padrão), 9 = outros","type":"string","enum":["1","2","9"]},"reason":{"description":"Justificativa (15 a 255 caracteres)","type":"string","minLength":15,"maxLength":255}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Estorno: cancela na prefeitura as NFS-e emitidas da venda e impede a emissão das pendentes. Idempotente.","tags":["vendas"]}},"/v1/sales/by-external-id/{externalId}/refund":{"post":{"operationId":"RefundsController_refundByExternalId","parameters":[{"name":"externalId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reasonCode":{"description":"Motivo do cancelamento: 1 = erro na emissão, 2 = serviço não prestado (padrão), 9 = outros","type":"string","enum":["1","2","9"]},"reason":{"description":"Justificativa (15 a 255 caracteres)","type":"string","minLength":15,"maxLength":255}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Estorno pelo id da venda na origem (?source=API|MCP|ABACATEPAY, padrão API)","tags":["vendas"]}},"/v1/invoices":{"get":{"operationId":"InvoicesController_list","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicePage"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Lista notas, com filtros por status, período e CPF/CNPJ do tomador","tags":["notas"]}},"/v1/invoices/{id}":{"get":{"operationId":"InvoicesController_get","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Status, número, chave, link do PDF e histórico de uma nota","tags":["notas"]}},"/v1/invoices/{id}/pdf":{"get":{"operationId":"InvoicesController_pdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"PDF (DANFSe) da nota emitida","tags":["notas"]}},"/v1/invoices/{id}/xml":{"get":{"operationId":"InvoicesController_xml","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"XML da nota emitida, como gravado pela prefeitura ou pela Sefin","tags":["notas"]}},"/v1/invoices/{id}/explain":{"get":{"operationId":"InvoicesController_explain","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Explica a rejeição da prefeitura e sugere a correção","tags":["notas"]}},"/v1/invoices/{id}/cancel":{"post":{"operationId":"InvoicesController_cancel","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reasonCode":{"type":"string","enum":["1","2","9"],"description":"1 = erro na emissão, 2 = serviço não prestado, 9 = outros"},"reason":{"type":"string","minLength":15,"maxLength":255}},"required":["reasonCode","reason"]}}}},"responses":{"201":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cancela uma NFS-e emitida (irreversível)","tags":["notas"]}},"/v1/invoices/{id}/retry":{"post":{"operationId":"InvoicesController_retry","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"202":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Reprocessa uma nota rejeitada ou com falha","tags":["notas"]}},"/v1/invoices/{id}/resend":{"post":{"operationId":"InvoicesController_resend","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["EMAIL","WHATSAPP"]},"to":{"type":"string"}},"required":["channel"]}}}},"responses":{"202":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Reenvia a nota ao cliente por e-mail ou WhatsApp","tags":["notas"]}},"/v1/past-sales/scan":{"post":{"operationId":"PastSalesController_scan","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monthsBack":{"description":"Quantos meses anteriores buscar além do atual (padrão 3)","type":"integer","minimum":0,"maximum":12}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Busca no AbacatePay as vendas pagas dos últimos meses e monta a prévia (não emite nada)","tags":["vendas passadas"]}},"/v1/past-sales":{"get":{"operationId":"PastSalesController_summary","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Prévia por mês: disponíveis, já emitidas em outro sistema, importadas, estornadas","tags":["vendas passadas"]}},"/v1/past-sales/items":{"get":{"operationId":"PastSalesController_list","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Vendas pagas antes do açaínfe (ou sem nota), filtradas por mês e situação","tags":["vendas passadas"]}},"/v1/past-sales/mark":{"post":{"operationId":"PastSalesController_mark","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"description":"Vendas específicas (ids da prévia)","type":"array","items":{"type":"string"}},"period":{"description":"Ou todas as vendas do mês AAAA-MM","type":"string","pattern":"^\\d{4}-\\d{2}$"},"alreadyIssued":{"type":"boolean","description":"true = já tem nota em outro sistema (não emitir); false = desfazer"}},"required":["alreadyIssued"]}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Marca/desmarca vendas que já têm nota em outro sistema (não serão emitidas)","tags":["vendas passadas"]}},"/v1/past-sales/ignore":{"post":{"operationId":"PastSalesController_ignore","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"description":"Pagamentos específicos (ids da prévia)","type":"array","items":{"type":"string"}},"period":{"description":"Ou todos os pagamentos do mês AAAA-MM","type":"string","pattern":"^\\d{4}-\\d{2}$"},"ignored":{"default":true,"description":"true = não é venda (ex.: teste), nunca emitir; false = desfazer","type":"boolean"},"reason":{"description":"Motivo, ex.: \"pagamento de teste\"","type":"string","maxLength":200}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Ignora (ou volta a considerar) pagamentos que não são venda, ex.: testes (nunca emitir)","tags":["vendas passadas"]}},"/v1/past-sales/issue":{"post":{"operationId":"PastSalesController_issue","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"string","pattern":"^\\d{4}-\\d{2}$","description":"Mês das vendas a emitir"},"confirmPastPeriod":{"description":"Obrigatório para meses anteriores ao atual: usuário ciente da competência retroativa (contador)","type":"boolean"},"fallbackProductId":{"description":"Produto usado para Pix avulso sem itens (sem ele, essas vendas ficam de fora)","type":"string"},"skipReconciliation":{"description":"Emitir sem cruzar com as notas da prefeitura (reconcile_past_sales). Só com o usuário ciente do risco de duplicidade","type":"boolean"}},"required":["period"]}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Emite as vendas disponíveis de um mês (meses anteriores exigem confirmPastPeriod)","tags":["vendas passadas"]}},"/v1/past-sales/reconcile":{"get":{"operationId":"PastSalesController_reconcile","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cruza as vendas do mês com as notas já emitidas na prefeitura (ex.: pelo eNotas). Só sugere","tags":["vendas passadas"]}},"/v1/past-sales/reconcile/apply":{"post":{"operationId":"PastSalesController_applyReconciliation","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"string","pattern":"^\\d{4}-\\d{2}$","description":"Mês das vendas (AAAA-MM)"},"confidence":{"type":"string","enum":["HIGH","MEDIUM"],"description":"Nível mínimo: HIGH = mesmo valor e CPF/CNPJ; MEDIUM = mesmo valor, nome e data próxima"},"ids":{"description":"Só estas vendas (pastSaleId), as que o usuário confirmou","type":"array","items":{"type":"string"}}},"required":["period","confidence"]}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Marca como já emitidas as vendas que correspondem a notas da prefeitura","tags":["vendas passadas"]}},"/v1/billing":{"get":{"operationId":"BillingController_summary","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Saldo em aberto, valor a pagar e data em que a emissão será pausada","tags":["cobrança"]}},"/v1/billing/charges":{"get":{"operationId":"BillingController_charges","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Extrato: uma cobrança por nota emitida","tags":["cobrança"]}},"/v1/billing/payments":{"post":{"operationId":"BillingController_pay","parameters":[],"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Gera (ou reaproveita) o Pix para pagar o saldo em aberto","tags":["cobrança"]}},"/v1/tenants/me/accountant":{"put":{"operationId":"AccountantController_set","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"email":{"description":"E-mail do contador","type":"string"},"whatsapp":{"description":"WhatsApp do contador com DDD","type":"string"},"monthlyReport":{"description":"Envio automático mensal (padrão: true)","type":"boolean"},"dayOfMonth":{"description":"Dia do envio (padrão: 1)","type":"integer","minimum":1,"maximum":28}}}}}},"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Cadastra o contador: recebe todo mês PDFs, XMLs e planilha das notas por e-mail/WhatsApp","tags":["contador"]},"delete":{"operationId":"AccountantController_remove","parameters":[],"responses":{"204":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Remove o contador cadastrado (deixa de receber o pacote mensal)","tags":["contador"]}},"/v1/tenants/me/accountant/reports":{"get":{"operationId":"AccountantController_reports","parameters":[],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Histórico de envios ao contador","tags":["contador"]},"post":{"operationId":"AccountantController_send","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"period":{"description":"Mês de referência (padrão: mês anterior)","type":"string","pattern":"^\\d{4}-\\d{2}$"}}}}}},"responses":{"201":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Envia agora o pacote de um mês ao contador (padrão: mês anterior)","tags":["contador"]}},"/v1/tenants/me/accountant/packages/{period}":{"get":{"operationId":"AccountantController_download","parameters":[{"name":"period","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"401":{"description":"Chave ausente ou inválida (UNAUTHORIZED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}],"summary":"Baixa o ZIP do mês (PDFs + XMLs + planilha)","tags":["contador"]}},"/v1/public/invoices/{id}/pdf":{"get":{"operationId":"PublicInvoicePdfController_pdf","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"sig","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""},"404":{"description":"Não encontrado (NOT_FOUND)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Download do DANFSe pelo tomador via link assinado","tags":["público"],"security":[]}},"/v1/public/pricing":{"get":{"operationId":"PublicPricingController_pricing","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pricing"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Preço vigente por nota (a landing page lê daqui)","tags":["público"],"security":[]}},"/v1/public/coverage":{"get":{"operationId":"PublicPricingController_coverage","parameters":[],"responses":{"200":{"description":"Sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Coverage"}}}},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Cidades atendidas (a landing e a lista de espera leem daqui): regimes liberados em cada uma","tags":["público"],"security":[]}},"/v1/public/accountant-packages/{tenantId}/{period}":{"get":{"operationId":"PublicAccountantPackageController_download","parameters":[{"name":"tenantId","required":true,"in":"path","schema":{"type":"string"}},{"name":"period","required":true,"in":"path","schema":{"type":"string"}},{"name":"sig","required":true,"in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":""},"4XX":{"description":"Erro do pedido: dados inválidos (VALIDATION), conflito (CONFLICT/INVALID_STATE) etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"Indisponibilidade (UNAVAILABLE) ou erro interno (INTERNAL); pode tentar de novo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"summary":"Download do pacote mensal pelo contador (link assinado enviado por e-mail/WhatsApp)","tags":["público"],"security":[]}}},"info":{"title":"açaínfe API","description":"Emissão de NFS-e com a tributação de cada produto, para quem vende no AbacatePay.\n\n**Autenticação:** gere uma chave em https://acainfe.com (menu \"Agentes de IA\") e envie no cabeçalho `x-api-key` (ou `Authorization: Bearer <chave>`).\n\n**Valores inteiros:** dinheiro em centavos (R$ 82,20 = 8220) e percentuais em pontos-base (2,01% = 201).\n\n**Exemplo — emitir uma nota:**\n```\ncurl -X POST https://api.acainfe.com/v1/sales \\\n  -H \"x-api-key: <chave>\" -H \"Content-Type: application/json\" \\\n  -d '{\"externalId\":\"pedido-123\",\"customer\":{\"name\":\"Ana Souza\",\"taxId\":\"52998224725\",\"email\":\"ana@exemplo.com\"},\"items\":[{\"productExternalId\":\"prod_abc\",\"totalCents\":9700}]}'\n```\nA emissão é assíncrona: acompanhe com `GET /v1/invoices/{id}`.\n\n**Erros:** toda resposta 4xx/5xx tem o formato `{ \"error\": \"<CÓDIGO>\", \"message\": \"...\", \"details\": {...} }` (esquema `Error`). Códigos: VALIDATION (422), NOT_FOUND (404), CONFLICT e INVALID_STATE (409), UNAUTHORIZED (401), CERTIFICATE_INVALID e CERTIFICATE_MISSING (422), UNAVAILABLE (503), INTERNAL (500).\n\n**Versionamento e descontinuação:** a versão está no caminho (`/v1`). Dentro de uma versão, só entram mudanças compatíveis (novos campos, novas rotas, novos valores opcionais). Mudança incompatível só numa nova versão (`/v2`). Uma rota ou versão descontinuada continua funcionando por pelo menos 90 dias, responde com os cabeçalhos `Deprecation` (RFC 9745) e `Sunset` (RFC 8594) e é anunciada em https://acainfe.com/developers e no llms.txt.\n\n**Agentes de IA:** o mesmo serviço está disponível via MCP em https://api.acainfe.com/mcp (HTTP streamable, mesma chave). Guia para agentes: https://acainfe.com/llms.txt.","version":"acainfe-0.1.0","contact":{}},"tags":[],"servers":[{"url":"https://api.acainfe.com"}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","enum":["VALIDATION","NOT_FOUND","CONFLICT","INVALID_STATE","UNAUTHORIZED","CERTIFICATE_INVALID","CERTIFICATE_MISSING","UNAVAILABLE","BAD_REQUEST","HTTP","INTERNAL"],"description":"Código do erro, estável para tratamento automático"},"message":{"type":"string","description":"Mensagem em português para o usuário"},"details":{"type":"object","additionalProperties":true,"description":"Contexto do erro (ex.: campos inválidos em details.issues)"}},"required":["error","message"],"additionalProperties":true},"Invoice":{"type":"object","properties":{"id":{"type":"string","description":"Id da nota no açaínfe"},"saleId":{"type":"string"},"status":{"type":"string","enum":["PENDING","PROCESSING","RETRYING","ISSUED","REJECTED","FAILED","CANCELLED"]},"environment":{"type":"string","enum":["PRODUCTION","HOMOLOGATION"]},"amountCents":{"type":"integer","description":"Valor da nota em centavos"},"amount":{"type":"string","description":"Valor formatado (ex.: \"97.00\")"},"serviceDescription":{"type":"string","description":"Discriminação do serviço"},"competenceDate":{"type":"string","format":"date-time"},"customer":{"type":"object","additionalProperties":true,"description":"Tomador"},"taxProfile":{"type":"object","additionalProperties":true,"description":"Tributação aplicada (código de serviço, NBS, ISS, IBS/CBS)"},"nfse":{"type":"object","properties":{"provider":{"type":"string","enum":["NACIONAL","GINFES","PAULISTANA"]},"number":{"type":"string","description":"Número da NFS-e"},"accessKey":{"type":"string","description":"Chave de acesso ou código de verificação"},"issuedAt":{"type":"string","format":"date-time"},"verificationUrl":{"type":"string","description":"Consulta pública da nota"},"pdfUrl":{"type":"string","description":"PDF (link assinado)"}},"required":[],"additionalProperties":true},"lastErrors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":true}},"hints":{"type":"array","items":{"type":"string"},"description":"O que fazer para resolver"}},"required":["id","status","amountCents"],"additionalProperties":true},"Sale":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string","enum":["API","MCP","ABACATEPAY","ACAINFE_BILLING"]},"externalId":{"type":"string","description":"Id da venda na origem (idempotência)"},"totalCents":{"type":"integer","description":"Total da venda em centavos"},"invoiceIds":{"type":"array","items":{"type":"string"}}},"required":["id","externalId"],"additionalProperties":true},"SaleResult":{"type":"object","properties":{"sale":{"$ref":"#/components/schemas/Sale"},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"duplicated":{"type":"boolean","description":"Venda já registrada antes (mesmo externalId)"},"held":{"type":"boolean","description":"Venda retida aguardando produto/tributação; vira nota sozinha depois"}},"required":["sale","invoices","duplicated"],"additionalProperties":true},"Product":{"type":"object","properties":{"id":{"type":"string"},"externalId":{"type":"string","description":"Id do produto no gateway (ex.: AbacatePay)"},"name":{"type":"string"},"serviceDescription":{"type":"string"},"defaultPriceCents":{"type":"integer","description":"Preço de referência em centavos"},"taxStatus":{"type":"string","enum":["CONFIRMED","PENDING_REVIEW"]},"active":{"type":"boolean"},"taxProfile":{"type":"object","additionalProperties":true}},"required":["id","name","taxStatus"],"additionalProperties":true},"Customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"taxId":{"type":"object"}},"required":["id"],"additionalProperties":true},"InvoicePage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"total":{"type":"integer","description":"Total de itens"},"page":{"type":"integer","description":"Página atual (começa em 1)"},"pageSize":{"type":"integer","description":"Itens por página"}},"required":["items","total","page","pageSize"],"additionalProperties":true},"ProductPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"total":{"type":"integer","description":"Total de itens"},"page":{"type":"integer","description":"Página atual (começa em 1)"},"pageSize":{"type":"integer","description":"Itens por página"}},"required":["items","total","page","pageSize"],"additionalProperties":true},"CustomerPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"total":{"type":"integer","description":"Total de itens"},"page":{"type":"integer","description":"Página atual (começa em 1)"},"pageSize":{"type":"integer","description":"Itens por página"}},"required":["items","total","page","pageSize"],"additionalProperties":true},"Pricing":{"type":"object","properties":{"pricePerInvoiceCents":{"type":"integer","description":"Preço por nota emitida, em centavos"},"currency":{"type":"string","enum":["BRL"]},"monthlyFeeCents":{"type":"integer","description":"Mensalidade em centavos (0)"},"graceDays":{"type":"integer","description":"Dias para pagar antes de pausar a emissão"}},"required":["pricePerInvoiceCents","currency"],"additionalProperties":true},"Coverage":{"type":"object","properties":{"cities":{"type":"array","items":{"type":"object","properties":{"cityCode":{"type":"string","description":"Código IBGE (7 dígitos)"},"cityName":{"type":"string"},"uf":{"type":"string"},"regimes":{"type":"array","items":{"type":"string"}}},"required":["cityCode","regimes"],"additionalProperties":true}}},"required":["cities"],"additionalProperties":true},"Health":{"type":"object","properties":{"status":{"type":"string"}},"required":[],"additionalProperties":true}}}}