Skip to content

Preview the sandbox reset impact (counts only, no mutations)

GET
/v1/tenants/me/sandbox/preview
curl --request GET \
--url https://api.emite.cr/v1/tenants/me/sandbox/preview \
--header 'Authorization: Bearer <token>'

Returns the row counts that would be deleted if POST /reset is called now. Snapshot in time — concurrent sandbox writes between this call and the actual reset will drift the numbers. The UI should label these as "approximate" and confirm the final counts returned by reset.

Media typeapplication/json
object
invoicesDeleted
required

Sandbox invoices that will be / were deleted (cascades to lines, taxes, discounts, payment methods, exonerations).

number
submissionsDeleted
required

Sandbox hacienda_submissions rows deleted.

number
idempotencyKeysDeleted
required

Sandbox idempotency_keys rows deleted.

number
atvTokensRevoked
required

Sandbox atv_tokens rows deleted (next sandbox emission triggers re-auth against Hacienda).

number
pendingJobsCancelled
required

Pending pg-boss jobs cancelled (hacienda.poll, email.invoice-* in created/retry state).

number
blobsDeleted
required

R2/S3 objects deleted under tenants/<tenantId>/sandbox/ and legacy invoices/<id>/... keys. Best-effort — orphans are inert.

number
blobsFailed
required

R2/S3 keys that failed to delete. Orphan, can be reaped by a sweeper later.

Array<string>
Examplegenerated
{
"invoicesDeleted": 1,
"submissionsDeleted": 1,
"idempotencyKeysDeleted": 1,
"atvTokensRevoked": 1,
"pendingJobsCancelled": 1,
"blobsDeleted": 1,
"blobsFailed": [
"example"
]
}

Missing or invalid JWT.

Sandbox reset requires the sandbox:reset scope (owner+admin only) AND a JWT session. API keys cannot trigger a reset.