Skip to main content
DELETE
Cancel subscription

Overview

The DELETE /subscription endpoint cancels one or more active subscriptions for a user. The cancellation is processed on-chain via the smart contract wallet system.

How It Works

  1. Signature Verification: Request must include valid HMAC-SHA256 signature proving it comes from your authorized app
  2. Ownership Check: Only subscriptions owned by the requesting user can be cancelled
  3. On-Chain Execution: Subscription streams are closed via smart contract interaction
  4. Gas Fee Handling: Gas fees are automatically estimated and added (with 10% safety markup)

Request Parameters

Headers

Body

Signature Generation

Normal Flow (Client-Side)

When deviceId is available (Chrome, Firefox, etc.), generate the signature client-side:

Safari Fallback Flow (Server-Side)

In Safari, third-party cookies are blocked so deviceId is not available client-side. Instead:
  1. Client makes DELETE request without deviceId or signature headers
  2. Include signatureCallbackUrl in request body
  3. Server reads deviceId from first-party cookies
  4. Server makes callback to your /api/signature-callback endpoint
  5. Your endpoint generates and returns signature
  6. Server verifies signature and processes deletion
Your callback endpoint (/api/signature-callback):
Security: For DELETE requests, you MUST include sorted subscriptionIds (comma-separated) as additionalData in the signature to prevent tampering.

Example Request

Response

Success (200)

Error Responses

Gas Fees

Gas fees are automatically handled:
  • Estimated based on current network conditions
  • 10% safety markup added to prevent failures
  • Deducted from user’s wallet balance
  • No manual gas fee calculation required

Using the SDK

The React SDK handles all complexity for you:

Notes

  • Cancellations are immediate and irreversible
  • Users can re-subscribe at any time
  • On-chain confirmation may take a few seconds
  • Consider showing a loading state during cancellation
  • The SDK’s cancelSubscription() automatically refreshes subscription state after success

Authorizations

X-utilsio-Signature
string
header
required

Headers

X-utilsio-Signature
string
required

HMAC signature for request authentication

X-utilsio-Timestamp
string
required

Unix timestamp for request signing

Body

application/json
userId
string
required

The user ID who owns the subscription

deviceId
string
required

The device ID that initiated the subscription

appId
string
required

The application ID of the subscription

subscriptionIds
string[]
required

Array of subscription IDs to cancel

Unique identifier for a subscription

Response

Subscriptions cancelled successfully.

success
boolean

Whether the cancellation was successful

error
string

Error message if the cancellation failed

Last modified on February 6, 2026