Layers

DELETE /v1/organizations/:orgId

Offboard a customer — archive the child org and revoke its keys atomically.

View as Markdown
DELETE/v1/organizations/:orgId
Phase 1stableidempotent
Auth
Bearer
Scope
org:admin

Offboard a customer in one call. Archiving a child org is terminal: its status moves to archived, all of its API keys are revoked, and it can never be restored. This is the clean cut the flat model can't give you — no lingering OAuth tokens, no entangled credit history.

Archival is irreversible by design. If the same customer returns, create a fresh child org. An archived org cannot be resumed or re-activated.

Path
  • orgId
    stringrequired
    The child org id (`org_`-prefixed or bare UUID).
Headers
  • Idempotency-Key
    string (UUID)optional
    Optional. Archiving an already-archived org is itself idempotent and returns its terminal state.

Example request

curl -X DELETE https://api.layers.com/v1/organizations/org_d4e5f6a7-8b9c-4d0e-9f2a-3b4c5d6e7f80 \
  -H "Authorization: Bearer $PARENT_KEY"
const result = await fetch(
  "https://api.layers.com/v1/organizations/org_d4e5f6a7-8b9c-4d0e-9f2a-3b4c5d6e7f80",
  { method: "DELETE", headers: { "Authorization": `Bearer ${process.env.PARENT_KEY}` } },
).then((r) => r.json());
import os, requests

result = requests.delete(
    "https://api.layers.com/v1/organizations/org_d4e5f6a7-8b9c-4d0e-9f2a-3b4c5d6e7f80",
    headers={"Authorization": f"Bearer {os.environ['PARENT_KEY']}"},
).json()

Response

200OK
{
  "id": "org_d4e5f6a7-8b9c-4d0e-9f2a-3b4c5d6e7f80",
  "status": "archived",
  "archivedAt": "2026-06-02T13:00:00.000000+00:00",
  "reclaimedCredits": 3200,
  "revokedApiKeys": 2
}

Field notes

  • revokedApiKeys is the number of the child's active keys that were revoked by this call.
  • reclaimedCredits is the child's unspent non-reserved balance, swept back to the parent wallet as part of this call. Credits reserved for in-flight generations are not reclaimed. It's 0 only when the child had nothing reclaimable (never funded, or fully spent). See allocate for the funding side.

Errors

StatusCodeWhen
404NOT_FOUNDNo such org, or it isn't a direct child of your org.
422VALIDATIONThe :orgId is not a valid organization id (malformed UUID).
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks org:admin.

See also

On this page