Maile Cargo API Documentation

Integrated REST API

Complete API reference for Maile Cargo shipping integration. Access booking, freight rates, label generation and tracking through Cargoson's unified transport management API.

Get Your API Key

Maile Cargo API Overview

This API provides programmatic access to Maile Cargo shipping services through Cargoson's unified transport management platform. Integrate Maile Cargo capabilities including shipment booking, racking, rate quotes, and label generation into your applications.

API Capabilities

  • Create and manage Maile Cargo shipment bookings
  • Shipment tracking and status updates
  • Get freight rate quotes and transit times
  • Generate shipping labels in multiple formats (PDF, PNG, ZPL)
  • Create return labels for reverse logistics
  • Query parcel machine and pickup point locations
  • List available carrier services
  • Automated courier pickup requests

Base URL & Authentication

Base URL

https://www.cargoson.com/api/v1

Authentication

All requests must include your API key and the correct Accept header:

Authorization: Bearer YOUR_API_KEY
Accept: application/vnd.api.v1

Maile Cargo Booking API

Cargoson Automation
Cargoson Enhancement:

Maile Cargo doesn't provide a booking API. Cargoson automatically sends booking confirmations via email on your behalf, while you still use the same unified API interface.

Create Maile Cargo shipments and retrieve shipping labels using the Queries endpoint. Bookings are send to the carrier's system in real-time and labels are generated immediately.

Query vs Direct Booking

The Queries endpoint supports two booking methods:

  • Query mode - Create a transport request without specifying a carrier (yet). This allows you to manually compare carrier prices and delivery times, request new spot prices, make adjustments/updates to the shipment, and delegate carrier selection to others, before you make the final carrier selection in Cargoson.
  • Direct booking - Specify a carrier service ID (from the Rate or Services API) to book directly with Maile Cargo. This ensures your shipment uses the exact service you selected.

To book directly to Maile Cargo, always define the direct_booking_service_id.

POST /queries

Create a shipment query or direct booking for Maile Cargo. Include direct_booking_service_id to create an immediate booking.

Request Parameters

collection_date string required

Pickup date in YYYY-MM-DD format

collection_country string required

Pickup country code (ISO 3166-1 alpha-2)

collection_postcode string required

Pickup postal code

collection_address_row_1 string required

Pickup street address

collection_city string required

Pickup city

collection_company_name string required

Sender company name

collection_contact_name string required

Sender contact person

collection_contact_phone string required

Sender phone number

delivery_country string required

Delivery country code

delivery_postcode string required

Delivery postal code

delivery_address_row_1 string required

Delivery street address

delivery_city string required

Delivery city

delivery_company_name string required

Recipient company name

delivery_contact_name string required

Recipient contact person

delivery_contact_phone string required

Recipient phone number

rows_attributes array required

Array of packages/pallets with quantity, package_type, weight, and description

options[direct_booking_service_id] integer

Maile Cargo service ID for direct booking

Example: Direct Booking Request

{
  "collection_date": "2026-02-15",
  "collection_country": "DE",
  "collection_postcode": "10115",
  "collection_address_row_1": "Hauptstraße 123",
  "collection_city": "Berlin",
  "collection_company_name": "Demo GmbH",
  "collection_contact_name": "Max Mustermann",
  "collection_contact_phone": "+4930123456",
  "delivery_country": "SE",
  "delivery_postcode": "11122",
  "delivery_address_row_1": "Drottninggatan 45",
  "delivery_city": "Stockholm",
  "delivery_company_name": "Demo Sweden AB",
  "delivery_contact_name": "Erik Andersson",
  "delivery_contact_phone": "+46812345678",
  "rows_attributes": [
    {
      "quantity": 1,
      "package_type": "EUR",
      "weight": 100.0,
      "description": "Goods on EUR pallet"
    }
  ],
  "options": {
    "direct_booking_service_id": 1234
  }
}

Example Response

