NAV
JSON cURL PHP Python JAVA C#

Introduction

This subpage contains description about the implementation of our algorithms into your system. Our alghorithms were created to optimize and visualize packing of cubic items in in various cubic shaped loading spaces. Each our algorithm is possible to connect via the API which accepts requests and returns responses in JSON format.

What is an API?

An API is a set of programming code that enables data transmission between one software product and another. It also contains the terms of this data exchange.

Get started

To use our API, you need to register on our website (www.3dbinpacking.com) and get your username and API key.

In case you like to test our API, please replace username and api key given below and paste them into the browser address bar.

https://global-api.3dbinpacking.com/packer/fillContainer?query={"username":"USERNAME","api_key":"API_KEY","items":[{"id":"Speakers","w":3,"h":3,"d":3,"wg":2,"quantity":3,"vr":true},{"id":"Bigger item","w":3,"h":3,"d":5,"wg":1,"quantity":2,"vr":true}],"bins":[{"id":"Pack M","h":4,"w":4,"d":4,"wg":"","max_wg":""},{"id":"Pack S","h":3,"w":3,"d":6,"wg":"","max_wg":""}],"params":{"images_background_color":"255,255,255","images_bin_border_color":"59,59,59","images_bin_fill_color":"230,230,230","images_item_border_color":"22,22,22","images_item_fill_color":"255,193,6","images_item_back_border_color":"22,22,22","images_sbs_last_item_fill_color":"177,14,14","images_sbs_last_item_border_color":"22,22,22","images_format":"svg","images_width":50,"images_height":50,"images_source":"file","save_response":true,"stats":0,"item_coordinates":1,"images_complete":1,"images_sbs":1,"images_separated":0}}

If you get a response as below, it will mean that you did everything correctly.

{"id":"1556529305_9ff402ed696d0a5a3d9f26b8987a3758","not_packed_items":[],"bins_packed":[{"bin_data":{"w":4,"h":4,"d":4,"id":"Pack M","used_space":42.1875,"weight":2,"used_weight":100,"stack_height":3,"order_id":null},"image_complete":"https:\/\/eu.api.3dbinpacking.com\/images\/file_hash1.svg","items":[{"id":"Speakers","w":3,"h":3,"d":3,"wg":2,"image_sbs":"https:\/\/eu.api.3dbinpacking.com\/images\/file_hash2.svg","coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}}]},{"bin_data":{"w":3,"h":3,"d":6,"id":"Pack S","used_space":100,"weight":4,"used_weight":100,"stack_height":3,"order_id":null},"image_complete":"https:\/\/eu.api.3dbinpacking.com\/images\/file_hash3.svg","items":[{"id":"Speakers","w":3,"h":3,"d":3,"wg":2,"image_sbs":"https:\/\/eu.api.3dbinpacking.com\/images\/file_hash4.svg","coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}},{"id":"Speakers","w":3,"h":3,"d":3,"wg":2,"image_sbs":"https:\/\/eu.api.3dbinpacking.com\/images\/file_hash5.svg","coordinates":{"x1":0,"y1":0,"z1":3,"x2":3,"y2":3,"z2":6}}]}]}

Endpoints

Currently we have a few servers running around the world for high availability, low latency.
Our global API server is the best. This server will redirect your request to the closest available server.
The list of 3DBinPacking API endpoints:

PEM (X.509)

Requests

Below you can read through the details about methods of sending requests to our API servers.

Available methods of sending data

Available protocols:

Call methods:

Products

Pack a Shipment

Use Pack a Shipment tool to optimize your packing - by number of boxes, space utilization or cost.

URL

Request parameters

Required parameters

REQUEST

{
    "username":"_USERNAME_",
    "api_key":"_API_KEY_",
    "items":
    [
        {
            "id":"Speakers",
            "w":3,
            "h":3,
            "d":3,
            "wg":2,
            "q":3,
            "vr":true
        },
        {
            "id":"Bigger item",
            "w":3,
            "h":3,
            "d":5,
            "wg":1,
            "q":2,
            "vr":true
        },
        {
            "id":"Too big item",
            "w":5,
            "h":5,
            "d":5,
            "wg":1,
            "q":1,
            "vr":true
        }
    ],
    "bins":
    [
        {
            "id":"Pack M",
            "h":4,
            "w":4,
            "d":4,
            "wg":"",
            "max_wg":""
        },
        {
            "id":"Pack S",
            "h":3,
            "w":3,
            "d":6,
            "wg":"",
            "max_wg":""
        }
    ],
    "params":
    {
        "images_background_color":"255,255,255",
        "images_bin_border_color":"59,59,59",
        "images_bin_fill_color":"230,230,230",
        "images_item_border_color":"22,22,22",
        "images_item_fill_color":"255,193,6",
        "images_item_back_border_color":"22,22,22",
        "images_sbs_last_item_fill_color":"177,14,14",
        "images_sbs_last_item_border_color":"22,22,22",
        "images_format":"svg",
        "images_width":50,
        "images_height":50,
        "images_source":"file",
        "stats":0,
        "item_coordinates":1,
        "images_complete":1,
        "images_sbs":1,
        "images_separated":0,
        "optimization_mode":"bins_number"
    }
}
curl -X POST \\
-H "Content-Type: application/json" \\
-d '{"username": "_USERNAME_", "api_key": "_API_KEY_", "items": [{"id": "Speakers", "w": 3, "h": 3, "d": 3, "wg": 2, "q": 3, "vr": true},{"id": "Bigger item", "w": 3, "h": 3, "d": 5, "wg": 1, "q": 2, "vr": true},{"id":"Too big item","w":5,"h":5,"d":5,"wg":1,"q":1,"vr":true}], "bins": [{"id": "Pack M", "h": 4, "w": 4, "d": 4, "wg": "", "max_wg": ""},{"id": "Pack S", "h": 3, "w": 3, "d": 6, "wg": "", "max_wg": ""}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0, "optimization_mode":"bins_number"}}' \\
https://global-api.3dbinpacking.com/packer/packIntoMany \\
-k
<?php
$data = array(
    'bins' => array(
            array(
                    'id' => 'Pack M',
                    'h' => '4',
                    'w' => '4',
                    'd' => '4',
                    'wg' => '',
                    'max_wg' => ''
                ),
            array(
                    'id' => 'Pack S',
                    'h' => '3',
                    'w' => '3',
                    'd' => '6',
                    'wg' => '',
                    'max_wg' => ''
                )
        ),
    'items' => array(
            array(
                    'id' => 'Speakers',
                    'w' => '3',
                    'h' => '3',
                    'd' => '3',
                    'wg' => '2',
                    'q' => '3',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Bigger item',
                    'w' => '3',
                    'h' => '3',
                    'd' => '5',
                    'wg' => '1',
                    'q' => '2',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Too big item',
                    'w' => '5',
                    'h' => '5',
                    'd' => '5',
                    'wg' => '1',
                    'q' => '1',
                    'vr' => '1'
                )
        ),
    'username' => 'YOUR_USERNAME',
    'api_key' => 'YOUR_API_KEY',
    'params' => array(
            'images_background_color' => '255,255,255',
            'images_bin_border_color' => '59,59,59',
            'images_bin_fill_color' => '230,230,230',
            'images_item_border_color' => '22,22,22',
            'images_item_fill_color' => '255,193,6',
            'images_item_back_border_color' => '22,22,22',
            'images_sbs_last_item_fill_color' => '177,14,14',
            'images_sbs_last_item_border_color' => '22,22,22',
            'images_format' => 'svg',
            'images_width' => '50',
            'images_height' => '50',
            'images_source' => 'file',
            'stats' => '0',
            'item_coordinates' => '1',
            'images_complete' => '1',
            'images_sbs' => '1',
            'images_separated' => '0',
            'optimization_mode'=>'bins_number'
        )
);
$query = json_encode($data);

$url = "https://global-api.3dbinpacking.com/packer/packIntoMany";
$prepared_query = 'query='.$query;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$resp = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
}
curl_close($ch);

$response = json_decode($resp,true);
// display errors
if(isset($response['response']['errors'])){
    foreach($response['response']['errors'] as $error){
    echo $error['message'].'<br>';
    }
}
// display data
if( $response['response']['status'] > -1 ){
    $b_packed= $response['response']['bins_packed'];
    foreach ($b_packed as $bin){
        echo "<h2>Bin id:{$bin['bin_data']['id']}</h2>
        <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
        <p> Weight:{$bin['bin_data']['weight']}</p>
        <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>
        <img src=\"{$bin['image_complete']}\">
        <h2>Items packed in this bin:</h2>";
        $items = $bin['items'];
        echo '<table style="text-align: center">
        <tr><th>Item id</th>
            <th>Item dimensions</th>
            <th>Item weight</th>
            <th>Separated item</th>
            <th>Step by step</th></tr>';
        foreach ( $items as $item){
        echo "<tr><td>{$item['id']}</td>
                <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                <td> {$item['wg']}</td>
                <td><img src=\"{$item['image_separated']}\"></td>
                <td><img src=\"{$item['image_sbs']}\"></td>
            </tr>";
        }
        echo '</table>';
        echo '<hr>';

    }
}
#!/usr/bin/python

import httplib
import urllib
import json

