Dielines API: How to create custom dielines and 3D mockups

The Dielines API lets you generate dielines and create interactive 3D mockups programmatically. This post walks through the full flow, from your first sandbox request to a hosted, rotatable mockup page.

If you prefer to watch first, here is a recent screencast that demonstrates the entire process end to end:

A note on tooling

The examples below use curl, which is a command you run in a terminal (Terminal on macOS or Linux, Command Prompt or PowerShell on Windows). curl is built into all modern versions of these operating systems.

If you would rather use a graphical client, paste the same URL, headers, and body into Postman or Insomnia. Both are free and friendlier for first-time API testing.

Use the Sandbox to test for free

The Sandbox environment uses the same API key as production, but requests do not consume your monthly quota. Other templates on the Sandbox return dielines in their default options — to generate custom dielines from any other template on production you will need a paid Dielines API subscription. The demo template (becf-11101) is special: it accepts custom dimensions and is free on both the sandbox and the production API, so the same call works against either environment without consuming any quota.

  • Sandbox base URL: https://sandbox.api.diecuttemplates.com
  • Production base URL: https://api.diecuttemplates.com

The following request uses our free demo template (becf-11101) to generate a dieline PDF:

curl -X POST \
  https://sandbox.api.diecuttemplates.com/dieline-templates/becf-11101/dielines \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Dielines-Api-Version: 1.0" \
  -d '{
    "format": "pdf",
    "variables": {
      "unit": "mm",
      "material": 0.5,
      "length": 100.0,
      "width": 50.0,
      "height": 150.0,
      "dimension_texts": false
    }
  }'

The response contains a dieline id (for example di_ueipnpyp0rlw) and a download URL for the PDF. You will need this id in the next step.

Want to run this against production instead of the sandbox? Swap sandbox.api.diecuttemplates.com for api.diecuttemplates.com in the URL. For the demo template becf-11101 the call is free on both environments — no credit is consumed either way.

Full documentation, the list of available templates, and every variable you can set live here: Dielines API — Getting Started.

Two steps to a 3D mockup

Creating a mockup is a two-step flow:

  1. Generate a dieline and keep the returned id.
  2. Upload your print-ready artwork to that dieline.

Step 1 — Generate the dieline

Use the request shown above. Save the dieline id from the response.

Step 2 — Upload the artwork

Post your artwork file to the dieline you just created:

curl -X POST \
  https://sandbox.api.diecuttemplates.com/dielines/di_ueipnpyp0rlw/3d-mockups \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Dielines-Api-Version: 1.0" \
  -F "file=@/path/to/your/artwork.pdf" \
  -F "name=My Design" \
  -F "outside_design=true"

Accepted artwork formats: PDF, PNG, JPEG, SVG. The response returns the 3D mockup id and a hosted URL such as https://www.diecuttemplates.com/3d/llnmb1oh8r — open it to see what a live mockup page looks like.

Listing mockups for a dieline

You can list all mockups attached to a dieline:

curl -X GET \
  https://sandbox.api.diecuttemplates.com/dielines/di_ueipnpyp0rlw/3d-mockups \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Dielines-Api-Version: 1.0"

Premium website subscription vs. Dielines API

These are two separate products:

  • The Premium website subscription gives unlimited access on diecuttemplates.com — dieline downloads, nesting, the manufacturing cost calculator, 3D previews, and so on. It does not include Dielines API access.
  • The Dielines API is billed separately, with a Free tier plus monthly subscriptions. The Free tier covers unlimited calls against the demo template (becf-11101) on both sandbox and production; paid plans add the rest of the catalogue. Pricing details: Dielines API pricing.

Sandbox testing is always free, regardless of which product you have — so you can build and verify your entire integration before subscribing.

Putting it all together

The API portion of a 3D mockup pipeline is just two requests:

  1. POST /dieline-templates/{id}/dielines — returns a dieline id.
  2. POST /dielines/{id}/3d-mockups — returns a mockup id and a hosted URL.

If you hit anything specific while testing in the Sandbox, send us the request you are making and the response you are getting and we will take a look.