Create a new Template
https://api2.transloadit.com/templates
templates:write
scope.
POST fields
-
Passing
signature
is required. For more information please check Signature Authentication. -
Passing
params
is required. It should contain a JSON encoded object with the keys as shown in the table below.
Supported keys inside the params
field
-
auth
Object requiredContains at least your Transloadit Auth Key in the
key
property.If you enable Signature Authentication, you'll also set an expiry date for the request in the
expires
property like so:{ "key": "23c96d084c744219a2ce156772ec3211", "expires": "2024/01/01 16:53:14+00:00" }
The
referer
property is a regular expression to match against the HTTP referer of this upload, such as"example\.org"
. Specify this key to make sure that uploads only come from your domain.Uploads without a referer will always pass (as they are turned off for some browsers) making this useful in just a handful of use cases. For details about regular expressions, see Mozilla's RegExp documentation.
The
max_size
property can be used to set a maximum size that an upload can have in bytes, such as1048576
(1 MB). Specify this to prevent users from uploading excessively large files.This can be set as part of the Assembly request or as part of the Template.
The file size is checked as soon as the upload is started and if it exceeds the maximum size, the entire upload process is canceled and the Assembly will error out, even if it contains files that do not exceed the
max_size
limitation.If you want to just ignore the files that exceed a certain size, but process all others, then please use 🤖/file/filter.
-
name
StringrequiredName of this Template. Must be between 5-40 symbols (inclusive), lowercase, can only contain dashes and latin letters.
-
template
StringrequiredAll the Assembly Instructions and Template Settings as a JSON encoded string.
-
require_signature_auth
Integer ⋅ default:0
Use
1
to deny requests that do not include a signature. With Signature Authentication you can ensure no one else is sending requests on your behalf.
Response
Here’s an example response body:
On success this request returns a JSON response with the success codeTEMPLATE_CREATED
, the Template ID, name and content.
On error it contains a JSON response including an error
field that contains an error status code and a reason
field that contains details on what went wrong.