Skip to main content
Prerequisite You should have installed Node.js (version 18.10.0 or higher).
const headers = {
  "Content-Type": "application/json",
  "Accept": "application/json",
  "X-ApiCaching-OriginUrl": YOUR_API_URL,
  "X-ApiCaching-ApiKey": "YOUR_API_KEY",
  // Cache for 12 hours
  "X-ApiCaching-MaxAge": 43200,
  // SWR - It can serve stale data for up to 300 seconds, before fetching from the origin
  "X-ApiCaching-Swr": 300
}

const payload = {
  // Your payload data here
}

fetch("YOUR_APICACHING_ENDPOINT", {
  method: "POST",
  headers,
  body: JSON.stringify(payload),
}
I