conn = httplib.HTTPConnection(host='global-api.3dbinpacking.com', port=80)
data = {"username": "_USERNAME_", "api_key": "_API_KEY_", "items": [{"id": "Speakers", "w": 3, "h": 3, "d": 3, "wg": 2, "q": 3, "vr": true},{"id": "Bigger item", "w": 3, "h": 3, "d": 5, "wg": 1, "q": 2, "vr": true},{"id": "Too big item", "w": 5, "h": 5, "d": 5, "wg": 1, "q": 1, "vr": true}], "bins": [{"id": "Pack M", "h": 4, "w": 4, "d": 4, "wg": "", "max_wg": ""},{"id": "Pack S", "h": 3, "w": 3, "d": 6, "wg": "", "max_wg": ""}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0, "optimization_mode":"bins_number"}}
params =  urllib.urlencode( {'query':json.dumps(data)} )
headers = {"Content-type": "application/x-www-form-urlencoded",
    "Accept": "text/plain"}
conn.request( "POST", "/packer/packIntoMany", params, headers )
content = conn.getresponse( ).read( )
conn.close( )
print content
package javaapplication1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;;
import org.json.simple.JSONObject;
import org.springframework.web.client.RestTemplate;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
        RestTemplate restTemplate = new RestTemplate();
        JSONObject json = new JSONObject();


        //SET BINS
        List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

        Map<String, String> bin1 = new HashMap<String, String>();
        bin1.put("id", "Pack M");
        bin1.put("h", "4");
        bin1.put("w", "4");
        bin1.put("d", "4");
        bin1.put("wg", "");
        bin1.put("max_wg", "");
        bins.add(bin1);
        Map<String, String> bin2 = new HashMap<String, String>();
        bin2.put("id", "Pack S");
        bin2.put("h", "3");
        bin2.put("w", "3");
        bin2.put("d", "6");
        bin2.put("wg", "");
        bin2.put("max_wg", "");
        bins.add(bin2);

        //SET ITEMS
        List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
        Map<String, String> item1 = new HashMap<String, String>();
        item1.put("id", "Speakers");
        item1.put("w", "3");
        item1.put("h", "3");
        item1.put("d", "3");
        item1.put("wg", "2");
        item1.put("q", "3");
        item1.put("vr", "1");
        items.add(item1);
        Map<String, String> item2 = new HashMap<String, String>();
        item2.put("id", "Bigger item");
        item2.put("w", "3");
        item2.put("h", "3");
        item2.put("d", "5");
        item2.put("wg", "1");
        item2.put("q", "2");
        item2.put("vr", "1");
        items.add(item2);
        Map<String, String> item3 = new HashMap<String, String>();
        item3.put("id", "Too big item");
        item3.put("w", "5");
        item3.put("h", "5");
        item3.put("d", "5");
        item3.put("wg", "1");
        item3.put("q", "1");
        item3.put("vr", "1");
        items.add(item3);

        //SET PARAMETERS
        Map <String , String > params  = new HashMap <String , String >();
        params.put("images_background_color", "255,255,255")
        params.put("images_bin_border_color", "59,59,59")
        params.put("images_bin_fill_color", "230,230,230")
        params.put("images_item_border_color", "22,22,22")
        params.put("images_item_fill_color", "255,193,6")
        params.put("images_item_back_border_color", "22,22,22")
        params.put("images_sbs_last_item_fill_color", "177,14,14")
        params.put("images_sbs_last_item_border_color", "22,22,22")
        params.put("images_format", "svg")
        params.put("images_width", "50")
        params.put("images_height", "50")
        params.put("images_source", "file")
        params.put("stats", "0")
        params.put("item_coordinates", "1")
        params.put("images_complete", "1")
        params.put("images_sbs", "1")
        params.put("images_separated", "0")
        params.put("optimization_mode", "bins_number")

        //ADD ELEMENTS TO JSON
        json.put("username", "YOUR_USERNAME");
        json.put("api_key", "YOUR_API_KEY");
        json.put("items", items);
        json.put("bins", bins);
        json.put("params", params);

        //CALL QUERY
        HttpURLConnection conn;
        URL addr = new URL("https://global-api.3dbinpacking.com/packer/packIntoMany");
        conn = (HttpURLConnection) addr.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.connect();
        OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

        // prepare POST body
        String query = "query=" + json.toString();

        osw.write(query);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String response_json = br.readLine();

        //DO SOMETHING COOL WITH THE RESPONSE
        System.out.println(response_json);
    }
}
string data;
System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://global-api.3dbinpacking.com/packer/packIntoMany") as System.Net.HttpWebRequest;

var request_data = new {username = "YOUR_USERNAME",
                        api_key = "YOUR_API_KEY",
                        items = new[] {
                                        new { id = "Speakers", w = "3", h = "3", d = "3", wg = "2", q = "3", vr = "1"},
                                        new { id = "Bigger item", w = "3", h = "3", d = "5", wg = "1", q = "2", vr = "1"},
                                        new { id = "Too big item", w = "5", h = "5", d = "5", wg = "1", q = "1", vr = "1"}
                                        },
                        bins = new[] {
                                        new { id = "Pack M", h = "4", w = "4", d = "4", wg = "", max_wg = ""},
                                        new { id = "Pack S", h = "3", w = "3", d = "6", wg = "", max_wg = ""}
                                        },

                        @params = new { images_background_color = "255,255,255",
                                        images_bin_border_color = "59,59,59",
                                        images_bin_fill_color = "230,230,230",
                                        images_item_border_color = "22,22,22",
                                        images_item_fill_color = "255,193,6",
                                        images_item_back_border_color = "22,22,22",
                                        images_sbs_last_item_fill_color = "177,14,14",
                                        images_sbs_last_item_border_color = "22,22,22",
                                        images_format = "svg",
                                        images_width = "50",
                                        images_height = "50",
                                        images_source = "file",
                                        stats = "0",
                                        item_coordinates = "1",
                                        images_complete = "1",
                                        images_sbs = "1",
                                        images_separated = "0",
                                        optimization_mode= "bins_number"
                                        }
                    };

string json_str = JsonConvert.SerializeObject(request_data);

string queryParam = "query="+json_str;

byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;

System.IO.Stream postStream = req.GetRequestStream();
postStream.Write(postBytes, 0, postBytes.Length);
postStream.Close();

X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\global-api.3dbinpacking.com.pem");
req.ClientCertificates.Add(Cert);

using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
{
    System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
    data = reader.ReadToEnd();
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[bins]
(required)
Array of packing spaces parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters of extra request parameters array

[bins] - Packing spaces array details

Param name Description Data type
id
(required)
Packing space ID. The number or code you use to identify the packing space. string
w
(required)
Packing space width integer or float
h
(required)
Packing space height integer or float
d
(required)
Packing space depth/length integer or float
wg The weight of the packing space integer or float
max_wg The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit integer or float

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer Vertical rotation. The information if the item can be rotated vertically.
q
(required)
The amount of the same items to pack integer
group Grouped items are packed together, which enables to separate e.g. food products (group 'X') from domestic detergents (group 'Y'). string
separate Items separation; Parameter set to '1' means that given items cannot be packed together with other items integer Available values:
1 - means that items will be separated,
0 [default] - means that items will not be separated
limit_per_bin Define how many items can be packed in one packing space integer
acceptable_bins Define which packing spaces can be used to pack items. If the parameter is not set, then all packing spaces can be used. Given values have to contain packing spaces ID included in 'bins' parameter. array
item_colors_schema Define which kind of color schema should be used string Available values:
default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color',
'random' - x,
'item' - x
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
optimization_mode Define a packing optimisation method string Available values:
bins_number [default] - the smallest possible number of packing spaces;
bins_utilization - max. utilization inside packing spaces;
cost - the lowest cost of shipment or transport ('cost' parameter is required to be given for every packing space)
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that coordinates of the placement of each item will not be returned,
1 - that coordinates of the placement of each item will be returned
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "response":{
        "id":"response_id",
        "bins_packed":[
            {
                "bin_data":{
                    "w":3,
                    "h":3,
                    "d":6,
                    "id":"Pack S",
                    "used_space":100,
                    "weight":4,
                    "gross_weight":4,
                    "used_weight":100,
                    "stack_height":3
                },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Speakers",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":2,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                    },{
                        "id":"Speakers",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":2,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":3,"x2":3,"y2":3,"z2":6}
                    }
                ]
            },{
                "bin_data":{
                    "w":3,
                    "h":3,
                    "d":6,
                    "id":"Pack S",
                    "used_space":83.3333,
                    "weight":1,
                    "gross_weight":1,
                    "used_weight":100,
                    "stack_height":3
                },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Bigger item",
                        "w":3,
                        "h":3,
                        "d":5,
                        "wg":1,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":5}
                    }
                ]
            }
        ],
        "errors":[
            {
                "level":"notice",
                "message":"Item \u0027Too big item\u0027 can\u0027t be packed into any bin."
            }
        ],
        "status":1,
        "not_packed_items":[
            {
                "id":"Too big item",
                "q":1,
                "w":5,
                "h":5,
                "d":5,
                "wg":1
            }
        ]
    }
}
Param name Description Data type Info
[bins_packed] List of packed items array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[bins_packed] - The list of packing spaces to be packed

Param name Description Data type
bin_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array

