Add these lines to your fileCreate query to the files { } section:
...on MediaImage {
id
}
...on GenericFile {
id
}
A developer encountered an “access denied” error when attempting to use the fileCreate GraphQL mutation to upload files. The error message appeared garbled/reversed in the response.
Resolution:
The issue was resolved by adding the write_files access scope to the app’s permissions, as required by the Shopify Admin API documentation.
Follow-up questions:
Getting file IDs: After successful upload, file IDs can be retrieved by adding inline fragments to the query:
... on MediaImage { id }
... on GenericFile { id }
Related issue: Another user reported a “No such object” XML error when checking uploaded file URLs, suggesting potential problems with staged upload paths or file accessibility after creation.
Status: Original issue resolved; additional troubleshooting questions remain open regarding file ID retrieval and post-upload file access.
Add these lines to your fileCreate query to the files { } section:
...on MediaImage {
id
}
...on GenericFile {
id
}