# Order Document

The order documents endpoint allows managing documents associated with orders. Documents can be of type invoice or deliveryNote and must be in PDF format. The create and update operations require a base64 string representation of the document content.

# The order document resource

# JSON object

{
  "id": 548789787,
  "orderId": 13032291,
  "customerId": 1000050,
  "type": "deliveryNote",
  "fileName": "AN011738_DeliveryNote.pdf",
  "contentType": "appliction/pdf",
  "base64Content": "JVBERi0xLjQKJcOiw6PDj8....mVmCjQxMzIyCiUlRU9GCg==",
  "createdAt": "2024-05-13T12:41:38Z",
  "updatedAt": "2024-05-13T12:41:38Z"
}

# Properties

  • id int32 - read-only
    The id of the document.

  • orderId int32 - read-only
    The id of the order the document belongs to.

  • customerId int32 - required
    The id of the customer the document belongs to.

  • type string - required
    The type of the document. Allowed values: invoice, deliveryNote.

  • fileName string (length 3 - 50 chars) - required
    The name of the file.

  • contentType string - required
    The content type of the document. Only application/pdf is allowed.

  • base64Content string - required
    The base64 encoded content of the document.

  • createdAt date (ISO 8601) - read-only
    The date the document was created.

  • updatedAt date (ISO 8601) - read-only
    The date the document was last updated.

# POST - Create an Order Document

Requires scope Order.Document.Write

Use this operation to create a document for an order. Ensure that there is no existing document with the same fileName related to the same order and client.

curl -X POST \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "customerId": 1000050,
        "type": "deliveryNote",
        "fileName": "AN011738_DeliveryNote.pdf",
        "contentType": "appliction/pdf",
        "base64Content": "JVBERi0xLjQKJcOiw6PDj8....mVmCjQxMzIyCiUlRU9GCg==",
      }'

Responses

  • 201 - Created
    The document was created successfully. Returns the created document resource.

  • 400 - Bad Request
    Returns a problem details JSON object.

# GET - Retrieve a list of Order Documents

Requires scope Order.Document.Read or Order.Document.Write

Use this operation to retrieve a list of documents for a specific order.

curl -X GET \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents' \
  -H 'X-API-KEY: YOUR_API_KEY'

Parameters

  • orderId int32 - required
    The order id.

  • type string
    Filter documents by type. Allowed values are: invoice, deliveryNote.

  • fileName string
    Filter documents by file name.

  • contentType string
    Filter documents by content type. Only application/pdf is allowed.

  • createdAtMin date (ISO 8601)
    Show documents created after a specific date.

  • createdAtMax date (ISO 8601)
    Show documents created before a specific date.

  • updatedAtMin date (ISO 8601)
    Show documents updated after a specific date.

  • updatedAtMax date (ISO 8601)
    Show documents updated before a specific date.

  • page int32 (default: 0)
    The page number that contains the results. If not specified, the first page will be returned.

  • pageSize int32 (default: 50)
    The maximum number of results returned per page. Value must be between 1 and 250.

Responses

  • 200 - OK
    Returns a list of document resources.

# GET - Retrieve a specific Order Document

Requires scope Order.Document.Read or Order.Document.Write

Use this operation to retrieve a document by specifying the order id and document id.

curl -X GET \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents/{id}' \
  -H 'X-API-KEY: YOUR_API_KEY'

Parameters

  • orderId int32 - required
    The order id.

  • id int32 - required
    The document id.

Responses

  • 200 - OK
    Returns the specific document resource.

  • 404 - Not Found
    The given document id hasn't been found.

# PUT - Update an Order Document

Requires scope Order.Document.Write

Use this operation to update properties of a document for a specific order.

curl -X PUT \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents/{documentId}' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "type": "string",
        "fileName": "string",
        "contentType": "string",
        "base64content": "string"
      }'

Parameters

  • orderId int32 - required
    The order id.

  • documentId int32 - required
    The document id.

Responses

  • 200 - OK
    The document was updated successfully. Returns the updated document resource.

  • 400 - Bad Request
    Returns a problem details JSON object.

  • 404 - Not Found
    The given document id hasn't been found.

# Examples

In this example the order document content is replaced by a new content.

curl -X PUT \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents/{documentId}' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "type": "deliveryNote",
        "fileName": "AI01_DeliveryNote.pdf",
        "contentType": "application/pdf",
        "base64Content": "ajshshdkajhHHAALDKJFALSDJ....mVmCjQxMzIyCiUlRU9GCg=="
      }'

# DELETE - Delete an Order Document

Requires scope Order.Document.Delete

Use this operation to delete a document for a specific order.

curl -X DELETE \
  'https://{domain}.logistic.cloud/api/{version}/orders/{orderId}/documents/{documentId}' \
  -H 'X-API-KEY: YOUR_API_KEY'

Parameters

  • orderId int32 - required
    The order id.

  • documentId int32 - required
    The document id.

Responses

  • 200 - OK
    The document was deleted successfully. Returns true.

  • 404 - Not Found
    The given document id hasn't been found.