Run a Shopify Admin GraphQL bulk mutation to update metafield values across thousands of products using stagedUploadsCreate and bulkOperationRunMutation

domain: shopify.dev · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Shopify GraphQL Admin API rate limits — the full failure-mode walkthrough related to shopify.dev, checked against official docs, with linked verified routes.

Steps

  1. Prepare a JSONL file where each line is a valid JSON object containing the mutation variables for one product's metafield update — e.g., `{"input": {"id": "gid://shopify/Product/123", "metafields": [{"namespace": "custom", "key": "size_guide", "value": "...", "type": "single_line_text_field"}]}}`
  2. Call `stagedUploadsCreate(input: [{ filename: "metafields_update.jsonl", mimeType: "text/jsonl", httpMethod: POST, resource: BULK_MUTATION_VARIABLES }])` to get a pre-signed upload URL and staged target parameters
  3. Upload the JSONL file to the staged upload URL using a multipart POST with the parameters returned by stagedUploadsCreate; the file must be uploaded before calling bulkOperationRunMutation
  4. Call `bulkOperationRunMutation(mutation: "mutation productMetafieldUpdate($input: ProductInput!) { productUpdate(input: $input) { product { id } userErrors { field message } } }", stagedUploadPath: $uploadKey)` to start the bulk operation
  5. Poll `currentBulkOperation { id status errorCode }` until `status` is `COMPLETED` — also subscribe to the `bulk_operations/finish` webhook to receive notification without polling
  6. Download the results JSONL from `currentBulkOperation.url` (available when status is COMPLETED) and parse each line to identify any `userErrors` that indicate failed individual mutations

Known gotchas

Related routes

Run a Shopify Admin GraphQL stagedUploadsCreate + bulkOperationRunMutation pipeline to bulk-import metafield values for thousands of products
shopify.dev · 5 steps · unrated
Run a Shopify Admin GraphQL bulk mutation to update variant prices across a large catalog using stagedUploadsCreate and bulkOperationRunMutation
shopify.dev · 6 steps · unrated
Build a Shopify Bulk Operations GraphQL mutation to bulk-update variant prices from an external pricing engine
Shopify Admin GraphQL Bulk Operations · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans