Create a tus upload
Creates a resumable upload resource from validated Assembly metadata.
{TUS_URL}Use the tus_url capability URL from the validated Assembly response as the request destination. It does not use ambient API2 host credentials.
For a normal fixed-size upload, first create an Assembly with
num_expected_upload_files set to the number of files. Copy its assembly_ssl_url and tus_url
into the example below. Do not substitute the general API hostname for the returned tus_url.
This example reserves four bytes, then uploads the text file. For a real file, use its byte
length and send its bytes in the PATCH request.
assembly_ssl_url='<assembly_ssl_url from the creation response>'
tus_url='<tus_url from the creation response>'
assembly_metadata=$(printf %s "$assembly_ssl_url" | base64 | tr -d "\n")
curl --fail-with-body -sS --include --request POST \
--url "$tus_url" \
--header 'tus-resumable: 1.0.0' \
--header 'upload-length: 4' \
--header "upload-metadata: assembly_url $assembly_metadata,filename ZmlsZS50eHQ=,fieldname ZmlsZQ=="
A successful 201 response returns the upload URL in its location header.
Copy that URL below. Keep it so an interrupted transfer can resume at the server’s reported offset.
upload_url='<Location response header>'
curl --fail-with-body -sS --request PATCH \
--url "$upload_url" \
--header 'tus-resumable: 1.0.0' \
--header 'upload-offset: 0' \
--header 'content-type: application/offset+octet-stream' \
--data-binary 'file'
See the resumable upload guide for recovery and completion. Deferred lengths, concatenation, and exact header grammars are covered below.
For parallel uploads, create partial resources, upload their bytes, then create a final
resource that concatenates them. Only the final file becomes an Assembly input and runs
through your Template. Set num_expected_upload_files to the number of final files, not
the number of partial resources. Include assembly_url, filename, and fieldname metadata
on every partial and final creation request. With tus-js-client, also supply these fields
in metadataForPartialUploads when using parallelUploads.
Leave Upload-Concat out for a normal upload. Set it to partial on each partial
creation request. After all partial uploads finish, create the final resource with:
Upload-Concat: final;<PARTIAL_UPLOAD_URL_1> <PARTIAL_UPLOAD_URL_2>
Replace the placeholders with the complete Location URLs returned for the partial uploads.
Keep the semicolon immediately after final; separate the URLs with spaces. Their order
determines the byte order in the final file.
Authentication
Send assembly_url in the Upload-Metadata header with the Base64-encoded assembly_ssl_url value from the same validated Assembly response.
Request headers
Complete JSON Schema
Normalized lowercase headers for fixed-length, deferred-length, partial, or final tus upload creation.
| Field | Type and description |
|---|---|
tus-resumablerequired | string (always: "1.0.0")The negotiated tus version. |
upload-metadatarequired | stringComma-separated ASCII metadata keys with optional standard Base64 values. Successful Transloadit uploads include filename and fieldname; authentication metadata is composed by the transport. Validation pattern (regular expression)^[\x21-\x2b\x2d-\x7e]+(?: (?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)?(?:,[\x21-\x2b\x2d-\x7e]+(?: (?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)?)*$ |
Any of the following schemas may apply:
required properties: upload-length
Fields beyond those listed for this object are accepted.
| Field | Type and description |
|---|---|
content-type | string (always: "application/offset+octet-stream") |
upload-concat | string (always: "partial") |
upload-defer-length | neverThis value is prohibited. |
upload-lengthrequired | stringA canonical unsigned base-10 byte count in the signed 64-bit range, without zero padding or a plus sign. Validation pattern (regular expression)^(?:0|[1-9][0-9]{0,17}|[1-8][0-9]{18}|9[0-1][0-9]{17}|92[0-1][0-9]{16}|922[0-2][0-9]{15}|9223[0-2][0-9]{14}|92233[0-6][0-9]{13}|922337[0-1][0-9]{12}|92233720[0-2][0-9]{10}|922337203[0-5][0-9]{9}|9223372036[0-7][0-9]{8}|92233720368[0-4][0-9]{7}|922337203685[0-3][0-9]{6}|9223372036854[0-6][0-9]{5}|92233720368547[0-6][0-9]{4}|922337203685477[0-4][0-9]{3}|9223372036854775[0-7][0-9]{2}|922337203685477580[0-6]|9223372036854775807)$ |
upload-defer-length: "1"
Fields beyond those listed for this object are accepted.
| Field | Type and description |
|---|---|
content-type | string (always: "application/offset+octet-stream") |
upload-concat | string (always: "partial") |
upload-defer-lengthrequired | string (always: "1") |
upload-length | neverThis value is prohibited. |
required properties: upload-concat
Fields beyond those listed for this object are accepted.
| Field | Type and description |
|---|---|
content-type | neverThis value is prohibited. |
upload-concatrequired | string (maximum length: 8192)Validation pattern (regular expression)^final;(?:https?:\/\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+)?\/resumable\/files\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+(?:\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+)*(?: (?:https?:\/\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+)?\/resumable\/files\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+(?:\/[^/\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+)*)*$ |
upload-defer-length | neverThis value is prohibited. |
upload-length | neverThis value is prohibited. |
Request body
Binary request body. application/offset+octet-stream The body is optional.
Response
HTTP 201
No response body.
Response headers
Complete JSON Schema
Fields beyond those listed for this object are accepted.
| Field | Type and description |
|---|---|
locationrequired | string (minimum length: 1)The new upload resource URL. Clients must validate it as a returned capability. |
tus-resumablerequired | string (always: "1.0.0") |
upload-offset | stringA canonical unsigned base-10 byte count in the signed 64-bit range, without zero padding or a plus sign. Validation pattern (regular expression)^(?:0|[1-9][0-9]{0,17}|[1-8][0-9]{18}|9[0-1][0-9]{17}|92[0-1][0-9]{16}|922[0-2][0-9]{15}|9223[0-2][0-9]{14}|92233[0-6][0-9]{13}|922337[0-1][0-9]{12}|92233720[0-2][0-9]{10}|922337203[0-5][0-9]{9}|9223372036[0-7][0-9]{8}|92233720368[0-4][0-9]{7}|922337203685[0-3][0-9]{6}|9223372036854[0-6][0-9]{5}|92233720368547[0-6][0-9]{4}|922337203685477[0-4][0-9]{3}|9223372036854775[0-7][0-9]{2}|922337203685477580[0-6]|9223372036854775807)$ |
x-content-type-optionsrequired | string (always: "nosniff") |
Error response
Text response body. text/plain; charset=utf-8
Response body schema
Complete JSON Schema
stringAny of the following schemas may apply:
Variant 1: string
stringValidation pattern (regular expression)
^ERR_[A-Z0-9_]+: [^\r\n]*\n$Variant 2: string
stringRaw text/plain hook error framing with a verbatim payload; JSON-shaped but not necessarily valid JSON.
Validation pattern (regular expression)
^\{"error":"(?:[\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]|[^\x09-\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff])*"\}$Response headers
Complete JSON Schema
Fields beyond those listed for this object are accepted.
| Field | Type and description |
|---|---|
content-typerequired | string (always: "text/plain; charset=utf-8") |
tus-resumablerequired | string (always: "1.0.0") |
x-content-type-optionsrequired | string (always: "nosniff") |