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

# 4. Create Shipment (Weight-Based)

POST https://api.impala-courier.com/api/public/shipments
Content-Type: application/json

Creates a shipment priced by weight. `amount` should match the value returned by **Calculate Pricing** for this weight/route — the server may reject mismatched amounts.

**Body parameters**
| Field | Type | Required | Description |
|---|---|---|---|
| senderName | string | Yes | Pickup contact name |
| senderPhone | string | Yes | E.164 format, e.g. +265991234567 |
| senderCity | string | Yes | Pickup city |
| receiverName | string | Yes | Delivery contact name |
| receiverPhone | string | Yes | E.164 format |
| receiverCity | string | Yes | Delivery city |
| serviceType | string | Yes | `standard` or `express` |
| declaredValue | number | Yes | Value of goods in MWK, for insurance purposes |
| amount | number | Yes | Shipping cost in MWK, from Calculate Pricing |
| weight | number | Yes | Package weight in kg |
| pricingType | string | Yes | Must be `weight_based` |
| description | string | Yes | Order/contents description |
| ecommerceOrderId | string | Yes | Your platform's order ID, for reconciliation |
| shopId | string | Yes | Your shop code, provided by Impala Courier |

Reference: https://docs.impala-courier.com/impala-courier-e-commerce-api/4-create-shipment-weight-based

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/public/shipments:
    post:
      operationId: 4-create-shipment-weight-based
      summary: 4. Create Shipment (Weight-Based)
      description: >-
        Creates a shipment priced by weight. `amount` should match the value
        returned by **Calculate Pricing** for this weight/route — the server may
        reject mismatched amounts.


        **Body parameters**

        | Field | Type | Required | Description |

        |---|---|---|---|

        | senderName | string | Yes | Pickup contact name |

        | senderPhone | string | Yes | E.164 format, e.g. +265991234567 |

        | senderCity | string | Yes | Pickup city |

        | receiverName | string | Yes | Delivery contact name |

        | receiverPhone | string | Yes | E.164 format |

        | receiverCity | string | Yes | Delivery city |

        | serviceType | string | Yes | `standard` or `express` |

        | declaredValue | number | Yes | Value of goods in MWK, for insurance
        purposes |

        | amount | number | Yes | Shipping cost in MWK, from Calculate Pricing |

        | weight | number | Yes | Package weight in kg |

        | pricingType | string | Yes | Must be `weight_based` |

        | description | string | Yes | Order/contents description |

        | ecommerceOrderId | string | Yes | Your platform's order ID, for
        reconciliation |

        | shopId | string | Yes | Your shop code, provided by Impala Courier |
      tags:
        - ''
      parameters:
        - name: X-API-Key
          in: header
          required: true
          schema:
            type: string
        - name: X-API-Key
          in: header
          description: Your shop's API key
          required: false
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/4. Create Shipment
                  (Weight-Based)_Response_201
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: integer
                shopId:
                  type: string
                weight:
                  type: number
                  format: double
                senderCity:
                  type: string
                senderName:
                  type: string
                description:
                  type: string
                pricingType:
                  type: string
                senderPhone:
                  type: string
                serviceType:
                  type: string
                receiverCity:
                  type: string
                receiverName:
                  type: string
                declaredValue:
                  type: integer
                receiverPhone:
                  type: string
                ecommerceOrderId:
                  type: string
              required:
                - amount
                - shopId
                - weight
                - senderCity
                - senderName
                - description
                - pricingType
                - senderPhone
                - serviceType
                - receiverCity
                - receiverName
                - declaredValue
                - receiverPhone
                - ecommerceOrderId
servers:
  - url: https://api.impala-courier.com
    description: https://api.impala-courier.com
components:
  schemas:
    ApiPublicShipmentsPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        amount:
          type: integer
        status:
          type: string
        trackingNumber:
          type: string
        ecommerceOrderId:
          type: string
      required:
        - amount
        - status
        - trackingNumber
        - ecommerceOrderId
      title: ApiPublicShipmentsPostResponsesContentApplicationJsonSchemaData
    4. Create Shipment (Weight-Based)_Response_201:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/ApiPublicShipmentsPostResponsesContentApplicationJsonSchemaData
        success:
          type: boolean
      required:
        - data
        - success
      title: 4. Create Shipment (Weight-Based)_Response_201
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

```

## Examples



**Request**

```json
{
  "amount": 8500,
  "shopId": "{{shopCode}}",
  "weight": 2.5,
  "senderCity": "Blantyre",
  "senderName": "John Doe",
  "description": "Order #12345 - Electronics",
  "pricingType": "weight_based",
  "senderPhone": "+265991234567",
  "serviceType": "standard",
  "receiverCity": "Lilongwe",
  "receiverName": "Jane Smith",
  "declaredValue": 50000,
  "receiverPhone": "+265987654321",
  "ecommerceOrderId": "SHOP-12345"
}
```

**Response**

```json
{
  "data": {
    "amount": 8500,
    "status": "pending_pickup",
    "trackingNumber": "IMP123456789012",
    "ecommerceOrderId": "SHOP-12345"
  },
  "success": true
}
```

**SDK Code**

```python 4. Create Shipment (Weight-Based)_example
import requests

url = "https://api.impala-courier.com/api/public/shipments"

