shopify-api-graphql

Use Shopify GraphQL APIs — Admin API for server-side CRUD, Storefront API for client-side queries, versioning, cost-based rate limiting, bulk operations, pagination. Use when integrating with Shopify data.

17 stars

Best use case

shopify-api-graphql is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use Shopify GraphQL APIs — Admin API for server-side CRUD, Storefront API for client-side queries, versioning, cost-based rate limiting, bulk operations, pagination. Use when integrating with Shopify data.

Teams using shopify-api-graphql should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/shopify-api-graphql/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/shopify-commerce/.agent/skills/shopify-api-graphql/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/shopify-api-graphql/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How shopify-api-graphql Compares

Feature / Agentshopify-api-graphqlStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use Shopify GraphQL APIs — Admin API for server-side CRUD, Storefront API for client-side queries, versioning, cost-based rate limiting, bulk operations, pagination. Use when integrating with Shopify data.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Shopify GraphQL APIs

## Before writing code

**Fetch live docs**:
1. Fetch `https://shopify.dev/docs/api/admin-graphql` for Admin API schema
2. Fetch `https://shopify.dev/docs/api/storefront` for Storefront API schema
3. Web-search `site:shopify.dev graphql api versioning` for current API versions

## Two APIs

### Admin API (Server-Side)

Full CRUD on all store resources:
- Endpoint: `https://{store}.myshopify.com/admin/api/{version}/graphql.json`
- Auth: `X-Shopify-Access-Token` header
- Use for: product management, order processing, customer data, metafields, fulfillment
- Rate limit: cost-based, max 1,000 points per query. Restore rate varies by plan (100 pts/s Standard, 200 Advanced, 1,000 Plus)

### Storefront API (Client-Side)

Read-heavy access for custom storefronts:
- Endpoint: `https://{store}.myshopify.com/api/{version}/graphql.json`
- Auth: `X-Shopify-Storefront-Access-Token` header
- Use for: product browsing, cart operations, checkout, customer account
- Rate limit: cost-based (separate budget from Admin API)

## API Versioning

Quarterly releases: `YYYY-MM` (January, April, July, October)
- Each version supported for 12 months after release
- `unstable` version available for testing upcoming changes
- Always specify version in URL path

## Admin API Examples

### Query Products

```graphql
query Products($first: Int!, $after: String) {
  products(first: $first, after: $after) {
    edges {
      node {
        id
        title
        handle
        status
        variants(first: 10) {
          edges {
            node {
              id
              title
              price
              sku
              inventoryQuantity
            }
          }
        }
        metafields(first: 5) {
          edges {
            node {
              namespace
              key
              value
              type
            }
          }
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
```

### Create Product

```graphql
mutation ProductCreate($input: ProductInput!) {
  productCreate(input: $input) {
    product {
      id
      title
    }
    userErrors {
      field
      message
    }
  }
}
```

### Bulk Operations

For large data exports:

```graphql
mutation {
  bulkOperationRunQuery(
    query: """
    {
      products {
        edges {
          node {
            id
            title
            variants {
              edges {
                node { id sku price }
              }
            }
          }
        }
      }
    }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors { field message }
  }
}
```

Poll for completion, then download JSONL result file.

## Storefront API Examples

### Query Products

```graphql
query Products($first: Int!) {
  products(first: $first) {
    edges {
      node {
        id
        title
        handle
        priceRange {
          minVariantPrice { amount currencyCode }
        }
        images(first: 1) {
          edges {
            node { url altText }
          }
        }
      }
    }
  }
}
```

### Cart Operations

```graphql
mutation CartCreate($input: CartInput!) {
  cartCreate(input: $input) {
    cart {
      id
      lines(first: 10) {
        edges {
          node {
            id
            quantity
            merchandise {
              ... on ProductVariant {
                id
                title
                price { amount currencyCode }
              }
            }
          }
        }
      }
      cost {
        totalAmount { amount currencyCode }
      }
      checkoutUrl
    }
    userErrors { field message }
  }
}
```

## Cost-Based Rate Limiting

Each query has a calculated cost:
- Single object field: 1 point
- Connection (list): 2 points + (first * child cost)
- Maximum single query cost: 1,000 points (enforced before execution)
- Restore rate by plan: 100 pts/s (Standard), 200 (Advanced), 1,000 (Plus), 2,000 (Enterprise)
- Throttle info in response extensions: `extensions.cost.throttleStatus`
- Handle throttled responses with backoff based on `retryAfter`

