e-invoicing

Compliance Network Implementation Guide

Portugal

Enabling support for Portugal involves confirming prerequisites and product IDs, registering with the Autoridade Tributária e Adueneira (AT) tax authority, and setting up credentials.

Prerequisites

Available products

  • pt_temp__1.0

Error handling

When handling errors, the client application must follow the Indirect Tax API's error handling principles, as specified in the error handling documentation.

In general, all error codes in the 400 range are client errors, which you need to analyze. After fixing the error, you can resend the request. Error codes 408 and 429 are exceptions: In these cases, you should wait at least 60 seconds before retrying. Error codes in the 500 range are server errors. In that case, resend the request according to the instructions given on the error handling documentation, which also includes a full list of error codes Indirect Tax API can return.

You can find errors coming from the Sovos platform in the application response. In addition, here is a list of errors that the certified eInvoicing solution can return:

Error code ID Error description
SDOC0003 The series name is required.
SDOC0004 The discount amount is not a valid number.
SDOC0005 The discount percentage is not a valid number.
SDOC0006 The discount percentage is required.
SDOC0007 The currency is required.
SDOC0008 The document correlation ID is required.
SDOC0009 The document type is required.
SDOC0010 The document platform is required.
SDOC0011 The document type is not valid.
SDOC0012 The document platform is not valid.
SDOC0013 The discount percentage is not a valid percentage.
SDOC0014 Is self billing is not a valid number Boolean.
SDOC0015 Ignore database notifications configuration is not a valid Boolean.
SDOC0016 The document dates are required.
SDOC0017 The document totals are required.
SDOC0018 The document lines are required.
SDOC0019 The document customer/buyer information is required.
SDOC0020 The document seller/issuer information is required.
SDOC0021 The observations value is required.
SDOC0022 The binary data content is required.
SDOC0023 The binary data content type is required.
SDOC0024 The binary data name is required.
SDOC0025 The binary data content is not a valid Base64.
SDOC0026 The due date is not a valid date.
SDOC0027 The delivery date is not a valid date.
SDOC0028 The goods service available date is not a valid date.
SDOC0029 The departure date is not a valid date.
SDOC0030 The arrival date is not a valid date.
SDOC0031 The party seller name is required.
SDOC0032 The party seller address is required.
SDOC0033 The party seller zip code is required.
SDOC0034 The party seller zip area is required.
SDOC0035 The party seller country is required.
SDOC0036 The party seller VAT number is required.
SDOC0037 Has a document in attachment is not a valid boolean.
SDOC0038 The notifications email is required.
SDOC0039 The notifications email is not valid.
SDOC0040 The notifications language is required.
SDOC0041 The meta info value is required.
SDOC0042 The meta info key is required.
SDOC0043 The due date is required.
SDOC0044 The goods service available date is required. This can be specified in the header or in all document lines.
SDOC0045 Inconsistent goods service available date. This can only be specified in the header or in all document lines.
SDOC0046 Total to pay is not a valid number.
SDOC0047 Total VAT is not a valid number.
SDOC0048 Total taxable is not a valid number.
SDOC0049 Total gross amount is not a valid number.
SDOC0050 Total net amount is not a valid number.
SDOC0051 Total discount is not a valid number.
SDOC0052 Total charges is not a valid number.
SDOC0053 Total stamp duty is not a valid number.
SDOC0054 Total withholding tax amount is not a valid number.
SDOC0055 Number of lines is not a valid number.
SDOC0056 Total to pay must be a non-negative number.
SDOC0057 Total VAT must be a non-negative number.
SDOC0058 Total taxable must be a non-negative number.
SDOC0059 Total gross amount must be a non-negative number.
SDOC0060 Total net amount must be a non-negative number.
SDOC0061 Total discount must be a non-negative number.
SDOC0062 Total charges must be a non-negative number.
SDOC0063 Total stamp duty must be a non-negative number.
SDOC0064 Total withholding tax amount must be a non-negative number.
SDOC0065 Number of lines must be a non-negative number.
SDOC0066 Discount amount must be a non-negative number.
SDOC0067 Total to pay is required.
SDOC0068 Total gross amount is required.
SDOC0069 Total taxable is required.
SDOC0070 Total VAT or stamp duty is required.
SDOC0071 Total VAT is required when there is a line with VAT percentage defined.
SDOC0072 Total VAT is required when there is a summary with VAT percentage defined.
SDOC0073 Total stamp duty is required when there is a line with stamp duty paragraph defined.
SDOC0074 Total stamp duty is required when there is a summary with stamp duty paragraph defined.
SDOC0075 VAT summary is required when the total VAT is defined.
SDOC0076 Stamp duty summary is required when the total stamp duty is defined.
SDOC0077 Total charges is required when there is a line with charges defined.
SDOC0078 Total discount is required when there is a line with discounts defined.
SDOC0079 Total discount is required when there are document discounts defined.
SDOC0080 Total VAT is required when there is advance payment with VAT percentage defined.
SDOC0081 Total withholding tax amount is required when there is a line with withholding information defined.
SDOC0082 Total withholding tax amount is required when there is a summary with withholding information defined.
SDOC0083 Withholding information summary is required when the total withholding tax amount is defined.
SDOC0084 VAT summary taxable amount is required.
SDOC0085 VAT summary tax percentage is required.
SDOC0086 VAT summary tax amount is required.
SDOC0087 VAT summary taxable amount is not a valid number.
SDOC0088 VAT summary tax percentage is not a valid number.
SDOC0089 VAT summary tax amount is not a valid number.
SDOC0090 VAT summary taxable amount must be a non-negative number.
SDOC0091 VAT summary tax amount must be a non-negative number.
SDOC0092 VAT summary tax percentage is not a valid percentage.
SDOC0093 VAT summary tax code is not valid.
SDOC0094 Stamp duty summary taxable amount is required.
SDOC0095 Stamp duty summary paragraph is required.
SDOC0096 Stamp duty summary tax amount is required.
SDOC0097 Stamp duty summary taxable amount is not a valid number.
SDOC0098 Stamp duty summary percentage is not a valid number.
SDOC0099 Stamp duty summary tax amount is not a valid number.
SDOC0100 Stamp duty summary amount is not a valid number.
SDOC0101 Stamp duty summary taxable amount must be a non-negative number.
SDOC0102 Stamp duty summary tax amount must be a non-negative number.
SDOC0103 Stamp duty summary percentage is not a valid percentage.
SDOC0104 Stamp duty summary amount must be a non-negative number.
SDOC0105 Withholding tax summary taxable amount is required.
SDOC0106 Withholding tax summary tax percentage is required.
SDOC0107 Withholding tax summary tax amount is required.
SDOC0108 Withholding tax summary taxable amount is not a valid number.
SDOC0109 Withholding tax summary tax percentage is not a valid number.
SDOC0110 Withholding tax summary tax amount is not a valid number.
SDOC0111 Withholding tax summary taxable amount must be a non-negative number.
SDOC0112 Withholding tax summary tax amount must be a non-negative number.
SDOC0113 Withholding tax summary tax percentage is not a valid percentage.
SDOC0114 Withholding tax summary tax code is not valid.
SDOC0115 The line delivery date is not a valid date.
SDOC0116 The line goods service available date is not a valid date.
SDOC0117 The line meta info value is required.
SDOC0118 The line meta info key is required.
SDOC0119 The line observations value is required.
SDOC0120 Line discount amount is not a valid number.
SDOC0121 Line discount percentage is not a valid number.
SDOC0122 Line discount percentage is not a valid percentage.
SDOC0123 Line discount amount must be a non-negative number.
SDOC0124 The line discount percentage is required.
SDOC0125 Line charge amount is not a valid number.
SDOC0126 Line charge percentage is not a valid number.
SDOC0127 Line charge percentage is not a valid percentage.
SDOC0128 Line charge VAT is required.
SDOC0129 The line charge amount is required.
SDOC0130 The line charge type is required.
SDOC0131 The line quantity is required.
SDOC0132 Schedule line quantity is required.
SDOC0133 Schedule line delivery date is required.
SDOC0134 The quantity value is required.
SDOC0135 The quantity unit of measure is required.
SDOC0136 The quantity value is not a valid number.
SDOC0137 The quantity value must be a non-negative number.
SDOC0138 When the line net amount and the line taxable amount are both defined, they must have the same value.
SDOC0139 Line withholding tax percentage is required.
SDOC0140 Line withholding tax amount is required.
SDOC0141 Line charge qualifier is not valid.
SDOC0142 Line withholding tax percentage is not a valid number.
SDOC0143 Line withholding tax amount is not a valid number.
SDOC0144 The party seller email is not valid.
SDOC0145 Line withholding tax amount must be a non-negative number.
SDOC0146 Line withholding tax percentage is not a valid percentage.
SDOC0147 Line withholding tax code is not valid.
SDOC0148 Line taxable unit price or line net price is required.
SDOC0149 Line stamp duty paragraph is required.
SDOC0150 Line stamp duty tax amount is required.
SDOC0151 When the line item net price and the item line taxable unit price are both defined, they must have the same value.
SDOC0152 Line stamp duty percentage is not a valid number.
SDOC0153 Line stamp duty tax amount is not a valid number.
SDOC0154 Line stamp duty amount is not a valid number.
SDOC0155 Line stamp duty percentage is not a valid percentage.
SDOC0156 Line stamp duty amount must be a non-negative number.
SDOC0157 Line VAT taxable amount or line net amount is required.
SDOC0158 Line VAT tax percentage is required.
SDOC0159 Line VAT tax amount is required.
SDOC0160 Line VAT taxable amount is not a valid number.
SDOC0161 Line VAT tax percentage is not a valid number.
SDOC0162 Line VAT tax amount is not a valid number.
SDOC0163 Line VAT tax percentage is not a valid percentage.
SDOC0164 Line VAT tax code is not valid.
SDOC0165 The case package quantity value is required.
SDOC0166 The case package quantity unit of measure is required.
SDOC0167 The case package quantity value is not a valid number.
SDOC0168 The case package quantity value must be a non-negative number.
SDOC0169 Units per package is not a valid number.
SDOC0170 Units per package must be greater than zero.
SDOC0171 When the line VAT tax percentage is zero, the exemption reason must be specified.
SDOC0172 The line VAT exemption reason code is required.
SDOC0173 The line VAT exemption reason text value is required.
SDOC0174 The line VAT exemption reason code is not valid.
SDOC0175 The invoicing start date is not a valid date.
SDOC0176 The invoicing end date is not a valid date.
SDOC0177 The line invoicing start date is not a valid date.
SDOC0178 The line invoicing end date is not a valid date.
SDOC0179 The creation date is not a valid date.
SDOC0180 The last update date is not a valid date.
SDOC0181 The line number is not a valid number.
SDOC0182 The line number must be greater than zero.
SDOC0183 A line type product cannot have withholding taxes.
SDOC0184 The line type is not valid.
SDOC0185 The line seller assigned identification or the trade item identification is required.
SDOC0186 The line item gross price or the line item unit price is required.
SDOC0187 The line item unit price is not a valid number.
SDOC0188 The line VAT or stamp duty tax is required.
SDOC0189 When the total net amount and the total taxable are both defined, they must have the same value.
SDOC0190 The line item net price is not a valid number.
SDOC0191 The line item gross price is not a valid number.
SDOC0192 The line item taxable unit price is not a valid number.
SDOC0193 The line item description is required.
SDOC0194 The line item gross amount is not a valid number.
SDOC0195 The line item net amount is not a valid number.
SDOC0196 The line item total discount amount is not a valid number.
SDOC0197 The line item total tax amount is not a valid number.
SDOC0198 The line item total payable amount is not a valid number.
SDOC0199 The line item total discount amount must be a non-negative number.
SDOC0200 The line item total tax amount must be a non-negative number.
SDOC0201 When the line VAT tax percentage is not zero, the exemption reason cannot be specified.
SDOC0202 The line item total payable amount is required.
SDOC0203 The line item gross amount is required.
SDOC0204 When the line item gross price and the item line unit price are both defined, they must have the same value.
SDOC0205 The advance payment line number is not a valid number.
SDOC0206 The advance payment line number must be greater than zero.
SDOC0207 The advance payment line description is required.
SDOC0208 The advance payment line VAT is required.
SDOC0209 The advance payment line assigned identification is required.
SDOC0210 The advance payment line taxable unit price is not a valid number.
SDOC0211 The advance payment line gross amount is not a valid number.
SDOC0212 The advance payment line net amount is not a valid number.
SDOC0213 The advance payment line taxable unit price must be greater than zero.
SDOC0214 The advance payment line gross amount must be greater than zero.
SDOC0215 The advance payment line net amount must be greater than zero.
SDOC0216 The advance payment line VAT taxable amount, the taxable unit price, or the gross amount is required.
SDOC0217 The advance payment line net amount is required.
SDOC0218 Only an invoice can deduct a previously received advance payment.
SDOC0219 An advance payment cannot have references.
SDOC0220 Only invoices or credit notes can have advance payment information.
SDOC0221 Invalid document type for invoice processing.
SDOC0222 A debit note or a credit note must reference an invoice.
SDOC0223 A debit note or a credit note must state the reason for credit/debit.
SDOC0224 The party seller is final consumer is not a valid boolean.
SDOC0225 The party seller VAT number is not valid.
SDOC0226 The party seller country is not valid.
SDOC0227 The party seller cannot be a final consumer.
SDOC0228 The notifications language is not valid.
SDOC0229 The currency is not valid.
SDOC0230 The party buyer email is invalid.
SDOC0231 The party buyer is final consumer is not a valid boolean.
SDOC0232 The party buyer VAT number is not valid.
SDOC0233 The party buyer country is not valid.
SDOC0234 The party buyer name is required.
SDOC0235 The party buyer VAT number is required.
SDOC0236 The party buyer address is required.
SDOC0237 The party buyer ZIP code is required.
SDOC0238 The party buyer ZIP area is required.
SDOC0239 The party buyer country is required.
SDOC0240 The party buyer GLN is not valid.
SDOC0241 The party seller GLN is not valid.
SDOC0242 The trade item identification is not a valid GTIN.
SDOC0243 A simplified invoice is not permitted if the taxable exceeds 1000.
SDOC0244 This document was already processed.
SDOC0245 This document sender (party seller) was not found.
SDOC0246 This document sender (party seller) must have VAT definitions in the system.
SDOC0247 This document sender (party seller) must have document number range definitions in the system.
SDOC0248 The document series name was not found.
SDOC0249 The stamp duty definition was not found for the specified paragraph.
SDOC0250 The VAT definition was not found for the specified percentage.
SDOC0251 The charge definition was not found for the specified type.
SDOC0252 The VAT exemption reason definition was not found for the specified reason code.
SDOC0253 The unit of measure definition was not found for the specified unit of measure code.
SDOC0254 There is a withholding tax percentage for the product issuer code definition but there is not match for the document line.
SDOC0255 The document for invoice references must exist in the system.
SDOC0256 Line stamp duty percentage or line stamp duty amount is required.
SDOC0257 Line stamp duty percentage and line stamp duty amount cannot be both specified.
SDOC0258 Stamp duty summary percentage or stamp duty summary amount is required.
SDOC0259 Stamp duty summary percentage and stamp duty summary amount cannot be both specified.
SDOC0260 The line VAT and stamp duty tax cannot be defined for non-priced item lines.
SDOC0261 Line VAT taxable amount and line net amount cannot be defined for non-priced item lines.
SDOC0262 The line item total payable amount cannot be defined for non-priced item lines.
SDOC0263 Line taxable unit price and line net price cannot be defined for non-priced item lines.
SDOC0264 The line item gross price and the line item unit price cannot be defined for non-priced item lines.
SDOC0265 The line item gross amount cannot be defined for non-priced item lines.
SDOC0266 The line withholding tax cannot be defined for non-priced item lines.
SDOC0267 The line charges cannot be defined for non-priced item lines.
SDOC0268 The line discounts cannot be defined for non-priced item lines.
SDOC0269 The party ship from email is invalid.
SDOC0270 The party ship from is final consumer is not a valid boolean.
SDOC0271 The party ship from VAT number is not valid.
SDOC0272 The party ship from country is not valid.
SDOC0273 The party ship from name is required.
SDOC0274 The party ship from address is required.
SDOC0275 The party ship from zip code is required.
SDOC0276 The party ship from zip area is required.
SDOC0277 The party ship from country is required.
SDOC0278 The party ship from GLN is not valid.
SDOC0279 The party ship from cannot be a final consumer.
SDOC0280 The party ship to email is invalid.
SDOC0281 The party ship to is final consumer is not a valid boolean.
SDOC0282 The party ship to VAT number is not valid.
SDOC0283 The party ship to country is not valid.
SDOC0284 The party ship to name is required.
SDOC0285 The party ship to address is required.
SDOC0286 The party ship to zip code is required.
SDOC0287 The party ship to zip area is required.
SDOC0288 The party ship to country is required.
SDOC0289 The party ship to GLN is not valid.
SDOC0290 The party ship to cannot be a final consumer.
SDOC0291 This document sender (party seller) cannot send this document type.
SDOC0292 This document receiver (party buyer) cannot receive this document type.
SDOC0293 This document receiver (party buyer) is not configured to be connected with the document sender (party seller).
SDOC0294 The line gross amount must be equal to unit/gross price * quantity.
SDOC0295 When the line unit/gross price is negative, no discount should be applied.
SDOC0296 The line discount amount is not equal to the calculated gross amount * discount percentage.
SDOC0297 The line taxable amount must be equal to the line gross amount without discounts.
SDOC0298 The line discounts amount must be equal to the line calculated discounts.
SDOC0299 The line discounts amount is required when there are line calculated discounts.
SDOC0300 The line discounts amount should not be specified when there are no line calculated discounts.
SDOC0301 The line net price (taxable unit price) must be equal to line specified taxable amount / quantity.
SDOC0302 The line net price (taxable unit price) must be equal to line calculated taxable amount / quantity.
SDOC0303 The line withholding tax amount must be equal to the line calculated withholding tax amount.
SDOC0304 The line VAT amount must be equal to the line calculated VAT amount.
SDOC0305 The line stamp duty amount must be equal to the line calculated stamp duty amount.
SDOC0306 The line total amount must be equal to the line calculated total amount.
SDOC0307 The line charge VAT amount must be equal to the line charge calculated VAT amount.
SDOC0308 The line charge amount must be equal to the line charge calculated amount.
SDOC0309 The document total charge amount must be equal to the line charges calculated amount.
SDOC0310 The document total discount amount must be equal to the line discounts calculated amount.
SDOC0311 The document discount amount must be equal to the line discounts calculated amount.
SDOC0312 The document total stamp duty amount must be equal to the line stamp duties calculated amount.
SDOC0313 There is a line stamp duty not found in the document stamp duty summary.
SDOC0314 There is a summary stamp duty not found in the line stamp duty.
SDOC0315 The document summary stamp duty amount must be equal to the line stamp duties calculated amount for the paragraph.
SDOC0316 The document summary stamp duty taxable amount must be equal to the line stamp duties calculated taxable amount for the paragraph.
SDOC0317 There is a summary VAT not found in the line VAT.
SDOC0318 The document summary VAT amount must be equal to the line VAT calculated amount for the percentage.
SDOC0319 The document summary VAT taxable amount must be equal to the line VAT calculated taxable amount for the percentage.
SDOC0320 There is a summary withholding tax not found in the line withholding taxes.
SDOC0321 The document summary withholding tax amount must be equal to the line withholding taxes calculated amount for the percentage.
SDOC0322 The document summary withholding tax taxable amount must be equal to the line withholding taxes calculated taxable amount for the percentage.
SDOC0323 There is a line VAT not found in the document VAT summary.
SDOC0324 There is a line withholding tax not found in the document withholding tax summary.
SDOC0325 The document total VAT amount must be equal to the line VAT calculated amount.
SDOC0326 The document total withholding tax amount must be equal to the line withholding taxes calculated amount.
SDOC0327 The document total taxable amount must be equal to the line taxable calculated amount.
SDOC0328 The document total gross amount must be equal to the line gross calculated amount.
SDOC0329 The document total amount must be equal to the line total calculated amount.
SDOC0330 The line total calculated amount cannot be negative for a product, even though negative adjustments are permitted.
SDOC0331 Total VAT is required when there is a line with charges with VAT percentage defined.
SDOC0332 Line withholding information is required when the total withholding tax amount is defined.
SDOC0333 Line stamp duty information is required when the total stamp duty amount is defined.
SDOC0334 Line gross amount is required when the line gross price is defined.
SDOC0335 Line gross price is required when the line gross amount is defined.
SDOC0336 Line gross amount is required when the total gross amount is defined and there is no advance payment information.
SDOC0337 Total gross amount is required when there is a line with gross amount or advance payment defined.
SDOC0338 Line charges is required when the total charges amount is defined.
SDOC0339 Line discounts or document discounts is required when the total discount amount is defined.
SDOC0340 Line VAT information is required when the total VAT amount is defined.
SDOC0341 When the advance payment gross amount and the advance payment taxable unit price are both defined, they must have the same value.
SDOC0342 When the advance payment taxable amount and the advance payment taxable unit price are both defined, they must have the same value.
SDOC0343 When the advance payment taxable amount and the advance payment gross amount are both defined, they must have the same value.
SDOC0344 The advance payment VAT amount must be equal to the advance payment calculated VAT amount.
SDOC0345 The advance payment total amount must be equal to the advance payment calculated total amount.
SDOC0346 This document sender (party seller) cannot generate a certified document for this document type.
SDOC0347 Generate document date configuration is not a valid boolean.
SDOC0348 The document date is less than the last generated document date for the series name.
SDOC0349 A legal credit or debit note must have at least an existing referenced invoice for rectification data.
SDOC0350 The document references must belong to the same customer as the document.
SDOC0351 The document references must belong to the same seller as the document.
SDOC0352 The document date is less than the referenced document date.
SDOC0353 The document currency is not the same as the referenced currency.
SDOC0354 The document line product code was not found in the referenced documents.
SDOC0355 The credit document line taxable amount for the product code is less than the one available based on the calculation of the referenced documents.
SDOC0356 The credit document line quantity amount for the product code is less than the one available based on the calculation of the referenced documents.
SDOC0357 The credit document total taxable amount is less than the one available based on the calculation of the referenced documents.
SDOC0358 An invoice that deducts an advance payment must have a reference to the invoice containing the advance payment.
SDOC0359 The advance payment value to deduct is less than the one available based on the calculation of the referenced documents.
SDOC0360 The document date is less than the referenced advance payment document date.
SDOC0361 The document currency is not the same as the referenced advance payment currency.
SDOC0362 The document advance payment line code was not found in the referenced documents.
SDOC0363 The document advance payment references must belong to the same customer as the document.
SDOC0364 The document advance payment references must belong to the same seller as the document.
SDOC0365 The document correlation ID is not valid. It must be a GUID or a Trade document ID.
SDOC0366 The transport net weight value is required.
SDOC0367 The transport net weight unit of measure is required.
SDOC0368 The transport net weight value is not a valid number.
SDOC0369 The transport net weight value must be a non-negative number.
SDOC0370 The transport gross weight value is required.
SDOC0371 The transport gross weight unit of measure is required.
SDOC0372 The transport gross weight value is not a valid number.
SDOC0373 The transport gross weight value must be a non-negative number.
SDOC0374 The discount amount is required.
SDOC0375 The line discount amount is required.
SDOC0376 The line number is required.
SDOC0377 The line number must be specified and must be unique.
SDOC0378 The line departure date is not a valid date.
SDOC0379 The line arrival date is not a valid date.
SDOC0380 Ignore referenced documents checks configuration is not a valid boolean.
SDOC0381 Invalid document type for dispatch advice processing.
SDOC0382 Line gross amount is required when the total gross amount is defined.
SDOC0383 Document ship to information is required.
SDOC0384 The departure date is required.
SDOC0385 The arrival date is required.
SDOC0386 The line item unit price must be a non-negative number.
SDOC0387 The line item net price must be a non-negative number.
SDOC0388 The line item gross price must be a non-negative number.
SDOC0389 The line item taxable unit price must be a non-negative number.
SDOC0390 The line item gross amount must be a non-negative number.
SDOC0391 The line item net amount must be a non-negative number.
SDOC0392 The line item total payable amount must be a non-negative number.
SDOC0393 The exchange rate value is required.
SDOC0394 The exchange rate currency is required.
SDOC0395 The exchange rate value is not a valid number.
SDOC0396 The exchange rate value must be a non-negative number.
SDOC0397 The exchange rate currency is not valid.
SDOC0398 For legal documents, the currency code must be EUR.
SDOC0399 Invoice reference as third-party ERP internal reference configuration is not a valid boolean.
SDOC0400 The cancellation date is not a valid date.
SDOC0401 The batch due date is not a valid date.
SDOC0402 The location email is not valid.
SDOC0403 The location country is not valid.
SDOC0404 The location GLN is not valid.
SDOC0405 Document charge amount is not a valid number.
SDOC0406 Document charge percentage is not a valid number.
SDOC0407 Document charge percentage is not a valid percentage.
SDOC0408 Document charge VAT is required.
SDOC0409 The document charge amount is required.
SDOC0410 The document charge type is required.
SDOC0411 Document charge qualifier is invalid.
SDOC0412 The case package net price is not a valid number.
SDOC0413 This document destination (party buyer) was not found.
SDOC0414 This document destination (party buyer) cannot send this document type.
SDOC0415 This document destination (party buyer) cannot generate a certified document for this document type.
SDOC0416 This document destination (party buyer) must have VAT definitions in the system.
SDOC0417 This document destination (party buyer) must have document number range definitions in the system.

Register with the Portugal tax authority

Obtain the required NIF by registering with the Autoridade Tributária e Adueneira (AT).


Issue certified e-invoice

Issuing a certified e-invoice in Portugal is based on the Default business process, which follows this order: Validation, Invoice Creation, PDF Generation, Signing, and Legal Archiving. The following diagram provides a detailed overview:

Portugal outbound flow

Step 1: Supplier creates the Standard Business Document

Every invoice sent to Sovos must be part of a Standard Business Document (SBD). This document includes a Standard Business Document Header (SBDH) and a Sovos Document node, which in turn includes a Sovos Canonical Invoice (SCI). To create the SBD, follow the detailed instructions in the SBDH, Sovos Document, and SCI pages.

Here are some key elements that should be included in the SBD to create a document in the SCI format:

Node Required Attributes Value
StandardBusinessDocumentHeader.Sender.Identifier Yes Authority="PT" Supplier's NIF
StandardBusinessDocumentHeader.Receiver.Identifier Yes Authority="PT" Buyer's NIF
StandardBusinessDocumentHeader.DocumentIdentification.Standard Yes urn:oasis:names:specification:ubl:schema:xsd:Invoice-2
StandardBusinessDocumentHeader.DocumentIdentification.TypeVersion Yes 2.1
StandardBusinessDocumentHeader.DocumentIdentification.Type Yes Invoice
StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes

Child node Type: Country

Child node Identifier: PT

StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes

Child node Type: ProcessType

Child node Identifier: Outbound

StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes

Child node Type: CompanyCode

Child node Identifier : Supplier's NIF

StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes

Child node Type: SenderDocumentId

Child node Identifier: A unique document ID. We recommend the ERP document ID.

StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) Yes

Child node Type: SenderSystemId

Child node Identifier: The system ID configured in the backend. This parameter is used to determine which notifications are returned to the client and what attachments they include. If SenderSystemId is not configured on the client side, it will use the default value of "DefaultSystemERP". For more information, see this topic.

StandardBusinessDocumentHeader.BusinessScope.Scope (with child nodes) No

Child node Type: BusinessCategory

Child node Identifier: B2B

StandardBusinessDocumentHeader.BusinessScope.Scope.BusinessService.BusinessServiceName Yes Default
SovosDocument.SovosCanonicalInvoice.Invoice Yes SCI
Note:

Include all the mandatory nodes, as specified in the SBDH schema. If you cannot provide the information and the respective mandatory node is not mentioned on the current page, for example the receiver.identifier, you can leave the node empty but you must still include it in the SBDH.

SBD sample
Below is a sample of the SBD. In addition, there's a full sample of the SBD on the Postman Samples page.
CODE
<sbd:StandardBusinessDocument xmlns="http://uri.etsi.org/01903/v1.4.1#" xmlns:sbd="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:ad="http://www.sovos.com/namespaces/additionalData" xmlns:sci="http://www.sovos.com/namespaces/sovosCanonicalInvoice" xmlns:svs="http://www.sovos.com/namespaces/sovosDocument" xmlns:sov="http://www.sovos.com/namespaces/sovosExtensions" 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:leg="http://www.sovos.com/namespaces/sovosExtensions/LegalExtension" xmlns:inv="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader file:///C:\Users\helder.barbosa\OneDrive - Sovos Compliance\Sovos\Sovos XSDs\Sovos Document/StandardBusinessDocumentHeader.xsd">
<sbd:StandardBusinessDocumentHeader>
	<sbd:HeaderVersion>1.0</sbd:HeaderVersion>
	<sbd:Sender>
		<sbd:Identifier Authority="PT">999999999</sbd:Identifier>
	</sbd:Sender>
	<sbd:Receiver>
		<sbd:Identifier Authority="PT">999999999</sbd:Identifier>
		<sbd:ContactInformation>
			<sbd:Contact/>
			<sbd:EmailAddress/>
			<sbd:FaxNumber/>
			<sbd:TelephoneNumber/>
			<sbd:ContactTypeIdentifier/>
		</sbd:ContactInformation>
	</sbd:Receiver>
	<sbd:DocumentIdentification>
		<sbd:Standard>urn:oasis:names:specification:ubl:schema:xsd:Invoice-2</sbd:Standard>
		<sbd:TypeVersion>2.1</sbd:TypeVersion>
		<sbd:InstanceIdentifier>100002</sbd:InstanceIdentifier>
		<sbd:Type>Invoice</sbd:Type>
		<sbd:MultipleType>false</sbd:MultipleType>
		<sbd:CreationDateAndTime>2023-10-31T00:00:00Z</sbd:CreationDateAndTime>
	</sbd:DocumentIdentification>
	<sbd:BusinessScope>
		<sbd:Scope>
			<sbd:Type>Country</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>PT</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>CompanyCode</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>999999999</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>SenderDocumentId</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>1003432234</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>SenderSystemId</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>SystemERP</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>ProcessType</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>Outbound</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>BusinessProcess</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:BusinessService>
				<sbd:BusinessServiceName>Default</sbd:BusinessServiceName>
			</sbd:BusinessService>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>BusinessCategory</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>B2B</sbd:Identifier>
		</sbd:Scope>
		<sbd:Scope>
			<sbd:Type>Version</sbd:Type>
			<sbd:InstanceIdentifier/>
			<sbd:Identifier>1.0</sbd:Identifier>
		</sbd:Scope>
	</sbd:BusinessScope>
