Skala
Company

Truncate company data

Irreversibly deletes the authenticated company's data, either only stock movements or everything.

POST
/api/company/truncate

Irreversibly deletes the authenticated company's data. The operation runs in a single database transaction and supports two modes, selected with the action query parameter.

Mode 1 - Movements only (action=movements)

Keeps master data and only wipes stock movements and documents:

  • All stock quantities are reset to zero (amount, committed, usable, expected, missing, average cost, value in stock).
  • Stock transactions, serial numbers and stock quantity batches are deleted.
  • Work orders with their materials, operations and logs are deleted.
  • Sales/purchase orders (invoices) and their items, shipments and shipment items are deleted.
  • Stock adjustments, stock takes, stock transfers and their items are deleted.
  • Procurement requests/orders, events, stock level notifications and sale statistics/summaries are deleted.

Products, variants, recipes, contacts, locations, categories, units and tax rates are kept.

Mode 2 - Full truncate (action omitted or any other value, e.g. action=null)

Deletes everything from Mode 1 and additionally:

  • Stocks, stock variants, variant options/values and stock media.
  • Product recipes and product operations (BOM and routing) with their items.
  • Categories, operations, resources, tax rates, units, contacts and addresses.
  • All locations except the company's first (oldest) location; remaining locations are reactivated.
  • External ID mappings (integration references).
  • Company default manufacturing/purchase/sales locations are cleared.

In both modes the company's default category, unit and tax are cleared and the company is marked as demo-data-deleted.

Confirmation

The request body must confirm the operation in one of two ways:

  • Password: send password with the current user's password.
  • Reset code: send code with the 6-digit code emailed by POST /api/account-reset/send-code (admin users only). The code is valid for 15 minutes and can be used once. When the code key is present, password is ignored.
AuthorizationBearer <token>

Send your Skala API key (skala_...) as a Bearer token. Create it in Skala under Settings > API Keys.

In: header

Query Parameters

action?string

Truncate mode. movements only wipes stock movements and documents and resets stock quantities to zero. Omit it (or send any other value such as null) for a full truncate.

Value in"movements" | "null"

Request Body

application/json

Confirmation of the operation, either with the user's password or with an emailed reset code.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.skalasuite.com/api/company/truncate?action=movements" \  -H "Content-Type: application/json" \  -d '{    "password": "your-account-password"  }'
{
  "success": true
}
{
  "success": false,
  "message": "Code is required"
}
Empty
{
  "success": false,
  "message": "Invalid or expired code"
}