What is the best way to validate and return data through an API?

When I use an API, I employ ts-node and axios without any libraries. I always inform GPT in the prompt about the desired data and the expected data format for the response. For example:

Return 
```json
{"items":
  [
    {
    "1": "City",
    "2": "City",
    "3": "City",
    "4": "City", 
    ...
    }
  ]
} 

Out of 10,000 requests, 20% of them are incorrect, and I have to repeat them. I validate the returned response using the Joi library.

Perhaps it would be better to validate the data at the prompt submission level. Is it too much that 20% of the data is not validated?