</sbd:StandardBusinessDocumentHeader>

Step 2: Supplier sends the SBD to Sovos

The supplier sends a POST request to the /documents endpoint.

The request must include the following request body parameters:

Name Type Required Description
data string Yes The Base64-encoded SBD from step 1
dataEncoding string Yes Use "base64"
Request sample
JSON
curl --location --request POST 'https://api-test.sovos.com/v1/documents' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--header 'x-correlationId: SET-TO-UNIQUE-VALUE' \
--data-raw '{
	"data": "PD9...de4=",
	"dataEncoding" : "base64"
}'
Response sample
JSON
{
    "timestamp": 1605282724079,
    "status": 202,
    "success": true,
    "message": "Document Received",
    "data": {
        "documentId": "3ad...af"
    }
}

Step 3: Validation

Sovos performs the necessary semantic, syntactic, and legal validations. In addition, Sovos performs a schema validation to make sure that the XML file conforms to the expected structure, comparing it with the official schema. A failed validation can result in the errors from this list and, in that case, the Certified e-invoicing process will be canceled.

Step 4: Invoice creation

Sovos creates a certified e-invoice for which a document number is generated from the identified document number series. The resulting Código Único de Documento da AT (ATCUD) will include the document's sequential number. The data will be stored in the system, so it'll be available for generating the Standard Audit File for Tax purposes (SAF-T) report.

