shopify-rate-limits
Handle Shopify API rate limits for both REST (leaky bucket) and GraphQL (calculated query cost). Use when hitting 429 errors, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "shopify rate limit", "shopify throttling", "shopify 429", "shopify THROTTLED", "shopify query cost", "shopify backoff".
Best use case
shopify-rate-limits is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Handle Shopify API rate limits for both REST (leaky bucket) and GraphQL (calculated query cost). Use when hitting 429 errors, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "shopify rate limit", "shopify throttling", "shopify 429", "shopify THROTTLED", "shopify query cost", "shopify backoff".
Teams using shopify-rate-limits 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/shopify-rate-limits/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How shopify-rate-limits Compares
| Feature / Agent | shopify-rate-limits | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Handle Shopify API rate limits for both REST (leaky bucket) and GraphQL (calculated query cost). Use when hitting 429 errors, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "shopify rate limit", "shopify throttling", "shopify 429", "shopify THROTTLED", "shopify query cost", "shopify backoff".
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.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Shopify Rate Limits
## Overview
Shopify uses two distinct rate limiting systems: leaky bucket for REST and calculated query cost for GraphQL. This skill covers both with real header values and response shapes.
## Prerequisites
- Understanding of Shopify's REST and GraphQL Admin APIs
- Familiarity with the `@shopify/shopify-api` library
## Instructions
### Step 1: Understand the Two Rate Limit Systems
**REST Admin API** — Leaky Bucket:
| Plan | Bucket Size | Leak Rate |
|------|------------|-----------|
| Standard | 40 requests | 2/second |
| Shopify Plus | 80 requests | 4/second |
The `X-Shopify-Shop-Api-Call-Limit` header shows your bucket state:
```
X-Shopify-Shop-Api-Call-Limit: 32/40
```
Means: 32 of 40 slots used. When full, you get HTTP 429 with `Retry-After` header.
**GraphQL Admin API** — Calculated Query Cost:
| Plan | Max Available | Restore Rate |
|------|--------------|-------------|
| Standard | 1,000 points | 50 points/second |
| Shopify Plus | 2,000 points | 100 points/second |
Every GraphQL response includes cost info in `extensions`:
```json
{
"extensions": {
"cost": {
"requestedQueryCost": 252,
"actualQueryCost": 12,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 988.0,
"restoreRate": 50.0
}
}
}
}
```
Key insight: `requestedQueryCost` is the *worst case* estimate. `actualQueryCost` is the real cost (often much lower). When `currentlyAvailable` drops to 0, you get `THROTTLED`.
### Step 2: Implement GraphQL Cost-Aware Throttling
```typescript
interface ShopifyThrottleStatus {
maximumAvailable: number;
currentlyAvailable: number;
restoreRate: number;
}
class ShopifyRateLimiter {
private available: number;
private restoreRate: number;
private lastUpdate: number;
constructor(maxAvailable = 1000, restoreRate = 50) {
this.available = maxAvailable;
this.restoreRate = restoreRate;
this.lastUpdate = Date.now();
}
updateFromResponse(throttleStatus: ShopifyThrottleStatus): void {
this.available = throttleStatus.currentlyAvailable;
this.restoreRate = throttleStatus.restoreRate;
this.lastUpdate = Date.now();
}
async waitIfNeeded(estimatedCost: number): Promise<void> {
// Estimate current available based on restore rate
const elapsed = (Date.now() - this.lastUpdate) / 1000;
const estimated = Math.min(
this.available + elapsed * this.restoreRate,
1000
);
if (estimated < estimatedCost) {
const waitSeconds = (estimatedCost - estimated) / this.restoreRate;
console.log(`Rate limit: waiting ${waitSeconds.toFixed(1)}s for ${estimatedCost} points`);
await new Promise((r) => setTimeout(r, waitSeconds * 1000));
}
}
}
// Usage
const limiter = new ShopifyRateLimiter();
async function rateLimitedQuery(client: any, query: string, variables?: any) {
await limiter.waitIfNeeded(100); // estimate cost
const response = await client.request(query, { variables });
// Update limiter from actual response
if (response.extensions?.cost?.throttleStatus) {
limiter.updateFromResponse(response.extensions.cost.throttleStatus);
}
return response;
}
```
### Step 3: Implement Retry with Backoff for 429s
```typescript
async function withShopifyRetry<T>(
operation: () => Promise<T>,
maxRetries = 5
): Promise<T> {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
try {
return await operation();
} catch (error: any) {
const isThrottled =
error.response?.code === 429 ||
error.body?.errors?.[0]?.extensions?.code === "THROTTLED";
if (!isThrottled || attempt === maxRetries) throw error;
// Use Retry-After header if available (REST), otherwise calculate
const retryAfter = error.response?.headers?.["retry-after"];
const delay = retryAfter
? parseFloat(retryAfter) * 1000
: Math.min(1000 * Math.pow(2, attempt) + Math.random() * 500, 30000);
console.warn(
`Shopify throttled (attempt ${attempt + 1}/${maxRetries}). ` +
`Retrying in ${(delay / 1000).toFixed(1)}s`
);
await new Promise((r) => setTimeout(r, delay));
}
}
throw new Error("Unreachable");
}
```
### Step 4: Reduce Query Cost
```typescript
// EXPENSIVE query — requests all fields, high cost
const EXPENSIVE = `{
products(first: 250) {
edges {
node {
id title description
variants(first: 100) {
edges {
node {
id title price sku inventoryQuantity
metafields(first: 10) {
edges { node { key value } }
}
}
}
}
images(first: 20) {
edges { node { url altText } }
}
}
}
}
}`;
// requestedQueryCost: ~5,502 (may THROTTLE immediately)
// OPTIMIZED query — only needed fields, lower page sizes
const OPTIMIZED = `{
products(first: 50) {
edges {
node {
id
title
variants(first: 10) {
edges {
node { id price sku }
}
}
}
}
pageInfo { hasNextPage endCursor }
}
}`;
// requestedQueryCost: ~112 (safe, leaves room for other queries)
```
### Step 5: Debug Query Cost
```bash
# Add this header to see cost breakdown per field
curl -X POST "https://store.myshopify.com/admin/api/2024-10/graphql.json" \
-H "X-Shopify-Access-Token: $TOKEN" \
-H "Content-Type: application/json" \
-H "Shopify-GraphQL-Cost-Debug: 1" \
-d '{"query": "{ products(first: 10) { edges { node { id title } } } }"}' \
| jq '.extensions.cost'
```
## Output
- Rate limit-aware client that prevents 429 errors
- Retry logic with proper backoff for both REST and GraphQL
- Optimized queries with lower calculated cost
- Debug headers for cost analysis
## Error Handling
| Scenario | REST Indicator | GraphQL Indicator |
|----------|---------------|-------------------|
| Approaching limit | `X-Shopify-Shop-Api-Call-Limit: 38/40` | `currentlyAvailable < 100` |
| At limit | HTTP 429 + `Retry-After: 2.0` | `errors[0].extensions.code: "THROTTLED"` |
| Recovering | Wait for `Retry-After` seconds | Wait for `restoreRate` to refill |
## Examples
### Queue-Based Bulk Operations
```typescript
import PQueue from "p-queue";
// For bulk operations, use Shopify's bulk query API instead
const BULK_QUERY = `
mutation bulkOperationRunQuery($query: String!) {
bulkOperationRunQuery(query: $query) {
bulkOperation {
id
status
url
}
userErrors { field message }
}
}
`;
// Bulk queries bypass rate limits for large data exports
await client.request(BULK_QUERY, {
variables: {
query: `{
products {
edges {
node {
id
title
variants { edges { node { id sku price } } }
}
}
}
}`,
},
});
```
## Resources
- [Shopify API Rate Limits](https://shopify.dev/docs/api/usage/rate-limits)
- [REST Rate Limits](https://shopify.dev/docs/api/admin-rest/usage/rate-limits)
- [GraphQL Rate Limits](https://shopify.dev/docs/api/usage/rate-limits#graphql-admin-api-rate-limits)
- [Bulk Operations](https://shopify.dev/docs/api/usage/bulk-operations/queries)
## Next Steps
For security configuration, see `shopify-security-basics`.Related Skills
workhuman-rate-limits
Workhuman rate limits for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman rate limits".
wispr-rate-limits
Wispr Flow rate limits for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr rate limits".
windsurf-rate-limits
Understand and manage Windsurf credit system, usage limits, and model selection. Use when running out of credits, optimizing AI usage costs, or understanding the credit-per-model pricing structure. Trigger with phrases like "windsurf credits", "windsurf rate limit", "windsurf usage", "windsurf out of credits", "windsurf model costs".
webflow-rate-limits
Handle Webflow Data API v2 rate limits — per-key limits, Retry-After headers, exponential backoff, request queuing, and bulk endpoint optimization. Use when hitting 429 errors, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "webflow rate limit", "webflow throttling", "webflow 429", "webflow retry", "webflow backoff", "webflow too many requests".
vercel-rate-limits
Handle Vercel API rate limits, implement retry logic, and configure WAF rate limiting. Use when hitting 429 errors, implementing retry logic, or setting up rate limiting for your Vercel-deployed API endpoints. Trigger with phrases like "vercel rate limit", "vercel throttling", "vercel 429", "vercel retry", "vercel backoff", "vercel WAF rate limit".
veeva-rate-limits
Veeva Vault rate limits for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva rate limits".
vastai-rate-limits
Handle Vast.ai API rate limits with backoff and request optimization. Use when encountering 429 errors, implementing retry logic, or optimizing API request throughput. Trigger with phrases like "vastai rate limit", "vastai throttling", "vastai 429", "vastai retry", "vastai backoff".
twinmind-rate-limits
Implement TwinMind rate limiting, backoff, and optimization patterns. Use when handling rate limit errors, implementing retry logic, or optimizing API request throughput for TwinMind. Trigger with phrases like "twinmind rate limit", "twinmind throttling", "twinmind 429", "twinmind retry", "twinmind backoff".
together-rate-limits
Together AI rate limits for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together rate limits".
techsmith-rate-limits
TechSmith rate limits for Snagit COM API and Camtasia automation. Use when working with TechSmith screen capture and video editing automation. Trigger: "techsmith rate limits".
supabase-rate-limits
Manage Supabase rate limits and quotas across all plan tiers. Use when hitting 429 errors, configuring connection pooling, optimizing API throughput, or understanding tier-specific quotas for Auth, Storage, Realtime, and Edge Functions. Trigger: "supabase rate limit", "supabase 429", "supabase throttle", "supabase quota", "supabase connection pool", "supabase too many requests".
stackblitz-rate-limits
WebContainer resource limits: memory, CPU, file system size, process count. Use when working with WebContainers or StackBlitz SDK. Trigger: "webcontainer limits".