The Spanish version is the authoritative reference. View in Spanish
Method to download the XML file (DownloadDocumentXml)
This method allows you to download a document's XML file using the GET DownloadDocumentXml service.
Through this method, you obtain the base64-encoded XML file of the queried document.
To connect to this functionality, you will need to enter the URL according to the environment you want to use:
https://developers.gosocket.net/api/v1/File/DownloadDocumentXmlhttps://developers-sbx.gosocket.net/api/v1/File/DownloadDocumentXmlHow does the DownloadDocumentXml method work?
To make the request, the method has the following parameters:
| DownloadDocumentXml (request) | |||
|---|---|---|---|
| Parameter | Type | Description | Allowed values |
| globalDocumentId* | String | Document identification in Gosocket. | 36-character alphanumeric UUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| type | String | Type of XML to download | See the Types of files to download table |
*Required
| Types of Files to Download | ||
|---|---|---|
| Type | Description | Countries where it applies |
| original | Fiscal (Tax) XML: XML sent to the Tax Authority. Only includes the custom fields in the countries where the Authority supports them within the XML. | AR, BO, CO, CR, DO, EC, PA, PE, PY, UY |
| default | Gosocket XML: XML that is stored in Inbox, includes the custom fields | All |
| response | Tax Authority Response: File with the Tax Authority's response for the issued document. | All |
| smartsupply | Smart Supply XML: XML that includes the fields related to the SS functionality. | All countries where SS is implemented |
| distribution | Distribution XML: XML that is distributed mandatorily | CO |
| addenda | Commercial Addenda XML: XML with the Addenda node | MX |
| integration | Integration JSON file: File with the request sent to the API for issuing the document | All |
Request example
The identifiers, tax IDs, and contents in these examples are fictitious; they are included only to illustrate the format of requests and responses.
GET https://developers-sbx.gosocket.net/api/v1/File/DownloadDocumentXml?globalDocumentId=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa&type=original
Note: Remember that before using the method, you must authenticate within the Authorization tab.
For this method, we use the Postman Params tab.
- Select the method type. In this case, you must select GET.
- Enter the method's URL.
- Enter the parameters shown in the table above with their corresponding values.
- Press Send.
Response example for downloading the Default XML (Gosocket)
{
"Name": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.xml",
"Description": "Xml Content for GlobalDocumentId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"Base64Content": "PD94bWwgdmVyc2lvbj0iMS4wIi...",
"Timestamp": "2023-09-20T16:25:46.7524651Z",
"Type": "xml"
}You can convert the response of the Base64Content parameter, whose result, for this example, is as follows (fragment — it includes the custom fields inside the <Personalizados> node):
<!-- … -->
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:Note>Cocina internacional, reposteria y cocteles. 200 Recetas.</cbc:Note>
<cbc:InvoicedQuantity unitCode="EA">1.000000</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="COP">1000000.00</cbc:LineExtensionAmount>
<cbc:FreeOfChargeIndicator>false</cbc:FreeOfChargeIndicator>
<cac:Delivery>
<cac:DeliveryLocation>
<cbc:ID schemeID="999" schemeName="EAN">613124312412</cbc:ID>
</cac:DeliveryLocation>
</cac:Delivery>
<cac:Item>
<cbc:Description>Articulo 1 Libro de cocina</cbc:Description>
<cac:SellersItemIdentification>
<cbc:ID>AOHV84-225</cbc:ID>
</cac:SellersItemIdentification>
<cac:StandardItemIdentification>
<cbc:ID schemeID="999" schemeName="EAN13">6543542313534</cbc:ID>
</cac:StandardItemIdentification>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="COP">1000000.00</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="EA">1.000000</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
<Personalizados>
<DocPersonalizado dteID="">
<campoString name="QRCode">NumFac:=SETP990002796
FecFac:2023-09-20
HorFac:08:43:20-05:00
NitFac:900000000
DocAdq:800000000
ValFac:1000000.00
ValIva:0.00
ValOtroIm:
ValTolFac:1000000.00
CUFE:0123456789abcdef0123456789abcdef0123456789abcdef...
QRCode:https://catalogo-vpfe-hab.dian.gov.co/document/searchqr?documentkey=0123456789abcdef...</campoString>
<campoString name="SERIE">SETP</campoString>
<campoString name="FOLIO">990002796</campoString>
<campoString name="FechaGeneracion">2023-09-20</campoString>
<campoString name="NoInterno">02633</campoString>
<campoString name="HoraGeneracion">16:25:46</campoString>
</DocPersonalizado>
</Personalizados>
Response example for downloading the distribution XML
{
"Name": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.xml",
"Description": "Xml Content for GlobalDocumentId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"Base64Content": "UEQ5NGJXd2dkbVZ5YzJsdmJqMGlNUzR3U1dsQ2JHSnRUblpaUjJ4MVdub3dhVlpXVWtkTVZHZHBUSG84UzFCRlJqQkRSMVpxWVVkYWJIS1JSMkR6...",
"Timestamp": "2023-09-20T16:25:46.7524651Z",
"Type": "xml"
}You can convert the response of the Base64Content parameter, whose result, for this example, is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<AttachedDocument xmlns="urn:oasis:names:specification:ubl:schema:xsd:AttachedDocument-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:sts="dian:gov:co:facturaelectronica:Structures-2-1"
xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"
xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ext:UBLExtensions/>
<cbc:UBLVersionID>UBL 2.1</cbc:UBLVersionID>
<cbc:CustomizationID>05</cbc:CustomizationID>
<cbc:ProfileID>DIAN 2.1: Factura Electrónica de Venta</cbc:ProfileID>
<cbc:ProfileExecutionID>2</cbc:ProfileExecutionID>
<cbc:ID>1695268803</cbc:ID>
<cbc:IssueDate>2023-09-26</cbc:IssueDate>
<cbc:IssueTime>22:17:49-05:00</cbc:IssueTime>
<cbc:DocumentType>Contenedor de Factura Electrónica</cbc:DocumentType>
<cbc:ParentDocumentID>SETP990002796</cbc:ParentDocumentID>
<cac:SenderParty>
<cac:PartyTaxScheme>
<cbc:RegistrationName>EMPRESA EJEMPLO</cbc:RegistrationName>
<cbc:CompanyID schemeAgencyID="195" schemeID="4" schemeName="31">900000000</cbc:CompanyID>
<cbc:TaxLevelCode listName="05">O-99</cbc:TaxLevelCode>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>IVA</cbc:Name>
</cac:TaxScheme>
</cac:PartyTaxScheme>
</cac:SenderParty>
<cac:ReceiverParty>
<cac:PartyTaxScheme>
<cbc:RegistrationName>CLIENTE EJEMPLO</cbc:RegistrationName>
<cbc:CompanyID schemeAgencyID="195" schemeID="5" schemeName="31">800000000</cbc:CompanyID>
<cbc:TaxLevelCode listName="05">O-13</cbc:TaxLevelCode>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>IVA</cbc:Name>
</cac:TaxScheme>
</cac:PartyTaxScheme>
</cac:ReceiverParty>
<cac:Attachment>
<cac:ExternalReference>
<cbc:MimeCode>text/xml</cbc:MimeCode>
<cbc:EncodingCode>UTF-8</cbc:EncodingCode>
<cbc:Description><![CDATA[<?xml version="1.0" encoding="utf-8"?><Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" ...]]></cbc:Description>
</cac:ExternalReference>
</cac:Attachment>
<cac:ParentDocumentLineReference>
<cbc:LineID>1</cbc:LineID>
<!-- … -->
Response example for downloading the original XML (Tax Authority XML)
{
"Name": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.xml",
"Description": "Xml Content for GlobalDocumentId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"Base64Content": "PD94bWwgdmVyc2lvbj0iMS4wIi...",
"Timestamp": "2023-09-20T16:25:46.7524651Z",
"Type": "xml"
}You can convert the response of the Base64Content parameter, whose result, for this example, is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<AttachedDocument xmlns="urn:oasis:names:specification:ubl:schema:xsd:AttachedDocument-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:sts="dian:gov:co:facturaelectronica:Structures-2-1"
xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"
xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ext:UBLExtensions/>
<cbc:UBLVersionID>UBL 2.1</cbc:UBLVersionID>
<cbc:CustomizationID>05</cbc:CustomizationID>
<cbc:ProfileID>DIAN 2.1: Factura Electrónica de Venta</cbc:ProfileID>
<cbc:ProfileExecutionID>2</cbc:ProfileExecutionID>
<cbc:ID>1695268803</cbc:ID>
<cbc:IssueDate>2023-09-26</cbc:IssueDate>
<cbc:IssueTime>22:17:49-05:00</cbc:IssueTime>
<cbc:DocumentType>Contenedor de Factura Electrónica</cbc:DocumentType>
<cbc:ParentDocumentID>SETP990002796</cbc:ParentDocumentID>
<cac:SenderParty>
<cac:PartyTaxScheme>
<cbc:RegistrationName>EMPRESA EJEMPLO</cbc:RegistrationName>
<cbc:CompanyID schemeAgencyID="195" schemeID="4" schemeName="31">900000000</cbc:CompanyID>
<cbc:TaxLevelCode listName="05">O-99</cbc:TaxLevelCode>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>IVA</cbc:Name>
</cac:TaxScheme>
</cac:PartyTaxScheme>
</cac:SenderParty>
<cac:ReceiverParty>
<cac:PartyTaxScheme>
<cbc:RegistrationName>CLIENTE EJEMPLO</cbc:RegistrationName>
<cbc:CompanyID schemeAgencyID="195" schemeID="5" schemeName="31">800000000</cbc:CompanyID>
<cbc:TaxLevelCode listName="05">O-13</cbc:TaxLevelCode>
<cac:TaxScheme>
<cbc:ID>01</cbc:ID>
<cbc:Name>IVA</cbc:Name>
</cac:TaxScheme>
</cac:PartyTaxScheme>
</cac:ReceiverParty>
<cac:Attachment>
<cac:ExternalReference>
<cbc:MimeCode>text/xml</cbc:MimeCode>
<cbc:EncodingCode>UTF-8</cbc:EncodingCode>
<cbc:Description><![CDATA[<?xml version="1.0" encoding="utf-8"?><Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" ...]]></cbc:Description>
</cac:ExternalReference>
</cac:Attachment>
<!-- … -->
Note: Unlike the other XML types, it does not contain custom fields.
Response example for downloading the Smart Supply XML
{
"Name": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa.xml",
"Description": "Xml Content for GlobalDocumentId aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"Base64Content": "PD94bWwgdmVyc2lvbj0iMS4wIi...",
"Timestamp": "2023-09-20T16:25:46.7524651Z",
"Type": "xml"
}You can convert the response of the Base64Content parameter, whose result, for this example, is as follows:
<!-- … -->
<cac:InvoiceLine>
<!-- … -->
<cac:Price>
<cbc:PriceAmount currencyID="COP">1000000.00</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="EA">1.000000</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
<Personalizados>
<DocPersonalizado dteID="">
<campoString name="QRCode">NumFac:=SETP990002796
FecFac:2023-09-20
HorFac:08:43:20-05:00
NitFac:900000000
DocAdq:800000000
ValFac:1000000.00
ValIva:0.00
ValOtroIm:
ValTolFac:1000000.00
CUFE:0123456789abcdef0123456789abcdef0123456789abcdef...
QRCode:https://catalogo-vpfe-hab.dian.gov.co/document/searchqr?documentkey=0123456789abcdef...</campoString>
<campoString name="SERIE">SETP</campoString>
<campoString name="FOLIO">990002796</campoString>
<campoString name="FechaGeneracion">2023-09-20</campoString>
<campoString name="NoInterno">02633</campoString>
<campoString name="HoraGeneracion">16:25:46</campoString>
<IDESTADO>3</IDESTADO>
<ESTADO>ACEPTADO</ESTADO>
<ValorOC>1000000</ValorOC>
</DocPersonalizado>
</Personalizados>
<cac:OrderReference>
<cbc:ID>9011</cbc:ID>
</cac:OrderReference>
Response parameters
| DownloadDocumentXml (response) | |||
|---|---|---|---|
| Parameter | Type | Description | Allowed values |
| Name | String | Name of the downloaded XML file | globalDocumentId.xml |
| Description | String | Description of the event performed. | Xml Content for GlobalDocumentId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
| Base64Content | String | Base64-encoded XML file | |
| TimeStamp | String | Date and time the document was created | yyyy-mm-ddThh:mm:ss |
| Type | String | File type | "xml" |
Method characteristics
-
When the document Id (globalDocumentId) does not exist, the system responds with a
404 Not Founderror message:{"Message": "Document with GlobalDocumentId (00000000-0000-0000-0000-000000000000) does not exist"} -
The file can be downloaded as many times as necessary.
-
When the type parameter is not specified, or a value outside the list is entered, the API responds with the default type XML.
-
The distribution XML has double encoding, so it will need to be decoded twice.