After some searching, I haven't been able to find a definite answer.
If I am given a zip code like 11111, it is technically a valid zip code but it doesn't exist. Is there a way to check this? The same goes for a postal code like a1a a1a (valid but not real).
For United States zipcodes:
You can purchase / download databases of zip codes, which you can use in your local app.
Google for
Here is one that you can use for free for non-commercial purposes (for commercial purposes you can purchase a cheap license):
http://www.unitedstateszipcodes.org/zip-code-database/
There are some providers which allow you to perform remote HTTP calls, search around