{
  "id": 12345,
  "reference": "CG12345",
  "status": "booked",
  "latest_status": "confirmed",
  "tracking_reference": "ABC1234567890",
  "tracking_url": "https://tracking.carrier.com/ABC1234567890",
  "label_url": "https://www.cargoson.com/labels/abc123.pdf",
  "confirmed_at": "2026-02-15T10:30:00Z"
}

Label Generation

Maile Cargo shipping labels are automatically generated when you create a booking. Labels are available in multiple formats to support different printer types.

Supported Label Formats

a4 - A4 PDF format for desktop printers (4 labels per page)
label_printer - 4x6in (~10x15cm) PDF format for thermal printers

Labels are included in the booking response via the label_url field. Download and print the label from the provided URL after booking.

Maile Cargo Rate API (Freight Pricing)

Cargoson Engine
Cargoson Enhancement:

Maile Cargo doesn't provide a native rate API. Cargoson's freight rate engine calculates prices using your uploaded price agreements, providing you the same API experience as carriers with native rate APIs. You can upload carrier rates in any format (Excel, PDF, even handwritten price lists) and we'll digitize them.

Get real-time Maile Cargo freight rates before booking. The Rate API returns available services, prices, and estimated delivery times.

POST /freightPrices/list

Get freight rate quotes from Maile Cargo and other activated carriers on your account.

Request Parameters

collection_date string required

Pickup date in YYYY-MM-DD format

collection_country string required

Pickup country code (ISO 3166-1 alpha-2)

collection_postcode string required

Pickup postal code

delivery_country string required

Delivery country code

delivery_postcode string required

Delivery postal code

rows_attributes array required

Array of packages/pallets with quantity, package_type, weight, and description

Example Request

{
  "collection_date": "2026-02-15",
  "collection_postcode": "10115",
  "collection_country": "DE",
  "collection_with_tail_lift": true,
  "collection_prenotification": true,
  "delivery_postcode": "11122",
  "delivery_country": "SE",
  "delivery_with_tail_lift": true,
  "delivery_prenotification": true,
  "delivery_return_document": true,
  "delivery_to_private_person": true,
  "frigo": true,
  "adr": false,
  "rows_attributes": [
    {
      "quantity": 1,
      "package_type": "EUR",
      "weight": 100.0,
      "description": "Goods on EUR pallet"
    },
    {
      "quantity": 2,
      "package_type": "FIN",
      "weight": 300.0,
      "description": "Goods on two FIN pallets"
    }
  ],
  "request_external_partners": false
}

Example Response

{
  "status": 200,
  "object": {
    "prices": [
      {
        "carrier": "Maile Cargo SIA",
        "reg_no": "40203365428",
        "id": 3828,
        "service": "Main",
        "service_id": 85,
        "price": "19.13",
        "unit": "payable_weight",
        "type": "price_list"
      },
      {
        "carrier": "Maile Cargo SIA",
        "reg_no": "40203365428",
        "id": 3828,
        "service": "Express Service",
        "service_id": 123,
        "price": "32.50",
        "unit": "real_weight",
        "type": "online"
      },
      {
        "carrier": "Demo Logistics GmbH",
        "reg_no": "87654321",
        "id": 456,
        "service": "Main",
        "service_id": 555,
        "price": "20.00",
        "unit": "payable_weight",
        "type": "price_list"
      }
    ]
  }
}

Maile Cargo Tracking API

Cargoson Automation
Cargoson Enhancement:

Maile Cargo doesn't provide tracking events via API. Cargoson provides a tracking portal where the carrier can manually update shipment status, giving you and your customers a consistent tracking experience.

Track Maile Cargo shipments using the Cargoson reference number. Get current status, location updates, and estimated delivery time.

GET /bookings/{reference}

Retrieve tracking details for a Maile Cargo shipment using the Cargoson booking reference.

Example Response

{
  "reference": "CG12345",
  "status": "in_transit",
  "latest_status": "collected",
  "tracking_reference": "ABC1234567890",
  "tracking_url": "https://tracking.carrier.com/ABC1234567890",
  "confirmed_at": "2026-02-15T10:30:00Z",
  "collected_at": "2026-02-15T14:20:00Z",
  "estimated_delivery": "2026-02-18T16:00:00Z"
}

