Create an upload URL

View as Markdown
Start an upload that sends the file bytes straight to storage. Creates the file record and returns a signed URL that accepts the bytes as the body of an HTTP PUT for the next 15 minutes. Send exactly the returned headers on the PUT and no Authorization header, then confirm the upload to make the file visible. The URL only creates the object, never replaces one, and refuses bodies over 500 MB. Asking again for an instrument path whose upload was never confirmed returns a fresh URL for the same file, so a failed PUT can be retried. The SDK's files.upload() runs all three steps; the [Upload files](https://docs.labric.co/upload-files) guide shows them with curl. At least one of job_execution_id and instrument_id is required: pass a job_execution_id for an artifact of a job running in a sandbox, which also records provenance linking the file to that execution, and pass an instrument_id for data captured off-platform by an instrument the Sync app cannot reach, which attaches the file to that instrument so instrument triggers and parsers pick it up. Requires an API key with the `write` scope.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
file_namestringRequired
The file name to record, e.g. results.csv.
content_typestring or nullOptional

MIME type of the file. Defaults to application/octet-stream, which is also substituted for types a browser could render as a page.

job_execution_idstring or nullOptionalformat: "uuid"
The job execution producing the file, for a job artifact.
instrument_idstring or nullOptionalformat: "uuid"

The instrument that captured the file, for off-platform data.

Response

OK
file_idstring
The ID of the file record awaiting its bytes.
upload_urlstring
Signed Google Cloud Storage URL. Send the file bytes as the body of an HTTP PUT to this URL with no Authorization header.
headersmap from strings to strings

Headers the PUT must carry exactly as given; the URL is signed for them. They set the Content-Type, let the object be created but not replaced, and cap the body at the platform’s file size limit.

expires_atstring
When the upload URL stops working, as an ISO 8601 timestamp.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
500
Internal Server Error