Shopify api graphql

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Shopify api graphql is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. 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.

How to use this skill

Skill file

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:

Storefront API (Client-Side)

Read-heavy access for custom storefronts:

API Versioning

Quarterly releases: YYYY-MM (January, April, July, October)

Admin API Examples

Query Products

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

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

Bulk Operations

For large data exports:

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

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

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:

Pagination

Relay-style cursor pagination:

Python SDK

The official ShopifyAPI package (GitHub: Shopify/shopify_python_api) provides a Python client:

Best Practices

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.