Create upload

createUpload(input: CreateUploadInput!): UploadSession!

Requires project.uploads.write.

Arguments

ArgumentTypeRequired
inputCreateUploadInput!Yes

Input fields

input

CreateUploadInput

FieldTypeRequiredDescription
projectReferenceString!YesProject UUID, slug or configured domain.
pathString!YesProject-relative destination path, for example assets/image.png. Leading slashes are stripped.
contentTypeStringNoMIME type; it becomes a required header of the PUT request.
sizeBytesFloat!YesFile size in bytes, a positive integer of at most 9007199254740991, checked against the storage quota.

Response

Returns UploadSession!. Open the type for its fields and nested types.

FieldTypeDescription
uploadIdID!UUID of the pending upload.
pathString!Project-relative path of the upload.
uploadUrlString!Short-lived signed URL for the PUT request that sends the bytes.
requiredHeadersStringMap!Headers the PUT request must send.
statusUploadMetadataStatus!Always pending until the bytes are stored.

Types marked with ! cannot be null. Lists use [Type] notation. The type index lists all published input and response types.

Example

query.graphql
mutation CreateUpload($input: CreateUploadInput!) {  createUpload(input: $input) {    status    path    requiredHeaders    uploadId    uploadUrl  }}
variables.json
{  "input": {    "projectReference": "00000000-0000-4000-8000-000000000001",    "path": "example",    "sizeBytes": 0  }}