# Validation Failed The request is well-formed but contains invalid data or violates business rules. Check the `errors` array for details on each invalid field. **HTTP Status:** `422 Unprocessable Entity` ## Error Codes | Code | Description | | --- | --- | | `missing_required_field` | A required field is missing | | `invalid_cpf` | The CPF number is not valid | | `invalid_cnpj` | The CNPJ number is not valid | | `kyc_incomplete` | Customer KYC is not complete (cannot create loan) | | `offer_expired` | The credit offer has expired | | `simulation_mismatch` | Loan parameters do not match the simulation | | `amount_out_of_range` | Requested amount is outside the allowed range | ## Example Response ```json { "type": "https://api.dinie.com.br/errors/missing_required_field", "title": "Validation Error", "status": 422, "detail": "One or more required fields are missing.", "code": "missing_required_field", "errors": [ { "code": "missing_required_field", "param": "cpf", "detail": "The cpf field is required." } ] } ``` ## How to Resolve - **`missing_required_field`** -- Check the `errors` array for which fields are missing and include them. - **`invalid_cpf` / `invalid_cnpj`** -- Validate the document number locally before sending. CPF has 11 digits; CNPJ has 14. - **`kyc_incomplete`** -- Ensure the customer has completed all required KYC steps before creating a loan. - **`offer_expired`** -- Request a fresh credit offer. Offers have a limited validity window. - **`simulation_mismatch`** -- The loan amount, term, or other parameters must match the simulation exactly. - **`amount_out_of_range`** -- Check the offer's `min_amount` and `max_amount` and adjust your request. ## See Also - [Error Handling guide](/apis/concepts/errors) -- Full error handling patterns and code examples