Recover a finished resumable upload result

GET /api/v1/user_uploads/tus-result

Recover the permanent attachment URL when the final response of a resumable upload has been lost. This server extension is available only when server_tus_upload_result is true in the queue registration response.

For this extension, upload_id is the decoded path component after /api/v1/tus/ in the upload's Location URL. Preserve any S3 multipart suffix after +. This URL shape belongs to this server and is not a general tus protocol guarantee. Before making the authorized request, the client must verify that the upload URL's scheme, host and port match the organization's.

The result is read from the attachment record saved by the handler before completion, so it remains available after tusd session state is gone. Only the owner can retrieve it. An unknown, unfinished, deleted, archived or foreign upload returns upload: null. For an archived upload of the authenticated owner in the same organization with a matching size, upload_state: unavailable is additionally returned; the client must stop automatic polling and re-creating that upload. A null value without that state does not permit starting a new upload: completion may still be running. Responses must not be cached.

Usage examples

curl -G https://z.u1v.ru/api/v1/user_uploads/tus-result \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode upload_id=1/4e/m2A3MSqFnWRLUf9SaPzQ0Up_/zulip.txt \
    --data-urlencode expected_size=6

Parameters

upload_id

Required string: the server-issued ID, including the multipart suffix. Length is 1 to 2048 characters; ASCII control characters are not allowed. Do not construct the ID from a filename yourself.

expected_size

Required integer: the original file size in bytes, not less than zero. A mismatch with the finished attachment's size is an error.

Response

FieldTypeMeaning
resultStringsuccess on success.
msgStringServer message.
ignored_parameters_unsupportedArray of stringsUnsupported parameters.
uploadObject or nullThe owner's finished upload result, or no available result.
upload_stateOptional string unavailablePresent only for an archived upload with matching owner, organization and expected size. This upload will never be confirmed; stop automatic polling and re-creation.

When a result is present, the upload object contains:

FieldTypeMeaning
urlStringThe attachment's permanent relative URL.
filenameStringThe original name for display.
sizeIntegerThe finished attachment's size in bytes.

Invalid parameters or a size mismatch return HTTP 400.

Response examples

{
    "msg": "",
    "result": "success",
    "upload": {
        "filename": "zulip.txt",
        "size": 6,
        "url": "/user_uploads/1/4e/m2A3MSqFnWRLUf9SaPzQ0Up_/zulip.txt"
    }
}
{
    "msg": "",
    "result": "success",
    "upload": null
}
{
    "code": "BAD_REQUEST",
    "msg": "Uploaded file size does not match.",
    "result": "error"
}