# Getting a List of Active Subscriptions

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

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

#### Path Parameters

<table><thead><tr><th width="171.22222900390625">Name</th><th width="132.4444580078125">Type</th><th>Description</th></tr></thead><tbody><tr><td>projectId</td><td>integer</td><td>Your project 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>

#### Successful response

```
"result": [
        {
            "subscriptionId": 5961196,
            "description": "test_unitpay",
            "status": "active",
            "startDate": "2025-03-19 15:23:35",
            "successPayments": 1,
            "failPayments": 0,
            "lastPaymentId": null,
            "lastUpdateDate": null,
            "parentPaymentId": "2181234567",
            "totalSum": "50.00"
        },
        {
            "subscriptionId": 5961466,
            "description": "test_unitpay",
            "status": "active",
            "startDate": "2025-03-20 15:13:38",
            "successPayments": 2,
            "failPayments": 0,
            "lastPaymentId": null,
            "lastUpdateDate": null,
            "parentPaymentId": "2187654321",
            "totalSum": "100.00"
        }
```

<table data-header-hidden><thead><tr><th width="192.66664632161456">name</th><th width="114.7777099609375">type</th><th>decription</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><p>Subscription status: </p><p></p><ul><li><code>new</code> - subscription created, no attempts to debit the subscription have been made yet; </li><li><code>active</code> - subscription active; </li><li><code>close</code> - subscription closed.</li></ul></td></tr><tr><td><strong>startDate</strong> </td><td>string</td><td>Subscription creation date in YYYY-mm-dd HH:ii:ss format (e.g., 2024-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>Last subscription payment date in dd.mm.yyyy hh:ii:ss format</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 closing the subscription (only transmitted if <code>status=close</code>):<br><code>api</code> — subscription closed by you via API;<br><code>error</code> — subscription closed due to reaching the error limit when attempting to debit funds;<br><code>abuse</code> — subscription closed due to a subscriber complaint.</td></tr></tbody></table>

#### Incorrect response

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

<table data-header-hidden><thead><tr><th width="197.888916015625">name</th><th width="108.22212727864581">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>

To get a list of all subscriptions, add the parameter

<table><thead><tr><th width="197.888916015625">name</th><th width="108.22212727864581">type</th><th>description</th></tr></thead><tbody><tr><td>all</td><td>integer</td><td>1</td></tr></tbody></table>

The response will contain a list of subscriptions in all statuses: new, active, close.

{% 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/subscription-list.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.
