Document

Endpoints relating to Document objects

List document objects

Returns a list of all documents associated with shipments

Request
query Parameters
page
integer >= 1
Default: 1

Page number of the page to retrieve

Example: page=1
per
integer [ 1 .. 100 ]
Default: 20

Count of items in each page. Should be between 1 and 100 (inclusive)

Example: per=20
f.shipment.id
string

Filters the list for documents that belong to the given shipment

f.document_type
string

Filters the list for documents that are the given type

f.archived_at.exists
string

Filters the list for documents that have been archived

f.uploaded_at.gt
string

Filters the list for documents that where uploaded after the given time

f.uploaded_at.lt
string

Filters the list for documents that where uploaded before the given time

f.uploaded_at.gte
string

Filters the list for documents that where uploaded on or after the given time

f.uploaded_at.lte
string

Filters the list for documents that where uploaded on or before the given time

Responses
200

collection of documents

Response Schema: application/json
_object
string
self
string
version
integer
object
_object
string
prev
string or null
next
string or null
total_count
integer
Array of objects (Document)
400

error

get/documents
Response samples
application/json

Success

{}

Create a document

Create a new document for this client using the request payload

Request
Request Body schema: application/json
required
file_name
required
string

Name of the document.

mime_type
required
string

A two type descriptor describing the media type associated with the document.

document_type
required
string

Type of document.

memo
string

Document memo or message.

document
required
string

Document represented in a strict Base64-encoded string.

user_email
string

Email of the user that will be listed as the document's uploader. If omitted, it will default to the company's admin.

shipment_id
required
integer

Corresponding shipment for the document.

Responses
200

Created

Response Schema: application/json
_object
string
self
string
version
integer
object (CreateDocument)
file_name
required
string

Name of the document.

mime_type
required
string

A two type descriptor describing the media type associated with the document.

document_type
required
string

Type of document.

memo
string

Document memo or message.

document
required
string

Document represented in a strict Base64-encoded string.

user_email
string

Email of the user that will be listed as the document's uploader. If omitted, it will default to the company's admin.

shipment_id
required
integer

Corresponding shipment for the document.

400

error

post/documents
Request samples
application/json
{
  • "file_name": "Flexport-Booking.pdf",
  • "mime_type": "application/pdf",
  • "document_type": "packing_list",
  • "memo": null,
  • "document": "SGVsbG8sIFdvcmxkIQ==",
  • "user_email": "johndoe@flexport.com",
  • "shipment_id": 1234567
}
Response samples
application/json

Success

{}

Retrieve a document

Retrieves the details of a single document.

Request
path Parameters
id
required
string

The unique id for the requested document

Responses
200

Success

Response Schema: application/json
_object
string
self
string
version
integer
object (Document)
_object
string

Type of the object. Always /document for this object.

id
string <string>

Unique identifier for the document

file_name
string
document_type
string <string>

Type of the document.

memo
string or null

A short message or description about the document

file_link
string <uri>

The link that can be used to download the file.

archived_at
string or null <date-time>

Date-time string when this document was archived. Null if not archived.

object (FileMetadata)
object (ShipmentRef)
400

error

get/documents/{id}
Response samples
application/json

Success

{}

Download a document

Retrieves the contents of a specified file. Returns the file as a stream of bytes.

Request
path Parameters
id
required
string

The unique id for the requested document

Responses
200

Success

Response Schema:
string <binary>
400

error

get/documents/{id}/download
Response samples
application/json
{}