Step 5: Sovos generates the PDF

Sovos generates a PDF based on the contents of the XML file. While Sovos uses a default template to create the corresponding PDF, it is also possible to obtain a template that matches the issuer's look and feel. In either case, Sovos must always follow legal rules such as including the ATCUD and the QR code in the generated PDF.

Step 6: Signing

Sovos provides advanced digital signature for the issued certified e-invoice, with the Sovos digital certificate following the obligation to apply a qualified electronic signature (QES) or seal.

Sovos stores all certified invoice data for the legal period of at least ten years. Sovos also stores the signed generated PDF for the same legal period. This data is available for audit or consultation purposes.

Step 8: Supplier retrieves the application responses

Attachments configuration

You can access your attachments:

  • As binary data, so the file is embedded in the Base64-encoded application response.

  • As open download links, in which the response contains a public URL to download the file.

  • As secure download links, in which you need to use the Indirect Tax API's bearer token to download the attachment.

By default, Sovos configures your attachments as open download links to avoid potential size limitations when retrieving responses. To improve security, you should configure them as secure links. Then, make a GET call to the secure link returned by the Indirect Tax API, and include the API token. Sample request:

CODE
curl --location 'https://einvoicing-api.sovos.com/download/api/v1/download/JqYyqliXiJFKhXshnBQZfW3qpfwATVGE5Q73T41JUynNLJD8zHy5VH__9qzL9No-Kia9olSw3_lNX3KmaA9Je89Xx--vk5pQjyKx0iT_4CwPSABD0Yg7uxXZ8SNiliEhFY-4TOX7m1TV5FwwfqntehbGaiGMI2JVYu18VBDiC_0/plain%27 \
--header 'Authorization: Bearer TOKEN'

As a response to the initial sending of the document, the client receives a JSON response message with an HTTP status code of 202 (asynchronous transaction). This means that the supplier must retrieve the application responses that become available during the transaction, which provide status information and a URL to access the PDF.

To complete a transaction, the supplier must retrieve application responses until the SCIResponseCode in the response has the value of either "AP" or "RE", which indicates that the transaction is finished. A successful transaction will generate these application responses:

# SCICloudStatusCode SCIResponseCode
1 209 AP
2 401 RE

The supplier can use the following Indirect Tax API endpoints to retrieve application responses:

  • GET /notifications/PT

  • GET /documents/PT/{documentId}/notifications

GET /notifications/PT
The supplier can send a GET request to the /notifications/PT endpoint to retrieve application responses that match the configured search criteria. To make this request, set the following query parameters:
Name Type Required Default Description
taxId string No

Include only notifications related to the specified taxId. This value is related to the CompanyCode in the SBDH.

page integer No 1 To specify the page to be returned, use a value between 1 and 10.
perPage integer No 10

To specify the number of results for the returned page, use a value between 1 and 100.

Important:

If the attachment file is configured to return binary content instead of a link, use only values between 1 and 10.

sourceSystemId string Yes Include only notifications related to documents that originate from the given source system. This value is related to the SenderSystemId in the SBDH.
includeAcknowledged boolean No false Use "true" to include previously acknowledged notifications in the result.
Request sample
JSON
curl --location --request GET 'https://api-test.sovos.com/v1/notifications/PT?page=1&perPage=2&includeAcknowledged=true&taxId={taxId}&sourceSystemId={sourceSystemId}&includeBinaryData=true&processType=0' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--header 'x-correlationId: SET-TO-UNIQUE-VALUE'
Response sample
JSON
{
    "status": 200,
    "message": "Notifications Listed",
    "success": true,
    "timestamp": 1708537586642,
    "data": {
        "pageState": {
            "page": 1,
            "perPage": 2,
            "totalEntries": 1,
            "totalPages": 1
        },
            {
                "notificationId": "b0a9c81a-...9b29-e7a693da0ecd",
                "correlationId": "rrt-...-21916838-1",
                "appPrefix": "sph",
                "metadata": {
                    "productId": "pt_temp__1.0",
                    "documentId": "DOCUMENT-ID",
                    "erpDocumentId": "ERP-DOCUMENT-ID",
                    "erpSystemId": "SystemERP",
                    "processType": "0",
                    "taxId": "999999999",
                    "sciCloudStatusCode": "209",
                    "sciResponseCode": "AP",
                    "sciStatusAction": "NOA"
                },
                "content": "PD..g==",
                "createdDate": 1708008887925
            }
        ]
    }
}
GET /documents/PT/{documentId}/notifications
The supplier can send a GET request to the /documents/PT/{documentId}/notifications endpoint to retrieve application responses related to a single document. To make this request, set the following parameter:
Name Type Required Parameter type Default Description
documentId string Yes Path The document ID returned in step 2
includeAcknowledged boolean No Query false Use "true" to include previously acknowledged notifications in the result
includeBinaryData boolean No Query false Use "true" to include the binary data of the XML and PDF in the application response
Request sample
JSON
curl --location --request GET 'https://api-test.sovos.com/v1/documents/PT/{documentId}/notifications?includeAcknowledged=true&includeBinaryData=true' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--header 'x-correlationId: SET-TO-UNIQUE-VALUE'
Response sample
JSON
{
    "timestamp": 1633687728708,
    "status": 200,
    "success": true,
    "message": "Notifications Listed",
    "data": {
        "pageState": {
            "page": 1,
            "perPage": 2,
            "totalPages": 1,
            "totalEntries": 1
        },
        "notifications": [
            {
                "createdDate": 1629824492,
                "metadata": {
                    "productId": "pt_temp__1.0",
                    "documentId": "3add2b7104dc0049ff0bf410f57e0a19afaf",
                    "erpDocumentId": "80257087",
                    "erpSystemId": "SystemERP",
                    "processType": "0",
                    "taxId": "999999999",
                    "sciCloudStatusCode": "200",
                    "sciResponseCode": "AP",
                    "sciStatusAction": "NOA"
                },
                "appPrefix": "SPH",
                "notificationId": "da3095da-f974-420c-bce2-e33682692276",
                "content": "PEF...c2U+"
            }
        ]
    }
}

Step 9: Supplier marks the application responses as acknowledged

The supplier must process the retrieved application responses and mark them as acknowledged. This can be done by sending a PUT request to the /notifications/PT endpoint.

To make this request, use the following request body parameters:

Name Type Required Description
status string Yes Use "read"
notificationId string Yes The notification ID
Note: You can acknowledge multiple notificationId values in one Indirect Tax API call by including them in a single request.
Request sample
JSON
curl --location --request PUT 'https://api-test.sovos.com/v1/notifications/PT' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--header 'x-correlationId: SET-TO-UNIQUE-VALUE' \
--data-raw '[
    {
        "status": "read",
        "notificationId": "51341d39-fd3e-4dcf-aea3-a73d73e0de76"
    }
]'
Response sample
JSON
{
    "timestamp": 1601673284,
    "status": 200,
    "success": true,
    "message": "Notifications acknowledged successfully."
}

Step 10: Supplier sends the invoice

As the final step, the supplier should send the invoice and optionally the PDF to the buyer using an agreed-upon channel.