Cache mailchimp api to stay under rate limits
Marketing site list previews without hammering API
Shared edge cache for popular list metadata endpoints. For "cache mailchimp api to stay under rate limits", store MAILCHIMP_BASIC_AUTH in Secret Vault, call https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10 from a Worker, and let JavaScript / HTML hit only https://realcomposer.com/v1/workspace/cache-mailchimp-api-avoid-rate-limits with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.
Uncached Mailchimp spikes cost and latency
Every JavaScript / HTML visitor can trigger a fresh Mailchimp call. Bursts exhaust per-minute quotas even when data changes slowly.
- Thundering herds after cache expiry on the origin
- Analytics skewed by client-side retry storms
- Support tickets blaming "API downtime" during spikes
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Store MAILCHIMP_BASIC_AUTH in the vault. JavaScript / HTML never embeds the raw secret, only a revocable rc_live_ client token.
Configure upstream steps and output mapping
Use GET against https://{{secrets.MAILCHIMP_DC}}.api.mailchimp.com/3.0/lists/{{query.listId}}/members?count=10. Allowed origins on the client token should match set cache ttl to 300s so repeat gets with the same query string hit caches.default.
Call from JavaScript / HTML
Allowed origins on the token should list every JavaScript / HTML host that calls this URL.
const data = await fetch('https://realcomposer.com/v1/workspace/cache-mailchimp-api-avoid-rate-limits', {
headers: { Authorization: 'Bearer rc_live_your_token' }
}).then(r => r.json());
{
"requestId": "req_cache-ma",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "cache-mailchimp-api-avoid-rate-limits"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"memberId": "sample",
"email": "sample",
"status": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- 300s
- Client auth
- Restricted client token
- Mapped output fields
- 3
- Payload
- 256 B to 56 B (-78%)
curl -X GET "https://realcomposer.com/v1/workspace/cache-mailchimp-api-avoid-rate-limits" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
Can JavaScript / HTML call Mailchimp without holding the production key?
Log request IDs for cache-mailchimp-api-avoid-rate-limits, not raw Mailchimp payloads, because upstream bodies may include PII.
How do I forward JSON bodies to POST upstreams?
cache-mailchimp-api-avoid-rate-limits forwards client JSON to POST upstreams unchanged; secrets interpolate only in URLs and header templates.
What happens if an upstream step times out?
Allowed origins on the cache-mailchimp-api-avoid-rate-limits client token restrict which domains may call the edge URL.
Sources & Definitions Used in This Answer
Deploy this JavaScript / HTML + Mailchimp Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.