The EUVATAPI API is a JSON REST API which provides EU VAT number validation, EU VAT rates based on IP address, country code or user geolocation and calculated prices including EU VAT.
API requests are made using a friendly URL structure and results are returned in JSON format, providing a simple integration and full compatibility with any application, programming language or framework.
This API documentation explains all the parameters and features with integration examples and code examples for PHP and Curl.
https://euvatapi.com/api/v1/
After signing up, you will receive an API access key to access any of the API endpoints.
To authenticate with the API, you must provide your API access key in the access_key
parameter of the API endpoint URL:
All API data is returned in an easily parsable JSON format.
Below is an example response using the validate endpoint to validate a VAT number.
{
"success": true,
"valid": true,
"format_valid": true,
"database": "ok",
"query": "LU26375245",
"country_code": "LU",
"vat_number": "26375245",
"company_name": "AMAZON EUROPE CORE S.A R.L.",
"company_address": "5, RUE PLAETIS L-2338 LUXEMBOURG"
}
If your request fails, the API will return a 3-digit error-code along with an internal error type and a plain text "info" parameter containing suggestions for the user.
Below is an example error caused by providing an invalid API Access Key.
{
"success": false,
"error": {
"code": 102,
"type": "invalid_access_key",
"info": "You supplied an invalid Access Key."
}
}
Code | Type | Description |
---|---|---|
101 | missing_access_key | You did not supply an Access Key. |
102 | invalid_access_key | You supplied an invalid Access Key. |
104 | usage_limit_reached | You have reached your subscription plan's monthly API request allowance. |
106 | invalid_callback_function_name | You have not supplied a valid callback function name. |
210 | no_vat_number_supplied | You did not provide a VAT Number. |
310 | no_country_code_or_ip_supplied | You did not provide a Country Code or IP Address. |
311 | both_country_code_and_ip_supplied | You provided both Country Code and IP Address. Only one of the two can be used. |
410 | invalid_ip_address | You have provided an invalid IP Address. |
411 | could_not_resolve_ip | The IP Address you specified could not be resolved. Please try again or contact support. |
404 | 404_not_found | The requested API resource does not exist. |
405 | method_not_allowed | Method not allowed. Supported methods: GET, POST. |
510 | invalid_country_code | You have specified an invalid Country Code. |
609 | missing_amount_key | You have not provided an amount value. |
610 | invalid_amount | You provided an invalid amount value. |
500 | server_error | Something went wrong - Internal server error. |
Please Note: This is not a complete list of errors. If you come receive an error message you are not sure about please contact our support.
The API also supports JSONP callbacks so you can use the service in javascript.
To specify the javascript function to be called, provide the callback=
parameter to any of the endpoints.
Not sure what JSONP is? Here's an explanation Stack Overflow.
// Set the endpoint and the callback function name
var endpoint = 'https://euvatapi.com/api/v1/validate?vat_number=LU26375245&access_key=YOUR_ACCESS_KEY&callback=my_callback_function';
// Define the callback function
function my_callback_function(json){
//log to the console
console.log('json', json);
// Alert the result object properties
alert(json.valid);
alert(json.query);
alert(json.company_name);
alert(json.company_address);
}
// Validate VAT number via jQuery AJAX call with JSONP callback
$.ajax(
url: endpoint,
dataType: 'jsonp',
jsonpCallback: 'my_callback_function',
jsonp: 'callback',
});
my_callback_function({
{
"valid": true,
"format_valid": true,
"database": "ok",
"query": "LU26375245",
"country_code": "LU",
"vat_number": "26375245",
"company_name": "AMAZON EUROPE CORE S.A R.L.",
"company_address": "5, RUE PLAETIS L-2338 LUXEMBOURG"
}
})
You can perform VAT number validations and company information lookups using the API's validate
endpoint.
Simply specify the vat_number
you would like to validate and append it to the API request URL.
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
valid
boolean
Contains true
if the VAT number you provided could be successfully validated, false
if not.
format_valid
boolean
Contains true
if the syntax/format of the VAT number you provided is valid, false
if not.
database
string
Contains ok
if the EU member state's VAT database is currently able to process the VAT number validation, failure
if not.
query
stringReturns the VAT number provided.
country_code
stringThe 2-letter country code used to validate the VAT number.
vat_number
stringThe VAT number without the 2-letter country code prefix (if provided).
company_name
stringThe name of the company the VAT number is assigned to (if available).
company_address
stringThe address of the company the VAT number is assigned to (if available).
Since each EU Member State is required to keep its VAT number database information current and correct, regular database updates (which can result in temporary downtime of the respective member state's database) are performed.
To ensure that the requested VAT number can be matched in the relevant member state's database when the API request is made, the API returns an additional database
JSON property containing "ok"
if the required database is available, and "failure"
, if not.
If a connection to the member state's database could not be established and therefore the database
property returns "failure"
, the API's valid
object will automatically return false
.
valid
property.
{
[...]
"valid": false,
"database": "ok",
[...]
}
valid false and database "ok" - The VAT number is not valid
{
"valid": false,
"database": "failure",
[...]
}
valid false and database "failure" - The validation must be retried later as the VAT number has not been checked
Using the API's rate
endpoint, you may request VAT rates for an EU country of your choice.
country_code
parameter to the request URL.
0
.
success
booleanWhether the call has resulted in a successful response.
country_code
stringThe 2-letter country code.
country_name
stringContains the full country name.
standard_rate
floatContains percentage standard VAT rate used by the country code.
other_rates
objectContains an array of "other rate" objects and/or empty array if the country has only a standard rate.
rate
floatContains percentage VAT rate used for the described products or services.
class
string
The class of the VAT rate. This can be "reduced"
, "higher"
, "exempt"
or "zero"
.
description
stringContains a text description to clarify which products or services the rate is applied to.
To identify the relevant country by geolocating an IP address simply append the ip_address
query parameter.
0
.
Additionally to EU VAT rates via the country_code
and ip_address
parameters, you may also request the API to identify the country by geolocating the IP address making the request.
To have the API use the client's IP address to identify the county required, simply set the requests use_client_ip
parameter to 1
.
// Set the endpoint and use_client_ip = 1
var endpoint = 'https://euvatapi.com/api/v1/rate?access_key=YOUR_ACCESS_KEY&use_client_ip=1';
// get the VAT rates via jQuery AJAX
$.get(endpoint, function(result){
// log to the console
console.log('result', result);
// Alert the validation result object properties
alert(json.country_code);
alert(json.country_name);
alert(json.standard_rate);
});
{
"success": true,
"country_code": "DE",
"country_name": "Germany",
"standard_rate": 19,
"other_rates": [
{
"rate": 7,
"class": "reduced",
"description": "Some foodstuffs; water supplies (excluding bottled water); medical equipment for disabled persons; some domestic passenger transport; intra-community and international passenger transport for certain road, rail and inland waterway transportation; books (excluding books whose content is harmful to minors); e-books; audiobooks; newspapers and periodicals (except those containing content harmful to minors and\/or more than 50% advertising); admission to cultural events; writers and composers; some agricultural inputs; hotel accommodation (only short-term accommodation); certain admission to sports events; social services; medical and dental care; firewood; some timber for industrial use; take away food; cut flowers and plants for decorative use and food production; taxation of some gold coins and jewellery",
},
...
]
}
Using the API's rate_list
endpoint, you may also request VAT rates for all EU member states at once.
Using the API's price
endpoint, you may request the API to calculate VAT compliant prices using the countries standard rate. This API endpoint requires two query parameters which are explained below:
You need to specify the amount
you would like to use for your VAT price calculation as an integer:
As already mentioned above, three different parameters can be used to identify the country and obtain the required VAT rates. Choose only one of the following:
The API response will confirm the country you provided by returning both country_code
and country_name
properties. The amount
you entered will be returned as price_excl_vat
, and the VAT compliant price will be contained in the price_incl_vat
property. Additionally, the API will return a vat_rate
property showing the EU VAT rate used for the calculation.