Create Multi-Package Consignment

This API is used to create consignments that contain multiple packages in a single shipment. For example, this endpoint should be used when an order is split into multiple boxes.

When to Use?

Scenario Endpoint
Single package shipment /api/v1/consignments
2 or more packages /api/v1/consignments/multi-package

Example Scenario: A customer ordered 3 large items and each was packed in a separate box. In this case, a single consignment with 3 packages is created.


Endpoint Information

Property Value
URL {{BASE_URL}}/api/v1/consignments/multi-package
HTTP Method POST
Content Type application/json
Authentication APIKEY header
Rate Limit 300 requests / 1 minute (sliding window)

Rate Limit Exceeded: When the limit is exceeded, the API returns a 429 Too Many Requests error. For details, see Rate Limit.

Idempotency: This endpoint supports duplicate request protection. For details, see Idempotency.


Differences from Single Package

Feature Single Package Multi-Package
Endpoint /api/v1/consignments /api/v1/consignments/multi-package
packages array 1 element Minimum 2 elements
package_type Each package can be different All packages must be the same
specific_provider_barcode At consignment level At package level (separate for each package)

Important Rules

1. Package Type Rule

All packages must have the same package_type value. If different package_type values are sent, you will receive an error.

2. Custom Barcode Rule (specific_provider_barcode)

In multi-package consignments, custom barcode usage is done at the package level. The following rules must be observed:

Scenario Valid? Description
All packages have barcodes ✅ Valid Each package has a unique barcode assigned
No packages have barcodes ✅ Valid System assigns automatic barcodes
Some packages have barcodes ❌ Error Either all or none

Rule: If specific_provider_barcode is used, all packages must have unique barcodes. Partial usage (giving barcodes to some packages but not others) is not accepted.


Quick Start

Minimal Request Example

Below is an example of creating a consignment with 2 packages:

{
    "provider_id": 1,
    "preference": 0,
    "consignor": {
        "name": "Sender Company",
        "country": "TR",
        "state": "Istanbul",
        "city": "Sisli",
        "postal_code": "34381",
        "address": "Example Street No:1",
        "phone_number": "+902121234567"
    },
    "consignee": {
        "name": "Recipient Name",
        "country": "TR",
        "state": "Ankara",
        "city": "Cankaya",
        "postal_code": "06690",
        "address": "Recipient address",
        "phone_number": "+905551234567"
    },
    "packages": [
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 2.5,
            "length": 40,
            "width": 30,
            "height": 20
        },
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 3.2,
            "length": 50,
            "width": 35,
            "height": 25
        }
    ]
}

Request Example with Custom Barcodes

To assign custom barcodes to each package:

{
    "provider_id": 1,
    "preference": 0,
    "consignor": { ... },
    "consignee": { ... },
    "packages": [
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 2.5,
            "length": 40,
            "width": 30,
            "height": 20,
            "specific_provider_barcode": "PKG-001-A"
        },
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 3.2,
            "length": 50,
            "width": 35,
            "height": 25,
            "specific_provider_barcode": "PKG-001-B"
        }
    ]
}

Note: The packages array must contain at least 2 packages. For single packages, use Create Domestic Consignment or Create International Consignment endpoints.


Optional Headers

Label Format (X-Label-Format)

Header Value Description
X-Label-Format application/pdf Default. Returns label in PDF format
X-Label-Format application/zpl Returns label in ZPL format. Ideal for thermal printers

Request Parameters

Basic Parameters

Parameter Name Parameter Type Required Description
preference Integer CONDITIONAL Carrier preference. Required if provider_id is not specified. Available Values
provider_id Integer CONDITIONAL Carrier ID. Required if preference is 0. Available Values
address_resolver_type Integer OPTIONAL Address resolution type. Available Values
reference_no String (MAX 255) OPTIONAL Reference number
invoice_number String (MAX 255) OPTIONAL Invoice number
specific_shipping_method String (MAX 255) OPTIONAL Provider shipping method. Available Values
generate_provider_barcode Bool OPTIONAL Auto-generate barcode. Default: false
is_pickup_requested Bool OPTIONAL Courier pickup request. Default: false

Sender Information (consignor)

Parameter Name Parameter Type Required Description
consignor.name String (MAX 255) REQUIRED Sender name
consignor.attention_name String (MAX 255) OPTIONAL Sender alternate name
consignor.country String (2-3 CHARS) REQUIRED Country code (ISO2 or ISO3)
consignor.state String (MAX 100) REQUIRED State/Province
consignor.city String (MAX 100) REQUIRED City/District
consignor.postal_code String (MAX 30) OPTIONAL Postal code
consignor.address String (MAX 1000) REQUIRED Full address
consignor.phone_number String (MAX 20) OPTIONAL Phone number
consignor.email String (MAX 255) OPTIONAL Email address

Recipient Information (consignee)

Parameter Name Parameter Type Required Description
consignee.name String (MAX 255) REQUIRED Recipient name
consignee.attention_name String (MAX 255) OPTIONAL Recipient alternate name
consignee.country String (2-3 CHARS) REQUIRED Country code (ISO2 or ISO3)
consignee.state String (MAX 100) REQUIRED State/Province
consignee.city String (MAX 100) REQUIRED City/District
consignee.postal_code String (MAX 30) OPTIONAL Postal code
consignee.address String (MAX 1000) REQUIRED Full address
consignee.phone_number String (MAX 20) OPTIONAL Phone number
consignee.email String (MAX 255) OPTIONAL Email address

Package Information (packages)

Important Rules:

  • The packages array must contain at least 2 elements
  • All packages must have the same package_type value
  • If specific_provider_barcode is used, it must be provided for all packages
