Direct API

Price Calculation

Calculate shipping prices from all available carriers and services

Endpoint

POST /orders/prices

Authentication

API Key required

Swagger Documentation

View in Swagger

How Price Calculation Works

  • • Returns pricing options from all available carriers and services
  • • Use carrier_id: 0 and service_id: 0 to get all options
  • • Specify carrier_id or service_id to filter results
  • • Same validation rules as order creation apply

Request Body

Note: The price calculation endpoint uses the same request structure as order creation, but allows carrier_id and service_id to be 0 to get pricing from all available options.

Carrier & Service Selection

Name Type Required Description
carrier_id integerYes Carrier ID (use 0 for all carriers)
service_id integerYes Service ID (use 0 for all services)

📋 Complete Request Structure

The price calculation endpoint uses the exact same request structure as the Create Order endpoint. All address fields, package content, and extra services are identical.

👉 Refer to the Create Order documentation for the complete request structure details.

Code Examples

Price Calculation Examples
const axios = require('axios');

// Get all available pricing options
const pricingData = {
  carrier_id: 0,  // 0 = all carriers
  service_id: 0,  // 0 = all services
  billing_to: {
    billing_address_id: 123
  },
  address_from: {
    email: "sender@example.com",
    phone: "0721234567",
    contact: "John Doe",
    country_code: "RO",
    locality_id: 10241,
    street_name: "Strada Exemplu",
    street_number: "10"
  },
  address_to: {
    email: "recipient@example.com",
    phone: "0731234567",
    contact: "Jane Smith",
    country_code: "RO",
    postal_code: "400001",
    street_name: "Strada Destinatie",
    street_number: "20"
  },
  content: {
    envelopes_count: 0,
    pallets_count: 0,
    parcels_count: 1,
    total_weight: 2.5,
    parcels: [
      {
        sequence_no: 1,
        size: {
          weight: 2.5,
          width: 30,
          height: 20,
          length: 40
        }
      }
    ]
  },
  extra: {
    parcel_content: "Electronics",
    insurance_amount: 500,
    insurance_amount_currency: "RON"
  }
};

axios.post('https://api.europarcel.com/api/public/orders/prices', pricingData, {
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
})
.then(response => {
  // Process pricing options
  response.data.data.forEach(option => {
    // Handle each pricing option
  });
})
.catch(error => {
  // Handle error
});

Response Structure

Success Response (200)

Success ResponseJSON
{
  "data": [
    {
      "carrier_id": 3,
      "carrier": "FAN Courier",
      "service_id": 1,
      "service_name": "De la ușă la ușă",
      "estimated_pickup_date": "2025-01-16",
      "estimated_delivery_date": "2025-01-18",
      "label_print_required": true,
      "price": {
        "amount": 45.50,
        "vat": 8.65,
        "total": 54.15,
        "currency": "RON"
      }
    },
    {
      "carrier_id": 1,
      "carrier": "Cargus",
      "service_id": 1,
      "service_name": "Standard",
      "estimated_pickup_date": "2025-01-16",
      "estimated_delivery_date": "2025-01-19",
      "label_print_required": false,
      "price": {
        "amount": 42.30,
        "vat": 8.04,
        "total": 50.34,
        "currency": "RON"
      }
    }
  ],
  "validation_address": {
    "address_from": {
      "locality_id": 10241,
      "postal_code": "010001",
      "locality_name": "București",
      "county_name": "București",
      "country_code": "RO"
    },
    "address_to": {
      "locality_id": 456,
      "postal_code": "400001",
      "locality_name": "Cluj-Napoca",
      "county_name": "Cluj",
      "country_code": "RO"
    }
  }
}

Error Responses

Validation Error (400)

Validation ErrorJSON
{
  "valid": false,
  "message": "Validation failed",
  "error_code": "VALIDATION_FAILED",
  "errors": {
    "billing_to.billing_address_id": [
      "The specified address does not belong to this customer"
    ],
    "content.total_weight": [
      "The total weight must equal the sum of parcel weights"
    ]
  }
}

Key Differences from Order Creation

✅ Price Calculation

  • • Returns multiple pricing options
  • • No wallet payment required
  • • No AWB generation
  • • carrier_id: 0 allowed (all carriers)
  • • service_id: 0 allowed (all services)

🚀 Order Creation

  • • Creates actual order
  • • Requires wallet payment
  • • Generates AWB number
  • • carrier_id must be > 0
  • • service_id must be > 0