Pass the menu and read the page

SignupFolio

Signup API calls: 3 changes for a leaner sync

To cut API calls in a signup sync, batch writes and read larger pages; pace the remaining requests below your API's published limits.

Key takeaways

  • Count reads and writes separately before choosing a change.
  • Check batch limits for both records and bytes.
  • Test larger read pages for timeouts.
  • Pace requests and retry only when safe.

Pacing keeps the remaining calls under the published limits. None of them needs new infrastructure, but each one starts with reading the vendor's limits.

The usual setup makes one call for each signup. The job finds a new user, sends one create request, and moves to the next. That works when signups are few. As volume grows, the same pattern turns a short job into a long queue, and it spends your rate allowance on overhead instead of data.

The limit figures in this post come from the documentation pages linked in each section. Limits differ by provider and change over time, so treat them as examples of what to look for. Check the current page for your own tool before you set a batch size.

Count the calls before you change anything

Before you touch the code, count. Pull the logs from your last several syncs and write down three figures for each run: how many signups the sync moved, how many API calls it made, and how long it ran. Divide calls by signups. That ratio shows how much room there is to improve. A ratio near one means every record gets its own request. A ratio well below one means some batching already happens somewhere in the path.

Split the calls by type, too. Reads, such as listing existing contacts to check for duplicates, and writes, such as creating or updating records, need different fixes. Check whether the duplicate check costs more calls than the write itself, especially if it runs once for each record and pulls far more data than it uses. If you can see only the total, add a counter for each call type before you change anything else.

Add one summary line to every sync run. Record the start time, the end time, the number of signups read, the number sent, the number that failed, and the calls made by type. One line for each run is enough to spot a trend, and it gives you a baseline for judging each change. Without it, you are guessing whether a change helped.

Count against the right budget, too. Rate limits are not always one number for the whole program. They can apply to each credential, app, or group of endpoints. GitHub's REST API documentation shows how the arithmetic can mislead:

An app with a 15,000 request limit can make 10,000 requests on your behalf and exhaust your personal access allowance of 5,000 requests, while the app still has 5,000 requests remaining.

— Rate limits for the REST API, GitHub Docs

The app still has requests left, but the personal-access budget is empty. Find out which credential your sync uses and which limit it draws from, then measure your calls against that number.

Illustrative example: count the write savings

Suppose a sync creates 100 signups using one request for each signup. That takes 100 write calls. With an illustrative batch size of 20 records, the same writes take 5 calls. Duplicate-check reads still need their own count; batching writes does not remove them.

Batch the writes

A batch endpoint accepts many records in one request. The number of write calls falls roughly in proportion to the batch size, so the savings are largest when a sync creates many signups at once. The catch is that batch endpoints cap how much a single request can hold, and your design has to stay under those caps.

Defaults matter too. GitHub's Git LFS batch API ships with its own setting, and the GitHub REST documentation gives a default of 100 Git LFS objects in each API request. Your library may send a default batch size you never chose. Find the default and the documented maximum, then set the size on purpose.

Batching trades speed for fewer calls. A record held in a buffer waits until the batch fills or the sync flushes, so a signup may reach the other tool later than it would with one call each. For a welcome email or a fraud check that needs the record right away, keep single-record calls. Batch the bulk paths, like nightly backfills and catch-up runs, where a short delay costs nothing.

Segment's HTTP API source documentation, published on Twilio's site, shows the kind of limit to look for. HTTP API Source, Twilio Two things follow. First, measure payload size in bytes, not only the record count, because a request can be too large even when it holds few records. Second, check the individual event cap too, since one oversized event can break a batch that is otherwise fine.

Build the batcher as a plain loop. Collect records in a buffer. Flush the buffer when it reaches your record limit, or when adding the next record would push it past the byte limit. Flush whatever remains when the sync ends, so nothing sits in memory unsent. Keep batches small enough that a failure costs you one batch rather than the whole run.

Handle partial failures and retries

A batch can succeed for some records and fail for others. Check what the endpoint returns in that case. If it reports errors for individual records, resend only the records that failed. If it reports only a failure for the whole request, split the failed batch in half and send each half again. Repeating the split isolates a bad record in a few rounds. Log the record ID with each error, so someone can look at it later without rerunning the job.

Retries can create duplicates. If a request times out after the tool has already saved the records, a retry sends them again. Unless the endpoint is idempotent, you end up with duplicate contacts. Look for an upsert option that creates a record or updates it when a key matches, such as the signup email address. With an upsert, a retried batch becomes a safe repeat rather than a second copy. For related retry checks, see prevent duplicate welcome emails.

Make read pages bigger

Reads are the other half of the job. If your sync pages through existing records to find duplicates or confirm state, page size sets how many round trips that takes. A larger page means fewer calls to cover the same list. Box's developer documentation puts the point directly: "Use with a higher limit to retrieve large lists in fewer requests." Box API rate limits, Box Dev Docs

Set the page size to the largest value the endpoint accepts, then test it. Bigger pages take longer to return, so watch for timeouts. Some endpoints also cap the value even when you ask for more, so check what comes back. Start at the documented maximum, time a real page, and step down only if calls fail or run too long.

Trim each record to the fields you use. The same page advises: "Request only the fields you need with the fields query parameter." Box API rate limits, Box Dev Docs Smaller responses mean less data on each page, which can reduce the time cost of larger pages; keep watching for timeouts. Field trimming does not reduce the number of calls by itself, but it lets you raise the page size safely.

