Layers

DELETE /v1/social-accounts/:socialAccountId

Revoke a social account. Cancels any scheduled posts on it.

View as Markdown
DELETE/v1/social-accounts/:socialAccountId
Phase 1stable
Auth
Bearer
Scope
social:write

Disconnect a social account. Layers drops the stored token, marks the account disconnected (with disconnectedReason = "revoked_by_partner"), and cancels every queued post targeting it. Already-published posts stay on the platform — we don't delete upstream content.

Use this when the end-customer asks to disconnect, or as part of offboarding a customer. For leased accounts, DELETE /v1/leased-accounts/:id is the better endpoint — it releases the billing as well.

Revoking cancels all queued scheduled posts on this account in a single transaction. The response's canceledScheduledPosts count is your audit trail. If that number surprises you, stop and re-check before moving on.

Path
  • socialAccountId
    stringrequired
    Account to revoke.

This endpoint takes no request body. The cancellation reason is recorded internally as revoked_by_partner.

Example request

curl -X DELETE https://api.layers.com/v1/social-accounts/sa_01HXZ9P2M4N5KLM6TUV7WXYZ9A \
  -H "Authorization: Bearer lp_live_01HX9Y6K7EJ4T2_4QZpN..."
const result = await layers.social.revoke({
  socialAccountId: "sa_01HXZ9P2M4N5KLM6TUV7WXYZ9A",
});

console.log(`Canceled ${result.canceledScheduledPosts} queued posts.`);
result = layers.social.revoke(
    social_account_id="sa_01HXZ9P2M4N5KLM6TUV7WXYZ9A",
)

Response

200Revoked
{
  "socialAccountId": "sa_01HXZ9P2M4N5KLM6TUV7WXYZ9A",
  "status": "disconnected",
  "disconnectedReason": "revoked_by_partner",
  "canceledScheduledPosts": 4,
  "disconnectedAt": "2026-04-18T19:15:02Z"
}

Errors

StatusCodeWhen
401UNAUTHENTICATEDMissing or invalid key.
403FORBIDDEN_SCOPEKey lacks social:write.
404NOT_FOUNDAccount not in your organization, or already disconnected.
429RATE_LIMITEDWrite budget exhausted.

For leased accounts, prefer DELETE /v1/leased-accounts/:id — it releases the billing relationship in addition to disconnecting. Calling this endpoint on a leased account succeeds (the account is marked disconnected) but does not release the lease.

See also

On this page