mediaCreate Mutation
Description
Creates a new media item by uploading a file. For image files (excluding SVG), multiple size variants are automatically generated and stored. The file is uploaded to cloud storage and metadata is extracted.
mutation mediaCreate($file: Upload!) {
mediaCreate(file: $file) {
_id
id
created {
date
}
modified {
date
}
title
alt
caption
ext
mime
size
width
height
url
key
formatArray {
name
ext
mime
width
height
size
url
key
}
folder
}
}
Variables
{
"file": "File"
}
Response
{
"mediaCreate": {
"_id": "610b920346bbbd0732e479b9",
"id": 915105626536,
"created": {
"date": 1725679831622
},
"modified": {
"date": 1724623905269
},
"title": "example",
"alt": "example",
"caption": "example",
"ext": "example",
"mime": "example",
"size": 42,
"width": 42,
"height": 42,
"url": "https://example.com",
"key": "example",
"formatArray": [
{
"name": "example",
"ext": "example",
"mime": "example",
"width": 42,
"height": 42,
"size": 42,
"url": "https://example.com",
"key": "example"
}
],
"folder": "example"
}
}
Arguments
| Name | Type | Description |
|---|---|---|
file | Upload! | File to upload. Supported formats include images, documents, and other file types. |