> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apostra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete account

> Hard-delete an empty account under your organization

`DELETE /api/v2/accounts/{customerId}`

Permanently deletes an account under your organization. Only `CHILD`-type accounts can be deleted, and the caller must be an `ADMIN` on the organization. The call refuses with `409` if the account still has linked resources — unwind those first.

For normal account deletion, send no request body and remove dependent resources first.

## Request

```bash curl theme={null}
curl -X DELETE https://api.apostra.com/api/v2/accounts/200 \
  -H "Authorization: Bearer $SCOPE3_API_KEY"
```

## Parameters

| Field        | Type   | Required | Notes                                       |
| ------------ | ------ | -------- | ------------------------------------------- |
| `customerId` | string | Yes      | Path parameter. ID of the account to delete |

## Staging canary cleanup proof

<Warning>
  `runOwnedCleanupReceipt` is reserved for the automated Apostra publisher-onboarding staging canary. It is not a general cascade-delete option, and customer integrations must omit it.
</Warning>

After the internal preparation endpoint has persisted an exact cleanup receipt, the canary reconciler attaches that receipt when finalizing its disposable test seller:

```json theme={null}
{
  "runOwnedCleanupReceipt": {
    "kind": "publisher_onboarding_canary",
    "receiptToken": "550e8400-e29b-41d4-a716-446655440000",
    "campaignIds": ["campaign_01JEXAMPLE"]
  }
}
```

| Field                                 | Type      | Required                         | Notes                                                                          |
| ------------------------------------- | --------- | -------------------------------- | ------------------------------------------------------------------------------ |
| `runOwnedCleanupReceipt.kind`         | string    | Yes when the receipt is supplied | Must be `publisher_onboarding_canary`. Any other value is rejected with `400`. |
| `runOwnedCleanupReceipt.receiptToken` | string    | Yes when the receipt is supplied | UUID returned by the internal cleanup-preparation request.                     |
| `runOwnedCleanupReceipt.campaignIds`  | string\[] | Yes when the receipt is supplied | Up to 20 unique campaign IDs bound to the durable receipt.                     |

The service accepts this receipt only for a marked disposable publisher-onboarding test child, from an Apostra SuperAdmin acceptance-test request scoped to its exact parent. It rechecks the persisted account, campaign, strategy, and advertiser proof before deletion. Missing cleanup steps, new dependencies, or any receipt mismatch fail closed.

## Response

`204 No Content`. The account is removed; there is no response body.

## Errors

* `400 VALIDATION_ERROR` — the account is not a deletable child, or the optional canary receipt is malformed.
* `401 UNAUTHORIZED` — missing or invalid bearer token.
* `403 FORBIDDEN` — caller is not an `ADMIN` on the target account's parent organization (including when an existing account is outside the caller's organization), or receipt-bound cleanup was requested without the required internal authority.
* `404 NOT_FOUND` — the account does not exist.
* `409 CONFLICT` — the account still has linked resources, or the receipt no longer exactly matches the target child and its cleanup state.

See [Errors](/v2/reference/errors) for the full error contract.

## Related

<CardGroup cols={2}>
  <Card title="Account tasks" href="/v2/storefront/account/tasks" icon="list-check">
    All account operations
  </Card>

  <Card title="List accounts" href="/v2/storefront/account/tasks/list-customer-accounts" icon="list">
    Find the account ID
  </Card>
</CardGroup>