Maile Cargo Return Labels API

Powered by Cargoson
Cargoson Enhancement:

Maile Cargo doesn't natively support return labels. Cargoson generates return labels and manages the return logistics process through our platform.

Generate return shipping labels for Maile Cargo shipments. Return labels allow customers to send items back using pre-paid shipping.

POST /bookings/{reference}/return_labels

Create a return label for an existing Maile Cargo shipment.

Request Parameters

label_format string

Label format: a4 or label_printer (default: a4)

Example Request

{
  "label_format": "a4"
}

Example Response

{
  "return_label_url": "https://www.cargoson.com/labels/return_abc123.pdf",
  "tracking_reference": "RETURN9876543210",
  "tracking_url": "https://tracking.carrier.com/RETURN9876543210"
}

Return Label Features

  • Pre-paid return shipping labels
  • Same format options as outbound labels (A4, thermal)
  • Separate tracking reference for returns
  • Seamless integration with Maile Cargo return services

Maile Cargo Courier Requests

Cargoson Automation

Cargoson automates courier pickup requests for Maile Cargo shipments, which makes it one less task you will need to think about.

How Cargoson Handles Courier Requests

Many shipping carriers require you to create labels separately and then manually request courier pickup. Others do not have a separate label plus courier call system, and each shipment is a complete, separate shipment. We believe that there should be a single standard of carrier APIs, but currently, each carrier creates their own unique system, which makes it difficult for their users to remember each one's quirks and intricacies. Cargoson simplifies your courier calls by treating every shipment holistically: courier requests are automatically managed as part of the booking process.

Smart Pickup Optimization

Cargoson optimizes courier calls to reduce costs and improve efficiency.

  • 1. Batch consolidation - Multiple shipments from the same location are grouped into a single pickup request
  • 2. Carrier-specific handling - Some carriers include pickup in the booking, others require separate requests. Cargoson handles both variants automatically for you
  • 3. Regular pickup schedules - Configure prescheduled pickups at specific intervals (e.g., daily to my main warehouse at 3 PM) and Cargoson will skip individual courier calls entirely

Benefits

  • No need to track which carriers require separate courier requests
  • Automatic optimization prevents unnecessary pickup calls
  • Support for regular pickup schedules
  • Simplified shipping workflow - just create the booking

Configuration

Courier pickup automation is enabled by default for all Maile Cargo shipments. To configure regular pickup schedules or custom pickup optimization rules, contact [email protected].

Maile Cargo Services API

Cargoson Engine
Cargoson Enhancement:

The Services API is a Cargoson-provided feature that returns a unified list of all available services from Maile Cargo and other carriers in your network. This allows you to dynamically display shipping options to your customers without hardcoding service IDs.

Retrieve a list of available Maile Cargo shipping services. Use service IDs when making direct bookings to ensure you get the exact service you want.

GET /services/list

Return list of Maile Cargo services available on your company account.

Example Response

{
  "services": [
    {
      "carrier": {
        "id": 3828,
        "name": "Maile Cargo SIA",
        "short_name": "Maile Cargo",
        "reg_no": "40203365428"
      },
      "id": 85,
      "name": "Main",
      "service_type": "road_freight"
    },
    {
      "carrier": {
        "id": 3828,
        "name": "Maile Cargo SIA",
        "short_name": "Maile Cargo",
        "reg_no": "40203365428"
      },
      "id": 123,
      "name": "Express Service",
      "service_type": "express"
    }
  ]
}

Using Service IDs

Service IDs from this endpoint can be used with the direct_booking_service_id parameter when creating bookings to select the right service and send the shipment to the Maile Cargo system.

Complete Code Examples

Below are complete working examples showing the full workflow: get rates, select a service, book shipment, and extract tracking information.

# Define the service ID you want to use
CARRIER_SERVICE_ID=85

