All Collections
Last Mile API
Creating a delivery
Creating a delivery
Sam Forde avatar
Written by Sam Forde
Updated over a week ago

Create a delivery request that sends an order to your service.


Create delivery

When an order is completed, our app will process it. As a part of our order processing, we send the order to you. The processing is usually instantaneous, though if the webhook fails we will send the order in up to 10 minutes from order creation. To format the Create delivery request:

  1. Go to the App Setup page.

  2. Click Create delivery.


Format the create delivery API endpoint

Create delivery request is a POST to an endpoint of your choice. We will use your Staging/Production endpoint as the base, so you only need to add the missing path to your Create delivery endpoint.

If your Create delivery endpoint is completely different from the general endpoint, ensure you include https:// in the URL.


Format the create delivery request

The format of the request body needs to be valid JSON. We support liquid variables that are on our create delivery list, and you can use any liquid filter. Here’s an example request that will be prefilled automatically for you:

Line item schema

If you need line items in your request, create the JSON for one line item in the Line item schema section. You can then pass the array of line items in the request body by using the ##{{ line_items }} liquid variable.


Create a delivery response

Delivery ID

Your Create delivery response should have a "key" : "value" pair containing a unique identifier for a delivery order. Please enter the key from that key-value pair in the Delivery ID field. We will use it when checking order status updates or cancelling an order, and you can access it through the ##{{ courier.delivery.id }} variable.

Tracking details

In the Tracking number field, please enter the key from the response that contains your tracking number. In the Tracking URL field, please enter the key that contains your tracking URL. We will attach the tracking number and the URL when we process the order, if the merchant has enabled tracking details.

If you don’t want to offer tracking details, leave both fields blank.


Merchant perspective

When merchants connect to your service, they can choose:

  • Which locations in Zapiet - Pickup + Delivery will use your service

  • Whether they want to use tracking details

Selecting a location

Merchants can have only one LMD provider per Zapiet - Pickup + Delivery location, and they can choose which locations each provider should serve.

If the merchant is already using an LMD provider for a location, the location will be greyed out.

Selecting tracking details

If you left tracking details in your Create delivery request blank, this section will not show. Merchant can select whether they want to

  • Add tracking details

  • Send tracking details to the customer

If Add [LMD provider name] tracking details to Shopify order is enabled, we will automatically fulfil the order when processing it. This allows us to add the tracking number to the order and then poll your service for the order status. If Send tracking details to customer is enabled, we will send a Shipping confirmation email to the customer when fulfilling the order. That way the customer can get the tracking number and the tracking URL.


Testing create delivery

If you have only one key in the authentication header, you can test the Create delivery request from the comfort of Zapiet Partners.

  1. Go to App setup.

  2. Click Create delivery.

  3. Click Test request.

  4. Enter your API key in the API key field.

  5. Click Preview request.

You should now see the preview request you formatted earlier, with sample data instead of liquid variables. Click Send request and you’ll see the response from your service.


Let’s see how the delivery status works next.

Did this answer your question?