LastMile Delivery
Welcome to the Lastmile Delivery API documentation.
LastMile is an independent delivery service in Denmark.
We hope the integration will be easy and if you have any questions, please direct them to soren@lastmile.nu
What can I do with the API?
The API will grant you access the LastMile delivery system. You need to be either a client or a partner. Once a partner or a client you will receive an API-token.
What is the difference between a partner and a client?
A client is a single business who needs a delivery service. The client either orders the driver manually or is integrating LastMile delivery API to its webshop.
A partner has multiple clients who needs a reliable delivery a service. The Partner is in charge of the order flow for the client. The partner requests the delivery service on behalf of the client. The partner is in charge of billing the client as LastMile will send on combined invoice to the partner. Each client will get a unique API-token.
For ordering a courier to make a pickup, you need to send this post request. The pickup information is automatically deducted from the API-token used (each client (pickup place) needs its own token)
If the wanted time is not possible, the order will be pushed into the future. You will be notified that the order is pushed and you will receive the time the courier arrives. If the time is not acceptable, you need to cancel the pickup.
Address If you already have the latitude and longitude of the customer, please send them along. This can avoid some errors.
Request parameters
The name of person who is receiving the order
The telephone number of the person receiving the order. Our courier needs to get a hold of the customer from time to time
Our courier needs to know where to deliver the order
The zip code of address of the person receiving the order
The corresponding city to the zip code
Country where the address is locate. Please write in local tounge. (Danmark, Sverige, Norge)
The time where the order should be picked up at the pickup-site. either: HH:II or YY-MM-DD HH:II for future orders
if the paid = false, the order is not paid and the restaurant must charge the customer in the store
If you use the LastMile iPad solution where the order content is displayed, use this to distinguish orders that are for delivery and orders where the end customer will come pick it up. 1=Delivery, 0=Self pickup. Default value is 1
If you use the LastMile iPad solution where the ordercontent is displayed,wrap the order content in json and send it
your own id of the order (The order id you send to the restaurant)
To indicate if the restaurant handles the delivery them self
Request headers
application/json
Insert correct Bearer token here
Responses
If succesfull
Body
if successfull the error will be false
Here is where it gets interestring
if we cannot arrive at the requested time, this will be true.
In rare cases, we will offer an earlier time. Push will be true and early will be true. This is currently disabled.
The requested time send.
The time the courier arrives at the pickup place
The time the courier is expected to arrive at the person with the order
The distance from pickup to dropoff in meters
The price. This price is individual based on the clients. This is the price LastMile will charge the client or partner
If early is true, this will be presented. Otherwise this will be null
the next possible pickup
Arrival at dropoff site
This string is unique for this delivery. Keep it. You will need it if you have to cancel or recieve updates regarding the delivery.
Forgot the Bearer token ?
Body
You get this kind of error if something is wrong. Check the message
Body
If you need to cancel a delivery, this is how you do it. When you created the delivery, you received a ‘uid’. You need that to cancel the delivery. The motivation for using a ‘uid’ instead of just the id is a security measure.
Remember in order to freely cancel the delivery, the cancellation must be done 20 minutes before the pickup_time.
Request parameters
Insert the uid you got upon creating the delivery request
Request headers
Inset your bearer token here
Responses
excelent - delivery canceled
Body
If you need a detailed list of the deliveries from a specific client, simply send the start and end date in the format YYYY-MM-DD. Both dates are included in the return. Here you can see all the timestamps recorded.
Request headers
Your clients api-token goes here!
The from date YYYY-MM-DD
The end date of the range. Must be larger than start
Responses
Body
This will be false
2019-02-15 20:00:00
If errors, you get http 400
Body
Here you get a message as to what the error is
You can qualify for becomming a partner if you are representing clientes who are requesting a delivery service.
If you wish a partnership, please contact: kenneth@lastmile.nu
As a partner, you can easilly add your clients to the system and start requesting deliveries on their behalf. The invoice for the deliveries will be send to you as a partner.
As a LastMile partner you can easily connect your new clients to the LastMile delivery platform and start offering delivery service right away. Send a post-request with the required parameters to add your client. Once added, you recieve a unique API-token paired to your client. The price structure is the same as the overall partner agreement.
Please let LastMile know when your client wishes to start the deliveries. We might need to adjust the amount of couriers to satisfy our client needs.
Request parameters
LastMile uses emails as identifier. In the future the client will also be able to login and see delivery details if needed.
LastMile need to know the name of the business
LastMile need the CVR.
LastMile need a contact person at the pickup place
LastMile need a telephone so that we can communitcate with the business incase of delay or changes
LastMile need to know where to go
LastMile need to know the zip code of the pickup location
The corrosponding cityname to the zipcode
The lastmile area. This is important to have correct.
If the city is in another country then you basecountry.
Request headers
Your api_token
Responses
Everything is perfect. you recieve the api_token and everything is good to go. Prices are set according to the initial partner agreement. The price can be changed using your browser.
Body
if you are missing something
Body
["Please provide an email. Its used as a unique identifier. We wont spam. promise!"]
["Please provide your clients business name"]
You can use this, to get a list of all your clients. You can see the details you have entered of all your users
Request headers
Insert you personal (partner) api token
Responses
Body
Every now and then it is necessary to update client information. All the variables return from the Client-get can be updated. If you send empty variables or leave some out, they will not be updated.
If you ever need to delete a client, update the client setting the variable ‘deleted’ = 1
Request parameters
Responses
Use this to see how long time the delivery will take, the distance as well as the price.
if you already have the coordinates for the delivery address, please send them along. Then LastMile will use them insted.
Request parameters
Enter street aswell as house number!
Zip code belonging to the address
Country where the address is locate. Please write in local tounge. (Danmark, Sverige, Norge)
If you alread have the latitude, you can send it a long as well
If you alread have the longitude, you can send it a long as well
Responses
Body
The distance returned in meters
The delivery time in seconds
will be removed in time.
If you ever need to see how LastMile has divided the country/cities into areas, this is the one to use
Request headers
Your Barer token
Responses
When everything goes will you will receive the following response
Body
Odense has area 1, Aarhus 2… n will be announced later
Please make sure your token is correct.