# Sending attachments

## Attachment

Within SCSN, and UBL, documents are defined using the *Attachment*-element. This element is reused in all SCSN messages and is shown in the figure below. It is possible to define a document in two ways, namely: physically embed the document inside the *Embedded document binary-*&#x65;lement using a base64 binairy-to-text encoding, or refer to the location of the document using the *External reference*-element. The latter is used when the document can be found on an external server/portal and should be automatically/manually downloaded from this location. The latter option is preferred when the documents have a relatively large size when the same document is send multiple times over time, e.g. within multiple order messages.

![The Attachment-element](https://2328835143-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LquTHQI9fx-hOEUQGiB%2F-LtyjSddmdzmXxcRi8_n%2F-Lu2-ySg2fdpGiLJ7I0h%2Fimage.png?alt=media\&token=f34bef61-3df4-45e7-8550-eb9836dbb597)

## Order messages and Technical Product Data (TPD)

The order and order response 2.0 messages contain in total three ways to add attachments. The following overview shows how to use these methods.&#x20;

* **Order.Additional Document reference** is used for sending documents which are relevant for the complete order. Some examples are: Non-Disclosure Agreement (NDA) or a PDF Order (which is not encouraged).&#x20;
* **Order.OrderLine.Document reference** is used for sending documents which are relevant on line level, not on item level (see below), an example is a contract reference.&#x20;
* **Order.Orderline.LineItem.Item** is used for sending documents which are specific on item level, and replaces the Technical Product Data element of the Order 1.1 message. This element is mainly used for sending technical product data/specifications. It is possible to use this field in two ways:&#x20;
  * Directly refer/embed one or multiple files&#x20;
  * Refer to a TPD Package Message. This is a separate SCSN message which is used to send a package of several technical documents related to an item.&#x20;

![How to use Order.Orderline.LineItem.Item in two different ways ](https://2328835143-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LquTHQI9fx-hOEUQGiB%2F-LtyjSddmdzmXxcRi8_n%2F-Lu2-ZdjM1EJKM3KDht4%2Fimage.png?alt=media\&token=9663ab11-1dd2-43f0-821c-65cfc87f210f)

## Technical Product Data (TPD) Package Message

As mentioned in the previous section, SCSN contains a separate message for sending a package of technical documents. The [TPD Package 1.0 messag](https://smartconnected.semantic-treehouse.nl/#/TreeView/Message_1571046195_00383560)e is shown below and supports one or multiple [Attachments](#attachment), i.e. documents. Furthermore, this message contains additional functionality to specify certain attributes specific for the *Document*, such as an own *ID*, *Issue date*, *Document type*, and *Version*.  Moreover, the package itself contains a similar set of attributes, but additionally also contains a reference to an Item either via a *Buyers-, Sellers-,* or *StandardItemIdentification*. It should be noted that the package does not directly refer to an Orderline because it can be reused in multiple Orders and Orderlines.&#x20;

![TPD Package 1.0 Message](https://2328835143-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LquTHQI9fx-hOEUQGiB%2F-Lu23SLYRmsOpqKeX520%2F-Lu24P-WZnUn2kXgM2FN%2Fimage.png?alt=media\&token=c218b46c-3a4d-4aba-9f2b-abe039e87b0b)

## Using the measurement message

Besides adding an attachement, or sending a TPD message there is another way of sending files. The measurement message is intended to be used for sharing measurements of actual products, or certifications regarding a product as build. It does not define how these files should be structed due to this being highly use case dependend. The measurement message may be related to specific order lines or despatch lines to associate it with a product.

To attach a certificate or measurement file to the message an external reference (hyperlink) may be used, or it can be embedded and a mimCode can be provided.
