Cache Coinmarketcap Crypto Pricing API at Edge
Edge TTL shield for Frontend / Web CoinMarketCap calls
To cache coinmarketcap crypto pricing api at edge, set cacheTtlSeconds on a GET pipeline targeting https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol={{query.symbol}}. Identical query strings reuse Cloudflare caches.default before upstream sees traffic.
Uncached CoinMarketCap spikes cost and latency
Every Frontend / Web visitor can trigger a fresh CoinMarketCap 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 COINMARKETCAP_API_KEY in the vault. Frontend / Web never embeds the raw secret, only a revocable rc_live_ client token.
Configure upstream steps and output mapping
Use GET against https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol={{query.symbol}}. 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 Frontend / Web
Allowed origins on the token should list every Frontend / Web host that calls this URL.
const res = await fetch('https://realcomposer.com/v1/workspace/cache-crypto-pricing-api-edge', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_cache-cr",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "cache-crypto-pricing-api-edge"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"price": "sample",
"symbol": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- 300s
- Client auth
- Restricted client token
- Mapped output fields
- 2
- Payload
- 248 B to 36 B (-85%)
curl -X GET "https://realcomposer.com/v1/workspace/cache-crypto-pricing-api-edge" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
Can Frontend / Web call CoinMarketCap without holding the production key?
Log request IDs for cache-crypto-pricing-api-edge, not raw CoinMarketCap payloads, because upstream bodies may include PII.
How do I forward JSON bodies to POST upstreams?
cache-crypto-pricing-api-edge 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-crypto-pricing-api-edge client token restrict which domains may call the edge URL.
Sources & Definitions Used in This Answer
Deploy this Frontend / Web + CoinMarketCap Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.