Branch limit and managing branches
Hello! Our team recently hit our branch limit of 500. We noticed this after the Vercel integration stopped providing environment variables, causing our builds to fail. I manually deleted some old (~1 year) branches but I'd like some tips on how to manage branches.
Namely, is there a way to automatically delete old branches? I've read the docs page on managing branches (https://neon.tech/docs/manage/branches) but the only insight was manually deleting them one by one. It's a bit tedious to go through 500 branches manually only for the limit to fill up again sometime in the future.
Thanks in advance!
Neon
Manage branches - Neon Docs
Data resides in a branch. Each Neon project is created with a root branch called main, which is also designated as your default branch. You can create child branches from main or from previously creat...
5 Replies
ratty-blush•16mo ago
Hey @Eepu,
1. You can enable automatic deletions of branches via the Vercel integration (as in the screenshot). Read more on https://neon.tech/docs/guides/vercel.

ratty-blush•16mo ago
2. Another way to delete old branches is via API.
Using https://api-docs.neon.tech/reference/listprojectbranches you can fetch all the branches associated with the project, and depending on the
updated_at time, you can call the https://api-docs.neon.tech/reference/deleteprojectbranch API to delete the branch.
ratty-blush•16mo ago
Does that help?
national-goldOP•16mo ago
Yes, this is perfect! Tysm!
ratty-blush•16mo ago
Awesome, glad to be of help.