Transloadit

  • Demos
  • Docs & Help
  • Press
  • Pricing & Signup
hello@transloadit.comCall usBlogLogin

Templates

This guide assumes that you are familiar with building assembly instructions.

Basics

Templates are a way to securely store assembly instructions on our servers. You could also pass them directly in the hidden params parameter on your form.

However, it is important to know that the preferred method of integrating Transloadit is via templates. While it is convenient to specify your assembly instructions directly in the params field of your form, that approach has two major problems:

  • Visitors of your site can see the assembly settings you are using when checking your HTML source code.
  • Embedded secrets such as S3/SFTP access credentials are visible!

You should only consider not using a template when your assembly instructions are dynamic and you are not exposing access credentials in your template. Our /http/import robot is a good example of when you will likely use the params parameter instead of a template.

Creating a template is easy. You create a template on the Transloadit website with your account. All templates are encrypted using 256 bit AES encryption and securely stored on our servers.

Creating a template

  1. Login to your account.
  2. Click on the "Templates" link under "My Account", then click "Create template".
  3. Give your template a description. This is just for you as a reference.
  4. Provide the JSON for your template.
  5. Hit the save button.

You should now see a page showing the template you entered. On top of the page you will find your template_id which looks like this: "4b62ee4dbb38455d96fe13d972ec3211". This id is all you need to use the template.

Hint: For your convenience, there also is a "Test it!" section where you can upload a file and see if your template does what you expect it to do.

Using a template

Given an existing template_id, using it is as simple as replacing your assembly steps with the template id. For example:

{
    "auth":{"key": "YOUR-API-KEY"},
    "steps": {
        "encode":{
            "robot": "/video/encode",
            "preset": "iphone"
        },
        "export":{
            "robot": "/s3/store",
            "key": "your-key",
            "secret": "your-secret",
            "bucket": "your-bucket"
        }
    }
}

Would become:

{
    "auth": {"key": "YOUR-API-KEY"},
    "template_id": "4b62ee4dbb38455d96fe13d972ec3211"
}

Passing variables into a template

In addtion to a template_id, you can also specify other parameters. These can act as variables that will be recursively merged into your template.

Considering our previous example:

{
    "auth":{"key": "YOUR-API-KEY"},
    "steps":{
        "encode":{
            "robot": "/video/encode",
            "preset": "iphone"
        },
        "export":{
            "robot": "/s3/store",
            "key": "your-key",
            "secret": "your-secret",
            "bucket": "your-bucket"
        }
    }
}

You could merge additional logic into the template like this:

{
    "auth":{"key": "YOUR-API-KEY"},
    "template_id": "4b62ee4dbb38455d96fe13d972ec3211",
    "steps":{
        "export":{
            "bucket": "other-bucket"
        }
    }
}

Which is merged to create the following assembly:

{
    "auth":{"key": "YOUR-KEY"},
    "steps":{
        "encode":{
            "robot": "/video/encode",
            "preset": "iphone"
        },
        "export":{
            "robot": "/s3/store",
            "key": "your-key",
            "secret": "your-secret",
            "bucket": "other-bucket"
        }
    }
}

These additional params would be passed to your form using the hidden "params" field. Check the minimal integration again to see how this is done.

Comments

Help

  • Start a new support ticket
  • Browse existing support tickets

Integration

  • Transloadit Basics
  • The minimal integration
  • Building assembly instructions
  • Notifications vs Redirect Url
  • Templates
  • Configuring the jQuery plugin
  • How to add multi-file upload
  • Saving and displaying your files
  • Development Kits
  • NodeJS SDK
  • PHP SDK
  • Ruby Gem
  • iPhone SDK
  • Python SDK

API Documentation

  • API Basics
  • Authentication
  • The response
  • Robots
  • /image/resize
  • /video/encode
  • /video/thumbs
  • /audio/encode
  • /http/import
  • /file/filter
  • Storage Robots
  • /s3/store
  • /sftp/store
  • /cloudfiles/store
  • /youtube/store

More

  • How to set up an Amazon S3 bucket
  • Supported formats & codecs
  • FAQ
  • Community projects
  • About
  • Blog
  • Follow us on Facebook
  • Follow us on Twitter
  • Email
  • Imprint
  • Privacy policy
  • Terms of service