> For the complete documentation index, see [llms.txt](https://apidocs.cloudinvoice.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.cloudinvoice.net/documentacao-api/documentos/acoes/exportar.md).

# Exportar

Exporta documentos para ficheiros, em diferentes formatos de dados.

## Exportar Documento

{% hint style="warning" %}
Ao contrário do habitual na API CloudInvoice, a resposta a este endpoint é dada em byte stream com Content-Type variável, consoante o tipo (MIME type) do ficheiro gerado (ex: XML → application/xml).

É também incluido no header Content-Disposition da resposta o nome sugerido para o ficheiro.
{% endhint %}

<mark style="color:blue;">`GET`</mark> `https://api.cloudinvoice.net/documents/:id/export/`

#### Path Parameters

| Name | Type    | Description     |
| ---- | ------- | --------------- |
| id   | integer | ID do Documento |

#### Query Params

<table data-search="false"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>format<mark style="color:$danger;">*</mark></td><td>string</td><td><p>Formato do Ficheiro</p><p></p><p>Valores possíveis: <code>ubl</code></p></td></tr></tbody></table>

{% tabs %}
{% tab title="Exemplo de Pedido" %}

```shell
curl -X GET https://api.cloudinvoice.net/documents/1/export/
    -d 'format=ubl'
```

{% endtab %}

{% tab title="Ficheiro UBL (CIUS-PT)" %}

```xml
<?xml-model href="../schematron/urn_feap.gov.pt_CIUS-PT_1.0.5.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron" phase="#ALL" title="Main schema"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:n1="http://uri.etsi.org/01903/v1.4.1#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 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:n2="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2" xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:udt="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2" xmlns:ccts-cct="urn:un:unece:uncefact:data:specification:CoreComponentTypeSchemaModule:2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:feap.gov.pt:CIUS-PT:2.1.2</cbc:CustomizationID>
	<cbc:ProfileID>urn:www:espap:pt:profiles:profile1:ver1.0</cbc:ProfileID>
	<cbc:ID>A01/1</cbc:ID>
	<cbc:IssueDate>2023-01-04</cbc:IssueDate>
	<cbc:DueDate>2023-01-04</cbc:DueDate>
	<cbc:InvoiceTypeCode listID="UNCL1001">FT</cbc:InvoiceTypeCode>
	<cbc:Note>#NUMBER@ATCERTIFIEDPROGRAM#2713#</cbc:Note>
	<cbc:Note>#HASHCODE@ATCERTIFIEDPROGRAM#g1d8#</cbc:Note>
	<cbc:Note>#DESCRIPTION@ATCERTIFIEDPROGRAM# - Processado por programa certificado n. 2713/AT#</cbc:Note>
	<cbc:DocumentCurrencyCode listID="ISO4217">EUR</cbc:DocumentCurrencyCode>
	<cac:AdditionalDocumentReference>
		<cbc:ID schemeID="ANG">MPVYXKPF-1-Nº sequêncial</cbc:ID>
		<cbc:DocumentTypeCode>130</cbc:DocumentTypeCode>
	</cac:AdditionalDocumentReference>
	<cac:AdditionalDocumentReference>
		<cbc:ID>A01/1</cbc:ID>
		<cbc:DocumentDescription>INVOICE_REPRESENTATION</cbc:DocumentDescription>
		<cac:Attachment>...</cac:Attachment>
	</cac:AdditionalDocumentReference>
	<cac:AccountingSupplierParty>
		<cac:Party>
			...
		</cac:Party>
	</cac:AccountingSupplierParty>
	<cac:AccountingCustomerParty>
		<cac:Party>
			...
		</cac:Party>
	</cac:AccountingCustomerParty>
	<cac:Delivery>
		<cac:DeliveryLocation>
			<cac:Address>
				<cbc:StreetName>Desconhecido</cbc:StreetName>
				<cbc:CityName>Desconhecido</cbc:CityName>
				<cbc:PostalZone>0000-000</cbc:PostalZone>
				<cac:Country>
					<cbc:IdentificationCode listID="ISO3166-1">PT</cbc:IdentificationCode>
				</cac:Country>
			</cac:Address>
		</cac:DeliveryLocation>
	</cac:Delivery>
	<cac:TaxTotal>
		<cbc:TaxAmount currencyID="EUR">23.00</cbc:TaxAmount>
		<cac:TaxSubtotal>
			<cbc:TaxableAmount currencyID="EUR">100.00</cbc:TaxableAmount>
			<cbc:TaxAmount currencyID="EUR">23.00</cbc:TaxAmount>
			<cac:TaxCategory>
				<cbc:ID schemeID="UN/ECE 5305">NOR</cbc:ID>
				<cbc:Percent>23.00</cbc:Percent>
				<cac:TaxScheme>
					<cbc:ID>VAT</cbc:ID>
				</cac:TaxScheme>
			</cac:TaxCategory>
		</cac:TaxSubtotal>
	</cac:TaxTotal>
	<cac:LegalMonetaryTotal>
		<cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
		<cbc:TaxExclusiveAmount currencyID="EUR">100.00</cbc:TaxExclusiveAmount>
		<cbc:TaxInclusiveAmount currencyID="EUR">123.00</cbc:TaxInclusiveAmount>
		<cbc:AllowanceTotalAmount currencyID="EUR">0.00</cbc:AllowanceTotalAmount>
		<cbc:PrepaidAmount currencyID="EUR">123.00</cbc:PrepaidAmount>
		<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
	</cac:LegalMonetaryTotal>
	<cac:InvoiceLine>
		<cbc:ID>1</cbc:ID>
		<cbc:InvoicedQuantity unitCode="">1.000</cbc:InvoicedQuantity>
		<cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
		<cac:Item>
			<cbc:Name>Produto 1</cbc:Name>
			<cac:ClassifiedTaxCategory>
				<cbc:ID schemeID="UN/ECE 5305">NOR</cbc:ID>
				<cbc:Percent>23.00</cbc:Percent>
				<cac:TaxScheme>
					<cbc:ID>VAT</cbc:ID>
				</cac:TaxScheme>
			</cac:ClassifiedTaxCategory>
		</cac:Item>
		<cac:Price>
			<cbc:PriceAmount currencyID="EUR">100.00</cbc:PriceAmount>
			<cbc:BaseQuantity unitCode="">1.00</cbc:BaseQuantity>
		</cac:Price>
	</cac:InvoiceLine>
</Invoice>
```

{% endtab %}
{% endtabs %}

Para ver exemplos de pedidos nas várias linguagens, consulte a página[ Exemplos de Pedidos.](/introducao/exemplos-de-pedidos.md)
