Preview the sandbox reset impact (counts only, no mutations)
const url = 'https://api.emite.cr/v1/tenants/me/sandbox/preview';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”object
Sandbox invoices that will be / were deleted (cascades to lines, taxes, discounts, payment methods, exonerations).
Sandbox hacienda_submissions rows deleted.
Sandbox idempotency_keys rows deleted.
Sandbox atv_tokens rows deleted (next sandbox emission triggers re-auth against Hacienda).
Pending pg-boss jobs cancelled (hacienda.poll, email.invoice-* in created/retry state).
R2/S3 objects deleted under tenants/<tenantId>/sandbox/ and legacy invoices/<id>/... keys. Best-effort — orphans are inert.
R2/S3 keys that failed to delete. Orphan, can be reaped by a sweeper later.
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.