Skip to content
On this page

Attach documents to a shipment

To attach documents to a shipment, you must use the POST method on the /v1/shipments/{identification}/attachments route.

The identification parameter can be the shipment ID or the tracking code.

  • Shipment Id : always returns in the shipment_id field
  • Shipment Tracking: always returns in the tracking_code field

Endpoint: /v1/shipments/{id}/attachments

http
POST /v1/shipments/{identitication}/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: application/json
Accept: application/json

{ json | formData }

This method supports sending binary files in the multipart/form-data format or public urls via json application/json.

Obs: The URL parameter id can be the shipment ID or the tracking code.

Parametros:

PropertyRequiredTypeDescription
attachmentsYArrayArray
document_codeNStringIf attachment is a document
file_nameYStringFile name
urlYIntegerFile Public URL

Example request

Send json with urls:

http
POST /v1/shipments/1/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: application/json
Accept: application/json

{
    "attachments" : [
        {
            "url" : "https://tristarexpress.com/wp-content/uploads/2022/07/AF_logotipo_tristar_EXPRESS_NEGATIVO.png",
            "document_code" : "DOCUMENT"
        },
        {
            "url" : "https://tristarexpress.com/wp-content/uploads/2022/07/AF_logotipo_tristar_EXPRESS_NEGATIVO.png",
            "file_name" : "CPF.png",
            "document_code" : "DOCUMENT"
        }
    ]
}

Send binary files:

http
POST /v1/shipments/1/attachments HTTP/1.1
Host: sandbox.tristarexpress.com
Content-Type: multipart/form-data
Accept: application/json

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[0][file]"; filename="Arquivo.png"
Content-Type: <Content-Type header here>

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[0][document_code]"

DOCUMENT
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[1][document_code]"

DOCUMENT
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="attachments[1][file]"; filename="Arquvio2.png"
Content-Type: <Content-Type header here>

(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--