Validate a VAT Number in Python
When operating internationally with organizations outside of your country of origin, you must be able to access important information that is dependent on location such as their VAT number. The following API will check if a VAT code is valid, instantly. Possible country codes for VAT numbers include Austria (AT), Belgium (BE), Bulgaria (BG), Cyprus (CY), Czech Republic (CZ), Germany (DE), Denmark (DK), Estonia (EE), Greece (EL), Spain (ES), Finland (FI), France (FR), United Kingdom (GB), Croatia (HR), Hungary (HU), Ireland (IE), Italy (IT), Lithuania (LT), Luxembourg (LU), Latvia (LV), Malta (MT), The Netherlands (NL), Poland (PL), Portugal (PT), Romania (RO), Sweden (SE), Slovenia (SI), Slovakia (SK).
Run this command to install the SDK:
pip install cloudmersive-validate-api-client
Then, you can call the function:
from __future__ import print_function
import time
import cloudmersive_validate_api_client
from cloudmersive_validate_api_client.rest import ApiException
from pprint import pprint# Configure API key authorization: Apikey
configuration = cloudmersive_validate_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'# create an instance of the API class
api_instance = cloudmersive_validate_api_client.VatApi(cloudmersive_validate_api_client.ApiClient(configuration))
input = cloudmersive_validate_api_client.VatLookupRequest() # VatLookupRequest | Input VAT codetry:
# Validate a VAT number
api_response = api_instance.vat_vat_lookup(input)
pprint(api_response)
except ApiException as e:
print("Exception when calling VatApi->vat_vat_lookup: %s\n" % e)
This will return the country code, VAT number, whether the VAT is valid, and the business name and address including the building in which the business is located. You can retrieve the API Key from the Cloudmersive website at no cost and with no commitment. This will provide you with 800 monthly calls across our library of APIs.