# Step 1: Get freight prices for Maile Cargo
curl -X POST https://www.cargoson.com/api/v1/freightPrices/list \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.api.v1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "collection_date": "2026-02-15",
    "collection_country": "DE",
    "collection_postcode": "10115",
    "delivery_country": "SE",
    "delivery_postcode": "11122",
    "rows_attributes": [{
      "quantity": 1,
      "package_type": "EUR",
      "weight": 100.0,
      "description": "Goods on EUR pallet"
    }]
  }'

# Extract the price for your service from response:
# transport_price=$(echo "$response" | jq '.object.prices[] | select(.service_id==85) | .price')

# Step 2: Book shipment using the service_id
curl -X POST https://www.cargoson.com/api/v1/queries \
  -H "Content-Type: application/json" \
  -H "Accept: application/vnd.api.v1" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "collection_date": "2026-02-15",
    "collection_country": "DE",
    "collection_postcode": "10115",
    "collection_address_row_1": "Hauptstraße 123",
    "collection_city": "Berlin",
    "collection_company_name": "Demo GmbH",
    "collection_contact_name": "Max Mustermann",
    "collection_contact_phone": "+4930123456",
    "delivery_country": "SE",
    "delivery_postcode": "11122",
    "delivery_address_row_1": "Drottninggatan 45",
    "delivery_city": "Stockholm",
    "delivery_company_name": "Demo Sweden AB",
    "delivery_contact_name": "Erik Andersson",
    "delivery_contact_phone": "+46812345678",
    "rows_attributes": [{
      "quantity": 1,
      "package_type": "EUR",
      "weight": 100.0,
      "description": "Goods on EUR pallet"
    }],
    "options": {
      "direct_booking_service_id": '$CARRIER_SERVICE_ID'
    }
  }'

# Response contains:
# - reference: "CG12345"
# - tracking_url: "https://tracking.carrier.com/..."
# - label_url: "https://www.cargoson.com/labels/abc123.pdf"
const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://www.cargoson.com/api/v1';
const CARRIER_SERVICE_ID = 85;

async function bookToMaileCargo() {
  try {
    // Step 1: Get freight prices
    const pricesResponse = await axios.post(`${BASE_URL}/freightPrices/list`, {
      collection_date: '2026-02-15',
      collection_country: 'DE',
      collection_postcode: '10115',
      delivery_country: 'SE',
      delivery_postcode: '11122',
      rows_attributes: [{
        quantity: 1,
        package_type: 'EUR',
        weight: 100.0,
        description: 'Goods on EUR pallet'
      }]
    }, {
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/vnd.api.v1',
        'Authorization': `Bearer ${API_KEY}`
      }
    });

    // Step 2: Find service by ID and extract price
    const prices = pricesResponse.data.object.prices;
    const selectedService = prices.find(p => p.service_id === CARRIER_SERVICE_ID);

    if (!selectedService) {
      throw new Error(`Service ID ${CARRIER_SERVICE_ID} not found in prices`);
    }

    const transportPrice = selectedService.price;
    console.log(`Selected service price: €${transportPrice}`);

    // Step 3: Book shipment using the service_id
    const bookingResponse = await axios.post(`${BASE_URL}/queries`, {
      collection_date: '2026-02-15',
      collection_country: 'DE',
      collection_postcode: '10115',
      collection_address_row_1: 'Hauptstraße 123',
      collection_city: 'Berlin',
      collection_company_name: 'Demo GmbH',
      collection_contact_name: 'Max Mustermann',
      collection_contact_phone: '+4930123456',
      delivery_country: 'SE',
      delivery_postcode: '11122',
      delivery_address_row_1: 'Drottninggatan 45',
      delivery_city: 'Stockholm',
      delivery_company_name: 'Demo Sweden AB',
      delivery_contact_name: 'Erik Andersson',
      delivery_contact_phone: '+46812345678',
      rows_attributes: [{
        quantity: 1,
        package_type: 'EUR',
        weight: 100.0,
        description: 'Goods on EUR pallet'
      }],
      options: {
        direct_booking_service_id: CARRIER_SERVICE_ID
      }
    }, {
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/vnd.api.v1',
        'Authorization': `Bearer ${API_KEY}`
      }
    });

    // Extract important fields
    const reference = bookingResponse.data.reference;
    const trackingUrl = bookingResponse.data.tracking_url;
    const labelUrl = bookingResponse.data.label_url;

    console.log('Shipment booked successfully!');
    console.log(`Reference: ${reference}`);
    console.log(`Tracking: ${trackingUrl}`);
    console.log(`Label: ${labelUrl}`);

    return { reference, trackingUrl, labelUrl };
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

