Calculate the flat outside dimensions of a template for the given variables, returned as a list of parts — one per part, each with its flat outside bounding_box. The request consumes one Dimension API credit (a repeat of the same request within seven days is free).
| id string |
Unique identifier for the dieline template. required For example: "becf-10319" Dieline template ids start with "becf". Available dieline templates are listed on https://www.diecuttemplates.com/dielines |
||||||
| area boolean |
When set to true, the flat material area of each part is calculated and added to that part in the response as an area object. Optional. Off by default because the calculation is significantly slower than the dimensions themselves. Area calculation is only supported for templates in the "Cartons" and "Corrugated cardboards" groups. Valid values are: true, false Default value: false |
||||||
| variables object |
Key-value pairs including values for the template's variables that define the packaging dieline's size.
|
| type string | The object type. Always "part_list" . |
| id string | Unique identifier of this result. |
| dieline_template_id string | The identifier of the template the parts were calculated for — for example "becf-11a02" . |
| total integer | The number of parts returned. 1 for a simple dieline; one per part for a multi-part dieline. |
| parts array | An array of part objects, one per part. A simple box returns a single entry with name "default". Each part carries its own bounding_box, and — when area is requested — its own area. |
curl -i -X POST \
https://api.diecuttemplates.com/dimensions/becf-11a02/parts\
-H "Content-Type: application/json" \
-H "Dimensions-Api-Version: 1.0" \
-H "Authorization: Bearer <YOUR_DIMENSIONS_API_KEY_HERE>" \
-d '{
"variables": {
"unit": "mm",
"material": 0.5,
"length": 200.0,
"width": 100.0,
"height": 40.0
}
}'
require 'uri'
require 'net/http'
require 'openssl'
url = URI('https://api.diecuttemplates.com/dimensions/becf-11a02/parts')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request['Dimensions-Api-Version'] = '1.0'
request['Authorization'] = 'Bearer <YOUR_DIMENSIONS_API_KEY_HERE>'
params = {
"variables": {
"unit": "mm",
"length": 200.00,
"width": 100.00,
"height": 40.00,
"material": 0.5
}
}
request.body = params.to_json
response = http.request(request)
puts response.read_body
$url = 'https://api.diecuttemplates.com/dimensions/becf-11a02/parts';
$data = [
"variables" => [
"unit" => "mm",
"material" => "0.5",
"length" => "200.0",
"width" => "100.0",
"height" => "40.0"
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Dimensions-Api-Version: 1.0',
'Authorization: Bearer <YOUR_DIMENSIONS_API_KEY_HERE>'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
} else {
echo 'Response: ' . $response;
}
curl_close($ch);
The example responses below were requested with area: true, so each part includes its area object. Leave area out (or set it to false) and the area object is omitted from each part.
application/json {
"part_list": {
"type": "part_list",
"id": "dm_9f2a1c7b4e10",
"dieline_template_id": "becf-11a02",
"total": 1,
"parts": [
{
"type": "part",
"id": "default",
"name": "default",
"category": "carton",
"bounding_box": {
"unit": "mm",
"width": 280.0,
"height": 180.0
},
"area": {
"value": 48847.29,
"unit": "mm2"
}
}
]
}
}
application/json {
"part_list": {
"type": "part_list",
"id": "dm_1b8d6a3f902c",
"dieline_template_id": "becf-12401",
"total": 2,
"parts": [
{
"type": "part",
"id": "inner-tray",
"name": "Inner tray",
"category": "carton",
"bounding_box": {
"unit": "mm",
"width": 429.0,
"height": 310.0
},
"area": {
"value": 98450.0,
"unit": "mm2"
}
},
{
"type": "part",
"id": "sleeve-cover",
"name": "Sleeve cover",
"category": "cover",
"bounding_box": {
"unit": "mm",
"width": 394.0,
"height": 273.5
},
"area": {
"value": 76320.0,
"unit": "mm2"
}
}
]
}
}
| message string |
High level error message. Example: "Validation failed for one or more variables" More detailed error messages can be included in the "errors" object. |
| errors array | Detailed error messages. Each entry has a message, and — for broken rules — an optional suggestion object. |
application/json {
"message": "Validation failed for one or more variables.",
"errors": [
{
"message": "Invalid 'unit'. Valid 'unit' values are 'mm' and 'in'."
}
]
}
{
"message": "Forbidden. Available Dieline Dimensions API credits count = 0",
"errors": []
}