Files

A file resource can represent all kinds of files like shipment labels, available in different file formats.

File

Attribute

Description

document_type

Category the file belongs to, for example label or invoice.

formats

List of Format objects holding the extension and mime type in which the file is available.

Format

If you request a file using the default Accept header application/vnd.api+json, you will get a list of the supported formats of that file. This list can contain the following mime types:

  • application/pdf

  • application/zpl

  • image/png

  • text/csv

Warning

The shipment label file will become available in the format you have specified, by default this will be the first label format defined on the carrier resource, most likely application/pdf. If you use a Zebra printer and want the label file in application/zpl, you need to specify this in the request meta when creating the shipment.

Retrieve a file in a specific format

Use one of the available formats in the Accept header to retrieve the actual file as binary data. For example:

GET /files/a9e3852c-b8b2-4066-a32a-651ea661ba30 HTTP/1.1
Accept: application/pdf

The response will be of the same mime type and contain the raw file data.

HTTP/1.1 200 OK
Content-Type: application/pdf

%PDF-1.4 [...] %%EOF