// Usage
bookToMaileCargo();
import requests

API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://www.cargoson.com/api/v1'
CARRIER_SERVICE_ID = 85

def book_to_maile_cargo():
    headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/vnd.api.v1',
        'Authorization': f'Bearer {API_KEY}'
    }

    # Step 1: Get freight prices
    prices_data = {
        'collection_date': '2026-02-15',
        'collection_country': 'DE',
        'collection_postcode': '10115',
        'delivery_country': 'SE',
        'delivery_postcode': '11122',
        'rows_attributes': [{
            'quantity': 1,
            'package_type': 'EUR',
            'weight': 100.0,
            'description': 'Goods on EUR pallet'
        }]
    }

    prices_response = requests.post(
        f'{BASE_URL}/freightPrices/list',
        headers=headers,
        json=prices_data
    )
    prices_response.raise_for_status()

    # Step 2: Find service by ID and extract price
    prices = prices_response.json()['object']['prices']
    selected_service = next(
        (p for p in prices if p['service_id'] == CARRIER_SERVICE_ID),
        None
    )

    if not selected_service:
        raise ValueError(f'Service ID {CARRIER_SERVICE_ID} not found in prices')

    transport_price = selected_service['price']
    print(f'Selected service price: €{transport_price}')

    # Step 3: Book shipment using the service_id
    booking_data = {
        'collection_date': '2026-02-15',
        'collection_country': 'DE',
        'collection_postcode': '10115',
        'collection_address_row_1': 'Hauptstraße 123',
        'collection_city': 'Berlin',
        'collection_company_name': 'Demo GmbH',
        'collection_contact_name': 'Max Mustermann',
        'collection_contact_phone': '+4930123456',
        'delivery_country': 'SE',
        'delivery_postcode': '11122',
        'delivery_address_row_1': 'Drottninggatan 45',
        'delivery_city': 'Stockholm',
        'delivery_company_name': 'Demo Sweden AB',
        'delivery_contact_name': 'Erik Andersson',
        'delivery_contact_phone': '+46812345678',
        'rows_attributes': [{
            'quantity': 1,
            'package_type': 'EUR',
            'weight': 100.0,
            'description': 'Goods on EUR pallet'
        }],
        'options': {
            'direct_booking_service_id': CARRIER_SERVICE_ID
        }
    }

    booking_response = requests.post(
        f'{BASE_URL}/queries',
        headers=headers,
        json=booking_data
    )
    booking_response.raise_for_status()
    booking = booking_response.json()

    # Extract important fields
    reference = booking['reference']
    tracking_url = booking['tracking_url']
    label_url = booking['label_url']

    print('Shipment booked successfully!')
    print(f'Reference: {reference}')
    print(f'Tracking: {tracking_url}')
    print(f'Label: {label_url}')

    return {
        'reference': reference,
        'tracking_url': tracking_url,
        'label_url': label_url
    }

# Usage
if __name__ == '__main__':
    book_to_maile_cargo()
<?php
$apiKey = 'YOUR_API_KEY';
$baseUrl = 'https://www.cargoson.com/api/v1';

define('CARRIER_SERVICE_ID', 85);

