# Closing a Subscription

<mark style="color:blue;">`GET`</mark>&#x20;

```
https://unitpay.ru/api?    
    method=closeSubscription
    params[subscriptionId]=123456789
    params[secretKey]=key
```

#### Required parameters

<table><thead><tr><th width="169">Name</th><th width="113.4444580078125">Type</th><th>Description</th></tr></thead><tbody><tr><td>subscriptionId</td><td>integer</td><td>Subscription ID in the UnitPay system</td></tr><tr><td>secretKey</td><td>string</td><td>Secret key, available in the project settings</td></tr></tbody></table>

#### Examples of responses to a request

{% tabs %}
{% tab title="successful response" %}

```
{
   "result": {
      "message": "Subscription successfully closed"
   }
}
```

{% endtab %}

{% tab title="error response" %}

```
{
   "error": {
      "message": "Error description"
   }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
The request can be executed in test mode. [Learn more](https://help.unitpay.ru/en/other/using-the-test-api)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.unitpay.ru/en/payments/recurring-payments/close-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
