> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.milenow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.milenow.com/_mcp/server.

# Create Order Optional Merchant Id

POST https://lastmile.milenow.com/index.php/api/v1/partners/order/create

Reference: https://docs.milenow.com/api-reference/order/post-app-apiv-1-trackingapi-createorderwithoutmerchant

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `access_token` (string, optional) — Access Token (Required)
- `tracking_no` (string, optional) — Tracking no (Optional)
- `reference_id` (string, optional) — Reference id (Optional)
- `agent` (string, optional) — Agent Name (Optional)
- `merchant_name` (string, optional) — Merchant Id/Name (Optional)
- `merchant_location_id` (integer, optional) — Branch/Merchant Location Id (Optional)
- `customer` (string, optional) — Customer Name (Required)
- `contact_person` (string, optional) — Contact Person Name (Optional)
- `phone` (string, optional) — Customer phone (Required)
- `city` (string, optional) — City (Required)
- `customer_address` (string, optional) — Customer Address (Required if lat, long not provided)
- `customer_address_lat` (double, optional) — Customer Latitude (Optional)
- `customer_address_lon` (double, optional) — Customer Longitude (Optional)
- `is_pickup` (integer, optional) — is Pickup possible values are 1,0 (Required)
- `pickup_address` (string, optional) — Pickup Address (Required if is_pickup=1)
- `pickup_address_lat` (double, optional) — Pickup Latitude (Optional)
- `pickup_address_lon` (double, optional) — Pickup Longitude (Optional)
- `receiver_address` (string, optional) — Receiver Address (Required if is_pickup=1)
- `receiver_address_lat` (double, optional) — Receiver Latitude (Optional)
- `receiver_address_lon` (double, optional) — Receiver Longitude (Optional)
- `receiver_name` (string, optional) — Receiver Name (Required if is_pickup=1)
- `external_customer_code` (string, optional) — Add Customer code if you make new customer or you enter the route id.
- `area` (string, optional) — Add area
- `block` (string, optional) — Add block
- `address_id` (string, optional) — Add address Id if you make new customer
- `receiver_phone` (string, optional) — Receiver Phone (Required if is_pickup=1)
- `receiver_postcode` (string, optional) — Receiver Postcode (Optional)
- `receiver_city` (string, optional) — Receiver city (Optional)
- `cod` (double, optional) — Cash on Delivery Amount (Optional)
- `total_amount` (double, optional) — Total Amount (Optional)
- `description` (string, optional) — Order Description/Notes for Driver (Optional)
- `payee` (enum, optional) — Payee possible values are S,R (Required) S means sender will pay and R means Receiver will pay
  - Allowed values: `S`, `R`
- `is_same_day_delivery` (enum, optional) — is same day delivery possible values are 1,0 (Required)
  - Allowed values: `0`, `1`
- `is_foc` (enum, optional) — is free of charge possible values are 1,0 (Required)
  - Allowed values: `0`, `1`
- `deliver_on` (date, optional) — Order Deliver DateTime Format will be 2020-06-24 (Required)
- `deliver_on_time_from` (string, optional) — Order Deliver Time From Format will be hh:mm (24 hours)
- `deliver_on_time_to` (string, optional) — Order Deliver Time To Format will be hh:mm (24 hours)
- `deliver_on_time_from_utc` (string, optional) — Order Deliver Time From Format will be UTC
- `deliver_on_time_to_utc` (string, optional) — Order Deliver Time To Format will be UTC
- `pickup_datetime_from` (string, optional) — Order Pickup Date Time From Format will be 2021-12-25 hh:mm (24 hours)
- `pickup_datetime_to` (string, optional) — Order Pickup Date Time To Format will be 2021-12-25 hh:mm (24 hours)
- `payment_term_id` (integer, optional) — Use Payment term api to get payment term id.
- `route_id` (integer, optional) — Use routes api to get route id.
- `order_id` (integer, optional) — Order ID. Used only when is_update=1 to locate the order to update
- `is_update` (enum, optional) — is Update possible values are 1,0. If value is 1 the order is located by order_id, else tracking_no, else reference_id and must belong to the same company. Only deliver_on, deliver_on_time_from/to, pickup_datetime_from/to and description are updated. Order items, status, driver assignment and customer are left untouched
  - Allowed values: `0`, `1`
- `product_items` (string, optional) — Product Items in JSON format. Required format: \[\{"externalProductCode":"xxx","qty":2,"unitPrice":10}] or \[\{"product\_name":"xxx","qty":2,"product\_base\_price":10,"product\_tax":5}]
- `address_id` (string, optional) — customer address ID
- `customer_group_id` (integer, optional) — Customer Group ID (Optional) 1:Direct, 2:Indirect
- `is_prepaid` (integer, optional) — is Prepaid possible values are 1,0
- `customer_type_id` (integer, optional) — Customer Type: 1 = Individual Customer, 2 = Corporate Customer, 3 = Watchman, 4 = Supermarket, 5 = Abraaj FOC, 6 = Co-Packing, 7 = Co-operatives, 9 = E-commerce, 10 = Horeca, 12 = Mabara, 13 = Modern Trade, 14 = Mosques, 15 = Staff account

## Response

### 200

Returns order object with id, trackingNo, referenceId, createdBy, locality, customer, pickupAddress, receiverAddress, items

## Examples

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://lastmile.milenow.com/index.php/api/v1/partners/order/create"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://lastmile.milenow.com/index.php/api/v1/partners/order/create';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://lastmile.milenow.com/index.php/api/v1/partners/order/create"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://lastmile.milenow.com/index.php/api/v1/partners/order/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://lastmile.milenow.com/index.php/api/v1/partners/order/create")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://lastmile.milenow.com/index.php/api/v1/partners/order/create', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://lastmile.milenow.com/index.php/api/v1/partners/order/create");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://lastmile.milenow.com/index.php/api/v1/partners/order/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```