Description of usage of APIs to upload a file, attaching it to an order, downloading an order attachment, as well as deleting an attachment from an order.
Scenario
- Carrier and shipper are both present on Trans.eu platform
- The Shipper has assigned an Order to a Carrier
- The Order is not cancelled nor archived
Authorize access
Before it is possible to send any request, user needs to authorize access.
- client app was registered using registration form
- external app was granted api keys (client_id and client_secret)
- authorization process has been implemented in external app
Uploading attachments
Before a file can be added to an order as an attachment, it has to be uploaded via the following endpoint to be identified with a media_id.
Endpoint
PUT https://api.platform.trans.eu/ext/media-storage-api/v1/assetsThe endpoint’s content type is multipart/form-data, and the available file types are listed below:
- JPG, GIF, PNG, BMP, PDF, ODT, DOC, TXT, DOCX, TIFF, ODS, XLS, XLSX, PPT, RTF
Response:
{
"id": "3e7272cd-e805-42c5-bd55-dd9b9a43bc38",
"path": "https://api.media-storage.service/v1/assets/3e7272cd-e805-42c5-bd55-dd9b9a43bc38",
"ttl": {
"validTime": "not specified",
"expirationDate": null
},
"file": {
"etag": "\"1a9f3ffe9b03568b7d65b5436431a38f\"",
"size": 43543,
"type": "image/jpeg",
"name": "cargo_photo.jpg",
"hash": {
"md5": "1a9f3ffe9b03568b7d65b5436431a38f",
"sha256": "390e2f4af92946e773fe0cdef6c25f694ae6844290cfb411daea8f677237b072"
},
"permissions": {
"isPublic": true,
"acl": {
"1158167": "OWNER",
"public": "READER",
"guest": "READER"
}
},
"image": {
"width": 363,
"height": 471
}
}
}Adding uploaded attachment to order
The uploaded file can be added as an attachment to the order via the following endpoint. The endpoint has the orderId as a path variable — the orderId can be obtained from the response of the endpoint here (if shipper) and here (if carrier).
Endpoint
POST https://api.platform.trans.eu/orders-api/v1/orders/{orderId}/attachmentsExample of use
https://api.platform.trans.eu/orders-api/v1/orders/{b093cdfe-12cf-4958-a5da-0170141e9c71}/attachmentsRequest example
{
"media_id": "3e7272cd-e805-42c5-bd55-dd9b9a43bc38",
"media_name": "damaged pallet",
"type_id": "cargo_photo",
"visible_to_contractor": true,
"description": "goods damaged on pallet due to accident"
}Downloading attachments
Any attachment of an order can be downloaded by providing the mediaId path variable with the following endpoint.
Endpoint
GET https://api.platform.trans.eu/ext/media-storage-api/v1/assets/{mediaId}The file will be provided in the response.
Deleting order attachments
To delete an attachment of an order, use the following endpoint. This endpoint requires two path variables — orderId and attachmentId, which is the same value as the aforementioned media_id.
Endpoint
DELETE https://api.platform.trans.eu/orders-api/v1/orders/:orderId/attachments/:attachmentIdExample of use
https://api.platform.trans.eu/orders-api/v1/orders/{b093cdfe-12cf-4958-a5da-0170141e9c71}/attachments/{3e7272cd-e805-42c5-bd55-dd9b9a43bc38}Important — only the user from the author company can remove attachments — for example, if a shipper attached a file to an order, the carrier is forbidden from removing the attachment as well as vice versa. This will result in a 403 error (Forbidden).
Getting attachmentId
If the attachmentId is unknown to the user, the information can be found in the response of one of the two endpoints:
For shipper:
GET https://api.platform.trans.eu/ext/orders-api/v1/orders-created/{order-id}For carrier:
GET https://api.platform.trans.eu/ext/orders-api/v1/orders-received/{order-id}Response example
Within the response for either of these endpoints, the following information can be found:
"attachments": [
{
"author": null,
"company": {
"legal_name": "(P3DT) CargoON Test",
"company_id": 1079411
},
"created_at": "2026-05-15T13:55:59.514Z",
"description": "goods damaged on pallet due to accident",
"media_id": "3e7272cd-e805-42c5-bd55-dd9b9a43bc38",
"media_name": "damaged pallet",
"protected": false,
"source": "orders",
"source_id": null,
"type_id": "cargo_photo",
"visible_to_contractor": true
}
],The media_id value corresponds to the attachmentId value.