[bin_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Stack Pallets

Use Stack Pallets tool to optimize how you pack your pallets and reduce their number for transport and storage.

URL

Request parameters

Required parameters

REQUEST

{
    "username":"_USERNAME_",
    "api_key":"_API_KEY_",
    "items":
    [
        {
            "id":"Speakers",
            "w":3,
            "h":3,
            "d":3,
            "wg":2,
            "q":2,
            "vr":true
        },
        {
            "id":"Bigger item",
            "w":3,
            "h":3,
            "d":5,
            "wg":1,
            "q":2,
            "vr":true
        }
    ],
    "pallet":
    {
        "id":"Palet M",
        "h":4,
        "w":4,
        "d":4,
        "wg":"",
        "max_wg":""
    },
    "params":
    {
        "images_background_color":"255,255,255",
        "images_bin_border_color":"59,59,59",
        "images_bin_fill_color":"230,230,230",
        "images_item_border_color":"22,22,22",
        "images_item_fill_color":"255,193,6",
        "images_item_back_border_color":"22,22,22",
        "images_sbs_last_item_fill_color":"177,14,14",
        "images_sbs_last_item_border_color":"22,22,22",
        "images_format":"svg",
        "images_width":50,
        "images_height":50,
        "images_source":"file",
        "stats":0,
        "item_coordinates":1,
        "images_complete":1,
        "images_sbs":1,
        "images_separated":0
    }
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[pallet]
(required)
Array of pallet parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters array

[pallet] - Pallet array details

Param name Description Data type
id
(required)
Pallet ID. A pallet you want to stack your items onto string
w
(required)
Pallet width integer or float
h
(required)
Pallet height integer or float
d
(required)
Pallet depth/length integer or float
wg The weight of the packing space integer or float
max_wg The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit integer or float

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer Vertical rotation. The information if the item can be rotated vertically.
q
(required)
The amount of the same items to pack integer
item_colors_schema Define which kind of color schema should be used string
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that coordinates of the placement of each item will not be returned,
1 - that coordinates of the placement of each item will be returned
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "id":"response_id",
    "pallets_packed":[
        {
            "pallet_data":{
                "w":4,
                "h":3,
                "d":4,
                "id":"Paleta M",
                "used_space":56.25,
                "weight":2,
                "used_weight":100,
                "gross_weight":2,
                "stack_height":3
            },
            "image_complete":"image_url.svg",
            "items":[
                {
                    "id":"Speakers",
                    "w":3,
                    "h":3,
                    "d":3,
                    "wg":2,
                    "image_sbs":"image_url.svg",
                    "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                }
            ]
        },
        {
            "pallet_data":{
                "w":4,
                "h":3,
                "d":4,
                "id":"Palet M",
                "used_space":56.25,
                "weight":2,
                "used_weight":100,
                "gross_weight":2,
                "stack_height":3
            },
            "image_complete":"image_url.svg",
            "items":[
                {
                    "id":"Speakers",
                    "w":3,
                    "h":3,
                    "d":3,
                    "wg":2,
                    "image_sbs":"image_url.svg",
                    "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                }
            ]
        }
    ],
    "errors":[],
    "status":1,
    "not_packed_items":[
        {
            "id":"Bigger item",
            "q":2,
            "w":3,
            "h":3,
            "d":5,
            "wg":1
        }
    ]
}
Param name Description Data type Info
[pallets_packed] The list of pallets to be packed array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[pallets_packed] - The list of pallets to be packed

Param name Description Data type
pallet_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array

[pallet_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Find a Missing Dimension

Use Find a Missing Dimension tool to calculate measurements and the area your packing will use.

URL

Request parameters

Required parameters

REQUEST

{
    "username":"_USERNAME_",
    "api_key":"_API_KEY_",
    "bins": [
        {
            "w": 5,
            "h": 0,
            "d": 5,
            "id": "Bin1",
            "find": "h"
        },
        {
            "w": 3,
            "h": 30,
            "d": 3,
            "id": "Bin2",
            "find": "h"
        }
    ],
    "items": [
        {
            "w": 5,
            "h": 3,
            "d": 2,
            "q": 2,
            "vr": 1,
            "id": "Item1"
        },
        {
            "w": 3,
            "h": 3,
            "d": 3,
            "q": 3,
            "vr": 1,
            "id": "Item2"
        }
    ],
    "params":
    {
        "images_background_color":"255,255,255",
        "images_bin_border_color":"59,59,59",
        "images_bin_fill_color":"230,230,230",
        "images_item_border_color":"22,22,22",
        "images_item_fill_color":"255,193,6",
        "images_item_back_border_color":"22,22,22",
        "images_sbs_last_item_fill_color":"177,14,14",
        "images_sbs_last_item_border_color":"22,22,22",
        "images_format":"svg",
        "images_width":50,
        "images_height":50,
        "images_source":"file",
        "stats":0,
        "item_coordinates":1,
        "images_complete":1,
        "images_sbs":1,
        "images_separated":0
    }
}
curl -X POST \\
-H "Content-Type: application/json" \\
-d '{"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 5,"h": 0,"d": 5,"id": "Bin1","find": "h"},{"w": 3,"h": 30,"d": 3,"id": "Bin2","find": "h"}],"items": [{"w": 5,"h": 3,"d": 2,"q": 2,"vr": 1,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"q": 3,"vr": 1,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}' \\
https://global-api.3dbinpacking.com/packer/findSmallestBin \\
-k
<?php

$data = array(
    'bins' => array(
            array(
                    'id' => 'Bin1',
                    'h' => '0',
                    'w' => '5',
                    'd' => '5',
                    'find' => 'h'
                ),
            array(
                    'id' => 'Pack S',
                    'h' => '30',
                    'w' => '3',
                    'd' => '3',
                    'find' => 'h'
                )
        ),
    'items' => array(
            array(
                    'id' => 'Item1',
                    'w' => '5',
                    'h' => '3',
                    'd' => '2',
                    'wg' => '2',
                    'q' => '2',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Item2',
                    'w' => '3',
                    'h' => '3',
                    'd' => '3',
                    'wg' => '1',
                    'q' => '3',
                    'vr' => '1'
                )
        ),
    'username' => 'YOUR_USERNAME',
    'api_key' => 'YOUR_API_KEY',
    'params' => array(
            'images_background_color' => '255,255,255',
            'images_bin_border_color' => '59,59,59',
            'images_bin_fill_color' => '230,230,230',
            'images_item_border_color' => '22,22,22',
            'images_item_fill_color' => '255,193,6',
            'images_item_back_border_color' => '22,22,22',
            'images_sbs_last_item_fill_color' => '177,14,14',
            'images_sbs_last_item_border_color' => '22,22,22',
            'images_format' => 'svg',
            'images_width' => '50',
            'images_height' => '50',
            'images_source' => 'file',
            'stats' => '0',
            'item_coordinates' => '1',
            'images_complete' => '1',
            'images_sbs' => '1',
            'images_separated' => '0'
        )
);
$query = json_encode($data);

$url = "https://global-api.3dbinpacking.com/packer/findSmallestBin";
$prepared_query = 'query='.$query;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$resp = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
}
curl_close($ch);

$response = json_decode($resp,true);
// display errors
if(isset($response['response']['errors'])){
    foreach($response['response']['errors'] as $error){
    echo $error['message'].'<br>';
    }
}
// display data
if( $response['response']['status'] > -1 ){
    $b_packed= $response['response']['bins_packed'];
    foreach ($b_packed as $bin){
        echo "<h2>Bin id:{$bin['bin_data']['id']}</h2>
        <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
        <p> Weight:{$bin['bin_data']['weight']}</p>
        <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>
        <img src=\"{$bin['image_complete']}\">
        <h2>Items packed in this bin:</h2>";
        $items = $bin['items'];
        echo '<table style="text-align: center">
        <tr><th>Item id</th>
            <th>Item dimensions</th>
            <th>Item weight</th>
            <th>Separated item</th>
            <th>Step by step</th></tr>';
        foreach ( $items as $item){
        echo "<tr><td>{$item['id']}</td>
                <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                <td> {$item['wg']}</td>
                <td><img src=\"{$item['image_separated']}\"></td>
                <td><img src=\"{$item['image_sbs']}\"></td>
            </tr>";
        }
        echo '</table>';
        echo '<hr>';

    }
}
#!/usr/bin/python

import httplib
import urllib
import json

conn = httplib.HTTPConnection(host='global-api.3dbinpacking.com', port=80)
data = {"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 5,"h": 0,"d": 5,"id": "Bin1","find": "h"},{"w": 3,"h": 30,"d": 3,"id": "Bin2","find": "h"}],"items": [{"w": 5,"h": 3,"d": 2,"q": 2,"vr": 1,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"q": 3,"vr": 1,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}
params =  urllib.urlencode( {'query':json.dumps(data)} )
headers = {"Content-type": "application/x-www-form-urlencoded",
    "Accept": "text/plain"}
conn.request( "POST", "/packer/findSmallestBin", params, headers )
content = conn.getresponse( ).read( )
conn.close( )
print content
package javaapplication1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;;
import org.json.simple.JSONObject;
import org.springframework.web.client.RestTemplate;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
        RestTemplate restTemplate = new RestTemplate();
        JSONObject json = new JSONObject();


        //SET BINS
        List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

        Map<String, String> bin1 = new HashMap<String, String>();
        bin1.put("id", "Bin1");
        bin1.put("h", "0");
        bin1.put("w", "5");
        bin1.put("d", "5");
        bin1.put("find", "h");
        bins.add(bin1);
        Map<String, String> bin2 = new HashMap<String, String>();
        bin2.put("id", "Bin2");
        bin2.put("h", "30");
        bin2.put("w", "5");
        bin2.put("d", "5");
        bin2.put("find", "h");
        bins.add(bin2);

        //SET ITEMS
        List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
        Map<String, String> item1 = new HashMap<String, String>();
        item1.put("id", "Item1");
        item1.put("w", "5");
        item1.put("h", "3");
        item1.put("d", "2");
        item1.put("q", "2");
        item1.put("vr", "1");
        items.add(item1);
        Map<String, String> item2 = new HashMap<String, String>();
        item2.put("id", "Item2");
        item2.put("w", "3");
        item2.put("h", "3");
        item2.put("d", "3");
        item2.put("wg", "1");
        item2.put("q", "3");
        item2.put("vr", "1");
        items.add(item2);

        //SET PARAMETERS
        Map <String , String > params  = new HashMap <String , String >();
        params.put("images_background_color", "255,255,255")
        params.put("images_bin_border_color", "59,59,59")
        params.put("images_bin_fill_color", "230,230,230")
        params.put("images_item_border_color", "22,22,22")
        params.put("images_item_fill_color", "255,193,6")
        params.put("images_item_back_border_color", "22,22,22")
        params.put("images_sbs_last_item_fill_color", "177,14,14")
        params.put("images_sbs_last_item_border_color", "22,22,22")
        params.put("images_format", "svg")
        params.put("images_width", "50")
        params.put("images_height", "50")
        params.put("images_source", "file")
        params.put("stats", "0")
        params.put("item_coordinates", "1")
        params.put("images_complete", "1")
        params.put("images_sbs", "1")
        params.put("images_separated", "0")

        //ADD ELEMENTS TO JSON
        json.put("username", "YOUR_USERNAME");
        json.put("api_key", "YOUR_API_KEY");
        json.put("items", items);
        json.put("bins", bins);
        json.put("params", params);

        //CALL QUERY
        HttpURLConnection conn;
        URL addr = new URL("https://global-api.3dbinpacking.com/packer/findSmallestBin");
        conn = (HttpURLConnection) addr.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.connect();
        OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

        // prepare POST body
        String query = "query=" + json.toString();

        osw.write(query);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String response_json = br.readLine();

        //DO SOMETHING COOL WITH THE RESPONSE
        System.out.println(response_json);
    }
}
string data;
System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://global-api.3dbinpacking.com/packer/findSmallestBin") as System.Net.HttpWebRequest;

var request_data = new {username = "YOUR_USERNAME",
                        api_key = "YOUR_API_KEY",
                        items = new[] {
                                        new { id = "Item1", w = "5", h = "3", d = "2", wg = "2", q = "2", vr = "1"},
                                        new { id = "Item2", w = "3", h = "3", d = "3", wg = "1", q = "3", vr = "1"}
                                        },
                        bins = new[] {
                                        new { id = "Bin1", h = "0", w = "5", d = "5"},
                                        new { id = "Bin2", h = "30", w = "5", d = "5"}
                                        },

                        @params = new { images_background_color = "255,255,255",
                                        images_bin_border_color = "59,59,59",
                                        images_bin_fill_color = "230,230,230",
                                        images_item_border_color = "22,22,22",
                                        images_item_fill_color = "255,193,6",
                                        images_item_back_border_color = "22,22,22",
                                        images_sbs_last_item_fill_color = "177,14,14",
                                        images_sbs_last_item_border_color = "22,22,22",
                                        images_format = "svg",
                                        images_width = "50",
                                        images_height = "50",
                                        images_source = "file",
                                        stats = "0",
                                        item_coordinates = "1",
                                        images_complete = "1",
                                        images_sbs = "1",
                                        images_separated = "0"
                                        }
                    };

string json_str = JsonConvert.SerializeObject(request_data);

string queryParam = "query="+json_str;

byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;

System.IO.Stream postStream = req.GetRequestStream();
postStream.Write(postBytes, 0, postBytes.Length);
postStream.Close();

X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\global-api.3dbinpacking.com.pem");
req.ClientCertificates.Add(Cert);

using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
{
    System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
    data = reader.ReadToEnd();
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[bins]
(required)
Array of packing spaces parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters array

[bins] - Packing spaces array details

Param name Description Data type Info
id
(required)
Packing space ID. The number or code you use to identify the packing space. string
w
(required)
Packing space width float
h
(required)
Packing space height float
d
(required)
Packing space depth/length float
find
(required)
It indicate which dimension of container should be found string Available values:
'w' - menas that the algorithm will calculate width of container,
'h' - menas that the algorithm will calculate height of container,
'd' - menas that the algorithm will calculate depth of container

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer Vertical rotation. The information if the item can be rotated vertically.
q
(required)
The amount of the same items to pack integer
acceptable_bins Define which packing spaces can be used to pack items. If the parameter is not set, then all packing spaces can be used. Given values have to contain packing spaces ID included in 'bins' parameter. array
item_colors_schema Define which kind of color schema should be used string Available values:
default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color',
'random' - x,
'item' - x
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that coordinates of the placement of each item will not be returned,
1 - that coordinates of the placement of each item will be returned
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "response":{
        "id":"response_id",
        "bins_packed":[
            {
                "bin_data":{
                    "w":5,
                    "h":9,
                    "d":5,
                    "id":"Bin1",
                    "used_space":62.6667,
                    "weight":0,
                    "gross_weight":0,
                    "used_weight":100,
                    "stack_height":9,
                    "order_id":null
                },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":2,"y2":5,"z2":3}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":2,"y1":0,"z1":0,"x2":5,"y2":3,"z2":3}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":5,"z1":0,"x2":2,"y2":8,"z2":5}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":2,"y1":3,"z1":0,"x2":5,"y2":6,"z2":3}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":2,"y1":6,"z1":0,"x2":5,"y2":9,"z2":3}
                    }
                ],
                "not_packed_items":[]
            },{
                "bin_data":{
                    "w":3,
                    "h":19,
                    "d":3,
                    "id":"Bin2",
                    "used_space":82.4561,
                    "weight":0,
                    "gross_weight":0,
                    "used_weight":100,
                    "stack_height":19,
                    "order_id":null
                },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":3,"z1":0,"x2":3,"y2":6,"z2":3}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":6,"z1":0,"x2":3,"y2":9,"z2":3}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":9,"z1":0,"x2":3,"y2":14,"z2":2}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":14,"z1":0,"x2":3,"y2":19,"z2":2}
                    }
                ],
                "not_packed_items":[]
            }
        ],
        "errors":[],
        "status":1,
        "not_packed_items":[]
    }
}
Param name Description Data type Info
[bins_packed] List of packed items array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[bins_packed] - The list of packing spaces to be packed

