RESOURCE | 3D Mockups

POST '/dielines/{dieline_id}/3d-mockups'

Upload an image file with artwork and create a hosted 3D mockup page for a custom dieline.

Request Parameters

dieline_id string Unique identifier for the "dieline" object required
Example: "di_fwe4iu3vngty"
file file Artwork (image) file to upload. Allowed file extensions are PNG, JPEG, JPG, SVG or PDF.
For example:

name string Name of the 3D mockup
outside_design boolean Boolean flag indicating whether the uploaded file is intended for the inside or outside of the box. Default is "true".
When set to "false", it means the uploaded file is for the "inside_design"

Response Object

Returns a "3d_mockup" object.

Objects | 3d_mockup

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 for the 3d mockup.
links [3d_mockup_link]


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, Status = 200

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"
      }
    ]
  }
}