Main issue: uploading a PDF to Shopify’s Settings → Files via the Admin GraphQL API failed using stagedUploadsCreate.
Key guidance provided:
Follow Shopify’s multi-step file staging workflow. First call stagedUploadsCreate with correct input fields (fileSize, filename, mimeType, resource, httpMethod) to receive a staging URL, resourceUrl, and form parameters.
Use the returned data to perform an HTTP multipart/form-data upload to the staging URL (can test with an API client like Insomnia). Reference product media upload examples for the multipart pattern.
After the file is successfully staged, call fileCreate with the provided URL to create the file asset in Files.
Resources shared:
stagedUploadsCreate mutation documentation.
Product media upload examples for similar multi-stage flow.
fileCreate mutation documentation.
Outcome: the original poster confirmed it works after applying the suggested approach.
Notes:
The initial mutation structure was incorrect; the process requires variables and multiple requests, not just a single mutation.
Code snippets and API references were central to understanding the solution.
Status: resolved.
Summarized with AI on February 15.
AI used: gpt-5.
I have used the graphql API for upload pdf in shopify Settings->Files sections. But i didn’t get success if anyone have any suggestion regarding this please let us know.
i have used this code
I took a look at what you shared, and it appears you are may have run into a few issues in the file staging process for creating a new file asset in the admin. Here is our stagedUploadsCreate mutation doc that provides a good starting point of the mutation body and variable structure.
I suggest testing and debugging with an API client (like Insomnia), as this process requires multiple stages and requests to complete. Here is an example of a mutation I tested that successfully returned a staging url and details:
If you aren’t familiar with this type of workflow I’d suggest taking a look at our product media upload API examples for insights on a similar process. The data returned from the initial mutation will need to be formatted as multipart form data then uploaded through an HTTP request (examples provided in cURL).
Once a file is staged, you can use the url and fileCreate mutation to create a new file asset.
Hope that offers a good starting point for you - Cheers!