Delete a Company
MrPCMan · 2026-05-17
What is the proper way to delete (not archive) a company?
I have tried everything (including working with ChatGPT and Claude) to get rid of previous companies.\ I also tried the CURL functions they did not work.
I wanted to delete all companies before upgrading to the new version.
Thanks in advance
Answers
MrPCMan · 2026-05-18
Thanks for this and I will use it next time! I have chatGPT being used as my co-pilot, we figured a way to let's say to 'delete' the company and we are moving on. BTW, we just upgraded to the next version, thank @dotta and YOU for everything everyone does here!
Aron Prins · 2026-05-20
Glad you're unstuck — and good move upgrading. For anyone landing here later: the FK cascade fix lands in the next release window, so post-upgrade the cURL/API delete path should return cleanly on Companies with cost history. If that's not the case on your build (paperclip --version post-upgrade), drop a note here and I'll re-check the cascade migration shipped. Thanks for flagging the bug in the first place.
Aron Prins · 2026-05-17
Hey @MrPCMan — you've actually hit a known bug, not a usage error. Splitting this into three parts so you can pick the path that fits you.
---
Non-developer path (recommended)
The supported ways to hard-delete a Company are:
In the app: open the Companies page, find the row, click the menu and choose Delete Company, then confirm. From the CLI: bash npx paperclipai company delete <ID-or-PREFIX> --by id --yes --confirm <ID-or-PREFIX> Heads-up: --confirm takes the id/prefix as its value, so you literally type it twice. The help text doesn't make that obvious (tracked in #5157).
If either of those errors out, you're almost certainly hitting the bug below — don't keep retrying, it won't start working. Skip to part 3 and let your AI agent handle it, or wait for the fix.
---
Developer path — ⚠️ DESTRUCTIVE, only if you know what you're doing
> Warning: the steps below run raw SQL against your Paperclip Postgres database and permanently delete cost history and Company data. There is no undo. Do not run this on a database you can't afford to restore from backup. If you don't routinely operate Postgres, use part 1 or part 3 instead.
The reason cURL / API calls fail with HTTP 500 on Companies that have run any agent heartbeats: