Skip to main content

TaxId Validation

Get the information if the TaxId is valid or not.

GET https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}

Request

ParameterRequiredValue
Emailrequiredstring(50) The email address of the owner of the IPPN service with specific permissions to use IPPN services. Example: api@example.com
TokenrequiredThe token for the IPPN account is specific to your IPPN service and is provided by our commercial team.
note

*These parameters must be HTTP headers within the request.

Query

ParameterRequiredDescription
taxIdrequiredint Tax id of the partner organization that you want to validate. Example value: "599138645". In the REST API you should request as a query string parameter in the URL. Example: ?TaxId=599138645
CountryCoderequiredstring(2) Client country (To consult the code list for each country, access the link: ISO 3166-1 alpha-2). Example value: "PT"

Response

ParameterDescription
RequestIdUnique Id for the request to have a way to identify the request
Typeint 0 = Success; 1 = Error; "Success" or "Error". Object will be returned on Success; ErrorValue, ErrorHumanReadable, ValidationErrors will be returned on Error. Example value: "0"
ErrorValueMagniEnum
- Valueint Identifies the error with a number. To identify the types of errors in more detail, click here. Example value: "14"
- Namestring Identifies the error with a token. Example value: "SaveFailed"
ErrorHumanReadablestring Text that explains the error found. Example value: "ValidationError"
ValidationErrorsList of ValidationError
- Typestring Identifies the error with a token. Example value: "DocumentIsADuplicate"
- Fieldstring Name of the field in which validation failed. Example value: "DocumentDetailExternalId"
- Valuestring Value which failed validation. Example value: "6"
- ElementNumberstring Identifies index of the field in which validation failed. Example value: "67204"
- Detailstring Detailed error explanation. Example value: "Duplicate Document"
IsErrorboolean Whether the request failed or not. Example value: "false"
IsSuccessboolean Whether the request succeeded or not. Example value: "true"

Request Sample

Below you can check some examples of the REST request in some technologies.

cURL

curl --location --request GET 'https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}' \
--header 'email: XXX@example.com' \
--header 'token: XXX'

Javascript (fetch)

var myHeaders = new Headers();
myHeaders.append("email", "XXX@example.com");
myHeaders.append("token", "XXX");

var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};

fetch("https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

NodeJs (axios)

var axios = require('axios');

var config = {
method: 'get',
url: 'https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}',
headers: {
'email': 'XXX@example.com',
'token': 'XXX'
}
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

Python (requests)

import requests

url = "https://bo.magnifinance.com/api/v1.1/taxIdValidation"
headers = {
"email": "XXX@example.com",
"token": "XXX"
}
params = {
"countryCode": "{countryCode}",
"taxId": "{taxId}"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

PHP (cURL)

<?php
$countryCode = "{countryCode}";
$taxId = "{taxId}";
$ch = curl_init("https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode=" . $countryCode . "&taxId=" . $taxId);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"email: XXX@example.com",
"token: XXX"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

C# (HttpClient)

using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("email", "XXX@example.com");
client.DefaultRequestHeaders.Add("token", "XXX");

var response = await client.GetAsync("https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}");
Console.WriteLine(await response.Content.ReadAsStringAsync());

Java (HttpClient)

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://bo.magnifinance.com/api/v1.1/taxIdValidation?countryCode={countryCode}&taxId={taxId}"))
.header("email", "XXX@example.com")
.header("token", "XXX")
.GET()
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Example Response

Success

{
"RequestId": "65d21065-115c-4766-964e-d31412e37461",
"Type": 0,
"ErrorValue": null,
"ErrorHumanReadable": null,
"ValidationErrors": null,
"IsSuccess": true,
"IsError": false
}

Error

{
"RequestId": "7869d1d8-599c-451f-add5-f2f7d1c565a9",
"Type": 1,
"ErrorValue": {
"Value": 4,
"Name": "InvalidTaxId"
},
"ErrorHumanReadable": null,
"ValidationErrors": null,
"IsSuccess": false,
"IsError": true
}