This documentation page is intended for developers looking to integrate the Dielines API into their systems. If you have any questions, please get in touch.

Die Cut Templates provides a hosted API available via HTTPS.

Dielines API allows for generating custom dielines in PDF, DXF, and SVG formats, along with 3D mockups.

To create a nesting (also known as imposition or layout) for a dieline, you first need to create a dieline and obtain a nesting template ID. Once you have both the dieline ID and nesting template ID, you can create a custom nesting with specific sheet dimensions and margins.

Please make a
POST request to https://api.diecuttemplates.com/dielines/{dieline_id}/nestings/{nesting_template_id}


Code Examples



curl -i -X POST \
https://api.diecuttemplates.com/dielines/di_ueipnpyp0rlw/nestings/lt_xyz123abc\
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <YOUR_DIELINES_API_KEY_HERE>" \
  -H "Dielines-Api-Version: 1.0" \
  -d '{
  "format": "pdf",
  "variables": {
    "unit": "mm",
    "sheet_width": 1000.0,
    "sheet_height": 700.0,
    "sheet_margin_top": 15.0,
    "sheet_margin_bottom": 20.0,
    "sheet_margin_side": 10.0,
    "num_x": 3,
    "num_y": 2
  }
}'

require 'uri'
require 'net/http'
require 'openssl'

url = URI('https://api.diecuttemplates.com/dielines/di_ueipnpyp0rlw/nestings/lt_xyz123abc')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/json'
request['Dielines-Api-Version'] = '1.0'
request['Authorization'] = 'Bearer <YOUR_DIELINES_API_KEY_HERE>'
# Note: margin_x and margin_y are optional - include only if your template requires them
params = {
  "format": "pdf",
  "variables": {
    "unit": "mm",
    "sheet_width": 1000.00,
    "sheet_height": 700.00,
    "sheet_margin_top": 15.00,
    "sheet_margin_bottom": 20.00,
    "sheet_margin_side": 10.00,
    "num_x": 3,
    "num_y": 2
  }
}

request.body = params.to_json

response = http.request(request)
puts response.read_body


$url = 'https://api.diecuttemplates.com/dielines/di_ueipnpyp0rlw/nestings/lt_xyz123abc';
$data = [
    "format" => "pdf",
    "variables" => [
        "unit" => "mm",
        "sheet_width" => 1000.00,
        "sheet_height" => 700.00,
        "sheet_margin_top" => 15.00,
        "sheet_margin_bottom" => 20.00,
        "sheet_margin_side" => 10.00,
        "num_x" => 3,
        "num_y" => 2
    ]
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Dielines-Api-Version: 1.0',
    'Authorization: Bearer <YOUR_DIELINES_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);

Example Response

application/json
{
  "nesting": {
    "type": "nesting",
    "id": "ne_wpxjk9m2nlrw",
    "dieline_id": "di_ueipnpyp0rlw",
    "dieline_template_id": "becf-10301",
    "nesting_template_id": "lt_xyz123abc",
    "variables": {
      "unit": "mm",
      "sheet_width": 1000.0,
      "sheet_height": 700.0,
      "sheet_margin_top": 15.0,
      "sheet_margin_bottom": 20.0,
      "sheet_margin_side": 10.0,
      "dieline_variables": {
        "unit": "mm",
        "width": 100,
        "height": 150,
        "length": 50,
        "material": 0.5
      },
      "num_x": 3,
      "num_y": 2,
      "margin_x": 10,
      "margin_y": 20
    },
    "format": "pdf",
    "width": {
      "value": 990.0,
      "unit": "mm"
    },
    "height": {
      "value": 880.0,
      "unit": "mm"
    },
    "nesting_overflow": false,
    "sum_of_line_lengths": [
      {
        "name": "Cut",
        "unit": "mm",
        "value": 3000.0
      },
      {
        "name": "Crease",
        "unit": "mm",
        "value": 5000.0
      },
      {
        "name": "Total",
        "unit": "mm",
        "value": 8000.0
      }
    ],
    "url": "https://d2atdwxjx7uc4i.cloudfront.net/nestings/abc123.pdf",
    "created_at": "2024-12-18T19:27:22Z"
  }
} 


Response Object

Returns a nesting object with the following properties:

type string "nesting"
id string Unique ID for the nesting. For example: "ne_wpxjk9m2nlrw"
dieline_id string Unique identifier for the dieline used in this nesting
dieline_template_id string Unique identifier for the dieline template
nesting_template_id string Unique identifier for the nesting template used
variables object Configuration variables used to generate this nesting, including sheet dimensions, margins, and dieline variables
format string Output format of the nesting file (pdf, dxf, or svg)
width object Actual width of the nesting with unit
height object Actual height of the nesting with unit
nesting_overflow boolean Indicates whether the nesting exceeds the sheet boundaries
sum_of_line_lengths array Array of objects showing total lengths for Cut, Crease, and Total lines
url URL Download URL for the nesting file. For example: https://d2atdwxjx7uc4i.cloudfront.net/nestings/abc123.pdf
created_at string ISO 8601 timestamp of when the nesting was created

Read Nestings API documentation