Files
sowai-fiscal-svc/docs/openapi-v1.json
T
jonatanritterandClaude Opus 4.8 c2d2d30b70 feat(openapi): declare the full response contract (401/404/409/413) on every v1 route
Honors portability safeguard (c) -- the committed docs/openapi-v1.json was
enforced to stay in sync with app.openapi() (test_openapi_committed.py),
but the app declared almost no error responses: POST /v1/emissoes showed
only 200/422 (no 201), and no route declared 401/404/409/413 or the
structured 409 codes the spec names as contract. A Go reimplementation
reading only the committed OpenAPI as source of truth wouldn't learn them.

Adds responses={...} to every v1 router (emissao, certificados, series,
documentos GET/xml) covering the status codes each route actually returns
-- 201 as the default on POST /v1/emissoes (with 200 documented for the
Idempotency-Key replay case), 401 on every authenticated route, 404 where
the anti-oracle boundary applies, 409 naming the structured codes each
route raises, 413 on the certificate upload's size cap. Regenerated
docs/openapi-v1.json from app.openapi() (uv run python -c '...json.dump...'
per test_openapi_committed.py's own docstring) so the committed==generated
assertion stays green with FIX 1-4's new 409 codes included.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-08 15:36:58 -03:00

1932 lines
50 KiB
JSON

{
"components": {
"schemas": {
"Body_upload_certificate_endpoint_v1_certificados_post": {
"properties": {
"cnpj": {
"maxLength": 14,
"minLength": 14,
"title": "Cnpj",
"type": "string"
},
"file": {
"contentMediaType": "application/octet-stream",
"title": "File",
"type": "string"
},
"password": {
"title": "Password",
"type": "string"
}
},
"required": [
"cnpj",
"file",
"password"
],
"title": "Body_upload_certificate_endpoint_v1_certificados_post",
"type": "object"
},
"DestinatarioDataPayload": {
"description": "`None` no `EmissaoRequest.destinatario` == consumidor final n\u00e3o\nidentificado -- espelha `sowai_fiscal.xml_builder.DestinatarioData`.",
"properties": {
"address_city": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address City"
},
"address_city_ibge_code": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address City Ibge Code"
},
"address_complement": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address Complement"
},
"address_district": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address District"
},
"address_number": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address Number"
},
"address_state": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address State"
},
"address_street": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address Street"
},
"address_zip": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address Zip"
},
"cnpj": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Cnpj"
},
"cpf": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Cpf"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"ie": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Ie"
},
"indicador_ie": {
"title": "Indicador Ie",
"type": "string"
},
"nome": {
"title": "Nome",
"type": "string"
}
},
"required": [
"nome",
"indicador_ie"
],
"title": "DestinatarioDataPayload",
"type": "object"
},
"EmissaoRequest": {
"properties": {
"ambiente": {
"enum": [
"homologacao",
"producao"
],
"title": "Ambiente",
"type": "string"
},
"branch_ref": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
},
"destinatario": {
"anyOf": [
{
"$ref": "#/components/schemas/DestinatarioDataPayload"
},
{
"type": "null"
}
]
},
"document_model": {
"const": "55",
"default": "55",
"title": "Document Model",
"type": "string"
},
"emitente": {
"$ref": "#/components/schemas/EmitenteDataPayload"
},
"fin_nfe": {
"default": "1",
"maxLength": 1,
"minLength": 1,
"title": "Fin Nfe",
"type": "string"
},
"ind_final": {
"default": "1",
"maxLength": 1,
"minLength": 1,
"title": "Ind Final",
"type": "string"
},
"ind_pres": {
"default": "1",
"maxLength": 1,
"minLength": 1,
"title": "Ind Pres",
"type": "string"
},
"itens": {
"items": {
"$ref": "#/components/schemas/ItemDataPayload"
},
"minItems": 1,
"title": "Itens",
"type": "array"
},
"nat_op": {
"default": "Venda",
"title": "Nat Op",
"type": "string"
},
"pagamento": {
"$ref": "#/components/schemas/PagamentoDataPayload"
},
"serie": {
"minimum": 0.0,
"title": "Serie",
"type": "integer"
},
"tenant_ref": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
},
"tp_emis": {
"default": "1",
"maxLength": 1,
"minLength": 1,
"title": "Tp Emis",
"type": "string"
},
"uf_destino_tipo": {
"enum": [
"interna",
"interestadual"
],
"title": "Uf Destino Tipo",
"type": "string"
},
"ver_proc": {
"maxLength": 20,
"minLength": 1,
"title": "Ver Proc",
"type": "string"
}
},
"required": [
"tenant_ref",
"branch_ref",
"serie",
"emitente",
"itens",
"pagamento",
"ambiente",
"uf_destino_tipo",
"ver_proc"
],
"title": "EmissaoRequest",
"type": "object"
},
"EmitenteDataPayload": {
"properties": {
"address_city": {
"title": "Address City",
"type": "string"
},
"address_city_ibge_code": {
"title": "Address City Ibge Code",
"type": "string"
},
"address_complement": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Address Complement"
},
"address_district": {
"title": "Address District",
"type": "string"
},
"address_number": {
"title": "Address Number",
"type": "string"
},
"address_state": {
"maxLength": 2,
"minLength": 2,
"title": "Address State",
"type": "string"
},
"address_street": {
"title": "Address Street",
"type": "string"
},
"address_zip": {
"title": "Address Zip",
"type": "string"
},
"cnpj": {
"maxLength": 14,
"minLength": 14,
"title": "Cnpj",
"type": "string"
},
"crt": {
"maxLength": 1,
"minLength": 1,
"title": "Crt",
"type": "string"
},
"fone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Fone"
},
"ie": {
"title": "Ie",
"type": "string"
},
"nome_fantasia": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Nome Fantasia"
},
"razao_social": {
"title": "Razao Social",
"type": "string"
}
},
"required": [
"cnpj",
"razao_social",
"ie",
"crt",
"address_street",
"address_number",
"address_district",
"address_city",
"address_state",
"address_zip",
"address_city_ibge_code"
],
"title": "EmitenteDataPayload",
"type": "object"
},
"FiscalCertificateRead": {
"description": "Metadados do A1 -- NUNCA o bin\u00e1rio (`pfx_encrypted`/\n`password_encrypted` ficam de fora de prop\u00f3sito; ver\n`certificates.router.read_certificate_endpoint`'s docstring).",
"properties": {
"branch_ref": {
"title": "Branch Ref",
"type": "string"
},
"cnpj": {
"title": "Cnpj",
"type": "string"
},
"cnpj_certificado": {
"title": "Cnpj Certificado",
"type": "string"
},
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"not_valid_after": {
"format": "date-time",
"title": "Not Valid After",
"type": "string"
},
"not_valid_before": {
"format": "date-time",
"title": "Not Valid Before",
"type": "string"
},
"product_id": {
"format": "uuid",
"title": "Product Id",
"type": "string"
},
"subject_cn": {
"title": "Subject Cn",
"type": "string"
},
"tenant_ref": {
"title": "Tenant Ref",
"type": "string"
}
},
"required": [
"id",
"product_id",
"tenant_ref",
"branch_ref",
"cnpj",
"subject_cn",
"cnpj_certificado",
"not_valid_before",
"not_valid_after",
"created_at"
],
"title": "FiscalCertificateRead",
"type": "object"
},
"FiscalDocumentRead": {
"description": "NUNCA inclui `xml_assinado` -- o XML sai s\u00f3 por `GET /v1/documentos/\n{id}/xml` (`Response(media_type=\"application/xml\")`), mesmo racional de\n`FiscalCertificateRead` nunca incluir o bin\u00e1rio do certificado. Sem\n`sale_id`/`service_order_id` (porte table: este servi\u00e7o n\u00e3o conhece o\ndom\u00ednio do produto chamador).",
"properties": {
"ambiente": {
"title": "Ambiente",
"type": "string"
},
"autorizada_em": {
"anyOf": [
{
"format": "date-time",
"type": "string"
},
{
"type": "null"
}
],
"title": "Autorizada Em"
},
"branch_ref": {
"title": "Branch Ref",
"type": "string"
},
"chave_acesso": {
"title": "Chave Acesso",
"type": "string"
},
"codigo_numerico": {
"title": "Codigo Numerico",
"type": "string"
},
"created_at": {
"format": "date-time",
"title": "Created At",
"type": "string"
},
"document_model": {
"title": "Document Model",
"type": "string"
},
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"numero": {
"title": "Numero",
"type": "integer"
},
"product_id": {
"format": "uuid",
"title": "Product Id",
"type": "string"
},
"protocolo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Protocolo"
},
"rejeicao_codigo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Rejeicao Codigo"
},
"rejeicao_motivo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Rejeicao Motivo"
},
"serie": {
"title": "Serie",
"type": "integer"
},
"series_id": {
"format": "uuid",
"title": "Series Id",
"type": "string"
},
"status": {
"title": "Status",
"type": "string"
},
"tenant_ref": {
"title": "Tenant Ref",
"type": "string"
}
},
"required": [
"id",
"product_id",
"tenant_ref",
"branch_ref",
"series_id",
"document_model",
"serie",
"numero",
"chave_acesso",
"codigo_numerico",
"status",
"ambiente",
"rejeicao_codigo",
"rejeicao_motivo",
"protocolo",
"autorizada_em",
"created_at"
],
"title": "FiscalDocumentRead",
"type": "object"
},
"FiscalResultPayload": {
"properties": {
"cfop": {
"title": "Cfop",
"type": "string"
},
"consumidor_final": {
"title": "Consumidor Final",
"type": "boolean"
},
"csosn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Csosn"
},
"cst": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Cst"
},
"indicador_ie": {
"title": "Indicador Ie",
"type": "string"
},
"origem": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Origem"
},
"tributos": {
"items": {
"$ref": "#/components/schemas/TributoLinhaPayload"
},
"title": "Tributos",
"type": "array"
}
},
"required": [
"cfop",
"consumidor_final",
"indicador_ie"
],
"title": "FiscalResultPayload",
"type": "object"
},
"FiscalSeriesCreate": {
"description": "POST /v1/series body. `serie` allows `0` (SEFAZ convention for\n\"s\u00e9rie \u00fanica\"/sem s\u00e9rie formal) -- `ge=0`, unlike `next_number` which\nmust start at 1 (`ge=1`, a document numbering never starts at 0). Only\n`\"55\"` is accepted for now (Global Constraints/spec: F2 covers NF-e 55\nemission only -- `xml_builder.build_nfe` itself hardcodes `mod=\"55\"`;\naccepting `\"65\"` here would create a series nothing can ever allocate\nagainst without silently wrong output).",
"properties": {
"branch_ref": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
},
"document_model": {
"const": "55",
"default": "55",
"title": "Document Model",
"type": "string"
},
"next_number": {
"minimum": 1.0,
"title": "Next Number",
"type": "integer"
},
"serie": {
"minimum": 0.0,
"title": "Serie",
"type": "integer"
},
"tenant_ref": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
}
},
"required": [
"tenant_ref",
"branch_ref",
"serie",
"next_number"
],
"title": "FiscalSeriesCreate",
"type": "object"
},
"FiscalSeriesPatch": {
"additionalProperties": false,
"description": "PATCH /v1/series/{series_id} body -- ONLY `next_number` is editable\n(a manual correction, e.g. realigning the counter after a migration\nfrom another emissor). `tenant_ref`/`branch_ref`/`document_model`/\n`serie` are immutable once created -- delete and recreate the series\ninstead if it was set up wrong (no DELETE endpoint exists yet for this\nresource per the F2 API contract; ported convention documented here for\nwhen it does). `next_number` maps to a NOT NULL column, so explicit\n`null` is rejected with 422, same convention as the auto's\n`FiscalDocumentSeriesPatch`.",
"properties": {
"next_number": {
"anyOf": [
{
"minimum": 1.0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Next Number"
}
},
"title": "FiscalSeriesPatch",
"type": "object"
},
"FiscalSeriesRead": {
"properties": {
"branch_ref": {
"title": "Branch Ref",
"type": "string"
},
"document_model": {
"title": "Document Model",
"type": "string"
},
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"next_number": {
"title": "Next Number",
"type": "integer"
},
"product_id": {
"format": "uuid",
"title": "Product Id",
"type": "string"
},
"serie": {
"title": "Serie",
"type": "integer"
},
"tenant_ref": {
"title": "Tenant Ref",
"type": "string"
}
},
"required": [
"id",
"product_id",
"tenant_ref",
"branch_ref",
"document_model",
"serie",
"next_number"
],
"title": "FiscalSeriesRead",
"type": "object"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"title": "Detail",
"type": "array"
}
},
"title": "HTTPValidationError",
"type": "object"
},
"ItemDataPayload": {
"properties": {
"cest": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Cest"
},
"cfop": {
"title": "Cfop",
"type": "string"
},
"codigo": {
"title": "Codigo",
"type": "string"
},
"descricao": {
"title": "Descricao",
"type": "string"
},
"fiscal_result": {
"$ref": "#/components/schemas/FiscalResultPayload"
},
"gtin": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Gtin"
},
"ncm": {
"title": "Ncm",
"type": "string"
},
"peso_bruto_kg": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Peso Bruto Kg"
},
"peso_liquido_kg": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Peso Liquido Kg"
},
"quantidade": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Quantidade"
},
"unidade_comercial": {
"title": "Unidade Comercial",
"type": "string"
},
"unidade_tributavel": {
"title": "Unidade Tributavel",
"type": "string"
},
"valor_unitario": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Valor Unitario"
}
},
"required": [
"codigo",
"descricao",
"ncm",
"cfop",
"unidade_comercial",
"unidade_tributavel",
"quantidade",
"valor_unitario",
"fiscal_result"
],
"title": "ItemDataPayload",
"type": "object"
},
"PagamentoDataPayload": {
"properties": {
"indpag": {
"default": "0",
"title": "Indpag",
"type": "string"
},
"tpag": {
"title": "Tpag",
"type": "string"
},
"valor": {
"anyOf": [
{
"exclusiveMinimum": 0.0,
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Valor"
}
},
"required": [
"tpag",
"valor"
],
"title": "PagamentoDataPayload",
"type": "object"
},
"TributoLinhaPayload": {
"properties": {
"aliquota": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Aliquota"
},
"aliquota_st": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Aliquota St"
},
"base_calc": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Base Calc"
},
"base_calc_percent": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Base Calc Percent"
},
"codigo_beneficio": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Codigo Beneficio"
},
"csosn": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Csosn"
},
"cst": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Cst"
},
"fcp_percent": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Fcp Percent"
},
"mva": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Mva"
},
"rule_id": {
"format": "uuid",
"title": "Rule Id",
"type": "string"
},
"tax_domain": {
"title": "Tax Domain",
"type": "string"
},
"valor": {
"anyOf": [
{
"type": "number"
},
{
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"type": "string"
}
],
"title": "Valor"
}
},
"required": [
"tax_domain",
"base_calc",
"base_calc_percent",
"valor",
"rule_id"
],
"title": "TributoLinhaPayload",
"type": "object"
},
"ValidationError": {
"properties": {
"ctx": {
"title": "Context",
"type": "object"
},
"input": {
"title": "Input"
},
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"title": "Location",
"type": "array"
},
"msg": {
"title": "Message",
"type": "string"
},
"type": {
"title": "Error Type",
"type": "string"
}
},
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError",
"type": "object"
}
}
},
"info": {
"title": "sowai-fiscal-svc",
"version": "0.1.0"
},
"openapi": "3.1.0",
"paths": {
"/v1/certificados": {
"delete": {
"operationId": "deactivate_certificate_endpoint_v1_certificados_delete",
"parameters": [
{
"in": "query",
"name": "tenant_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
}
},
{
"in": "query",
"name": "branch_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"204": {
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"404": {
"description": "Nenhum certificado vivo para este (tenant_ref, branch_ref) -- anti-oracle"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Deactivate Certificate Endpoint",
"tags": [
"certificados"
]
},
"get": {
"description": "Metadados do certificado VIVO -- NUNCA o bin\u00e1rio (o .pfx/senha\ncifrados nunca saem do banco por esta rota; s\u00f3 `certificates.crypto.\nload_private_key_and_cert`, uso interno da emiss\u00e3o, Task 5, os\ndescriptografa, e s\u00f3 em mem\u00f3ria).",
"operationId": "read_certificate_endpoint_v1_certificados_get",
"parameters": [
{
"in": "query",
"name": "tenant_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
}
},
{
"in": "query",
"name": "branch_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalCertificateRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"404": {
"description": "Nenhum certificado vivo para este (tenant_ref, branch_ref) -- anti-oracle"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Read Certificate Endpoint",
"tags": [
"certificados"
]
},
"post": {
"operationId": "upload_certificate_endpoint_v1_certificados_post",
"parameters": [
{
"in": "query",
"name": "tenant_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
}
},
{
"in": "query",
"name": "branch_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_upload_certificate_endpoint_v1_certificados_post"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalCertificateRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"409": {
"description": "`detail.code`=`certificate_upload_conflict` -- upload concorrente venceu a corrida"
},
"413": {
"description": "Certificado excede o tamanho m\u00e1ximo permitido (262144 bytes)"
},
"422": {
"description": "PFX inv\u00e1lido/senha incorreta, CNPJ do certificado diverge do declarado, certificado vencido ou ainda n\u00e3o vigente"
}
},
"summary": "Upload Certificate Endpoint",
"tags": [
"certificados"
]
}
},
"/v1/documentos": {
"get": {
"operationId": "list_fiscal_documents_endpoint_v1_documentos_get",
"parameters": [
{
"in": "query",
"name": "tenant_ref",
"required": false,
"schema": {
"anyOf": [
{
"maxLength": 64,
"type": "string"
},
{
"type": "null"
}
],
"title": "Tenant Ref"
}
},
{
"in": "query",
"name": "branch_ref",
"required": false,
"schema": {
"anyOf": [
{
"maxLength": 64,
"type": "string"
},
{
"type": "null"
}
],
"title": "Branch Ref"
}
},
{
"in": "query",
"name": "status",
"required": false,
"schema": {
"anyOf": [
{
"maxLength": 20,
"type": "string"
},
{
"type": "null"
}
],
"title": "Status"
}
},
{
"in": "query",
"name": "limit",
"required": false,
"schema": {
"default": 50,
"maximum": 200,
"minimum": 1,
"title": "Limit",
"type": "integer"
}
},
{
"in": "query",
"name": "offset",
"required": false,
"schema": {
"default": 0,
"minimum": 0,
"title": "Offset",
"type": "integer"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/FiscalDocumentRead"
},
"title": "Response List Fiscal Documents Endpoint V1 Documentos Get",
"type": "array"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "List Fiscal Documents Endpoint",
"tags": [
"emissao"
]
}
},
"/v1/documentos/{document_id}": {
"get": {
"operationId": "get_fiscal_document_endpoint_v1_documentos__document_id__get",
"parameters": [
{
"in": "path",
"name": "document_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Document Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalDocumentRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"404": {
"description": "Documento fiscal n\u00e3o encontrado (ou de outro product/tenant -- anti-oracle)"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Fiscal Document Endpoint",
"tags": [
"emissao"
]
}
},
"/v1/documentos/{document_id}/xml": {
"get": {
"operationId": "get_fiscal_document_xml_endpoint_v1_documentos__document_id__xml_get",
"parameters": [
{
"in": "path",
"name": "document_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Document Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {}
},
"application/xml": {}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"404": {
"description": "Documento fiscal n\u00e3o encontrado (ou de outro product/tenant -- anti-oracle)"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Fiscal Document Xml Endpoint",
"tags": [
"emissao"
]
}
},
"/v1/emissoes": {
"post": {
"description": "`Idempotency-Key` OBRIGAT\u00d3RIO (design spec decis\u00e3o #6) -- ausente\nvira 422 na borda do FastAPI (`Header(...)`, sem default), antes de\nqualquer l\u00f3gica rodar. Repetida com a MESMA `product_id` -> 200 com o\ndocumento j\u00e1 existente (`created=False`); nova -> 201 (`created=True`).\nVer `emission.service.emitir_documento`'s docstring para o padr\u00e3o de\nduas camadas que garante isto mesmo sob duas requisi\u00e7\u00f5es concorrentes\ncom a mesma chave.",
"operationId": "emitir_documento_endpoint_v1_emissoes_post",
"parameters": [
{
"in": "header",
"name": "Idempotency-Key",
"required": true,
"schema": {
"maxLength": 255,
"minLength": 1,
"title": "Idempotency-Key",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EmissaoRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalDocumentRead"
}
}
},
"description": "Idempotency-Key repetida -- documento j\u00e1 emitido devolvido (replay, created=False)"
},
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalDocumentRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"409": {
"description": "Conflito estruturado -- `detail.code` identifica a causa: `fiscal_config_missing` (certificado/s\u00e9rie ausentes ou certificado vencido), `emitente_certificate_cnpj_mismatch` (CNPJ do emitente diverge do certificado da filial), `pagamento_total_diverge` (\u03a3 vPag \u2260 vNF), `fiscal_document_conflict` (colis\u00e3o de chave de acesso)."
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Emitir Documento Endpoint",
"tags": [
"emissao"
]
}
},
"/v1/health": {
"get": {
"operationId": "health_check_v1_health_get",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"additionalProperties": {
"type": "string"
},
"title": "Response Health Check V1 Health Get",
"type": "object"
}
}
},
"description": "Successful Response"
}
},
"summary": "Health Check"
}
},
"/v1/series": {
"get": {
"operationId": "list_fiscal_series_endpoint_v1_series_get",
"parameters": [
{
"in": "query",
"name": "tenant_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Tenant Ref",
"type": "string"
}
},
{
"in": "query",
"name": "branch_ref",
"required": true,
"schema": {
"maxLength": 64,
"title": "Branch Ref",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/FiscalSeriesRead"
},
"title": "Response List Fiscal Series Endpoint V1 Series Get",
"type": "array"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "List Fiscal Series Endpoint",
"tags": [
"series"
]
},
"post": {
"operationId": "create_fiscal_series_endpoint_v1_series_post",
"parameters": [
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalSeriesCreate"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalSeriesRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"409": {
"description": "`detail.code`=`duplicate_fiscal_series` -- j\u00e1 existe uma s\u00e9rie fiscal (live ou soft-deletada) para este (tenant_ref, branch_ref, document_model, serie)"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Create Fiscal Series Endpoint",
"tags": [
"series"
]
}
},
"/v1/series/{series_id}": {
"patch": {
"operationId": "update_fiscal_series_endpoint_v1_series__series_id__patch",
"parameters": [
{
"in": "path",
"name": "series_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Series Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Api-Key",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Api-Key"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalSeriesPatch"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FiscalSeriesRead"
}
}
},
"description": "Successful Response"
},
"401": {
"description": "API key ausente ou inv\u00e1lida"
},
"404": {
"description": "S\u00e9rie fiscal n\u00e3o encontrada (ou de outro product -- anti-oracle)"
},
"409": {
"description": "`detail.code`=`fiscal_series_number_regression`"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Update Fiscal Series Endpoint",
"tags": [
"series"
]
}
}
}
}