Sweeppea API v3

⚡ Rate Limits, Concurrency & Retries

Every limit the Sweeppea API v3 applies, what each one answers when you reach it, and how to write a client that never trips over them.

The one number to plan around is your plan's rate limit: 150 calls per minute by default.

Every other limit on this page sits well above it. A client that stays within its plan rate and honours the Retry-After header will never see any other limit.

The Limits at a Glance

LimitValueCounted perWhen you go over it
Plan rate limit150 calls per minute by default (MaxApiCallsPerMinute in POST /account/plan)API key, rolling 60-second window, all endpoints together429 + exact Retry-After + X-RateLimit-Limit / X-RateLimit-Remaining. Not charged to your monthly allowance
Firewall1,000 requests per minute from one IP address (5,000 per rolling 5-minute window)Source IP address, whatever the API key429 + Retry-After: 60
Platform-wide throttle300 requests per second (bursts of 600)All clients together429 + Retry-After: 1
Monthly allowanceMaxApiCallsAllowed in POST /account/planAccount, calendar monthNot blocked. Reported in every response (Telemetry); the account owner is emailed at 80% and 100%. Plan your usage or upgrade

Two more rules apply before any limit is counted:

RuleWhat happens
A request without Authorization: Bearer YOUR_API_KEY401, refused at the edge. It never reaches the API
A request sent to any address other than https://api-v3.sweeppea.com403 with the correct address

Your Plan's Rate Limit

Every account has an API rate limit: how many calls it may make in any sixty-second window, across every endpoint. It is part of your subscription plan, it is reported as MaxApiCallsPerMinute by POST /account/plan, and unless your plan says otherwise it is 150 calls per minute.

  • It is a rate, not an allowance. It is never "spent" and never resets: at any moment it counts the calls of the last 60 seconds.
  • It is counted per API key. Spreading the same key over several servers or addresses does not raise it.
  • A refused call is not charged. It is never written to the API log, so it does not consume your monthly allowance.
  • It is a different limit from MaxApiCallsAllowed, which is the monthly total.

Going over it returns 429 Too Many Requests:

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 7
X-RateLimit-Limit: 150
X-RateLimit-Remaining: 0
{
  "Response": false,
  "Message": "Rate limit exceeded: your plan allows 150 API calls per minute (rolling 60-second window, per API key). This call was NOT processed and does NOT count against your monthly allowance. Retry in 7 seconds.",
  "Code": 429,
  "Limit": 150,
  "WindowSeconds": 60,
  "RetryAfterSeconds": 7,
  "Documentation": "https://apidocs.sweeppea.com/concurrency.html"
}

Retry-After is exact: it is the number of seconds until the oldest call in your window leaves it and a slot is free. Wait that long, then retry. Do not retry sooner, because the call will be refused again.

If your integration genuinely needs a higher rate, contact support. It is a plan setting and can be raised.

The Firewall

In front of the API there is a firewall that limits each IP address to 1,000 requests per minute, measured over a rolling five-minute window (5,000 requests per five minutes). It protects the platform from floods and is deliberately far above any plan rate: a client that respects its plan limit never reaches it.

When an IP address goes over it, every request from that address is answered for a short while with:

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60
{
  "Response": false,
  "Code": 429,
  "Message": "Too many requests from your IP address. The API firewall allows up to 1,000 requests per minute from one IP address (measured over a rolling 5-minute window), independently of your plan. Nothing was processed. Wait the number of seconds in the Retry-After header, then try again.",
  "Documentation": "https://apidocs.sweeppea.com/concurrency.html"
}

You can tell the two 429 answers apart by the body: the plan limit carries Limit and RetryAfterSeconds, the firewall does not. Both are handled the same way: wait Retry-After seconds, then retry.

Before November 25, 2026

the firewall answered 555 (with an empty body) above 75 requests per minute, or 403 (empty body) above 300 requests per five minutes. Both limits were below the plan rate and both codes are gone. If your client still special-cases them, treat them like 429.

Parallel Requests

You can send requests in parallel. Every endpoint processes many requests at the same time, and the platform keeps a fixed amount of capacity reserved for each one.

  • Up to 5 requests in flight per API key is a comfortable pace. More parallelism does not make your plan rate any higher; it only reaches the limit sooner.
  • Three endpoints process one request at a time platform-wide, because two simultaneous calls could corrupt data: POST /winners/draw, POST /sweepstakes/create and POST /sweepstakes/clone. Send them one at a time. If another call is already running, yours is answered 500 with the message "The API could not complete this request…" and was not processed: retry it after a few seconds.