function bookToMaileCargo($apiKey, $baseUrl) {
    $headers = [
        'Content-Type: application/json',
        'Accept: application/vnd.api.v1',
        'Authorization: Bearer ' . $apiKey
    ];

    // Step 1: Get freight prices
    $pricesData = [
        'collection_date' => '2026-02-15',
        'collection_country' => 'DE',
        'collection_postcode' => '10115',
        'delivery_country' => 'SE',
        'delivery_postcode' => '11122',
        'rows_attributes' => [[
            'quantity' => 1,
            'package_type' => 'EUR',
            'weight' => 100.0,
            'description' => 'Goods on EUR pallet'
        ]]
    ];

    $ch = curl_init($baseUrl . '/freightPrices/list');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($pricesData));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $pricesResponse = curl_exec($ch);
    curl_close($ch);
    $prices = json_decode($pricesResponse, true)['object']['prices'];

    // Step 2: Find service by ID and extract price
    $selectedService = null;
    foreach ($prices as $price) {
        if ($price['service_id'] === CARRIER_SERVICE_ID) {
            $selectedService = $price;
            break;
        }
    }

    if (!$selectedService) {
        throw new Exception('Service ID ' . CARRIER_SERVICE_ID . ' not found in prices');
    }

    $transportPrice = $selectedService['price'];
    echo "Selected service price: €$transportPrice
";

    // Step 3: Book shipment using the service_id
    $bookingData = [
        'collection_date' => '2026-02-15',
        'collection_country' => 'DE',
        'collection_postcode' => '10115',
        'collection_address_row_1' => 'Hauptstraße 123',
        'collection_city' => 'Berlin',
        'collection_company_name' => 'Demo GmbH',
        'collection_contact_name' => 'Max Mustermann',
        'collection_contact_phone' => '+4930123456',
        'delivery_country' => 'SE',
        'delivery_postcode' => '11122',
        'delivery_address_row_1' => 'Drottninggatan 45',
        'delivery_city' => 'Stockholm',
        'delivery_company_name' => 'Demo Sweden AB',
        'delivery_contact_name' => 'Erik Andersson',
        'delivery_contact_phone' => '+46812345678',
        'rows_attributes' => [[
            'quantity' => 1,
            'package_type' => 'EUR',
            'weight' => 100.0,
            'description' => 'Goods on EUR pallet'
        ]],
        'options' => [
            'direct_booking_service_id' => CARRIER_SERVICE_ID
        ]
    ];

    $ch = curl_init($baseUrl . '/queries');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($bookingData));
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $bookingResponse = curl_exec($ch);
    curl_close($ch);
    $booking = json_decode($bookingResponse, true);

    // Extract important fields
    $reference = $booking['reference'];
    $trackingUrl = $booking['tracking_url'];
    $labelUrl = $booking['label_url'];

    echo "Shipment booked successfully!
";
    echo "Reference: $reference
";
    echo "Tracking: $trackingUrl
";
    echo "Label: $labelUrl
";

    return [
        'reference' => $reference,
        'tracking_url' => $trackingUrl,
        'label_url' => $labelUrl
    ];
}

// Usage
bookToMaileCargo($apiKey, $baseUrl);
?>
require 'net/http'
require 'json'

API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://www.cargoson.com/api/v1'
CARRIER_SERVICE_ID = 85

