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 3D mockup with custom artwork, you first need to create a dieline. Once you have the dieline ID, you can upload an image file with artwork to create a hosted 3D mockup page.

Please make a POST request to https://api.diecuttemplates.com/dielines/{dieline_id}/3d-mockups


Code Examples



curl -i -X POST \
https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/3d-mockups \
  -H 'Authorization: Bearer <YOUR_DIELINES_API_KEY_HERE>' \
  -H "Content-Type: multipart/form-data" \
  -H 'Dielines-Api-Version: 1.0'
  -F "file=@/path/to/your/artwork.png" \
  -F "name=my design" \
  -F "outside_design=false"


require 'net/http'
require 'uri'
require 'json'

# Define the endpoint and headers
uri = URI('https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/3d-mockups ')
headers = {
  'Authorization' => 'Bearer <YOUR_DIELINES_API_KEY_HERE>',
  'Dielines-Api-Version' => '1.0'
}

# Create the form data
form_data = [
  ['file', File.open('/path/to/your/artwork.png')],
  ['name', 'my design'],
  ['outside_design', 'false'] # 'false' is sent as a string
]

# Make the HTTP request
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri, headers)
request.set_form form_data, 'multipart/form-data'

response = http.request(request)

# Output the response
puts "Status Code: #{response.code}"
puts "Response Body: #{response.body}"




// Define the endpoint and headers
$url = "https://api.diecuttemplates.com/dielines/di_fwe4iu3vngty/3d-mockups ";
$headers = [
    "Authorization: Bearer <YOUR_DIELINES_API_KEY_HERE>",
    "Dielines-Api-Version: 1.0"
];

// Initialize cURL
$ch = curl_init();

// Attach the file and form data
$filePath = "/path/to/your/artwork.png"; // Replace with the actual file path
$postFields = [
    "file" => new CURLFile($filePath),
    "name" => "my design",
    "outside_design" => "false" // 'false' is sent as a string
];

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the request
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Handle errors
if (curl_errno($ch)) {
    echo "cURL Error: " . curl_error($ch);
} else {
    // Output the response
    echo "HTTP Status Code: " . $httpCode . PHP_EOL;
    echo "Response Body: " . $response . PHP_EOL;
}

// Close the cURL session
curl_close($ch);


Example Response

application/json
{
  "3d_mockup": {
    "type": "3d_mockup",
    "id": "llnmb1oh8r",
    "url": "https://www.diecuttemplates.com/3d/llnmb1oh8r",
    "name": "My design",
    "dieline": {
      "type": "dieline",
      "id": "ueipnpyp0rlw",
      "dieline_template_id": "becf-10301",
      "variables": {
        "unit": "mm",
        "length": 250.0,
        "width": 200.0,
        "height": 200.0,
        "material": 0.389
      },
      "format": "pdf",
      "url": "https://d2atdwxjx7uc4i.cloudfront.net/campaigns/0e9d742f-bdcd-4b41-8122-88e0426d263f20241218-14172-y29ocn.pdf",
      "artwork_dimensions": {
        "unit": "mm",
        "width": "723.06",
        "height": "502.44"
      },
      "created_at": "2024-12-18T19:27:22Z"
    },
    "links": [
      {
        "rel": "update",
        "href": "/dielines/ueipnpyp0rlw/3d-mockups/llnmb1oh8r",
        "method": "PUT"
      },
      {
        "rel": "delete",
        "href": "/dielines/ueipnpyp0rlw/3d-mockups/llnmb1oh8r",
        "method": "DELETE"
      }
    ]
  }
} 


Response Object

Returns a 3d_mockup object with the following properties:

type string "3d_mockup"
id string Unique ID for the 3D mockup. For example: "llnmb1oh8r"
url URL Hosted URL for the 3D Mockup. For example: https://www.diecuttemplates.com/3d/llnmb1oh8r
name string Name of the 3D mockup, if specified during creation.
dieline dieline Dieline object for the 3D mockup
links [3d_mockup_link] Array of links for update and delete operations

Read Dielines API documentation