CI/CD Integration
Automate PerfectSearch cache invalidation as part of your deployment pipeline. When you deploy new content, invalidate stale snapshots so bots see your latest pages. This works with GitHub Actions, Vercel deploy hooks, and any CI/CD system that can make HTTP requests.
How do I invalidate cache on deploy?
Call the PerfectSearch invalidation endpoint after your deploy completes. Send a POST request to /v1/webhook/invalidate with your site ID and a URL pattern. Use /** to invalidate all cached snapshots, or specify a more targeted pattern like /blog/** to invalidate only matching paths.
curl -X POST https://search.perfectline.io/api/v1/webhook/invalidate \
-H "Authorization: Bearer $PERFECTSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"siteId":"'$PERFECTSEARCH_SITE_ID'","pattern":"/**"}'How do I set up GitHub Actions?
Add a cache invalidation step to your existing GitHub Actions deployment workflow. The step runs after your deploy completes and calls the PerfectSearch invalidation API using secrets stored in your repository settings. Add your API key and site ID as repository secrets under Settings, then Secrets and variables, then Actions.
name: Deploy and Invalidate Cache
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Your existing deploy steps here...
- name: Invalidate PerfectSearch cache
env:
PERFECTSEARCH_API_KEY: ${{ secrets.PERFECTSEARCH_API_KEY }}
PERFECTSEARCH_SITE_ID: ${{ secrets.PERFECTSEARCH_SITE_ID }}
run: |
curl -X POST https://search.perfectline.io/api/v1/webhook/invalidate \
-H "Authorization: Bearer $PERFECTSEARCH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"siteId":"'$PERFECTSEARCH_SITE_ID'","pattern":"/**"}'Store your secrets in GitHub under Settings → Secrets and variables → Actions:
PERFECTSEARCH_API_KEY— Your API key from the PerfectSearch dashboardPERFECTSEARCH_SITE_ID— Your site ID from the PerfectSearch dashboard
How do I use Vercel deploy hooks?
Vercel deploy hooks let you trigger actions when a deployment completes. You can configure a webhook that calls the PerfectSearch invalidation endpoint automatically after every successful deploy, without modifying your CI/CD pipeline at all. Set this up directly in the Vercel dashboard.
- Go to your Vercel project → Settings → Git → Deploy Hooks
- Click Create Hookand name it “PerfectSearch Cache Invalidation”
- Select the branch that triggers the hook (typically
main) - Copy the generated webhook URL
- In your PerfectSearch dashboard, go to your site → Settings → Webhooks and paste the Vercel deploy hook URL
Alternatively, you can call the PerfectSearch invalidation API directly from a Vercel serverless function that runs on the deployment.completed webhook event.
Can I use other CI/CD systems?
Yes. Any CI/CD system that can make an HTTP POST request works with PerfectSearch cache invalidation. The API is a standard REST endpoint, so you can call it from GitLab CI, CircleCI, Jenkins, Bitbucket Pipelines, AWS CodePipeline, or any custom deployment script. Use the generic curl command below as a template.
# Generic invalidation command — works in any CI/CD system
curl -X POST https://search.perfectline.io/api/v1/webhook/invalidate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"siteId":"YOUR_SITE_ID","pattern":"/**"}'Replace YOUR_API_KEY and YOUR_SITE_ID with your actual values, stored as environment secrets in your CI/CD platform.
Invalidate only changed paths
For content-heavy sites, invalidate only changed paths instead of /** to reduce re-rendering load. For example, if you only updated blog posts, use /blog/** as the pattern. This avoids re-rendering thousands of unchanged product or landing pages, keeping your rendering queue lean and your cache hit rate high.