What is an Assembly Variable?

A Transloadit Assembly Variable is a placeholder such as ${file.original_basename} that resolves during processing. Robots use these values to adapt behavior from the current file, from submitted fields, or from Assembly-level context such as ${assembly.id} and ${unique_prefix}.

How Assembly Variables work

Variables are expressions evaluated against runtime context when a Robot needs values that are unknown at Template authoring time. Their namespaces expose file attributes, submitted fields, and Assembly-level values such as identifiers and unique prefixes, allowing one graph to adapt names and options per input. They differ from literal parameters because expansion occurs during execution and may vary across files. The resolved value crosses into paths or Robot settings, so its type, allowed characters, and absence behavior matter.

Key facts

  1. File-scoped variables can resolve differently for every item in one Assembly, which enables per-source naming but can also create collisions when basenames repeat.
  2. Fields provide request-specific data to Instructions without changing the Template: they can arrive as form fields submitted with the upload or be set programmatically in the fields parameter, with form-submitted values taking precedence on conflict. They remain untrusted input and require validation before sensitive use.
  3. A missing or malformed value can propagate into a Robot parameter or output path; integrations should test fallback behavior rather than assume every file exposes every field.

When Assembly Variables matter

Use variables when output names or Robot options must depend on per-file or per-request data without separate Instructions. Sanitize values used in paths or names, because unexpected input can create invalid or conflicting outputs.

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free