Empty the whole site database
clear_site_database
Drops every collection in a site database, destroying the tables along with their columns and relationships.
This does not merely empty the collections. The tables themselves are dropped in one irreversible step, so the collections, their columns and their relationships all go and the site is left with an empty database it cannot read from. The live site loses its content and its schema the moment it runs, and nothing can restore what it drops. The response counts the dropped tables in dropped.
clear_collection is not simply a narrower version of this: it empties one collection and leaves it standing, columns included, while this destroys the collections themselves. The database stays provisioned, so its connection keeps working, but the schema has to be rebuilt. The CMS folder of storage is emptied too, since every file in it belonged to an item.
It needs the Delete projects permission in the workspace, which the stock member role does not hold, so an ordinary member cannot run it. Before it runs, the tool tells the client to read eligibility from list_database_backups, and while that reads ready and canBackup is true, to take a backup with create_database_backup, when it has that tool, and wait until the backup reads ready. On unsupported or no-database, no backup of this data exists or ever will, and a database backup can only ever be downloaded from the editor, never restored.
The tool tells the client never to call it to tidy up or to retry a failed import, and to call it only when you asked for exactly this, understand that the schema goes too, and confirmed it. See Clear every collection.
Request
Call it with a POST to https://api.modulify.ai/v1/clear_site_database, sending the inputs below as a JSON object. The token needs the sites:delete scope.
This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an Idempotency-Key header whenever you might retry it.
curl -X POST https://api.modulify.ai/v1/clear_site_database \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"projectId":"PROJECT_ID"}'Over MCP, the same method is the clear_site_database tool.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
Response
Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.