Param name Description Data type
bin_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array
[not_packed_items] Items unable to be packed in the packing space array

[bin_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Find a Box Size

Use Find a Box Size tool to maximize the use of space and calculate the right-sized box for your packing.

URL

Request parameters

Required parameters

REQUEST

{
    "bins": [
        {
            "w": 0,
            "h": 0,
            "d": 0,
            "id": "Bin1"
        }
    ],
    "items": [
        {
            "w": 5,
            "h": 3,
            "d": 2,
            "q": 2,
            "vr": 1,
            "id": "Item1"
        },{
            "w": 3,
            "h": 3,
            "d": 3,
            "q": 3,
            "vr": 1,
            "id": "Item2"
        }
    ],
    "username": "YOUR_USERNAME",
    "api_key": "YOUR_API_KEY",
    "params": {
        "images_background_color": "255,255,255",
        "images_bin_border_color": "59,59,59",
        "images_bin_fill_color": "230,230,230",
        "images_item_border_color": "214,79,79",
        "images_item_fill_color": "177,14,14",
        "images_item_back_border_color": "215,103,103",
        "images_sbs_last_item_fill_color": "99,93,93",
        "images_sbs_last_item_border_color": "145,133,133",
        "images_width": 100,
        "images_height": 100,
        "images_source": "file",
        "images_sbs": 1,
        "item_coordinates": 1,
        "images_complete": 1,
        "images_separated": 1
    }
}
curl -X POST \\
-H "Content-Type: application/json" \\
-d '{"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 0,"h": 0,"d": 0,"id": "Bin1"}],"items": [{"w": 5,"h": 3,"d": 2,"q": 2,"vr": 1,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"q": 3,"vr": 1,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}' \\
https://global-api.3dbinpacking.com/packer/findBinSize \\
-k
<?php

$data = array(
    'bins' => array(
            array(
                    'id' => 'Bin1',
                    'h' => '0',
                    'w' => '0',
                    'd' => '0',
                )
        ),
    'items' => array(
            array(
                    'id' => 'Item1',
                    'w' => '5',
                    'h' => '3',
                    'd' => '2',
                    'q' => '2',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Item2',
                    'w' => '3',
                    'h' => '3',
                    'd' => '3',
                    'q' => '3',
                    'vr' => '1'
                )
        ),
    'username' => 'YOUR_USERNAME',
    'api_key' => 'YOUR_API_KEY',
    'params' => array(
            'images_background_color' => '255,255,255',
            'images_bin_border_color' => '59,59,59',
            'images_bin_fill_color' => '230,230,230',
            'images_item_border_color' => '22,22,22',
            'images_item_fill_color' => '255,193,6',
            'images_item_back_border_color' => '22,22,22',
            'images_sbs_last_item_fill_color' => '177,14,14',
            'images_sbs_last_item_border_color' => '22,22,22',
            'images_format' => 'svg',
            'images_width' => '50',
            'images_height' => '50',
            'images_source' => 'file',
            'item_coordinates' => '1',
            'images_complete' => '1',
            'images_sbs' => '1',
            'images_separated' => '0'
        )
);
$query = json_encode($data);

$url = "https://global-api.3dbinpacking.com/packer/findBinSize";
$prepared_query = 'query='.$query;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$resp = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
}
curl_close($ch);

