Calculators
📦 CBM Calculator ⚖️ Chargeable Weight 📐 Cubic Meter Calculator 📏 Cubic Feet Calculator 🚢 Single Container 🗃️ Multiple Container 🏗️ Pallet Calculator 🔄 Unit Converter 📊 LCL vs FCL 🏷️ Freight Class ✈️ Air Freight Estimator 🧮 Landed Cost 🛡️ Cargo Insurance 🧊 3D Cargo Planner
Home / Garden
🏠 Cubic Meter Calculator 🌿 Cubic Feet Calculator 📦 Cubic Inch Calculator
Guides & Blog
📖 What is CBM? 📏 CBM in Centimeters 📐 CBM in Inches ✈️ CBM for Air Shipment 📋 Incoterms Guide ✍️ Blog
Directory
🏢 Browse Logistics Companies ➕ List Your Company — Free
API
🔌 API Overview 📄 API Docs 💳 API Pricing — from $99/yr
Developer Guide

Integration Guide

Step-by-step guides to integrate the CBM Calculator API into your WordPress site, web application, or backend system.

Integration Options

MethodBest ForDifficulty
WordPress PluginWordPress sitesEasy (5 min)
HTML EmbedAny websiteEasy (10 min)
REST API (Direct)Custom apps, backend systemsMedium
Bootstrap WidgetBootstrap sitesEasy (10 min)

WordPress Plugin

Our WordPress plugin adds the CBM calculator to any page or post using a shortcode. Requires an active API subscription.

Installation

  1. Download the plugin from your account dashboard after subscribing
  2. In WordPress admin: Plugins → Add New → Upload Plugin
  3. Upload the calculatecbm-plugin.zip file
  4. Activate the plugin
  5. Go to Settings → CBM Calculator → enter your API key

Usage

// Basic calculator:
[calculatecbm]

// With options:
[calculatecbm units="cm" show_weight="true" show_container="true" theme="light"]

// Minimal mode (single item):
[calculatecbm mode="basic"]

Shortcode Parameters

ParameterValuesDefault
unitscm, mm, m, in, ftcm
show_weighttrue, falsetrue
show_containertrue, falsetrue
themedark, light, autodark
modebasic, advancedadvanced
languageen, zh, hi, es, aren

HTML Embed

Add the CBM calculator to any website with a single script tag. Works on any HTML page — no WordPress required.

<!-- Place this div where you want the calculator -->
<div id="cbm-calculator"></div>

<!-- Add before </body> -->
<script>
  window.CBMConfig = {
    apiKey: 'YOUR_API_KEY',
    units: 'cm',
    showContainerFit: true,
    theme: 'dark'
  };
</script>
<script src="https://api.calculatecbm.com/embed/v1/widget.js"></script>

Bootstrap Integration

For Bootstrap-based sites, use our pre-styled Bootstrap-compatible widget:

<!-- Requires Bootstrap 5 -->
<div class="container">
  <div id="cbm-bootstrap-widget"></div>
</div>

<script>
  window.CBMConfig = { apiKey: 'YOUR_API_KEY', framework: 'bootstrap5' };
</script>
<script src="https://api.calculatecbm.com/embed/v1/widget-bootstrap.js"></script>

Direct API Integration

For full control, call the API directly from your backend. See the API Documentation for all endpoints and parameters.

Frontend JavaScript Integration

// Important: Never expose your API key in frontend code.
// Proxy through your own backend instead:

// Your backend endpoint (PHP/Node/Python/etc.):
// POST /api/cbm-proxy
// → Calls api.calculatecbm.com/v1/calculate with your API key
// → Returns result to frontend

async function calculateCBM(items) {
  const res = await fetch('/api/cbm-proxy', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ items })
  });
  return res.json();
}

PHP Proxy Example

<?php
// /api/cbm-proxy.php
header('Content-Type: application/json');

$input = json_decode(file_get_contents('php://input'), true);
if(!isset($input['items'])) { http_response_code(400); echo json_encode(['error'=>'Missing items']); exit; }

$ch = curl_init('https://api.calculatecbm.com/v1/calculate');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => json_encode(['items' => $input['items']]),
  CURLOPT_HTTPHEADER => ['Authorization: Bearer '.getenv('CBM_API_KEY'), 'Content-Type: application/json']
]);
echo curl_exec($ch);
curl_close($ch);

Webhook Configuration (Enterprise)

Enterprise subscribers can configure webhooks to receive notifications:

POST https://api.calculatecbm.com/v1/webhooks
Authorization: Bearer YOUR_ENTERPRISE_API_KEY
{
  "url": "https://yoursite.com/webhook/cbm",
  "events": ["quota.warning", "quota.exceeded"],
  "secret": "your_webhook_secret"
}
💡 Need help with integration? Email api@calculatecbm.com with your use case and we'll provide a custom integration guide.