payload = {
    "amount": 8500,
    "shopId": "{{shopCode}}",
    "weight": 2.5,
    "senderCity": "Blantyre",
    "senderName": "John Doe",
    "description": "Order #12345 - Electronics",
    "pricingType": "weight_based",
    "senderPhone": "+265991234567",
    "serviceType": "standard",
    "receiverCity": "Lilongwe",
    "receiverName": "Jane Smith",
    "declaredValue": 50000,
    "receiverPhone": "+265987654321",
    "ecommerceOrderId": "SHOP-12345"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 4. Create Shipment (Weight-Based)_example
const url = 'https://api.impala-courier.com/api/public/shipments';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"amount":8500,"shopId":"{{shopCode}}","weight":2.5,"senderCity":"Blantyre","senderName":"John Doe","description":"Order #12345 - Electronics","pricingType":"weight_based","senderPhone":"+265991234567","serviceType":"standard","receiverCity":"Lilongwe","receiverName":"Jane Smith","declaredValue":50000,"receiverPhone":"+265987654321","ecommerceOrderId":"SHOP-12345"}'
};

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

```go 4. Create Shipment (Weight-Based)_example
package main

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

func main() {

	url := "https://api.impala-courier.com/api/public/shipments"

	payload := strings.NewReader("{\n  \"amount\": 8500,\n  \"shopId\": \"{{shopCode}}\",\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"senderName\": \"John Doe\",\n  \"description\": \"Order #12345 - Electronics\",\n  \"pricingType\": \"weight_based\",\n  \"senderPhone\": \"+265991234567\",\n  \"serviceType\": \"standard\",\n  \"receiverCity\": \"Lilongwe\",\n  \"receiverName\": \"Jane Smith\",\n  \"declaredValue\": 50000,\n  \"receiverPhone\": \"+265987654321\",\n  \"ecommerceOrderId\": \"SHOP-12345\"\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby 4. Create Shipment (Weight-Based)_example
require 'uri'
require 'net/http'

url = URI("https://api.impala-courier.com/api/public/shipments")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"amount\": 8500,\n  \"shopId\": \"{{shopCode}}\",\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"senderName\": \"John Doe\",\n  \"description\": \"Order #12345 - Electronics\",\n  \"pricingType\": \"weight_based\",\n  \"senderPhone\": \"+265991234567\",\n  \"serviceType\": \"standard\",\n  \"receiverCity\": \"Lilongwe\",\n  \"receiverName\": \"Jane Smith\",\n  \"declaredValue\": 50000,\n  \"receiverPhone\": \"+265987654321\",\n  \"ecommerceOrderId\": \"SHOP-12345\"\n}"

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

```java 4. Create Shipment (Weight-Based)_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.impala-courier.com/api/public/shipments")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"amount\": 8500,\n  \"shopId\": \"{{shopCode}}\",\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"senderName\": \"John Doe\",\n  \"description\": \"Order #12345 - Electronics\",\n  \"pricingType\": \"weight_based\",\n  \"senderPhone\": \"+265991234567\",\n  \"serviceType\": \"standard\",\n  \"receiverCity\": \"Lilongwe\",\n  \"receiverName\": \"Jane Smith\",\n  \"declaredValue\": 50000,\n  \"receiverPhone\": \"+265987654321\",\n  \"ecommerceOrderId\": \"SHOP-12345\"\n}")
  .asString();
```

```php 4. Create Shipment (Weight-Based)_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.impala-courier.com/api/public/shipments', [
  'body' => '{
  "amount": 8500,
  "shopId": "{{shopCode}}",
  "weight": 2.5,
  "senderCity": "Blantyre",
  "senderName": "John Doe",
  "description": "Order #12345 - Electronics",
  "pricingType": "weight_based",
  "senderPhone": "+265991234567",
  "serviceType": "standard",
  "receiverCity": "Lilongwe",
  "receiverName": "Jane Smith",
  "declaredValue": 50000,
  "receiverPhone": "+265987654321",
  "ecommerceOrderId": "SHOP-12345"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp 4. Create Shipment (Weight-Based)_example
using RestSharp;

var client = new RestClient("https://api.impala-courier.com/api/public/shipments");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"amount\": 8500,\n  \"shopId\": \"{{shopCode}}\",\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"senderName\": \"John Doe\",\n  \"description\": \"Order #12345 - Electronics\",\n  \"pricingType\": \"weight_based\",\n  \"senderPhone\": \"+265991234567\",\n  \"serviceType\": \"standard\",\n  \"receiverCity\": \"Lilongwe\",\n  \"receiverName\": \"Jane Smith\",\n  \"declaredValue\": 50000,\n  \"receiverPhone\": \"+265987654321\",\n  \"ecommerceOrderId\": \"SHOP-12345\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 4. Create Shipment (Weight-Based)_example
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "amount": 8500,
  "shopId": "{{shopCode}}",
  "weight": 2.5,
  "senderCity": "Blantyre",
  "senderName": "John Doe",
  "description": "Order #12345 - Electronics",
  "pricingType": "weight_based",
  "senderPhone": "+265991234567",
  "serviceType": "standard",
  "receiverCity": "Lilongwe",
  "receiverName": "Jane Smith",
  "declaredValue": 50000,
  "receiverPhone": "+265987654321",
  "ecommerceOrderId": "SHOP-12345"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.impala-courier.com/api/public/shipments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```