Rate limits and avoiding 429 errors
Overview
DriveWealth limits how fast you can call the API. This protects the platform for every partner. When a call goes over a limit, the API answers with HTTP status 429 Too Many Requests.
A 429 means "slow down", not "something is broken". A well-built integration expects it, waits, and carries on. This guide explains our policy and shows how to build a client that rarely hits a limit and recovers fast when it does.
We do not publish rate limitsLimits differ by endpoint and can change over time. Do not look for a number to copy into your code. Build your client to react to
429responses instead. That approach keeps working when a limit changes.
At a glance
| Question | Short answer |
|---|---|
| Are the limits published? | No. They differ by endpoint and can change. |
| How do I know I hit one? | The API returns status 429. |
| What should my client do? | Stop sending, wait, then retry with exponential backoff and jitter. |
| How do I avoid it? | Use events instead of polling, ask for less data, cache what rarely changes, and smooth out bursts. |
| Is it safe to retry every error? | No. Retry 429. Do not retry other 4xx errors. Retry a failed write only with the same Idempotency-Key. |
| Who do I call if it keeps happening? | DriveWealth support. See If you still get 429 errors. |
How limits work
- Limits are not published. There is no table of numbers to look up.
- Limits differ by endpoint. A limit that suits one endpoint says nothing about another. Some endpoints are limited far below what you might expect.
- Limits can change. We tune them as the platform grows.
- Limits follow your credentials. Traffic from another partner does not use up your budget.
What a 429 looks like
You get HTTP status 429. Write your client to rely on the status code only.
| Do | Do not |
|---|---|
| Check the HTTP status code. | Parse the response body. A 429 can come from the platform gateway, so the body may not match the standard error response. |
| Use the backoff in this guide to decide how long to wait. | Build logic that needs X-RateLimit-* headers to exist. |
Avoid 429 errors
1. Use events instead of polling
Polling is the most common cause of 429 errors. If you check an order, deposit, or transfer on a timer, use DriveWealth events to learn when it changes. Then call the REST API once to read the new state. Keep a slow reconciliation sweep as a safety net, not as your main way to find changes.
2. Ask for less
- Use filters, date ranges, and
limiton list endpoints. Fetch only what you need. - Prefer one list call to many single-item calls.
- Page through results one page at a time. Do not request every page at once.
- Skip calls for data you already have.
3. Cache what rarely changes
Reference data, such as instruments and supported countries, changes slowly. Cache it and refresh it on a schedule instead of fetching it on every user request.
Cache your access token too. A token is valid for 60 minutes, so request a new one only when the current one is close to expiry. See Authorization.
4. Smooth out bursts
Short bursts hit limits faster than steady traffic.
- Send calls through a queue with a fixed number of workers.
- Add a client-side throttle that you can lower at run time.
- Spread scheduled jobs. If many jobs start at the top of the hour, add a random delay to each one.
- Keep concurrency low for batch work such as backfills and month-end reports, and run it off-peak.
5. Share one budget across your services
If several services or workers use the same credentials, they share the same limits. Coordinate them through one shared throttle or queue. Otherwise each worker backs off alone and the group still overloads the API.
Retry the right way
When a 429 arrives, stop sending to that endpoint, wait, and retry.
- Use exponential backoff: wait 1 second, then 2, 4, 8, and so on, up to a cap such as 60 seconds.
- Add jitter: randomize each wait, for example between 50% and 100% of the computed delay. Jitter stops many clients from retrying at the same moment.
- Stop after a fixed number of attempts. Then fail the request, log it, and alert.
- If
429responses keep arriving, slow your overall send rate. Do not only retry the failed call.
async function callWithRetry(send, { maxAttempts = 5, baseMs = 1000, capMs = 60000 } = {}) {
let delay = baseMs;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
const response = await send();
if (response.status !== 429) return response;
if (attempt === maxAttempts) break;
// Wait between 50% and 100% of the current delay (jitter), then double the delay.
const waitMs = delay / 2 + Math.random() * (delay / 2);
await new Promise((resolve) => setTimeout(resolve, waitMs));
delay = Math.min(delay * 2, capMs);
}
throw new Error("Rate limited: retries exhausted");
}import random
import time
def call_with_retry(send, max_attempts=5, base=1.0, cap=60.0):
delay = base
for attempt in range(1, max_attempts + 1):
response = send()
if response.status_code != 429:
return response
if attempt == max_attempts:
break
# Wait between 50% and 100% of the current delay (jitter), then double the delay.
time.sleep(random.uniform(delay / 2, delay))
delay = min(delay * 2, cap)
raise RuntimeError("Rate limited: retries exhausted")Know what is safe to retry
| Response | Retry? | Why |
|---|---|---|
429 | Yes, after waiting | The request was turned away because of load. In the usual case it was not processed, so waiting and retrying is the right response. |
400, 401, 403, 404, 409, 422 | No | These fail again until you change the request. |
5xx or a timeout on a read | Yes, with backoff | Reads do not change anything, so a repeat is safe. |
5xx or a timeout on a write | Yes, with the same Idempotency-Key | The request may have succeeded. A repeat with the same key returns the original response instead of running the operation again. Without a key, read the current state first. |
Use an idempotency key on orders and money movementSend an
Idempotency-Keyheader with a unique UUID on order, deposit, and withdrawal requests. If a call times out or returns a5xx, retry with the same key. DriveWealth returns the original response instead of running the operation a second time. Use a fresh key for each new operation. If you cannot use a key, read the current state first and match it with a natural key such asorderNoorpaymentIDbefore you retry. See Common data types.
Stop early with a circuit breaker
If most calls to an endpoint fail with 429 or 5xx, pause all calls to it for a short time. Then send one test request. If it succeeds, resume slowly. This protects your own systems and gives the platform room to recover.
Watch your traffic
Track these so you see a problem before your users do:
- Count of
429responses by endpoint, with the time. - Retries, with the attempt number.
- Requests that failed after the last retry. Alert on these.
- Requests per second by endpoint, so you can compare against a
429spike.
A new polling loop or batch job shows up here first.
If you still get 429 errors
First work through the steps above, starting with polling and bursts. If 429 responses continue at a steady, modest request rate, or if you need more throughput for a launch or migration, contact DriveWealth support. Include:
- the endpoint and HTTP method
- your approximate request rate and number of parallel workers
- whether the traffic is steady or a one-off job
We cannot quote a limit, but we can review your traffic pattern and your use case.
Updated 1 day ago