Skip to main content

Get a Document

Retrieves a document PDF download URL. Only applicable to documents in closed/canceled state.

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

Sample Body

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentGet>
<inv:Authentication>
<inv:Email></inv:Email>
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentGet>
</soap:Body>
</soap:Envelope>

Request

ParameterRequiredValue
Content-Typerequiredtext/xml

DocumentGet

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.

Parameters

ParameterRequiredDescription
DocumentIdrequiredint Id of the document that you want to retrieve. Example value: "67053"

Response

ParameterDescription
Typestring Description to inform if the request was a success or error. Example value: "Success"
ObjectDocumentGetOut
DocumentNumberstring The document's sequence number in the series. Example value: "FT FT/47"
DownloadUrlstring The URL to download the document PDF. Example value: "https://magnifilesdev.s3.eu-west-1.amazonaws.com/..."
ErrorMessagestring Unprocessed error message.
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"

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/Invoicing.asmx' \
--header 'Content-Type: text/xml' \
--header 'Cookie: ARRAffinity=; ARRAffinitySameSite=' \
--data-raw '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentGet>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentGet>
</soap:Body>
</soap:Envelope>'

JavaScript (fetch)

var myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
myHeaders.append("Cookie", "ARRAffinity=; ARRAffinitySameSite=");

var raw = `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentGet>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentGet>
</soap:Body>
</soap:Envelope>`;

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

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

Node.js (axios)

var axios = require('axios');

var data = `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:inv="http://MagniAPI/Invoicing/">
<soap:Header/>
<soap:Body>
<inv:DocumentGet>
<!--Optional:-->
<inv:Authentication>
<!--Optional:-->
<inv:Email></inv:Email>
<!--Optional:-->
<inv:Token></inv:Token>
</inv:Authentication>
<inv:DocumentId>67267</inv:DocumentId>
</inv:DocumentGet>
</soap:Body>
</soap:Envelope>`;

var config = {
method: 'post',
url: 'https://bo.magnifinance.com/MagniAPI/Invoicing.asmx',
headers: {
'Content-Type': 'text/xml',
'Cookie': 'ARRAffinity=; ARRAffinitySameSite='
},
data: data
};

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

Example Response

Success

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetResponse xmlns="http://MagniAPI/Invoicing/">
<Response>
<RequestId>993d5c2c-6082-4f43-b786-d186a80c5d65</RequestId>
<Type>Success</Type>
<Object>
<DocumentNumber>FT FT/21</DocumentNumber>
<DownloadUrl>https://magnifilesdev.s3.eu-west-1.amazonaws.com/18471/2022/1da38787-a2ae-4c1e-aeb9-2d3630b28d55.pdf?X-Amz-Expires=7200&amp;response-cache-control=No-cache&amp;response-content-disposition=attachment%3B%20filename%3DFTFT_21_companySprint47APItest_2022-04-04_EUR2%252c96.pdf&amp;X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAJ3INGX4GEGE7JUSA/20220405/eu-west-1/s3/aws4_request&amp;X-Amz-Date=20220405T135243Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Signature=ac9b992e01c275d3555949f4f6d89d4098290c9eacd774d86ccb15ead0158114</DownloadUrl>
</Object>
</Response>
</DocumentGetResponse>
</soap:Body>
</soap:Envelope>

Error

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DocumentGetResponse xmlns="http://MagniAPI/Invoicing/">
<Response>
<RequestId>36f6b1fe-376c-4ce9-812e-0bb6e834dd69</RequestId>
<Type>Error</Type>
<ErrorValue>
<Value>6</Value>
<Name>ElementDoesNotExist</Name>
</ErrorValue>
</Response>
</DocumentGetResponse>
</soap:Body>
</soap:Envelope>