## Pagination

Relay-style cursor pagination:
- Forward: `first` + `after` (from `pageInfo.endCursor`)
- Backward: `last` + `before` (from `pageInfo.startCursor`)
- Always check `pageInfo.hasNextPage` / `pageInfo.hasPreviousPage`

## Python SDK

The official `ShopifyAPI` package (GitHub: `Shopify/shopify_python_api`) provides a Python client:
- Install: `pip install ShopifyAPI`
- Supports both REST (legacy) and GraphQL APIs
- Handles authentication, rate limiting, and pagination
- Useful for backend scripts and data pipelines

## Best Practices

- Use GraphQL Admin API (not REST) — REST is deprecated
- Always specify the API version in requests
- Request only the fields you need to minimize query cost
- Use bulk operations for large data exports (> 250 items)
- Handle rate limits gracefully with exponential backoff
- Use cursor pagination, not offset-based
- Check `userErrors` in mutation responses — a 200 status does not mean success
- Cache stable data (product info, collections) to reduce API calls

Fetch the Shopify GraphQL API reference for the current schema, available queries/mutations, and latest API version before implementing.

Related Skills

shopify-webhooks

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement Shopify webhooks — subscription methods (HTTP, EventBridge, Pub/Sub, SQS), HMAC verification, mandatory GDPR webhooks, delivery methods, retry policy, and idempotency. Use when building event-driven Shopify integrations.

shopify-themes

17
from OrcaQubits/agentic-commerce-skills-plugins

Develop Shopify themes — file structure, Online Store 2.0, sections and blocks, settings schema, Dawn reference theme, Theme Check linting, asset pipeline, and theme deployment. Use when building or customizing Shopify themes.

shopify-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test Shopify applications — app testing with Vitest and Playwright, theme testing with Theme Check, Function testing, webhook testing, extension testing, and CI/CD pipelines. Use when writing tests for Shopify projects.

shopify-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Set up a Shopify development environment — Shopify CLI installation, Partner account, development stores, environment variables, project structures for themes, apps, and Hydrogen. Use when starting a new Shopify project.

shopify-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Secure Shopify applications — HMAC webhook verification, session token validation, OAuth scope management, Content Security Policy, GDPR mandatory webhooks, input validation, and secure coding practices. Use when implementing Shopify security features.

shopify-polaris

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Shopify app UIs with Polaris — component categories, Web Components transition, React legacy components, App Design Guidelines, accessibility, @shopify/draggable, and design tokens. Use when building Shopify admin app interfaces.

shopify-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize Shopify performance — Liquid rendering, asset optimization, CDN strategies, Core Web Vitals, Hydrogen caching, image optimization, preloading, and lazy loading. Use when improving Shopify store speed.

shopify-liquid

17
from OrcaQubits/agentic-commerce-skills-plugins

Write Shopify Liquid templates — objects, tags, filters, global objects, section schema, Online Store 2.0 JSON templates, and Liquid best practices. Use when customizing Shopify theme templates.

shopify-hydrogen

17
from OrcaQubits/agentic-commerce-skills-plugins

Build headless Shopify storefronts with Hydrogen — Remix-based framework, Oxygen deployment, storefront.query(), caching strategies, cart, customer accounts, SEO, and analytics. Use when building custom Shopify storefronts.

shopify-functions

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Shopify Functions — serverless WebAssembly extensions for discounts, delivery customization, payment customization, cart validation, cart transforms, and order routing. Use when extending Shopify's backend logic.

shopify-customers

17
from OrcaQubits/agentic-commerce-skills-plugins

Manage Shopify customers — Customer Account API, new vs classic accounts, Multipass SSO, customer segmentation, B2B company accounts, metafields, and marketing consent. Use when working with Shopify customer data.

shopify-checkout-ui

17
from OrcaQubits/agentic-commerce-skills-plugins

Build Shopify checkout UI extensions — extension targets, UI primitives, Preact/Remote DOM rendering, checkout APIs, metafield access, post-purchase extensions, and thank-you page customization. Use when customizing Shopify checkout.