DTOs decouple API representation from the database schema.
Using DTOs helps maintain a clear separation between how data is stored in the database and how it's represented in the API. This allows flexibility in API design without impacting database structure. For example, if your e-commerce project stores customer orders in a complex entity, a DTO can represent a simplified version for API responses.
Additional Notes
Why do teams use DTOs in Spring Boot in production code?