Parameter Name Parameter Type Required Description
packages[].package_type Integer REQUIRED Package type (must be same for all packages). Available Values
packages[].provider_packaging_type String OPTIONAL Provider specific packaging type. Available Values
packages[].post_type Integer OPTIONAL Post type. Available Values
packages[].weight Float REQUIRED Package weight (kg)
packages[].length Float REQUIRED Package length (cm)
packages[].width Float REQUIRED Package width (cm)
packages[].height Float REQUIRED Package height (cm)
packages[].specific_provider_barcode String (MAX 255) OPTIONAL Package-specific barcode. If used, must be provided for all packages

Package Item Information (packages[].items) - Optional

Parameter Name Parameter Type Required Description
packages[].items[].unit_price Float OPTIONAL Unit price
packages[].items[].quantity Integer OPTIONAL Quantity
packages[].items[].description String (MAX 255) OPTIONAL Product description
packages[].items[].category String (MAX 255) OPTIONAL Category
packages[].items[].origin String (2-3 CHARS) OPTIONAL Country of origin
packages[].items[].currency_code String (3 CHARS) OPTIONAL Currency code (default: TRY)

Special Services (special_services) - Optional

Parameter Name Parameter Type Required Description
special_services[].service_type String REQUIRED Service type
special_services[].details Object CONDITIONAL Service details

For detailed information, see Special Services.

Document Information (documents) - Optional

Parameter Name Parameter Type Required Description
documents[].id Integer REQUIRED Previously uploaded document ID

For detailed information, see Upload Document.


Example Usage

3 Package Consignment Example (with Custom Barcodes)

curl -X POST "{{BASE_URL}}/api/v1/consignments/multi-package" \
  -H "Content-Type: application/json" \
  -H "APIKEY: {{APIKEY}}" \
  -d '{
    "provider_id": 1,
    "preference": 0,
    "reference_no": "ORD-20241217-MULTI-001",
    "consignor": {
        "name": "Furniture Store Inc.",
        "country": "TR",
        "state": "Istanbul",
        "city": "Sisli",
        "postal_code": "34381",
        "address": "Buyukdere Street No:185",
        "phone_number": "+902123456789"
    },
    "consignee": {
        "name": "John Smith",
        "country": "TR",
        "state": "Ankara",
        "city": "Cankaya",
        "postal_code": "06690",
        "address": "Kizilay District No:42",
        "phone_number": "+905551234567"
    },
    "packages": [
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 15.5,
            "length": 120,
            "width": 60,
            "height": 40,
            "specific_provider_barcode": "FRN-2024-001-A",
            "items": [
                {
                    "description": "Sofa - Left Module",
                    "unit_price": 5000,
                    "quantity": 1
                }
            ]
        },
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 15.5,
            "length": 120,
            "width": 60,
            "height": 40,
            "specific_provider_barcode": "FRN-2024-001-B",
            "items": [
                {
                    "description": "Sofa - Right Module",
                    "unit_price": 5000,
                    "quantity": 1
                }
            ]
        },
        {
            "package_type": 1,
            "post_type": 4,
            "weight": 8.2,
            "length": 80,
            "width": 50,
            "height": 30,
            "specific_provider_barcode": "FRN-2024-001-C",
            "items": [
                {
                    "description": "Sofa - Middle Module",
                    "unit_price": 4000,
                    "quantity": 1
                }
            ]
        }
    ]
}'

API Response

Successful Response

{
    "status": true,
    "message": "Multi package consignment created successfully",
    "data": {
        "consignment": 632285,
        "barcode": "XYZ123456",
        "c2hBarcode": "C2H07238640099",
        "providerTrackingCode": "XYZ123456",
        "trackingUrl": "https://<provider_domain>/<tracking_url>",
        "contentType": "application/pdf",
        "base64label": "...base64data",
        "detail": {
            "total_cost": 450.50,
            "currency_code": "TRY",
            "currency_rate": 1,
            "reference_no": "ORD-20241217-MULTI-001",
            "packages": {
                "desi": 125.6,
                "weight": 39.2,
                "quantity": 3
            }
        }
    }
}

Response Fields

Field Type Description
data.consignment Integer Created consignment ID
data.barcode String Carrier barcode
data.c2hBarcode String ComToHome system barcode
data.providerTrackingCode String Carrier tracking code
data.trackingUrl String Carrier tracking URL
data.base64label String Base64 encoded shipping label
data.detail.total_cost Float Total shipping cost
data.detail.packages.quantity Integer Total package count
data.detail.packages.weight Float Total weight (kg)
data.detail.packages.desi Float Total volumetric weight

Error Responses

Insufficient Package Count

{
    "status": false,
    "errors": [
        {
            "message": "This collection should contain 2 elements or more.",
            "field": "packages"
        }
    ]
}

Different Package Type Error

All packages must have the same package_type value:

{
    "status": false,
    "errors": [
        {
            "message": "All package elements must have the same [package_type].",
            "field": "packages[1].packageType"
        }
    ]
}

Partial Barcode Error

When some packages have barcodes but others don't:

{
    "status": false,
    "errors": [
        {
            "message": "If any package has a [specific_provider_barcode], then all packages must have one—and they must be unique.",
            "field": "specific_provider_barcode"
        }
    ]
}

Common Error Scenarios

Error Description Solution
This collection should contain 2 elements or more. Less than 2 elements in packages array Add at least 2 packages
All package elements must have the same [package_type]. Packages have different package_type values Use the same package_type for all packages
If any package has a [specific_provider_barcode], then all packages must have one—and they must be unique. Some packages have barcodes, some don't Either provide unique barcodes for all packages or none

Related Pages