Sort and filter on the server, not in your code. If the API can filter by status or creation time, a filtered list returns only the records you need, and you avoid pulling pages you will throw away. Each page you skip is a call you do not make.

Stop re-reading what you already know. Store a cursor or a last-synced time, and ask only for signups created since the last successful run. Many syncs read the whole list every time and make the same calls with nothing new to show. An incremental read ties the number of read calls to the number of new signups, not to the size of the whole list.

The options compare as follows:

OptionWhat it reducesWhat to check in the docsMain risk
One call for each signup (baseline)Nothing; cost grows with each signupRequest caps for each second and minuteVolume turns a short job into a long queue
Batched writesWrite calls, roughly in proportion to batch sizeMaximum records and bytes in each request, and individual event capPartial failures and retry duplicates unless you upsert
Larger read pagesRead calls for duplicate checks and list scansMaximum page size the endpoint acceptsSlow responses and timeouts at high page sizes
Incremental readsReads of records you already processedWhether the API filters by time or cursorMissed records if the saved cursor is wrong
Paced sync with backoffRejected calls and retry stormsRequests each second and the budget for each credentialA slower run when you hold to a strict ceiling

Pace the sync against your budget

Batching and paging lower the number of calls you make. Pacing decides what happens when you still reach a limit. A sync that sends requests as fast as it can will hit the cap, get rejected, and retry. Each rejected call still uses your sync's time and can delay the signups behind it, so a fast burst is not always faster overall.

Segment's documentation offers one example of a published guideline: it recommends that each workspace stay within 1,000 HTTP API requests each second. HTTP API Source, Twilio Your tool may publish a different ceiling. Set your own target below the published limit, with room for other traffic. Spread calls across the run instead of sending them in a burst at the top of the hour. A steady rate is easier to keep under a cap than a spike.

The published ceiling can also depend on who is asking. GitHub's Git LFS figures show the gap: unauthenticated users can download 30,000 objects each minute, while authenticated users can upload or download 300,000 objects each minute. GitHub REST documentation Check which credential your sync uses and which tier it falls into before you pick a number.

Here are the published figures from this post in one place, so you can check each against your tool's page:

Limit and scopePublished figureSource
Git LFS batch API default, objects in each request100GitHub Docs
Git LFS, unauthenticated downloads each minute30,000GitHub Docs
Git LFS, authenticated uploads or downloads each minute300,000GitHub Docs
Separate bucket, unauthenticated requests each minute300GitHub Docs
Separate bucket, authenticated requests each minute3,000GitHub Docs
Segment batch request size500 KBTwilio
Segment individual event size32 KBTwilio
Segment recommended requests each second for each workspace1,000Twilio

The rows mix figures for each minute and each second, and they come from different products, so read each one against its own scope. Your tool's current page is the authority.

When a request is rejected, wait before you retry. Use exponential backoff: wait a short time after the first failure, double the wait after each further failure, stop at a maximum, and add some randomness so several jobs do not retry at the same moment. If the API sends reset information in its response headers, use it to set the wait. Set a maximum number of attempts, and send records that still fail to a queue or a log, so one stuck record cannot hold up the run. See also signup API error checks before retry.

Watch for rejections as a signal, not as noise. If rejections rise at the same hour each day, the sync is colliding with other traffic, and the fix is to move or spread the work, not to retry harder. Log each rejection with its time and endpoint so you can see the pattern. A few days of those logs usually show which part of the sync needs to slow down.

Remember that the budget is shared. Some endpoints sit in a separate bucket with their own ceiling. GitHub REST documentation If your signup sync, a dashboard, and a one-off import all use the same key, they can draw from the same allowance, and a busy import can starve the sync. Where the tool allows it, give the sync its own credential, so its budget stays predictable and its usage is easy to read in the logs.

Put the plan together

Start with the change that removes the most calls for the least risk. Batch writes first if writes dominate; if duplicate-check reads cost more, choose a read change from your own call-type split. Next, raise read page sizes and add a time or cursor filter so each sync reads only new records. Last, add pacing and backoff so the job survives a busy hour without a pile of retries.

Test before you ship. Run the old and new sync against the same set of signups, ideally in a sandbox or on a copy of the list. Compare four things: calls made, records created, duplicates found, and run time. If the record counts match and the call total drops, the change works. If the counts differ, the gap is the bug to find, and the call savings do not count until you fix it.

Plan a rollback before you deploy. Keep the old sync code path behind a switch, so you can turn the batched path off without a redeploy if the counts drift. Note the switch in your change log, along with who can flip it.

Keep a short change log. Write down each batch size, page size, and pacing ceiling you chose, the date you set it, and the vendor page you used to choose it. Limits change, and a setting that worked last quarter can fail after a vendor update. When you upgrade the integration, reread the limits page and run the call count from the first section again. That tells you whether the new setup still saves calls.

Today, pull your last sync log, split its calls into reads and writes, and choose the largest avoidable group to investigate first.

Common questions

Does pacing reduce API calls?

Pacing controls request timing; batching and larger pages reduce the calls needed to move the same records.

Which change should come first?

Start with the call type that dominates your own logs, then compare the old and new sync on the same records.

Can I retry an entire failed batch?

Check the endpoint's response and duplicate-handling behavior before retrying a whole batch.

Sources and check date

Related posts

More posts