$response = json_decode($resp,true);
// display errors
if(isset($response['response']['errors'])){
    foreach($response['response']['errors'] as $error){
    echo $error['message'].'<br>';
    }
}
// display data
if( $response['response']['status'] > -1 ){
    $b_packed= $response['response']['bins_packed'];
    foreach ($b_packed as $bin){
        echo "<h2>Bin id:{$bin['bin_data']['id']}</h2>
        <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
        <p> Weight:{$bin['bin_data']['weight']}</p>
        <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>
        <img src=\"{$bin['image_complete']}\">
        <h2>Items packed in this bin:</h2>";
        $items = $bin['items'];
        echo '<table style="text-align: center">
        <tr><th>Item id</th>
            <th>Item dimensions</th>
            <th>Item weight</th>
            <th>Separated item</th>
            <th>Step by step</th></tr>';
        foreach ( $items as $item){
        echo "<tr><td>{$item['id']}</td>
                <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                <td> {$item['wg']}</td>
                <td><img src=\"{$item['image_separated']}\"></td>
                <td><img src=\"{$item['image_sbs']}\"></td>
            </tr>";
        }
        echo '</table>';
        echo '<hr>';

    }
}
#!/usr/bin/python

import httplib
import urllib
import json

conn = httplib.HTTPConnection(host='global-api.3dbinpacking.com', port=80)
data = {"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 0,"h": 0,"d": 0,"id": "Bin1"}],"items": [{"w": 5,"h": 3,"d": 2,"q": 2,"vr": 1,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"q": 3,"vr": 1,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}
params =  urllib.urlencode( {'query':json.dumps(data)} )
headers = {"Content-type": "application/x-www-form-urlencoded",
    "Accept": "text/plain"}
conn.request( "POST", "/packer/findBinSize", params, headers )
content = conn.getresponse( ).read( )
conn.close( )
print content
package javaapplication1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;;
import org.json.simple.JSONObject;
import org.springframework.web.client.RestTemplate;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
        RestTemplate restTemplate = new RestTemplate();
        JSONObject json = new JSONObject();


        //SET BINS
        List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

        Map<String, String> bin1 = new HashMap<String, String>();
        bin1.put("id", "Bin1");
        bin1.put("h", "0");
        bin1.put("w", "0");
        bin1.put("d", "0");
        bins.add(bin1);

        //SET ITEMS
        List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
        Map<String, String> item1 = new HashMap<String, String>();
        item1.put("id", "Item1");
        item1.put("w", "5");
        item1.put("h", "3");
        item1.put("d", "2");
        item1.put("q", "2");
        item1.put("vr", "1");
        items.add(item1);
        Map<String, String> item2 = new HashMap<String, String>();
        item2.put("id", "Item2");
        item2.put("w", "3");
        item2.put("h", "3");
        item2.put("d", "3");
        item2.put("q", "3");
        item2.put("vr", "1");
        items.add(item2);

        //SET PARAMETERS
        Map <String , String > params  = new HashMap <String , String >();
        params.put("images_background_color", "255,255,255")
        params.put("images_bin_border_color", "59,59,59")
        params.put("images_bin_fill_color", "230,230,230")
        params.put("images_item_border_color", "22,22,22")
        params.put("images_item_fill_color", "255,193,6")
        params.put("images_item_back_border_color", "22,22,22")
        params.put("images_sbs_last_item_fill_color", "177,14,14")
        params.put("images_sbs_last_item_border_color", "22,22,22")
        params.put("images_format", "svg")
        params.put("images_width", "50")
        params.put("images_height", "50")
        params.put("images_source", "file")
        params.put("item_coordinates", "1")
        params.put("images_complete", "1")
        params.put("images_sbs", "1")
        params.put("images_separated", "0")

        //ADD ELEMENTS TO JSON
        json.put("username", "YOUR_USERNAME");
        json.put("api_key", "YOUR_API_KEY");
        json.put("items", items);
        json.put("bins", bins);
        json.put("params", params);

        //CALL QUERY
        HttpURLConnection conn;
        URL addr = new URL("https://global-api.3dbinpacking.com/packer/findBinSize");
        conn = (HttpURLConnection) addr.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.connect();
        OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

        // prepare POST body
        String query = "query=" + json.toString();

        osw.write(query);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String response_json = br.readLine();

        //DO SOMETHING COOL WITH THE RESPONSE
        System.out.println(response_json);
    }
}
string data;
System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://global-api.3dbinpacking.com/packer/findBinSize") as System.Net.HttpWebRequest;

var request_data = new {username = "YOUR_USERNAME",
                        api_key = "YOUR_API_KEY",
                        items = new[] {
                                        new { id = "Item1", w = "5", h = "3", d = "2", q = "2", vr = "1"},
                                        new { id = "Item2", w = "3", h = "3", d = "3", q = "3", vr = "1"}
                                        },
                        bins = new[] {
                                        new { id = "Bin1", h = "0", w = "0", d = "0"}
                                        },

                        @params = new { images_background_color = "255,255,255",
                                        images_bin_border_color = "59,59,59",
                                        images_bin_fill_color = "230,230,230",
                                        images_item_border_color = "22,22,22",
                                        images_item_fill_color = "255,193,6",
                                        images_item_back_border_color = "22,22,22",
                                        images_sbs_last_item_fill_color = "177,14,14",
                                        images_sbs_last_item_border_color = "22,22,22",
                                        images_format = "svg",
                                        images_width = "50",
                                        images_height = "50",
                                        images_source = "file",
                                        item_coordinates = "1",
                                        images_complete = "1",
                                        images_sbs = "1",
                                        images_separated = "0"
                                        }
                    };

string json_str = JsonConvert.SerializeObject(request_data);

string queryParam = "query="+json_str;

byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;

System.IO.Stream postStream = req.GetRequestStream();
postStream.Write(postBytes, 0, postBytes.Length);
postStream.Close();

X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\global-api.3dbinpacking.com.pem");
req.ClientCertificates.Add(Cert);

using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
{
    System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
    data = reader.ReadToEnd();
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[bins]
(required)
Array of packing spaces parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters array

[bins] - Packing spaces array details

Param name Description Data type
id
(required)
Packing space ID. The number or code you use to identify the packing space. string
w
(required)
Packing space max. width
(required)
float
h
(required)
Packing space max. height float
d
(required)
Packing space max. depth/length float

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer Vertical rotation. The information if the item can be rotated vertically.
q
(required)
The amount of the same items to pack integer
item_colors_schema Define which kind of color schema should be used string
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that coordinates of the placement of each item will not be returned,
1 - that coordinates of the placement of each item will be returned
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "response":{
        "id":"response_id",
        "bins_packed":[
            {
                "bin_data":{
                    "w":8,
                    "h":3,
                    "d":7,
                    "id":null,
                    "used_space":83.9286,
                    "weight":0,
                    "gross_weight":0,
                    "used_weight":100,
                    "stack_height":3
                },
                "image_complete":"image_url.png",
                "items":[
                    {
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":0,"z1":2,"x2":5,"y2":3,"z2":4}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":2,"y1":0,"z1":4,"x2":5,"y2":3,"z2":7}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":5,"y1":0,"z1":0,"x2":8,"y2":3,"z2":3}
                    },{
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":5,"y1":0,"z1":3,"x2":8,"y2":3,"z2":6}
                    }
                ]
            }
        ],
        "errors":[],
        "status":1,
        "not_packed_items":[]
    }
}
Param name Description Data type Info
[bins_packed] List of packed items array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[bins_packed] - The list of packing spaces to be packed

Param name Description Data type
bin_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array
[not_packed_items] Items unable to be packed in the packing space array

[bin_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Try Out Box Sizes

Use Try Out Box Sizes tool to compare packing items in different sized boxes or packing spaces.

URL

Request parameters

Required parameters

REQUEST

{
    "username":"_USERNAME_",
    "api_key":"_API_KEY_",
    "items":
    [
       {"id":"Speakers","w":3,"h":3,"d":3,"wg":2,"q":3,"vr":true},
       {"id":"Bigger item","w":3,"h":3,"d":5,"wg":1,"q":2,"vr":true}
    ],
    "bins":
    [
       {"id":"Pack M","h":4,"w":4,"d":4,"wg":"","max_wg":""},
       {"id":"Pack S","h":3,"w":3,"d":6,"wg":"","max_wg":""}
    ],
    "params":
    {
       "images_background_color":"255,255,255",
       "images_bin_border_color":"59,59,59",
       "images_bin_fill_color":"230,230,230",
       "images_item_border_color":"22,22,22",
       "images_item_fill_color":"255,193,6",
       "images_item_back_border_color":"22,22,22",
       "images_sbs_last_item_fill_color":"177,14,14",
       "images_sbs_last_item_border_color":"22,22,22",
       "images_format":"svg",
       "images_width":50,
       "images_height":50,
       "images_source":"file",
       "stats":0,
       "item_coordinates":1,
       "images_complete":1,
       "images_sbs":1,
       "images_separated":0
    }
}
curl -X POST \\
-H "Content-Type: application/json" \\
-d '{"username": "_USERNAME_", "api_key": "_API_KEY_", "items": [{"id": "Speakers", "w": 3, "h": 3, "d": 3, "wg": 2, "q": 3, "vr": true},{"id": "Bigger item", "w": 3, "h": 3, "d": 5, "wg": 1, "q": 2, "vr": true}], "bins": [{"id": "Pack M", "h": 4, "w": 4, "d": 4, "wg": "", "max_wg": ""},{"id": "Pack S", "h": 3, "w": 3, "d": 6, "wg": "", "max_wg": ""}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}' \\
https://global-api.3dbinpacking.com/packer/pack \\
-k
<?php
$data = array(
    'bins' => array(
            array(
                    'id' => 'Pack M',
                    'h' => '4',
                    'w' => '4',
                    'd' => '4',
                    'wg' => '',
                    'max_wg' => ''
                ),
            array(
                    'id' => 'Pack S',
                    'h' => '3',
                    'w' => '3',
                    'd' => '6',
                    'wg' => '',
                    'max_wg' => ''
                )
        ),
    'items' => array(
            array(
                    'id' => 'Speakers',
                    'w' => '3',
                    'h' => '3',
                    'd' => '3',
                    'wg' => '2',
                    'q' => '3',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Bigger item',
                    'w' => '3',
                    'h' => '3',
                    'd' => '5',
                    'wg' => '1',
                    'q' => '2',
                    'vr' => '1'
                )
        ),
    'username' => 'YOUR_USERNAME',
    'api_key' => 'YOUR_API_KEY',
    'params' => array(
            'images_background_color' => '255,255,255',
            'images_bin_border_color' => '59,59,59',
            'images_bin_fill_color' => '230,230,230',
            'images_item_border_color' => '22,22,22',
            'images_item_fill_color' => '255,193,6',
            'images_item_back_border_color' => '22,22,22',
            'images_sbs_last_item_fill_color' => '177,14,14',
            'images_sbs_last_item_border_color' => '22,22,22',
            'images_format' => 'svg',
            'images_width' => '50',
            'images_height' => '50',
            'images_source' => 'file',
            'stats' => '0',
            'item_coordinates' => '1',
            'images_complete' => '1',
            'images_sbs' => '1',
            'images_separated' => '0'
        )
);
$query = json_encode($data);

$url = "https://global-api.3dbinpacking.com/packer/pack";
$prepared_query = 'query='.$query;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$resp = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
}
curl_close($ch);

