> 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.

# 1. Calculate Pricing

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

Returns a shipping quote for a given weight and route, before a shipment is created. Use this to show delivery cost at checkout.

**Body parameters**
| Field | Type | Required | Description |
|---|---|---|---|
| weight | number | Yes | Package weight in kg |
| senderCity | string | Yes | Pickup city (e.g. Blantyre, Lilongwe, Zomba, Mzuzu) |
| receiverCity | string | Yes | Delivery city |

Reference: https://docs.impala-courier.com/impala-courier-e-commerce-api/1-calculate-pricing

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/public/pricing/calculate:
    post:
      operationId: 1-calculate-pricing
      summary: 1. Calculate Pricing
      description: >-
        Returns a shipping quote for a given weight and route, before a shipment
        is created. Use this to show delivery cost at checkout.


        **Body parameters**

        | Field | Type | Required | Description |

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

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

        | senderCity | string | Yes | Pickup city (e.g. Blantyre, Lilongwe,
        Zomba, Mzuzu) |

        | receiverCity | string | Yes | Delivery city |
      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:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/1. Calculate Pricing_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                weight:
                  type: number
                  format: double
                senderCity:
                  type: string
                receiverCity:
                  type: string
              required:
                - weight
                - senderCity
                - receiverCity
servers:
  - url: https://api.impala-courier.com
    description: https://api.impala-courier.com
components:
  schemas:
    ApiPublicPricingCalculatePostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        amount:
          type: integer
        weight:
          type: number
          format: double
        currency:
          type: string
        senderCity:
          type: string
        pricingType:
          type: string
        receiverCity:
          type: string
      required:
        - amount
        - weight
        - currency
        - senderCity
        - pricingType
        - receiverCity
      title: ApiPublicPricingCalculatePostResponsesContentApplicationJsonSchemaData
    1. Calculate Pricing_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/ApiPublicPricingCalculatePostResponsesContentApplicationJsonSchemaData
        success:
          type: boolean
      required:
        - data
        - success
      title: 1. Calculate Pricing_Response_200
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

```

## Examples



**Request**

```json
{
  "weight": 2.5,
  "senderCity": "Blantyre",
  "receiverCity": "Lilongwe"
}
```

**Response**

```json
{
  "data": {
    "amount": 8500,
    "weight": 2.5,
    "currency": "MWK",
    "senderCity": "Blantyre",
    "pricingType": "weight_based",
    "receiverCity": "Lilongwe"
  },
  "success": true
}
```

**SDK Code**

```python 1. Calculate Pricing_example
import requests

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

payload = {
    "weight": 2.5,
    "senderCity": "Blantyre",
    "receiverCity": "Lilongwe"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript 1. Calculate Pricing_example
const url = 'https://api.impala-courier.com/api/public/pricing/calculate';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"weight":2.5,"senderCity":"Blantyre","receiverCity":"Lilongwe"}'
};

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

```go 1. Calculate Pricing_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"receiverCity\": \"Lilongwe\"\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 1. Calculate Pricing_example
require 'uri'
require 'net/http'

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

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  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"receiverCity\": \"Lilongwe\"\n}"

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

```java 1. Calculate Pricing_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/pricing/calculate")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"receiverCity\": \"Lilongwe\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.impala-courier.com/api/public/pricing/calculate', [
  'body' => '{
  "weight": 2.5,
  "senderCity": "Blantyre",
  "receiverCity": "Lilongwe"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp 1. Calculate Pricing_example
using RestSharp;

var client = new RestClient("https://api.impala-courier.com/api/public/pricing/calculate");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"weight\": 2.5,\n  \"senderCity\": \"Blantyre\",\n  \"receiverCity\": \"Lilongwe\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift 1. Calculate Pricing_example
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "weight": 2.5,
  "senderCity": "Blantyre",
  "receiverCity": "Lilongwe"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.impala-courier.com/api/public/pricing/calculate")! 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()
```