Build with the Fits In The Box API

A REST API for 3D bin packing, shipping-tier logic, and packing-aware Shopify experiences. Pack items into the smallest possible boxes, calculate shipping outcomes, and power storefront upsell logic from a single API call.

Quick Start

Three steps to your first pack result.

1. Get your API key

Install the app on Shopify, then go to Settings > API Keys in the Fits In The Box admin. Your key starts with fitb_.

2. Pack items

Send item dimensions and get back the optimal box assignment.

curl -X POST https://api.fitsinthebox.com/v1/pack \
  -H "Authorization: Bearer fitb_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "name": "Blue T-Shirt",
        "length": 10.0,
        "width": 8.0,
        "height": 1.5,
        "weight": 0.3,
        "quantity": 2
      },
      {
        "name": "Ceramic Mug",
        "length": 4.5,
        "width": 4.5,
        "height": 5.0,
        "weight": 0.8,
        "quantity": 1
      }
    ],
    "dimension_unit": "in",
    "weight_unit": "lb"
  }'

3. Parse the response

The API returns box assignments with utilization and cost.

{
  "boxes": [
    {
      "box_name": "Medium Flat Rate",
      "items": ["Blue T-Shirt x2", "Ceramic Mug"],
      "utilization": 0.62,
      "shipping_cost": 15.05
    }
  ],
  "total_shipping_cost": 15.05,
  "total_boxes": 1
}

Two Pack Modes

Choose the mode that fits your integration.

Raw Dimensions

Send item measurements directly. Works without Shopify — use it from any platform or custom storefront.

POST /v1/pack
{
  "items": [
    {
      "name": "Widget",
      "length": 6.0,
      "width": 4.0,
      "height": 3.0,
      "weight": 1.2,
      "quantity": 1
    }
  ],
  "dimension_unit": "in",
  "weight_unit": "lb"
}

Shopify Product IDs

Send Shopify variant IDs and the API resolves dimensions from your synced product catalog. Includes upsell suggestions.

POST /v1/pack/shopify
{
  "line_items": [
    {
      "variant_id": 44012345678,
      "quantity": 2
    },
    {
      "variant_id": 44087654321,
      "quantity": 1
    }
  ]
}

Authentication

All API requests require a Bearer token in the Authorization header. Keys are prefixed with fitb_ and can be generated and rotated in the Fits In The Box admin panel under Settings > API Keys.

Authorization: Bearer fitb_your_key_here

Rate Limits

Monthly Quota

5,000 requests/month on the free tier. Pro plan includes higher limits.

Burst Limit

100 requests/hour to prevent abuse. Responses include X-RateLimit-Remaining headers.