API documentation Menu
            
                
                    
                    
GET https://bo.magnifinance.com/api/v1.1/document?documentId={DocumentId}
                
                
                    
                        
                    
                
                
                
                    
                        
                    
                
                
                
                    
                        
API 2.1
Get a Document
Finalizes and retrieves a document by allocating a DocumentNumber and DownloadUrl. After DocumentCreate is successfully completed, DocumentGet should wait at least 10 seconds before it is called.
GET https://bo.magnifinance.com/api/v1.1/document?documentId={DocumentId}
Request
Header
| Parameter | Required | Value | 
|---|---|---|
| required | string(50) The API user with specific permission to create documents and get information about your own documents into a company Example: api@magnifinance.com | |
| Token | required | The token of the subscription in which the document will be generated. | 
*These parameters must be an HTTP headers within the request.
Query
| Parameter | Required | Description | 
|---|---|---|
| DocumentId | required | int Id of the document that you want to retrieve. Example value: "67053" In the REST API you should request as a query string parameter in the URL. Example: ?documentId=47257 | 
Response
| Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Type | int 0 = Success; 1 = Error; “Success” or “Error”. Object will be returned on Success; ErrorValue, ErrorHumanReadable, ValidationErrors will be returned on Error. Example value: Example value: "0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Object | DocumentGetOut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
                                
 
 Type | 
                                        
                                            int    0 = Success; 1 = Error; “Success” or “Error”. Object will be returned on Success; ErrorValue, ErrorHumanReadable, ValidationErrors will be returned on Error. Example value:  Example value: "0"
                                         | 
                                    ErrorValue | 
                                        
                                             MagniEnum
                                         | 
                                    
                                         | 
                                             | 
                                    
 ErrorHumanReadable | 
                                        
                                            string Text that explains the error found. Example value: "ValidationError"
                                         | 
                                    ValidationErrors | 
                                        
                                            List of ValidationError
                                         | 
                                    
                                         | 
                                             | 
                                    
 IsError | 
                                        
                                            boolean  Whether the request failed or not.  Example value: "false"
                                         | 
                                    IsSuccess | 
                                        
                                            boolean  Whether the request succeeded or not. Example value: "true"
                                         | 
                                    Request SampleBelow you can check some examples of the REST request in some technologies. cURL
                        curl --location --request GET 'https://bo.magnifinance.com/api/v1.1/document?documentId={DOCUMENTID}' \
                        --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 raw = "";
                        var requestOptions = {
                        method: 'GET',
                        headers: myHeaders,
                        body: raw,
                        redirect: 'follow'
                        };
                        fetch("https://bo.magnifinance.com/api/v1.1/document?documentId={DOCUMENTID}", requestOptions)
                        .then(response => response.text())
                        .then(result => console.log(result))
                        .catch(error => console.log('error', error));
                    
                NodeJs (axios)
                        var axios = require('axios');
                        var data = '';
                        var config = {
                        method: 'get',
                        url: 'https://bo.magnifinance.com/api/v1.1/document?documentId={DOCUMENTID}',
                        headers: {
                        'email': 'XXX@example.com',
                        'token': 'XXX',
                        },
                        data : data
                        };
                        axios(config)
                        .then(function (response) {
                        console.log(JSON.stringify(response.data));
                        })
                        .catch(function (error) {
                        console.log(error);
                        });
                    
                Example ResponseSuccess
                       {
    "RequestId": "cd8cfa73-81f5-4a51-bb0d-059c138d3102",
    "Object": {
        "DocumentNumber": "FR FR/5",
        "DownloadUrl": "https://magniurlexample/9379/2023/cdc7b523-242b-4c57-aeca-463f756eb57d.pdf?X-Amz-Expires=3600&response-cache-control=No-cache&response-content-disposition=attachment%3B%20filename%3DFRFR_5_XXXo_2023-03-09_EUR1%252c23.pdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJ3INGX4GEGE7JUSA/20230309/eu-west-1/s3/aws4_request&X-Amz-Date=20230309T144144Z&X-Amz-SignedHeaders=host&X-Amz-Signature=1629a916abdf0fe578eab25370d1a1b33be35bb4714070edde0391b35a2d7fad",
        "PaymentStatus": null,
        "ErrorMessage": null,
        "TotalAmount": null,
        "UnpaidAmount": null,
        "Details": {
            "Document": {
                "DocumentStatusId": "C",
                "DocumentStatus": "Closed",
                "LoadDateTime": null,
                "LoadAddress": null,
                "DestinationAddress": null,
                "VehicleLicence": null,
                "TotalCredit": 0.00,
                "TotalDebit": 0.0,
                "Date": "2023-03-09T00:00:00",
                "DueDate": "2023-03-09T00:00:00",
                "Description": "xxxx",
                "Type": "T",
                "Serie": "FR",
                "Id": 80622,
                "TaxExemptionReasonCode": null,
                "DocumentReference": "",
                "Currency": "EUR",
                "Retention": 0.00,
                "EuroRate": null,
                "ExternalId": null,
                "Lines": [
                    {
                        "Code": "999",
                        "Description": "Serviços gerais",
                        "UnitPrice": 1.00000000,
                        "Quantity": 1.00,
                        "Unit": "Un.",
                        "Type": "S",
                        "TaxValue": 23.00,
                        "ProductDiscount": 0.0000,
                        "CostCenter": "General CCC"
                    }
                ],
                "PurchaseOrder": ""
            },
            "Receiver": {
                "TaxId": "107903857",
                "Name": "cliente teste pedro",
                "Address": "123",
                "City": "lx",
                "PostCode": "1111-111",
                "CountryCode": "PT",
                "PhoneNumber": "999999999",
                "CountryName": "Portugal",
                "LegalName": "empresa teste pedro",
                "Email": null,
                "IBAN": null
            },
            "Totals": {
                "Amount": 1.230000000000,
                "AmountText": "1,23",
                "WithoutTax": 1.0000000000,
                "WithoutTaxText": "1,00",
                "Tax": 0.230000000000,
                "TaxText": "0,23",
                "Discount": 0.0,
                "DiscountText": "0,00",
                "Retention": 0.0,
                "RetentionText": "0,00",
                "AmountBeforeDiscountAndTax": 1.0000000000,
                "AmountBeforeDiscountAndTaxText": "1,00",
                "TotalAmountWithExchangeRate": 0.0,
                "TotalAmountWithExchangeRateText": "0,00",
                "TotalCreditAmount": 1.0000000000,
                "TotalCreditAmountText": "1,00",
                "TotalDebitAmount": 0.0,
                "TotalDebitAmountText": "0,00"
            }
        }
    },
    "Type": 0,
    "ErrorValue": null,
    "ErrorHumanReadable": null,
    "ValidationErrors": null,
    "IsSuccess": true,
    "IsError": false
}
                    
                Error
{
"RequestId": "dc5983e0-a93c-4690-a2c4-4379978382fd",
"Object": null,
"Type": 1,
"ErrorValue": {
"Value": 6,
"Name": "ElementDoesNotExist"
},
"ErrorHumanReadable": null,
"ValidationErrors": null,
"IsSuccess": false,
"IsError": true
}
                    
                 | 