def book_to_maile_cargo
  headers = {
    'Content-Type' => 'application/json',
    'Accept' => 'application/vnd.api.v1',
    'Authorization' => "Bearer #{API_KEY}"
  }

  # Step 1: Get freight prices
  prices_uri = URI("#{BASE_URL}/freightPrices/list")
  prices_data = {
    collection_date: '2026-02-15',
    collection_country: 'DE',
    collection_postcode: '10115',
    delivery_country: 'SE',
    delivery_postcode: '11122',
    rows_attributes: [{
      quantity: 1,
      package_type: 'EUR',
      weight: 100.0,
      description: 'Goods on EUR pallet'
    }]
  }

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

  prices_request = Net::HTTP::Post.new(prices_uri)
  headers.each { |k, v| prices_request[k] = v }
  prices_request.body = prices_data.to_json

  prices_response = http.request(prices_request)
  prices = JSON.parse(prices_response.body)['object']['prices']

  # Step 2: Find service by ID and extract price
  selected_service = prices.find { |p| p['service_id'] == CARRIER_SERVICE_ID }

  raise "Service ID #{CARRIER_SERVICE_ID} not found in prices" unless selected_service

  transport_price = selected_service['price']
  puts "Selected service price: €#{transport_price}"

  # Step 3: Book shipment using the service_id
  booking_uri = URI("#{BASE_URL}/queries")
  booking_data = {
    collection_date: '2026-02-15',
    collection_country: 'DE',
    collection_postcode: '10115',
    collection_address_row_1: 'Hauptstraße 123',
    collection_city: 'Berlin',
    collection_company_name: 'Demo GmbH',
    collection_contact_name: 'Max Mustermann',
    collection_contact_phone: '+4930123456',
    delivery_country: 'SE',
    delivery_postcode: '11122',
    delivery_address_row_1: 'Drottninggatan 45',
    delivery_city: 'Stockholm',
    delivery_company_name: 'Demo Sweden AB',
    delivery_contact_name: 'Erik Andersson',
    delivery_contact_phone: '+46812345678',
    rows_attributes: [{
      quantity: 1,
      package_type: 'EUR',
      weight: 100.0,
      description: 'Goods on EUR pallet'
    }],
    options: {
      direct_booking_service_id: CARRIER_SERVICE_ID
    }
  }

  booking_request = Net::HTTP::Post.new(booking_uri)
  headers.each { |k, v| booking_request[k] = v }
  booking_request.body = booking_data.to_json

  booking_response = http.request(booking_request)
  booking = JSON.parse(booking_response.body)

  # Extract important fields
  reference = booking['reference']
  tracking_url = booking['tracking_url']
  label_url = booking['label_url']

  puts 'Shipment booked successfully!'
  puts "Reference: #{reference}"
  puts "Tracking: #{tracking_url}"
  puts "Label: #{label_url}"

  {
    reference: reference,
    tracking_url: tracking_url,
    label_url: label_url
  }
end

# Usage
book_to_maile_cargo

Why use Cargoson API for Maile Cargo integration

Integrating directly with Maile Cargo's native API means wrestling with carrier-specific documentation, handling unique data formats, and maintaining separate code for each provider. Cargoson offers a single unified RESTful API that supports Maile Cargo and 2,000+ carriers across European and North American markets, with new integrations added weekly. We reduce development time from months to days, handle carrier updates automatically, and manage regional exceptions. With Cargoson, you focus on growing your business instead of managing carrier technical complexities.

Benefits of integrating Maile Cargo via Cargoson API

One API for all carriers

Replace dozens of separate carrier integrations with one connection to Maile Cargo and 2,000+ other providers via Cargoson API. No more maintaining multiple authentication systems, handling different data formats, or updating code when carriers change their endpoints.

Clear documentation and support

Access straightforward API documentation with working code examples, detailed parameter descriptions, and clearly-defined endpoints. Our support team knows the logistics industry and can help you solve integration challenges quickly.

Code examples in multiple languages

Get started immediately with ready-to-use code examples in cURL, JavaScript, Python, PHP, and Ruby. Copy, paste, and adapt them to your stack, no need to figure out authentication, request formatting, or error handling from scratch.

Real support from logistics experts

Get help from people who understand shipping, not just APIs. Whether you're troubleshooting an integration issue or need advice on the best way to handle international shipments, our team is here to help.

World's most advanced freight pricing engine

Cargoson's freight pricing API goes far beyond simple rate lookups. Our engine can read, analyze, and digitize any carrier pricelist regardless of format or structure, making it the most powerful freight rate management solution in the logistics industry.

Universal format support

Our freight pricing engine handles any format: structured Excel files, complex PDFs, free text, or even handwritten pricelists. Upload your carrier contracts in any format, and our freight rate engine will parse the pricing rules, surcharges, and conditions automatically.

Direct carrier API integration

For carriers with modern systems (typically global parcel carriers and tech-forward freight companies), we pull rates directly from their APIs in real-time. This ensures you always get the most current pricing without manual updates.

Public online prices

Don't have a contract with a carrier yet? No problem. Cargoson can pull public online prices from carriers, allowing you to compare options even before establishing formal agreements.

