This API is available on GitHub. Currently using standard Portuguese numbers, but you can customize and also use with international codes or even create an API for mass shipping.
BSD-3 license (https://opensource.org/licenses/BSD-3-Clause)