# Getting Information About Subscription

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

<pre><code>https://unitpay.ru/api?
    method=getSubscription
<strong>    params[subscriptionId]=123456789
</strong>    params[secretKey]=key
</code></pre>

#### Path Parameters

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

#### Successful response

```
{
   "result": {
      "subscriptionId": 123456,
      "description": "test_description",
      "status": "active",
      "startDate": "2024-09-01 09:00:00",
      "successPayments": 4,
      "failPayments": 0,
      "lastPaymentId": 12345678911,
      "lastDateUpdate": "2024-09-15 19:30:00",
      "parentPaymentId": 12345678910,
      "totalSum": 50
   }
}

```

<table data-header-hidden><thead><tr><th width="180.44447835286456">name</th><th width="111.888916015625">type</th><th>description</th></tr></thead><tbody><tr><td><strong>subscriptionId</strong></td><td>number</td><td>Subscription ID in the Unitpay system</td></tr><tr><td><strong>description</strong></td><td>string</td><td>Subscription text description</td></tr><tr><td><strong>status</strong> </td><td>string</td><td>Subscription status:<br><code>new</code> - subscription created, no attempts to debit the subscription yet;<br><code>active</code> - subscription active;<br><code>close</code> - subscription closed.</td></tr><tr><td><strong>startDate</strong> </td><td>string</td><td>Subscription creation date in the format yyyy-mm-dd hh:ii:ss (e.g. 2023-10-01 12:32:00)</td></tr><tr><td><strong>successPayments</strong></td><td>number</td><td>Number of successful subscription payments</td></tr><tr><td><strong>failPayments</strong></td><td>number</td><td>Number of unsuccessful subscription debit attempts</td></tr><tr><td><strong>lastPaymentId</strong></td><td>number</td><td>ID of the last subscription payment</td></tr><tr><td><strong>lastUpdateDate</strong></td><td>string</td><td>Date of last subscription payment in yyyy-mm-dd hh:ii:ss format (e.g. 2022-10-01 12:32:00)</td></tr><tr><td><strong>parentPaymentId</strong></td><td>number</td><td>The ID of the parent payment that initiated the subscription</td></tr><tr><td><strong>totalSum</strong></td><td>number</td><td>Total amount debited to the payer under subscription</td></tr><tr><td><strong>closeType</strong></td><td>string</td><td>Reason for subscription closure (transmitted only in case of <code>status=close</code>):<br><code>api</code> - subscription closed by API partner<br><code>error</code> - subscription closed due to reaching the limit on the number of errors when attempting to debit<br><code>abuse</code> - subscription closed due to subscriber's complaint.</td></tr></tbody></table>

#### Incorrect response

```
{
   "error": {
      "message": "test_description
      "
   }
}
```

<table data-header-hidden><thead><tr><th width="180.44447835286456">name</th><th width="115.5555419921875">type</th><th>description</th></tr></thead><tbody><tr><td><strong>message</strong></td><td>string</td><td>Information with error description</td></tr></tbody></table>

{% hint style="warning" %}
Запрос можно выполнить в тестовом режиме. [Узнать подробнее](https://help.unitpay.ru/en/payments/recurring-payments/broken-reference).
{% endhint %}
