Skip to main content

TaxId Validation

Get the information if the TaxId is valid or not.

POST https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx

Request

ParameterRequiredValue
Content-Typerequiredtext/xml

Body

TaxIdValidation

Authentication
ParameterRequiredDescription
Emailrequiredstring(50) The API user with specific permission to create documents and get information about your own documents into a company. Example: api@magnifinance.com
Tokenrequiredstring(50) The token of the subscription in which the document will be generated.
Request Parameters
ParameterRequiredDescription
TaxIdrequiredint Tax id of the partner organization that you want to validate. Example value: "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
Value - int Identifies the error with a number. To identify the types of errors in more detail, click here. Example value: "14"
Name - string Identifies the error with a token. Example value: "SaveFailed"

Request Sample

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

cURL

curl --location --request POST 'https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx' \
--header 'Content-Type: application/soap+xml; charset=utf-8' \
--data-raw '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/v1.1/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:TaxIdValidation>
<inv:Authentication>
<inv:Email>XXX</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:CountryCode>XX</inv:CountryCode>
<inv:TaxId>XXX</inv:TaxId>
</inv:TaxIdValidation>
</soapenv:Body>
</soapenv:Envelope>'

JavaScript (fetch)

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/soap+xml; charset=utf-8");

var raw = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/v1.1/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:TaxIdValidation>
<inv:Authentication>
<inv:Email>XXX</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:CountryCode>XX</inv:CountryCode>
<inv:TaxId>XXX</inv:TaxId>
</inv:TaxIdValidation>
</soapenv:Body>
</soapenv:Envelope>`;

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

NodeJs (axios)

var axios = require('axios');

var data = `<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/v1.1/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:TaxIdValidation>
<inv:Authentication>
<inv:Email>XXX</inv:Email>
<inv:Token>XXX</inv:Token>
</inv:Authentication>
<inv:CountryCode>XX</inv:CountryCode>
<inv:TaxId>XXX</inv:TaxId>
</inv:TaxIdValidation>
</soapenv:Body>
</soapenv:Envelope>`;

var config = {
method: 'post',
url: 'https://bo.magnifinance.com/MagniAPI/v1.1/Invoicing.asmx',
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
},
data : data
};

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

Example Response

Success

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TaxIdValidationResponse xmlns="http://MagniAPI/v1.1/Invoicing/">
<ResponseTaxIdValidation>
<RequestId>74146a14-63b9-4335-abf2-a7cc8a5cda03</RequestId>
<Type>Success</Type>
</ResponseTaxIdValidation>
</TaxIdValidationResponse>
</soap:Body>
</soap:Envelope>

Error

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TaxIdValidationResponse xmlns="http://MagniAPI/v1.1/Invoicing/">
<ResponseTaxIdValidation>
<RequestId>0b3ae75f-47dc-4f12-befd-89a1203e99fb</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>4</Value>
<Name>InvalidTaxId</Name>
</ErrorValue>
</ResponseTaxIdValidation>
</TaxIdValidationResponse>
</soap:Body>
</soap:Envelope>