Content > Files > filesCreate
Commerce APIContentFilesfilesCreate
filesCreate
POST:files.json

Description

Upload or re-upload a file. Note that even though input is an array, only one file is accepted. Such design is made for API consistency.

Permission bit: "files.create"

Topic: Files

Arguments

data: [FileCreate!]!

Main argument for mutations.


shop_id: String!

Unique shop identifier. See also: Unique Identifiers

Example: "sh_EQzGqWoY"


Data Argument Fields

base64: String

Base64 encoded file or image

Example: "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"


content_type: String

Override default content type of the file

Example: "plain/text"

Valid when: content_type's length doesn't exceed 250 characters


image_alt: String

Alt title of the image

Example: "Lovely Sunset"

Valid when: image_alt's length doesn't exceed 250 characters


name: String

Filename, will be used to construct a unique file path

Example: "123.txt"

Valid when: name's length doesn't exceed 200 characters


pinned: Boolean

Whether file is pinned or not

Example: false


size: String

Size of the file to be uploaded (deferred uploads)

Example: "43534636"


storage: FileStorage

File storage type


text: String

Text if the file is a plain text file


url: String

An URL to download file or image from

Example: "http://apple.com/new_bg.gif"


Result

[File!]

Preview (typescript)

Loading module