Status Codes You Must Handle

StatusMeaningWhat to do
200 / 201Success—
400 Bad RequestA parameter is missing or invalid. The body lists every accepted parameter under HelpFix the request. Do not retry as is
401 UnauthorizedThe Authorization: Bearer … header is missing or malformedSend Authorization: Bearer YOUR_API_KEY. Do not retry
403 Forbidden"Invalid API token" (the key matches no account), a refusal (plan, module, ownership, disabled account), an endpoint that does not exist, or a request sent to an address other than api-v3.sweeppea.comRead Message. Do not retry as is
404 Not FoundThe record does not exist or does not belong to your accountDo not retry
429 Too Many RequestsA rate limit: plan, firewall or platform-wide. Nothing was processedWait Retry-After seconds, then retry. Safe for writes too
500 with "The API could not complete this request…"The API was momentarily busy and did not process the requestRetry after a few seconds. Safe for writes too
500 with any other MessageThe endpoint itself failed while processingRead Message. For a write, check whether it took effect before retrying
502 / 503 / 504The request may or may not have been processedReads: retry with backoff. Writes: check whether it took effect before retrying

Every error body has the same shape: { "Response": false, "Message": "…", "Code": … }.

Retrying Correctly

  1. Honour Retry-After when it is present (every 429). It is the exact wait.
  2. Otherwise use exponential backoff with jitter: 1 s, 2 s, 4 s, 8 s (plus a random fraction), at most 4 attempts.
  3. Never retry a 400, 401, 403 or 404. They will fail the same way.
  4. Retry writes only when nothing was processed (429, or the 500 that says so). After a 502/503/504 on a write, read the record first.
/* Calls The Sweeppea API, Honouring Retry-After And Backing Off With Jitter */

const sleep = (_ms) => new Promise((_resolve) => setTimeout(_resolve, _ms));

const NOT_PROCESSED = /The API could not complete this request/;

async function sweeppeaCall(_path, _body, _apiKey, _maxAttempts = 4) {

	for (let attempt = 1; attempt <= _maxAttempts; attempt++) {

		const response = await fetch(`https://api-v3.sweeppea.com/${_path}`, {
			method  : 'POST',
			headers : { 'Authorization' : `Bearer ${_apiKey}`, 'Content-Type' : 'application/json' },
			body    : JSON.stringify(_body)
		});

		const data = await response.json().catch(() => ({}));

		/* Rate Limited: Wait Exactly What The API Says */
		if (response.status === 429 && attempt < _maxAttempts) {

			await sleep((Number(response.headers.get('Retry-After')) || 60) * 1000);

			continue;
		}

		/* Busy, Not Processed: Safe To Retry, Even A Write */
		if (response.status === 500 && NOT_PROCESSED.test(data.Message || '') && attempt < _maxAttempts) {

			await sleep((2 ** attempt) * 1000 + Math.random() * 500);

			continue;
		}

		return { status : response.status, data };
	}
}

Pacing a Bulk Job

At 150 calls per minute you can make 2.5 calls per second. Pace your job a little under that and you will never be refused:

/* 2 Calls Per Second = 120 Per Minute, Comfortably Under A 150/min Plan */

const CALLS_PER_SECOND = 2;

for (const item of items) {

	const startedAt = Date.now();

	await sweeppeaCall('participants/add', item, apiKey);

	await sleep(Math.max(0, (1000 / CALLS_PER_SECOND) - (Date.now() - startedAt)));
}

Read your plan's real rate from POST /account/plan (MaxApiCallsPerMinute) instead of hard-coding 150.

Best Practices

  • Plan around your plan rate (MaxApiCallsPerMinute, 150 by default). It is the only limit a well-behaved client meets.
  • Always honour Retry-After. It is exact on the plan limit and safe on every other 429.
  • Retry only what was not processed: 429, and the 500 that says "The API could not complete this request". Check a write before retrying anything else.
  • Keep about 5 requests in flight per key, and send winners/draw, sweepstakes/create and sweepstakes/clone one at a time.
  • Watch Telemetry in every successful response: APICalls and MaxAPICalls tell you how much of the monthly allowance is used.
  • Always call https://api-v3.sweeppea.com and always send Authorization: Bearer YOUR_API_KEY.
  • Every API call is monitored and audited to prevent fraud and abuse. Sustained traffic far above your plan, or traffic designed to get around the limits, can lead to the API key being suspended.
© Sweeppea. All rights reserved.