{"openapi":"3.0.1","info":{"title":"Caixa Ideal API","description":"API de cartonização 3D para e-commerce brasileiro. Calcule a caixa ideal para qualquer conjunto de produtos em milissegundos.","contact":{"name":"Caixa Ideal","email":"suporte@caixaideal.com.br"},"license":{"name":"Proprietário"},"version":"v1.0"},"servers":[{"url":"https://api.caixaideal.com.br","description":"Produção"},{"url":"http://localhost:8080","description":"Local"}],"security":[{"ApiKey":[]},{"BearerJWT":[]}],"paths":{"/api/webhook/mercadopago":{"post":{"tags":["webhook-controller"],"operationId":"mercadoPago","parameters":[{"name":"x-signature","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string"}}},"required":true},"responses":{"200":{"description":"OK"}}}},"/api/webhook/asaas":{"post":{"tags":["webhook-controller"],"operationId":"asaas","parameters":[{"name":"asaas-access-token","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string"}}},"required":true},"responses":{"200":{"description":"OK"}}}},"/api/v1/embalagem/sugerir":{"post":{"tags":["embalagem-controller"],"operationId":"sugerir","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SugerirRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/SugerirResponse"}}}}}}},"/api/v1/embalagem/confirmar":{"post":{"tags":["embalagem-controller"],"operationId":"confirmar","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmarRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ConfirmarResponse"}}}}}}},"/api/playground/sugerir":{"post":{"tags":["playground-controller"],"operationId":"sugerir_1","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaygroundRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},"/api/me/simulador/sugerir":{"post":{"tags":["simulador-controller"],"summary":"Roda o solver para o tenant logado (cobra créditos como a API pública)","operationId":"sugerir_2","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SugerirRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/SugerirResponse"}}}}}}},"/api/me/billing/recarga/iniciar":{"post":{"tags":["billing-controller"],"operationId":"iniciarRecarga","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecargarRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CheckoutResult"}}}}}}},"/api/me/api-keys":{"get":{"tags":["api-key-controller"],"operationId":"list","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyResponse"}}}}}}},"post":{"tags":["api-key-controller"],"operationId":"create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiKeyResponse"}}}}}}},"/api/auth/refresh":{"post":{"tags":["auth-controller"],"operationId":"refresh","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}}}}},"/api/auth/login":{"post":{"tags":["auth-controller"],"operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}}}}},"/api/auth/cadastro":{"post":{"tags":["auth-controller"],"operationId":"cadastro","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}}}}}},"/api/v1/embalagem/saldo":{"get":{"tags":["embalagem-controller"],"operationId":"saldo","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},"/api/planos":{"get":{"tags":["plano-publico-controller"],"summary":"Planos ativos, do mais barato ao mais caro","operationId":"listar","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"type":"object"}}}}}}},"security":[]}},"/api/me/dashboard/timeline":{"get":{"tags":["dashboard-controller"],"operationId":"timeline","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":7}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"type":"object"}}}}}}}}},"/api/me/dashboard/stats":{"get":{"tags":["dashboard-controller"],"operationId":"stats","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"object"}}}}}}}},"/api/me/dashboard/requests":{"get":{"tags":["dashboard-controller"],"operationId":"requests","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":20}},{"name":"apiKeyId","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"type":"object"}}}}}}}}},"/api/me/dashboard/distribution":{"get":{"tags":["dashboard-controller"],"operationId":"distribution","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"type":"object","additionalProperties":{"type":"object"}}}}}}}}},"/api/me/billing/transacoes":{"get":{"tags":["billing-controller"],"operationId":"transacoes","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":20}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}}}}},"/api/me/billing/saldo":{"get":{"tags":["billing-controller"],"operationId":"saldo_1","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"object"}}}}}}}},"/api/mapa/{token}":{"get":{"tags":["mapa-controller"],"summary":"Plano de empacotamento de um pedido, por token público","operationId":"buscar","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"object"}}}}}},"security":[]}},"/api/auth/verificar-email/{token}":{"get":{"tags":["auth-controller"],"operationId":"verificarEmail","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}},"/api/me/api-keys/{id}":{"delete":{"tags":["api-key-controller"],"operationId":"revoke","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}}},"components":{"schemas":{"CaixaDto":{"required":["altura","largura","profundidade"],"type":"object","properties":{"id":{"type":"string"},"nome":{"type":"string"},"largura":{"type":"integer","format":"int32"},"altura":{"type":"integer","format":"int32"},"profundidade":{"type":"integer","format":"int32"},"peso_max_g":{"type":"integer","format":"int32"}}},"ItemDto":{"required":["altura","largura","profundidade","quantidade"],"type":"object","properties":{"id":{"type":"string"},"descricao":{"type":"string"},"largura":{"type":"integer","format":"int32"},"altura":{"type":"integer","format":"int32"},"profundidade":{"type":"integer","format":"int32"},"pesoGramas":{"type":"integer","format":"int32"},"quantidade":{"type":"integer","format":"int32"}}},"SugerirRequest":{"required":["caixas","itens"],"type":"object","properties":{"pedido_id":{"type":"string"},"estrategia":{"type":"string","enum":["CAIXA_UNICA","MENOR_VOLUME_TOTAL"]},"caixas":{"type":"array","items":{"$ref":"#/components/schemas/CaixaDto"}},"itens":{"type":"array","items":{"$ref":"#/components/schemas/ItemDto"}}}},"CaixaDoPlano":{"type":"object","properties":{"caixa":{"$ref":"#/components/schemas/CaixaSugerida"},"itens_posicionados":{"type":"array","items":{"$ref":"#/components/schemas/ItemPosicionado"}}}},"CaixaSugerida":{"type":"object","properties":{"id":{"type":"string"},"nome":{"type":"string"},"largura":{"type":"integer","format":"int32"},"altura":{"type":"integer","format":"int32"},"profundidade":{"type":"integer","format":"int32"},"aproveitamento":{"type":"number","format":"double"}}},"ItemPosicionado":{"type":"object","properties":{"id":{"type":"string"},"x":{"type":"integer","format":"int32"},"y":{"type":"integer","format":"int32"},"z":{"type":"integer","format":"int32"},"largura":{"type":"integer","format":"int32"},"altura":{"type":"integer","format":"int32"},"profundidade":{"type":"integer","format":"int32"}}},"SugerirResponse":{"type":"object","properties":{"pedido_id":{"type":"string"},"caixa_sugerida":{"$ref":"#/components/schemas/CaixaSugerida"},"itens_posicionados":{"type":"array","items":{"$ref":"#/components/schemas/ItemPosicionado"}},"caixas_sugeridas":{"type":"array","items":{"$ref":"#/components/schemas/CaixaDoPlano"}},"solver":{"type":"string"},"tempo_ms":{"type":"integer","format":"int64"},"creditos":{"type":"number","format":"double"},"cache_hit":{"type":"boolean"},"saldo_restante":{"type":"number","format":"double"},"mapa_embalagem":{"type":"string"}}},"ConfirmarRequest":{"required":["caixas_usadas","pedido_id"],"type":"object","properties":{"pedido_id":{"type":"string"},"caixas_usadas":{"type":"array","items":{"type":"string"}},"observacao":{"type":"string"}}},"ConfirmarResponse":{"type":"object","properties":{"pedido_id":{"type":"string"},"status":{"type":"string"},"historico_atualizado":{"type":"boolean"}}},"ItemRequest":{"type":"object","properties":{"largura":{"maximum":2000,"minimum":1,"type":"integer","format":"int32"},"altura":{"maximum":2000,"minimum":1,"type":"integer","format":"int32"},"profundidade":{"maximum":2000,"minimum":1,"type":"integer","format":"int32"},"quantidade":{"maximum":99,"minimum":1,"type":"integer","format":"int32"}}},"PlaygroundRequest":{"required":["itens"],"type":"object","properties":{"itens":{"maxItems":10,"minItems":0,"type":"array","items":{"$ref":"#/components/schemas/ItemRequest"}}}},"RecargarRequest":{"required":["pacoteCodigo"],"type":"object","properties":{"pacoteCodigo":{"type":"string"},"valor":{"type":"number"},"creditos":{"type":"integer","format":"int32"}}},"CheckoutResult":{"type":"object","properties":{"transacaoId":{"type":"string","format":"uuid"},"pixQrCode":{"type":"string"},"pixCopiaECola":{"type":"string"},"checkoutUrl":{"type":"string"},"expiresInSeconds":{"type":"integer","format":"int64"}}},"CreateKeyRequest":{"required":["nome"],"type":"object","properties":{"nome":{"type":"string"},"ambiente":{"type":"string"}}},"ApiKeyResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"nome":{"type":"string"},"chave_publica":{"type":"string"},"chave_completa":{"type":"string"},"ultimo_uso":{"type":"string","format":"date-time"},"ativo":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"RefreshRequest":{"required":["refresh_token"],"type":"object","properties":{"refresh_token":{"type":"string"}}},"AuthResponse":{"type":"object","properties":{"access_token":{"type":"string"},"refresh_token":{"type":"string"},"token_type":{"type":"string"},"expires_in":{"type":"integer","format":"int64"},"email_verificado":{"type":"boolean"},"plano":{"type":"string"},"saldo":{"type":"number","format":"double"}}},"LoginRequest":{"required":["email","senha"],"type":"object","properties":{"email":{"type":"string"},"senha":{"type":"string"}}},"SignupRequest":{"required":["documento","email","nome","senha","tipoPessoa"],"type":"object","properties":{"nome":{"type":"string"},"email":{"type":"string"},"senha":{"maxLength":2147483647,"minLength":8,"type":"string"},"documento":{"type":"string"},"tipoPessoa":{"type":"string"},"nomeFantasia":{"type":"string"}}}},"securitySchemes":{"ApiKey":{"type":"apiKey","description":"Chave de API no formato ibx_{live|test}_{prefix}.{secret}","name":"X-API-Key","in":"header"},"BearerJWT":{"type":"http","description":"JWT para rotas do dashboard (/api/me/*)","scheme":"bearer","bearerFormat":"JWT"}}}}