Skip to main content

How to erase a customer

Delete a customer's organization, assets, and provider clients with the gdpr-customer-teardown erasure workflow.

Irreversible

This workflow deletes outright. There is no soft delete and no undo. Read What erasure does and does not remove before running it.

Prerequisites​

  • An enrollment group whose workflows set includes gdpr-customer-teardown
  • The customer's external id
  • A JWT access token with onboarding management permissions
export API="https://api.example.com/api"
export TOKEN="YOUR_ACCESS_TOKEN"
export GROUP_ID="YOUR_ENROLLMENT_GROUP_ID"

Steps​

1. Confirm the target​

Check what you are about to delete:

curl -X POST "$API/enrollment-groups/$GROUP_ID/workflows/list-org-assets/run" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "params": { "customer.id": "customer-ext-42" } }'

This is a read-only preview of the organization and its assets. It is eventually consistent, so treat it as an indication rather than a guarantee of the exact set.

2. Run the erasure​

curl -X POST "$API/enrollment-groups/$GROUP_ID/workflows/gdpr-customer-teardown/run" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "params": { "customer.id": "customer-ext-42" } }'

The workflow tears down the customer's devices, then deletes the organization.

Verify it worked​

{
"subjectId": "customer-ext-42",
"runId": "0198f3f2-1a2b-7c3d-9e4f-5a6b7c8d9e0f"
}

Keep the runId — the run record is the audit artifact for the erasure.

curl -s "$API/workflow-runs/$RUN_ID" -H "Authorization: Bearer $TOKEN" \
| jq '{outcome, invokedBy, finishedAt, steps}'

What erasure does and does not remove​

RemovedNot removed
The customer's organizationDevice records
The organization's assetsOnboarding's workflow run history
The provider clientsThe enrollment group

Device records survive deliberately. Deleting them would prevent the hardware from ever re-enrolling. Each affected device reverts to registered and can be activated again without being re-registered.

Run history is not erased by this workflow. Erasing it here would let a caller delete the audit trail of their own erasure. Records expire on the configured retention window — 90 days by default — and that window is the erasure SLA for run history. There is no purge-by-id, so a record inside the window cannot be removed sooner through the API.

Confirm the retention window configured for your environment rather than assuming the default.

If it doesn't work​

404 organization_not_found — no organization with that external id under the parent, it is not viewable by your caller identity, or it was already erased. Erasure is convergent, so a repeat run against an already-erased customer is not an error condition to worry about.

401 caller_identity_missing — the request carried no resolvable caller identity.

503 — another erasure for the same customer is already running. The run lock is held on customer.id.

Partial failure — the run stops at the failing step and records it. Erasure steps are convergent (deleting something already absent succeeds), so retry the run to finish it.

See also​