---
title: How do I use the Prerender.io recache script to refresh multiple URLs?
description: Use the Prerender.io recache script to send batches of URLs from a text file or XML sitemap to the recache API and trigger fresh renders instantly.
---

[Skip to content](https://docs.prerender.io/docs/recache-api-script#main-content)

![prerender-logo](https://docs.prerender.io/hs-fs/hubfs/logo.png?width=100&height=75&name=logo.png)

Open main navigation

Close main navigation

- [Contact us](mailto:support@prerender.io)

[Contact us](mailto:support@prerender.io)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Knowledge Base - Prerender.io](https://docs.prerender.io/docs?hsLang=en)
2. [Get Found on AI & Search](https://docs.prerender.io/docs/get-found-on-ai-search?hsLang=en)

May 25, 2026

# How do I use the Prerender.io recache script to refresh multiple URLs?

## Trigger fresh renders for hundreds or thousands of URLs at once by sending batches directly to the Prerender.io recache API using a Python script.

#### TL;DR

The Prerender.io recache script is a Python utility that reads URLs from a text file or XML sitemap and sends them to the Prerender.io recache API in batches of up to 1,000 at a time. You run it from the command line with your Prerender.io token, an input source, and an optional rendering target (desktop or mobile). 

---

### Step 1: Copy your Prerender.io token.

Every request the script makes is authenticated with your Prerender.io token. Copy it before running anything.

1. Open your [Prerender.io dashboard](https://dashboard.prerender.io).
2. Go to **Security & Access** → **Prerender Token**.
3. Copy the token value. You will pass it as the first argument when you run the script.

⚠️ Keep your token private. Do not commit it to source control or include it in public forum posts.

---

### Step 2: Download the recache script.

Download the Python script and save it to a working directory on your machine.

➡️ [RecacheAPI\_Script.py](https://docs.prerender.io/hubfs/RecacheAPI_Script.py?hsLang=en)

ℹ️ Not sure whether the script is the right approach for your setup? Ask **Nexus, your AI integration assistant**, inside your Prerender.io dashboard. Describe what you are trying to update and Nexus will recommend the best path forward.

---

### Step 3: install the required dependencies.

The script requires Python 3 and the `requests` library. The `xml.etree.ElementTree` module is included in Python's standard library and does not need a separate installation.

**Check or install Python 3**

If you do not already have Python 3, [download it from python.org](https://www.python.org/downloads/). Verify your installation:

```
python3 --version
```

**Install the `requests` library**

```
pip install requests
```

 

---

 

### Step 4: Run the script.

Run the script from your terminal using the format below. Replace `YOUR_TOKEN` with the token you copied in Step 1.

```
python RecacheAPI_Script.py YOUR_TOKEN --input_file [FILE_PATH] --sitemap [SITEMAP_URL] --adaptive_type [TYPE]
```

 

**Arguments**

| Argument | Required | Description |
| --- | --- | --- |
| `YOUR_TOKEN` | Yes | Your Prerender.io token from Step 1. |
| `--input_file` | One of the two | Path to a `.txt` file containing one URL per line. |
| `--sitemap` | One of the two | Full URL of your XML sitemap, e.g. `https://example.com/sitemap.xml`. |
| `--adaptive_type` | Optional | `desktop` (default) or `mobile`. To cache both versions, run the script twice. |

Use either `--input_file` or `--sitemap` per run, not both.

 

**Example: recache from a text file**

```
python RecacheAPI_Script.py YOUR_TOKEN --input_file urls.txt --adaptive_type desktop
```

 

**Example: recache from a sitemap**

```
python RecacheAPI_Script.py YOUR_TOKEN --sitemap https://example.com/sitemap.xml --adaptive_type mobile
```

ℹ️ The script sends URLs in batches of 1,000, which is the API's batch limit. If your source contains more than 1,000 URLs, the script processes them in batches of 1,000. Check the terminal output to confirm all batches completed successfully.

⚠️ This script is provided "as is" without warranty of any kind. Use it at your own risk. Prerender.io is not responsible for data loss or service interruptions arising from its use.

---

### Step 5: Verify the recache completed.

After the script finishes, confirm that Prerender.io has processed the URLs.

1. Open your [Prerender.io dashboard](https://dashboard.prerender.io).
2. Find the submitted URLs in your cached pages list.
3. Check that the **Content Age** timestamp reflects the current run.

✅ The recache was successful when your submitted URLs appear in Cache Manager with updated content age.

If pages are missing or the script returned errors, see [How do I clear my Prerender.io cache?](https://docs.prerender.io/docs/how-to-purge-cache?hsLang=en) and [How the Cache Manager works](https://docs.prerender.io/docs/how-the-cache-manager-works?hsLang=en) for related guidance.[mailto:support@prerender.io](mailto:support@prerender.io)

---

### Related articles

- [How to clear the cache](https://docs.prerender.io/docs/how-to-purge-cache?hsLang=en)
- [Cache expiration](https://docs.prerender.io/docs/cache-expiration?hsLang=en)
- [How Prerender.io works](https://docs.prerender.io/docs/how-prerender-io-works?hsLang=en)
- [Your first steps with Prerender.io](https://docs.prerender.io/docs/getting-started?hsLang=en)

---

 

 

 

💬 **Still need help?** If the script returns errors, your token is rejected, or URLs are not appearing in the cache, our support team can help you diagnose the issue. → Contact us at [support@prerender.io](mailto:support@prerender.io)

 

 

- [How Prerender.io works](https://docs.prerender.io/docs/how-prerender-io-works?hsLang=en)
- [Getting started](https://docs.prerender.io/docs/getting-started?hsLang=en)
- [Integrations](https://docs.prerender.io/docs/integrations?hsLang=en#main-content)

    - [Prerender.io officially maintained integration](https://docs.prerender.io/docs/integrations?hsLang=en#prerender-io-officially-maintained-integration)
    - [Bubble](https://docs.prerender.io/docs/integrations?hsLang=en#bubble)
    - [FAQ](https://docs.prerender.io/docs/integrations?hsLang=en#faq)
- [Get Found on AI & Search](https://docs.prerender.io/docs/get-found-on-ai-search?hsLang=en#main-content)

    - [Google Search Performance](https://docs.prerender.io/docs/get-found-on-ai-search?hsLang=en#google-search-performance)
- [Troubleshooting](https://docs.prerender.io/docs/troubleshooting?hsLang=en)
- [Billing & Account](https://docs.prerender.io/docs/billing-account?hsLang=en#main-content)

    - [Plans & Subscriptions](https://docs.prerender.io/docs/billing-account?hsLang=en#plans-subscriptions)
    - [Renders, Usage & Limits](https://docs.prerender.io/docs/billing-account?hsLang=en#renders-usage-limits)
    - [Payments & Invoices](https://docs.prerender.io/docs/billing-account?hsLang=en#payments-invoices)
    - [Account Access & Security](https://docs.prerender.io/docs/billing-account?hsLang=en#account-access-security)

[![Chill listening crop-3](https://docs.prerender.io/hs-fs/hubfs/logo-1.png?width=24&height=24&name=logo-1.png "Chill listening crop-3")](http://prerender.io)

304 S. Jones Blvd #1205, Las Vegas, NV 89107

<https://www.twitter.com/> [mailto:support@prerender.io](mailto:support@prerender.io) <https://www.linkedin.com/company/prerender/> <https://github.com/prerender>

Copyright © 2025, Prerender.io