---
title: Cancel Subscription
slug: api-marketplace/cancel-subscription
description: Learn how to use the Auth API to generate payment links for customers and securely authenticate transactions using API Keys. This comprehensive document provides step-by-step instructions and highlights the necessary input parameters like amount, product 
createdAt: 2023-06-13T06:58:14.000Z
---

# Introduction

The "Cancel Subscription" API provides a straightforward method for terminating a subscription service. By utilizing this API, users can effectively halt ongoing subscription payments and terminate the associated subscription. Upon successful cancellation, the subscription status transitions to "CANCELLED," ensuring that the customer is no longer billed for the service. It's important to note that once a subscription is cancelled, it cannot be reactivated. This API offers a seamless solution for managing subscription lifecycles and ensuring that customers have control over their subscription commitments.

# Authentication

This API employs API Keys for request authentication. It's crucial to safeguard your API Keys, as they grant various privileges. To obtain the Access Key, kindly reach out to our Support/CSM team. Once obtained, please utilize this access key in the Authorization header.

Authentication for the API is executed through the Authorization header.

:::BlockQuote
\--header 'Authorization: YOUR\_ACCESS\_KEY\_HERE'
:::

Feel free to replace 'YOUR\_ACCESS\_KEY\_HERE' with the actual Access Key provided by our Support/CSM team.

# API Details

The details of the API can be found here.

## Sample Request&#x20;

:::CodeblockTabs
Pre-Production

```curl
curl --location --request POST 'https://api-preproduction.signzy.app/api/v3/eNach/eMandates/{subReferenceId}/cancel' \
--header 'Authorization: YOUR_ACCESS_KEY_HERE' \
--data ''
```

Production

```curl
curl --location --request POST 'https://api.signzy.app/api/v3/eNach/eMandates/{subReferenceId}/cancel' \
--header 'Authorization: YOUR_ACCESS_KEY_HERE' \
--data ''
```
:::

## Path Parameters

Here's a table outlining the key parameters, descriptions, whether they are mandatory or optional, and their data types.

| **Key**        | **Description**                                                   | **M/O**   | **Type** |
| -------------- | ----------------------------------------------------------------- | --------- | -------- |
| subReferenceId | A unique ID which was generated when the subscription was created | Mandatory | String   |

# Sample Response

:::CodeblockTabs
200

```json
{
    "result": {
        "status": "OK",
        "message": "Subscription Cancelled"
    }
}
```
:::

## Output Parameters

| **Key**        | **Description**       | **Type** |
| -------------- | --------------------- | -------- |
| result         | Result object         | Object   |
| result.status  | Status of the result  | String   |
| result.message | Message of the result | String   |

# Sample Errors

:::CodeblockTabs
400

```json
{
    "error": {
        "name": "error",
        "message": "",
        "status": "400",
        "reason": "ERROR",
        "type": "Bad Request",
        "statusCode": "400"
    }
}
```

401

```json
{
    "message": "Invalid authentication credentials"
}
```

404

```json
{
    "error": {
        "name": "error",
        "message": "",
        "status": "404",
        "reason": "ERROR",
        "type": "Not Found",
        "statusCode": "404"
    }
}
```
:::

## Error Parameters

| **Key**          | **Description**   | **Type** |
| ---------------- | ----------------- | -------- |
| error            | Main error object | Object   |
| error.name       | Error name        | String   |
| error.message    | Error message     | String   |
| error.status     | Error status code | String   |
| error.reason     | Error reason      | String   |
| error.type       | Type of error     | String   |
| error.statusCode | HTTP status code  | String   |

## Error Codes

| **Error Code** | **Error Message**     | **Explanation**                                                    |
| -------------- | --------------------- | ------------------------------------------------------------------ |
| 400            | Bad Request           | Input parameter has a missing required parameter or invalid inputs |
| 401            | Authorization Failed  | Authorization token is invalid                                     |
| 404            | Not Found             | The eneterd Sub Reference ID is not found                          |
| 500            | Internal Server Error | Internal error at Signzy, Please reach out to help\@signzy.com     |

