Getting throttled when syncing orders: how do API credits work and how can we use fewer?

Hi! Every night we sync orders, their line items and their shipments into our BI tool, and lately we keep getting throttled halfway through:

“There are not enough credits to perform the requested operation, which requires 101 credits, but there are only 12 left. In 2 seconds you will have enough credits to perform the operation” (code 30)

A few questions:

  • How do credits work exactly? Is the limit per user or per account?
  • Why is the cost so high when we only get a few orders back?
  • We run several workers in parallel to finish faster. Does that make it worse?
  • Is there a better way to pull this much data?

Hi! I hope you are doing well!

Thanks for the detailed questions. Going through them:

How credits work

The credit pool is per account, not per user. By default it holds 4,004 credits and refills at 60 credits per second. Every user, token and integration on the account shares that same pool.

Before running a query, we estimate its cost from the fields and page sizes you request and reserve those credits. After it runs, we charge the real cost and return the difference. That’s why a query can need 101 credits up front even if it only returns a few orders: the estimate assumes full pages.

You can see your current balance in every response under extensions.throttling.user_quota.

Running workers in parallel

Yes, it makes it worse. Parallel requests reserve credits from the same pool at the same time, so they compete with each other and with any other integration on your account. When you get a code 30 error, wait for the time_remaining it shows before retrying, and avoid parallel retries.

Best practices to use fewer credits

  1. Set first on every connection. If you don’t, the estimate assumes 100 results per level, and nested connections multiply (100 orders x 100 line items is estimated at about 10,000 credits).
  2. Paginate nested connections separately instead of requesting big outer and inner pages together.
  3. Request only the fields you need.
  4. Use date filters such as updated_from to pull only what changed since your last sync, instead of re-reading everything.
  5. Add analyze: true to check a query’s estimated cost before running it for real.

For bulk syncs, try Data Exports

For what you describe, a nightly sync into a BI tool, Data Exports is probably a better fit. It delivers your data as Parquet files on a schedule, and downloading them doesn’t use query credits. It already includes the tables you mentioned: orders, line_items, shipments, shipped_line_items and shipping_labels, among others.

On the free tier you get a full export every week and a delta every six hours. If you need fresher data, the paid tier gives you a daily full export and a delta every 30 minutes.

A good rule of thumb: use Data Exports for bulk and historical data, and keep the GraphQL API for live, targeted lookups, like checking one order or current stock.

Before switching, check that the columns you need are in the tables. A few columns, like gift_note and packing_note on orders, can come back empty in Data Exports, so for those you’d still use the API.

More details: Getting Started | ShipHero GraphQL API Data Exports | ShipHero GraphQL API Available Data Tables | ShipHero GraphQL API

Let us know how it goes!

Best regards, Luciano