$response = json_decode($resp,true);
// display errors
if(isset($response['response']['errors'])){
    foreach($response['response']['errors'] as $error){
    echo $error['message'].'<br>';
    }
}
// display data
if( $response['response']['status'] > -1 ){
    $b_packed= $response['response']['bins_packed'];
    foreach ($b_packed as $bin){
        echo "<h2>Bin id:{$bin['bin_data']['id']}</h2>
        <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
        <p> Weight:{$bin['bin_data']['weight']}</p>
        <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>
        <img src=\"{$bin['image_complete']}\">
        <h2>Items packed in this bin:</h2>";
        $items = $bin['items'];
        echo '<table style="text-align: center">
        <tr><th>Item id</th>
            <th>Item dimensions</th>
            <th>Item weight</th>
            <th>Separated item</th>
            <th>Step by step</th></tr>';
        foreach ( $items as $item){
        echo "<tr><td>{$item['id']}</td>
                <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                <td> {$item['wg']}</td>
                <td><img src=\"{$item['image_separated']}\"></td>
                <td><img src=\"{$item['image_sbs']}\"></td>
            </tr>";
        }
        echo '</table>';
        echo '<hr>';

    }
}
#!/usr/bin/python

import httplib
import urllib
import json

conn = httplib.HTTPConnection(host='global-api.3dbinpacking.com', port=80)
data = {"username": "_USERNAME_", "api_key": "_API_KEY_", "items": [{"id": "Speakers", "w": 3, "h": 3, "d": 3, "wg": 2, "q": 3, "vr": true},{"id": "Bigger item", "w": 3, "h": 3, "d": 5, "wg": 1, "q": 2, "vr": true}], "bins": [{"id": "Pack M", "h": 4, "w": 4, "d": 4, "wg": "", "max_wg": ""},{"id": "Pack S", "h": 3, "w": 3, "d": 6, "wg": "", "max_wg": ""}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}
params =  urllib.urlencode( {'query':json.dumps(data)} )
headers = {"Content-type": "application/x-www-form-urlencoded",
    "Accept": "text/plain"}
conn.request( "POST", "/packer/pack", params, headers )
content = conn.getresponse( ).read( )
conn.close( )
print content
package javaapplication1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;;
import org.json.simple.JSONObject;
import org.springframework.web.client.RestTemplate;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
        RestTemplate restTemplate = new RestTemplate();
        JSONObject json = new JSONObject();


        //SET BINS
        List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

        Map<String, String> bin1 = new HashMap<String, String>();
        bin1.put("id", "Pack M");
        bin1.put("h", "4");
        bin1.put("w", "4");
        bin1.put("d", "4");
        bin1.put("wg", "");
        bin1.put("max_wg", "");
        bins.add(bin1);
        Map<String, String> bin2 = new HashMap<String, String>();
        bin2.put("id", "Pack S");
        bin2.put("h", "3");
        bin2.put("w", "3");
        bin2.put("d", "6");
        bin2.put("wg", "");
        bin2.put("max_wg", "");
        bins.add(bin2);

        //SET ITEMS
        List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
        Map<String, String> item1 = new HashMap<String, String>();
        item1.put("id", "Speakers");
        item1.put("w", "3");
        item1.put("h", "3");
        item1.put("d", "3");
        item1.put("wg", "2");
        item1.put("q", "3");
        item1.put("vr", "1");
        items.add(item1);
        Map<String, String> item2 = new HashMap<String, String>();
        item2.put("id", "Bigger item");
        item2.put("w", "3");
        item2.put("h", "3");
        item2.put("d", "5");
        item2.put("wg", "1");
        item2.put("q", "2");
        item2.put("vr", "1");
        items.add(item2);

        //SET PARAMETERS
        Map <String , String > params  = new HashMap <String , String >();
        params.put("images_background_color", "255,255,255")
        params.put("images_bin_border_color", "59,59,59")
        params.put("images_bin_fill_color", "230,230,230")
        params.put("images_item_border_color", "22,22,22")
        params.put("images_item_fill_color", "255,193,6")
        params.put("images_item_back_border_color", "22,22,22")
        params.put("images_sbs_last_item_fill_color", "177,14,14")
        params.put("images_sbs_last_item_border_color", "22,22,22")
        params.put("images_format", "svg")
        params.put("images_width", "50")
        params.put("images_height", "50")
        params.put("images_source", "file")
        params.put("stats", "0")
        params.put("item_coordinates", "1")
        params.put("images_complete", "1")
        params.put("images_sbs", "1")
        params.put("images_separated", "0")

        //ADD ELEMENTS TO JSON
        json.put("username", "YOUR_USERNAME");
        json.put("api_key", "YOUR_API_KEY");
        json.put("items", items);
        json.put("bins", bins);
        json.put("params", params);

        //CALL QUERY
        HttpURLConnection conn;
        URL addr = new URL("https://global-api.3dbinpacking.com/packer/pack");
        conn = (HttpURLConnection) addr.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.connect();
        OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

        // prepare POST body
        String query = "query=" + json.toString();

        osw.write(query);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String response_json = br.readLine();

        //DO SOMETHING COOL WITH THE RESPONSE
        System.out.println(response_json);
    }
}
string data;
System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://global-api.3dbinpacking.com/packer/pack") as System.Net.HttpWebRequest;

var request_data = new {username = "YOUR_USERNAME",
                        api_key = "YOUR_API_KEY",
                        items = new[] {
                                        new { id = "Speakers", w = "3", h = "3", d = "3", wg = "2", q = "3", vr = "1"},
                                        new { id = "Bigger item", w = "3", h = "3", d = "5", wg = "1", q = "2", vr = "1"}
                                        },
                        bins = new[] {
                                        new { id = "Pack M", h = "4", w = "4", d = "4", wg = "", max_wg = ""},
                                        new { id = "Pack S", h = "3", w = "3", d = "6", wg = "", max_wg = ""}
                                        },

                        @params = new { images_background_color = "255,255,255",
                                        images_bin_border_color = "59,59,59",
                                        images_bin_fill_color = "230,230,230",
                                        images_item_border_color = "22,22,22",
                                        images_item_fill_color = "255,193,6",
                                        images_item_back_border_color = "22,22,22",
                                        images_sbs_last_item_fill_color = "177,14,14",
                                        images_sbs_last_item_border_color = "22,22,22",
                                        images_format = "svg",
                                        images_width = "50",
                                        images_height = "50",
                                        images_source = "file",
                                        stats = "0",
                                        item_coordinates = "1",
                                        images_complete = "1",
                                        images_sbs = "1",
                                        images_separated = "0"
                                        }
                    };

string json_str = JsonConvert.SerializeObject(request_data);

string queryParam = "query="+json_str;

byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;

System.IO.Stream postStream = req.GetRequestStream();
postStream.Write(postBytes, 0, postBytes.Length);
postStream.Close();

X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\global-api.3dbinpacking.com.pem");
req.ClientCertificates.Add(Cert);

using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
{
    System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
    data = reader.ReadToEnd();
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[bins]
(required)
Array of packing spaces parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters of extra request parameters array

[bins] - Packing spaces array details

Param name Description Data type
id
(required)
Packing space ID. The number or code you use to identify the packing space. string
w
(required)
Packing space width integer or float
h
(required)
Packing space height integer or float
d
(required)
Packing space depth/length integer or float
wg The weight of the packing space integer or float
max_wg The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit integer or float

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer
q
(required)
The amount of the same items to pack integer
item_colors_schema Define which kind of color schema should be used string Available values:
default - colors set in the following parameters will be used 'images_item_border_color' and 'images_bin_fill_color',
'random' - x,
'item' - x
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that coordinates of the placement of each item will not be returned,
1 - that coordinates of the placement of each item will be returned
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "response":{ 
        "id":"response_id",
        "bins_packed":[
            {
                "bin_data":{
                        "w":4,
                        "h":4,
                        "d":4,
                        "id":"Pack M",
                        "used_space":42.1875,
                        "weight":2,
                        "gross_weight":2,
                        "used_weight":100,
                        "stack_height":3
                    },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Speakers",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":2,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                    }
                ],
                "not_packed_items":[
                    {
                        "id":"Speakers",
                        "q":2
                    },
                    {
                        "id":"Bigger item",
                        "q":2
                    }
                ]
            },{
                "bin_data":{
                    "w":3,
                    "h":3,
                    "d":6,
                    "id":"Pack S",
                    "used_space":100,
                    "weight":4,
                    "gross_weight":4,
                    "used_weight":100,
                    "stack_height":3
                },
                "image_complete":"image_url.svg",
                "items":[
                    {
                        "id":"Speakers",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":2,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                    },{
                        "id":"Speakers",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":2,
                        "image_sbs":"image_url.svg",
                        "coordinates":{"x1":0,"y1":0,"z1":3,"x2":3,"y2":3,"z2":6}
                    }
                ],
                "not_packed_items":[
                    {
                        "id":"Speakers",
                        "q":1
                    },
                    {
                        "id":"Bigger item",
                        "q":2
                    }
                ]
            }
        ],
        "errors":[],
        "status":1,
        "not_packed_items":[]
    }
}

Param name Description Data type Info
[bins_packed] List of packed items array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[bins_packed] - The list of packing spaces to be packed

Param name Description Data type
bin_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array
[not_packed_items] Items unable to be packed in the packing space array

[bin_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Check Max Load

Use Check Max Load to Check exactly how many items will fill a box or packing space to capacity.

URL

Request parameters

Required parameters

REQUEST

{
    "username":"_USERNAME_",
    "api_key":"_API_KEY_",
    "bins": [
      {
         "w": 5,
         "h": 5,
         "d": 5,
         "max_wg": 0,
         "id": "Bin1"
      },
      {
         "w": 4,
         "h": 3,
         "d": 3,
         "max_wg": 0,
         "id": "Bin2"
      }
   ],
   "items": [
      {
         "w": 5,
         "h": 3,
         "d": 2,
         "vr": 1,
         "wg": 0,
         "id": "Item1"
      },
      {
         "w": 3,
         "h": 3,
         "d": 3,
         "vr": 1,
         "wg": 0,
         "id": "Item2"
      }
   ],
   "params": {
      "images_background_color": "255,255,255",
      "images_bin_border_color": "59,59,59",
      "images_bin_fill_color": "230,230,230",
      "images_item_border_color": "214,79,79",
      "images_item_fill_color": "177,14,14",
      "images_item_back_border_color": "215,103,103",
      "images_sbs_last_item_fill_color": "99,93,93",
      "images_sbs_last_item_border_color": "145,133,133",
      "images_width": 100,
      "images_height": 100,
      "images_source": "file",
      "images_sbs": 1,
      "item_coordinates": 1,
      "images_complete": 1,
      "images_separated": 1
   }
}
curl -X POST \\
-H "Content-Type: application/json" \\
-d '{"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 5,"h": 5,"d": 5,"max_wg": 0,"id": "Bin1"},{"w": 4,"h": 3,"d": 3,"max_wg": 0,"id": "Bin2"}],"items": [{"w": 5,"h": 3,"d": 2,"vr": 1,"wg": 0,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"vr": 1,"wg": 0,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}' \\
https://global-api.3dbinpacking.com/packer/fillContainer \\
-k
<?php

$data = array(
    'bins' => array(
            array(
                    'id' => 'Bin1',
                    'h' => '5',
                    'w' => '5',
                    'd' => '5',
                    'wg' => '',
                    'max_wg' => ''
                ),
            array(
                    'id' => 'Bin2',
                    'h' => '4',
                    'w' => '3',
                    'd' => '3',
                    'wg' => '',
                    'max_wg' => ''
                )
        ),
    'items' => array(
            array(
                    'id' => 'Item1',
                    'w' => '5',
                    'h' => '3',
                    'd' => '2',
                    'wg' => '0',
                    'vr' => '1'
                ),
            array(
                    'id' => 'Item2',
                    'w' => '3',
                    'h' => '3',
                    'd' => '3',
                    'wg' => '0',
                    'vr' => '1'
                )
        ),
    'username' => 'YOUR_USERNAME',
    'api_key' => 'YOUR_API_KEY',
    'params' => array(
            'images_background_color' => '255,255,255',
            'images_bin_border_color' => '59,59,59',
            'images_bin_fill_color' => '230,230,230',
            'images_item_border_color' => '22,22,22',
            'images_item_fill_color' => '255,193,6',
            'images_item_back_border_color' => '22,22,22',
            'images_sbs_last_item_fill_color' => '177,14,14',
            'images_sbs_last_item_border_color' => '22,22,22',
            'images_format' => 'svg',
            'images_width' => '50',
            'images_height' => '50',
            'images_source' => 'file',
            'stats' => '0',
            'item_coordinates' => '1',
            'images_complete' => '1',
            'images_sbs' => '1',
            'images_separated' => '0'
        )
);
$query = json_encode($data);

$url = "https://global-api.3dbinpacking.com/packer/fillContainer";
$prepared_query = 'query='.$query;
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $prepared_query );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$resp = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error #' . curl_errno($ch) . ': ' . curl_error($ch).'<br>';
}
curl_close($ch);

$response = json_decode($resp,true);
// display errors
if(isset($response['response']['errors'])){
    foreach($response['response']['errors'] as $error){
    echo $error['message'].'<br>';
    }
}
// display data
if( $response['response']['status'] > -1 ){
    $b_packed= $response['response']['bins_packed'];
    foreach ($b_packed as $bin){
        echo "<h2>Bin id:{$bin['bin_data']['id']}</h2>
        <p> {$bin['bin_data']['w']} x {$bin['bin_data']['h']} x {$bin['bin_data']['d']}</p>
        <p> Weight:{$bin['bin_data']['weight']}</p>
        <p> Used weight:{ $bin['bin_data']['used_weight'] }</p>
        <img src=\"{$bin['image_complete']}\">
        <h2>Items packed in this bin:</h2>";
        $items = $bin['items'];
        echo '<table style="text-align: center">
        <tr><th>Item id</th>
            <th>Item dimensions</th>
            <th>Item weight</th>
            <th>Separated item</th>
            <th>Step by step</th></tr>';
        foreach ( $items as $item){
        echo "<tr><td>{$item['id']}</td>
                <td> {$item['w']} x {$item['h']} x {$bin['bin_data']['d']}</td>
                <td> {$item['wg']}</td>
                <td><img src=\"{$item['image_separated']}\"></td>
                <td><img src=\"{$item['image_sbs']}\"></td>
            </tr>";
        }
        echo '</table>';
        echo '<hr>';

    }
}
#!/usr/bin/python

import httplib
import urllib
import json

conn = httplib.HTTPConnection(host='global-api.3dbinpacking.com', port=80)
data = {"username": "_USERNAME_", "api_key": "_API_KEY_", "bins": [{"w": 5,"h": 5,"d": 5,"max_wg": 0,"id": "Bin1"},{"w": 4,"h": 3,"d": 3,"max_wg": 0,"id": "Bin2"}],"items": [{"w": 5,"h": 3,"d": 2,"vr": 1,"wg": 0,"id": "Item1"},{"w": 3,"h": 3,"d": 3,"vr": 1,"wg": 0,"id": "Item2"}], "params": {"images_background_color": "255,255,255", "images_bin_border_color": "59,59,59", "images_bin_fill_color": "230,230,230", "images_item_border_color": "22,22,22", "images_item_fill_color": "255,193,6", "images_item_back_border_color": "22,22,22", "images_sbs_last_item_fill_color": "177,14,14", "images_sbs_last_item_border_color": "22,22,22", "images_format": "svg", "images_width": 50, "images_height": 50, "images_source": "file", "stats": 0, "item_coordinates": 1, "images_complete": 1, "images_sbs": 1, "images_separated": 0}}
params =  urllib.urlencode( {'query':json.dumps(data)} )
headers = {"Content-type": "application/x-www-form-urlencoded",
    "Accept": "text/plain"}
conn.request( "POST", "/packer/fillContainer", params, headers )
content = conn.getresponse( ).read( )
conn.close( )
print content
package javaapplication1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;;
import org.json.simple.JSONObject;
import org.springframework.web.client.RestTemplate;

public class JavaApplication1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws MalformedURLException, ProtocolException, IOException {
        RestTemplate restTemplate = new RestTemplate();
        JSONObject json = new JSONObject();


        //SET BINS
        List<Map<String , String>> bins  = new ArrayList<Map<String,String>>();

        Map<String, String> bin1 = new HashMap<String, String>();
        bin1.put("id", "Bin1");
        bin1.put("h", "5");
        bin1.put("w", "5");
        bin1.put("d", "5");
        bin1.put("wg", "");
        bin1.put("max_wg", "");
        bins.add(bin1);
        Map<String, String> bin2 = new HashMap<String, String>();
        bin2.put("id", "Bin2");
        bin2.put("h", "3");
        bin2.put("w", "4");
        bin2.put("d", "3");
        bin2.put("wg", "");
        bin2.put("max_wg", "");
        bins.add(bin2);

        //SET ITEMS
        List<Map<String , String>> items  = new ArrayList<Map<String,String>>();
        Map<String, String> item1 = new HashMap<String, String>();
        item1.put("id", "Item1");
        item1.put("w", "5");
        item1.put("h", "3");
        item1.put("d", "2");
        item1.put("wg", "0");
        item1.put("vr", "1");
        items.add(item1);
        Map<String, String> item2 = new HashMap<String, String>();
        item2.put("id", "Item2");
        item2.put("w", "3");
        item2.put("h", "3");
        item2.put("d", "3");
        item2.put("wg", "0");
        item2.put("vr", "1");
        items.add(item2);

        //SET PARAMETERS
        Map <String , String > params  = new HashMap <String , String >();
        params.put("images_background_color", "255,255,255")
        params.put("images_bin_border_color", "59,59,59")
        params.put("images_bin_fill_color", "230,230,230")
        params.put("images_item_border_color", "22,22,22")
        params.put("images_item_fill_color", "255,193,6")
        params.put("images_item_back_border_color", "22,22,22")
        params.put("images_sbs_last_item_fill_color", "177,14,14")
        params.put("images_sbs_last_item_border_color", "22,22,22")
        params.put("images_format", "svg")
        params.put("images_width", "50")
        params.put("images_height", "50")
        params.put("images_source", "file")
        params.put("stats", "0")
        params.put("item_coordinates", "1")
        params.put("images_complete", "1")
        params.put("images_sbs", "1")
        params.put("images_separated", "0")

        //ADD ELEMENTS TO JSON
        json.put("username", "YOUR_USERNAME");
        json.put("api_key", "YOUR_API_KEY");
        json.put("items", items);
        json.put("bins", bins);
        json.put("params", params);

        //CALL QUERY
        HttpURLConnection conn;
        URL addr = new URL("https://global-api.3dbinpacking.com/packer/fillContainer");
        conn = (HttpURLConnection) addr.openConnection();
        conn.setRequestMethod("POST");
        conn.setDoOutput(true);
        conn.connect();
        OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());

        // prepare POST body
        String query = "query=" + json.toString();

        osw.write(query);
        osw.flush();
        osw.close();

        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String response_json = br.readLine();

        //DO SOMETHING COOL WITH THE RESPONSE
        System.out.println(response_json);
    }
}
string data;
System.Net.HttpWebRequest req = System.Net.WebRequest.Create("https://global-api.3dbinpacking.com/packer/fillContainer") as System.Net.HttpWebRequest;

var request_data = new {username = "YOUR_USERNAME",
                        api_key = "YOUR_API_KEY",
                        items = new[] {
                                        new { id = "Item1", w = "5", h = "3", d = "2", wg = "0", vr = "1"},
                                        new { id = "Item2", w = "3", h = "3", d = "3", wg = "0", vr = "1"}
                                        },
                        bins = new[] {
                                        new { id = "Bin1", h = "5", w = "5", d = "5", wg = "", max_wg = ""},
                                        new { id = "Bin2", h = "3", w = "4", d = "3", wg = "", max_wg = ""}
                                        },

                        @params = new { images_background_color = "255,255,255",
                                        images_bin_border_color = "59,59,59",
                                        images_bin_fill_color = "230,230,230",
                                        images_item_border_color = "22,22,22",
                                        images_item_fill_color = "255,193,6",
                                        images_item_back_border_color = "22,22,22",
                                        images_sbs_last_item_fill_color = "177,14,14",
                                        images_sbs_last_item_border_color = "22,22,22",
                                        images_format = "svg",
                                        images_width = "50",
                                        images_height = "50",
                                        images_source = "file",
                                        stats = "0",
                                        item_coordinates = "1",
                                        images_complete = "1",
                                        images_sbs = "1",
                                        images_separated = "0"
                                        }
                    };

string json_str = JsonConvert.SerializeObject(request_data);

string queryParam = "query="+json_str;

byte[] postBytes = System.Text.Encoding.ASCII.GetBytes(queryParam);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = postBytes.Length;

System.IO.Stream postStream = req.GetRequestStream();
postStream.Write(postBytes, 0, postBytes.Length);
postStream.Close();

X509Certificate Cert = X509Certificate2.CreateFromCertFile("path_to_pem_key\global-api.3dbinpacking.com.pem");
req.ClientCertificates.Add(Cert);

using (System.Net.HttpWebResponse response = req.GetResponse() as System.Net.HttpWebResponse)
{
    System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
    data = reader.ReadToEnd();
}
Param name Description Data type
username
(required)
Username. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
api_key
(required)
API key. You can find the API key in the '/Profile settings/API access' section after logging in https://www.3dbinpacking.com/en/customer/api-data string
[bins]
(required)
Array of packing spaces parameters array
[items]
(required)
Array of items parameters. Limit: maximum total number of items per request = 4999 array
params Array of extra request parameters array

[bins] - Packing spaces array details

Param name Description Data type
id
(required)
Packing space ID. The number or code you use to identify the packing space. string
w
(required)
Packing space width float
h
(required)
Packing space height float
d
(required)
Packing space depth/length float
wg The weight of the packing space integer or float
max_wg The maximum weight that this packing space can hold. Value set to '0' (zero) means there is no weight limit integer or float

[items] - Items array details

Param name Description Data type Info
id
(required)
Item ID/SKU. The number or code you use to identify what is being packed. string
w
(required)
The width of the item integer or float
h
(required)
The height of the item integer or float
d
(required)
The depth or length of the item integer or float
wg The weight of the item integer or float
vr Vertical rotation. The information if the item can be rotated vertically. integer Vertical rotation. The information if the item can be rotated vertically.
item_colors_schema Define which kind of color schema should be used string
item_fill_color Item fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'

params - Optional parameters

Param name Description Data type Info
images_width Max. width of generated images integer Available values: 1 - 250
images_height Max. height of generated images integer Available values: 1 - 250
images_background_color Background color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_border_color Packing space border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_dashed_line_color Packing space front border color (dashed) string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_bin_fill_color Packing space fill color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_item_border_color Item border color string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_fill_color Fill color of the last item on images showing a packing process 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_sbs_last_item_border_color Border color of the last item on images showing packing 'step-by-step' string Available values: RGB values of colors dots separated 'red,green,blue', allowed values 0-255; Example: '255,120,10'
images_format Images format string Available values: [ png , svg ]
images_sbs Generate images showing a packing process 'step-by-step' integer Available values:
0 [default] - means that images showing a packing process 'step-by-step' will not be generated,
1 - means that images showing a packing process 'step-by-step' will be generated
images_complete Generate images showing a final packing result integer Available values:
0 [default] - means that images showing final packing result will not be generated,
1 - means that images showing final packing result will be generated
images_separated Generate images showing the placement of each item separately integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
item_coordinates Return coordinates (x, y, z) for each item integer Available values:
0 [default] - means that images showing the placement of each item separately will not be generated,
1 - means that images showing the placement of each item separately will be generated
stats Return the statistics of a packing process (e.g. images generation time) integer Available values:
0 [default] - means that the statistics of a packing process will not be returned,
1 - means that the statistics of a packing process will be returned

Response parameters

RESPONSE

{
    "response":{
        "id":"response_id",
        "bins_packed":[
            {
                "bin_data":{
                    "w":5,
                    "h":5,
                    "d":5,
                    "id":"Bin1",
                    "used_space":72,
                    "weight":0,
                    "gross_weight":0,
                    "used_weight":100,
                    "stack_height":5,
                    "order_id":null
                },
                "image_complete":"image_url.png",
                "items":[
                    {
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":0,"z1":2,"x2":5,"y2":3,"z2":4}
                    },{
                        "id":"Item1",
                        "w":5,
                        "h":3,
                        "d":2,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":3,"z1":0,"x2":5,"y2":5,"z2":3}
                    }
                ]
            },{
                "bin_data":{
                    "w":4,
                    "h":3,
                    "d":3,
                    "id":"Bin2",
                    "used_space":75,
                    "weight":0,
                    "gross_weight":0,
                    "used_weight":100,
                    "stack_height":3
                },
                "image_complete":"image_url.png",
                "items":[
                    {
                        "id":"Item2",
                        "w":3,
                        "h":3,
                        "d":3,
                        "wg":0,
                        "image_separated":"image_url.png",
                        "image_sbs":"image_url.png",
                        "coordinates":{"x1":0,"y1":0,"z1":0,"x2":3,"y2":3,"z2":3}
                    }
                ]
            }
        ],
        "errors":[],
        "status":1,
        "not_packed_items":[]
    }
}
Param name Description Data type Info
[bins_packed] List of packed items array
errors List of possible errors that may occur in request array Example: [{'level'}]; Possible returned values:'critical' - critical error - disabling packing, 'warning' - warning about incorrect data in request
status Response status integer Possible returned values:
1 - response hasn't included critical errors,
0 - response has included critical errors. * critical error - the error disabling packing. It could be caused by lack of one of the required parameters ('username','api_key') or incorrect value of parameter (eg. a field, which should contain number, contains string).
[not_packed_items] The list of item unable to be packed e.g. incorrect parameters input, excessive weight or size array

[bins_packed] - The list of packing spaces to be packed

Param name Description Data type
bin_data Details of the packing space to be packed array
image_complete Image of the packing space to be packed url
[items] Information about items to be packed in the packing space array

[bin_data] - Details of the packing space to be packed

Param name Description Data type
id Packing space ID. The number or code you use to identify the packing space. string
w Packing space width integer or float
h Packing space height integer or float
d Packing space depth/length integer or float
used_space Percentage of packing space utilized integer or float
weight Weight of items to be packed integer or float
gross_weight Weight of items to be packed + weight of packing space integer or float
used_weight Percentage of the permissible weight utilized integer or float
stack_height The height of stacked items integer or float

[items] - The list of items to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
wg The weight of the item integer or float
image_separated Image showing the position of each item url
image_sbs Images showing the packing process step-by-step url
coordinates Coordinates of items in the packing space {"x1":0,"y1":0,"z1":0,"x2":5,"y2":3,"z2":2}

[not_packed_items] - The list of items unable to be packed

Param name Description Data type
id Item ID/SKU. The number or code you use to identify what is being packed. string
w The width of the item integer or float
h The height of the item integer or float
d The depth or length of the item integer or float
q The amount of the same items to pack integer
wg The weight of the item integer or float

Errors

Error Meaning
400 Bad Request -- Your request is invalid.