Spot rate requests

For complex shipments or special cases, request spot rates where carriers review your specific requirements and provide a custom quote. All managed through the same unified API.

Maile Cargo shipping API: Simplified logistics automation

Automate your fulfillment process by integrating Cargoson's Shipping API with Maile Cargo and 2,000+ carriers worldwide. Create shipping labels, book pickups, and manage all your carriers from one platform while keeping your negotiated rates with each provider.

Automated label generation

Generate carrier-approved shipping labels in a single API request. Support for multiple label formats (A4, thermal printer) and automatic customs documentation for international shipments means less manual work and fewer shipping errors.

Real-time rate comparison

Compare live rates across Maile Cargo and your other activated carriers to choose the best option based on cost, speed, and service level.

Keep your negotiated rates

Connect your existing Maile Cargo account to retain your negotiated shipping rates. Cargoson simply provides the technical integration: you keep your direct carrier relationships and custom pricing agreements.

Enterprise-grade security for Maile Cargo API integration

Cargoson's API infrastructure meets European compliance standards, which ensure secure, audit-ready Maile Cargo integration for your business:

  • GDPR compliant data handling and storage across Europe
  • ISO 27001 certified information security management
  • End-to-end encryption for all API communications

Ready to integrate Maile Cargo shipping into your platform?

Book a demo to see how Cargoson's unified API can simplify your logistics operations

Book a Demo

Frequently Asked Questions

Cargoson is a TMS (Transport Management System) for European and North American manufacturers. Our central vision is simplicity: integrate any and all carriers and freight modes (road, parcel, air, sea, rail) into one window and one API. Whether you're shipping pallets across Europe or containers overseas, manage everything from a single platform.

Getting started is simple. First, sign up for a Cargoson account and get your API key. Then connect your Maile Cargo account in the Cargoson dashboard. Once that's done, you can start making API requests using our documentation and code examples. The whole setup typically takes less than an hour.

Yes, you'll need your own Maile Cargo account to use Maile Cargo services through Cargoson. This ensures you keep your negotiated rates and maintain your direct relationship with Maile Cargo. Cargoson simply provides the technical integration layer that makes it easier to work with Maile Cargo and other carriers through one unified API.

Cargoson operates on a transparent monthly subscription model with no per-shipment fees or commissions, ever. Your plan includes API access, documentation, support, and automatic updates when carriers change their systems. You pay Maile Cargo directly for shipping at your negotiated rates. No hidden costs, no surprises.

Absolutely! That's the main benefit of using Cargoson. Once you integrate our API, you can work with Maile Cargo and 2,000+ other carriers using the same endpoints, authentication, and data formats. Add new carriers without writing new integration code, just activate them in your Cargoson dashboard.

Yes! We integrate any carrier you need at no extra cost. This is included in your Cargoson subscription. Just introduce us to your carrier contacts, and we'll handle the technical integration. New integrations are added daily based on customer requests.

Yes, we can set up webhooks to notify your system based on events and triggers in Cargoson, such as shipment status updates, booking confirmations, or changes to your shipments. Contact our support team or book a demo to discuss your webhook requirements and setup.

Cargoson might be overkill if you're a small company shipping just a few times per month with a single carrier. You can probably manage those shipments fine without a TMS. We're also not the right fit if you're a carrier or freight forwarder. Cargoson is built specifically for beneficial cargo owners (BCOs) like manufacturers and distributors who own the goods being shipped. If you're looking for a TMS to manage your forwarding business or carrier operations, we're not designed for that use case.

Our API returns clear error messages with specific error codes and descriptions. Common issues are documented with solutions in our developer docs. If you get stuck, our support team can help troubleshoot integration issues.

We implement reasonable rate limits to ensure system stability for all customers. There are both long-period rate limits, and burst rate limits, with values that should be more than enough for most businesses. If you need higher limits for enterprise-scale operations, contact us to discuss custom rate limits for your account.

Start Using the Maile Cargo API

Get your API credentials to begin integration

Get Your API Key