Cancels one or more active subscriptions. Only subscriptions owned by the requesting user and belonging to the specified app can be cancelled.
/subscription endpoint cancels one or more active subscriptions for a user. The cancellation is processed on-chain via the smart contract wallet system.
| Header | Required | Description |
|---|---|---|
X-utilsio-Signature | Conditional | HMAC-SHA256 signature. Required unless using Safari fallback flow (see below) |
X-utilsio-Timestamp | Conditional | Unix timestamp in seconds. Required unless using Safari fallback flow |
| Field | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | User ID who owns the subscription |
deviceId | string | Conditional | Device ID. Optional if using Safari fallback - will be read from cookies |
appId | string | Yes | Your application ID |
subscriptionIds | string[] | Yes | Array of subscription IDs to cancel |
signatureCallbackUrl | string | Conditional | Required for Safari fallback when signature headers are not provided. URL to your /api/signature-callback endpoint |
deviceId is available (Chrome, Firefox, etc.), generate the signature client-side:
deviceId is not available client-side. Instead:
deviceId or signature headerssignatureCallbackUrl in request bodydeviceId from first-party cookies/api/signature-callback endpoint/api/signature-callback):
| Status | Error | Cause |
|---|---|---|
| 400 | userId, appId, and subscriptionIds are required | Missing required fields |
| 400 | Device ID not found. Please ensure cookies are enabled. | Safari flow failed to read deviceId from cookies |
| 400 | signatureCallbackUrl is required when signature is not provided | Safari flow missing callback URL |
| 400 | User wallet not configured | User hasn’t set up their wallet |
| 401 | Invalid signature | Signature verification failed |
| 403 | Some subscriptions not found or unauthorized | User doesn’t own all specified subscriptions |
| 404 | No valid subscriptions found to delete | None of the provided IDs exist |
| 500 | Failed to obtain signature from app | Safari flow: callback to app failed |
| 500 | Failed to delete subscription stream | On-chain transaction failed |
cancelSubscription() automatically refreshes subscription state after successHMAC signature for request authentication
Unix timestamp for request signing