# Cancel a subscription

## Cancel a subscription

> This endpoint allows cancellation of an existing subscription by ID.

```json
{"openapi":"3.0.0","info":{"title":"Subscription API","version":"3.0.0"},"servers":[{"url":"https://api-stg.onekeypayments.com","description":"Staging Server"}],"paths":{"/v3/subscriptions/{subscription_id}":{"delete":{"summary":"Cancel a subscription","description":"This endpoint allows cancellation of an existing subscription by ID.","operationId":"cancelSubscription","parameters":[{"name":"subscription_id","in":"path","description":"Unique numeric identifier of the subscription to be cancelled. This is the subscription ID provided when the subscription was created.","required":true,"schema":{"type":"integer","format":"int64"}},{"name":"Content-Type","in":"header","description":"Media type of the body sent to the API.","required":true,"schema":{"type":"string","default":"application/json"}},{"name":"X-Date","in":"header","description":"ISO8601 Datetime with Timezone (yyyy-MM-dd'T'HH:mm:ssZ)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"X-Login","in":"header","description":"Merchant X-Login API Key.","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Authorization control hash.","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","description":"Unique idempotency key for ensuring that the same request is not processed more than once.","required":false,"schema":{"type":"string"}}],"requestBody":{"description":"Empty request body","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"required":false},"responses":{"200":{"description":"Subscription successfully cancelled","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"420":{"description":"Subscription does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}},"421":{"description":"Subscription was already cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}},"426":{"description":"Subscription is terminated and cannot be cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}},"501":{"description":"Generic Error","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}}},"tags":["Subscriptions"]}}}}
```
