# GET /subscriptions/{{customer_id}} — List All Subscriptions By Customer Id

> Product: **Pabbly Subscription Billing** (v1)
> Base URL: `https://payments.pabbly.com/api/v1`
> Auth: Basic via `Authorization` header
> Canonical: `/subscription-billing/subscriptions/list-all-subscriptions-by-customer-id`

This API is used to retrieve a list of all the available subscriptions by customer id.

**Path parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| customer_id | string | Yes |  |

**Query parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| limit | string | No | Integer, default=50, min=1, max=100 The number of resources to be returned. |
| page | string | No | By default first page will be listed. For navigating through pages, use the page parameter. |
| billing_cycle | string | No | Supported value: onetime,lifetime,specific |
| billing_period | string | No | Supported value: w,m,y |
| product_id | string | No | Uniquely identifies the product. It is the api identifier for the product. |
| plan_id | string | No | Uniquely identifies the plan. It is the api identifier for the plan. |
| status | string | No | Supported value: live,pending,cancelled,expired,dunning, trial, nonrenewing, unpaid, paused etc |

**Response (200)** — List All Subscriptions By Customer Id:

```json
{
    "status": "success",
    "message": "Subscriptions data",
    "data": [
        {
            "plan": {
                "plan_active": "true",
                "bump_offer": {},
                "createdAt": "2020-02-06T11:30:00.807Z",
                "updatedAt": "2020-02-06T11:30:00.807Z",
                "id": "5e3bf8b8db85462760295d2f",
                "product_id": "5e3a95143c92e44b424b6d47",
                "user_id": "5b961bc55dfff7797d9cd897",
                "plan_name": "New recurring plan",
                "plan_code": "new-recurring-plan",
                "price": 200,
                "billing_period": "m",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": 0,
                "setup_fee": 0,
                "plan_description": "<p>zdf</p>"
            },
            "setup_fee": 0,
            "payment_terms": "",
            "currency_symbol": "$",
            "addons": [
                {
                    "id": "5e3aac363c92e44b424b6dfc",
                    "user_id": "5b961bc55dfff7797d9cd897",
                    "name": "Add on 1 one time",
                    "product_id": "5e3a95143c92e44b424b6d47",
                    "code": "add-on-1-one-time",
                    "price": 100,
                    "quantity": 1,
                    "billing_cycle": "onetime",
                    "billing_period": "",
                    "associate_plans": "all_plans",
                    "plans_array": null,
                    "category_array": [
                        "5e3aac1924b63d4b28410d4d"
                    ],
                    "adjusted_amount": 100
                }
            ],
            "payment_method": "5e5e2d18815f5442a4208e13",
            "taxable": true,
            "gateway_type": "test",
            "gateway_id": "5e3a950824b63d4b28410c8d",
            "custom_fields": [],
            "cron_process": "done",
            "createdAt": "2020-03-03T10:10:32.152Z",
            "updatedAt": "2020-03-03T10:10:32.152Z",
            "id": "5e5e2d18815f5442a4208e10",
            "customer_id": "5e5e2bca815f5442a4208dfe",
            "product_id": "5e3a95143c92e44b424b6d47",
            "plan_id": "5e3bf8b8db85462760295d2f",
            "amount": 200,
            "email_id": "ethridgertamara@gmail.com",
            "status": "live",
            "quantity": 1,
            "starts_at": "2020-03-03T10:10:32.323Z",
            "activation_date": "2020-03-03T10:10:32.323Z",
            "expiry_date": "2120-03-03T10:10:32.323Z",
            "trial_days": 0,
            "trial_expiry_date": "",
            "next_billing_date": "2020-04-03T10:10:32.323Z",
            "last_billing_date": "2020-03-03T10:10:32.323Z",
            "canceled_date": null
        },
        {
            "plan": {
                "plan_active": "true",
                "bump_offer": {},
                "createdAt": "2020-02-06T11:30:00.807Z",
                "updatedAt": "2020-02-06T11:30:00.807Z",
                "id": "5e3bf8b8db85462760295d2f",
                "product_id": "5e3a95143c92e44b424b6d47",
                "user_id": "5b961bc55dfff7797d9cd897",
                "plan_name": "New recurring plan",
                "plan_code": "new-recurring-plan",
                "price": 200,
                "billing_period": "m",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": 0,
                "setup_fee": 0,
                "plan_description": "<p>zdf</p>"
            },
            "setup_fee": 0,
            "payment_terms": "",
            "currency_symbol": "$",
            "addons": [
                {
                    "id": "5e3aac363c92e44b424b6dfc",
                    "user_id": "5b961bc55dfff7797d9cd897",
                    "name": "Add on 1 one time",
                    "product_id": "5e3a95143c92e44b424b6d47",
                    "code": "add-on-1-one-time",
                    "price": 100,
                    "quantity": 1,
                    "billing_cycle": "onetime",
                    "billing_period": "",
                    "associate_plans": "all_plans",
                    "plans_array": null,
                    "category_array": [
                        "5e3aac1924b63d4b28410d4d"
                    ],
                    "adjusted_amount": 100
                }
            ],
            "payment_method": "test",
            "taxable": true,
            "gateway_type": "test",
            "gateway_id": "5e3a950824b63d4b28410c8d",
            "custom_fields": [],
            "cron_process": "done",
            "createdAt": "2020-03-03T10:07:30.453Z",
            "updatedAt": "2020-03-03T10:14:22.586Z",
            "id": "5e5e2c62815f5442a4208e01",
            "customer_id": "5e5e2bca815f5442a4208dfe",
            "product_id": "5e3a95143c92e44b424b6d47",
            "plan_id": "5e3bf8b8db85462760295d2f",
            "amount": 200,
            "email_id": "ethridgertamara@gmail.com",
            "status": "nonrenewing",
            "quantity": 1,
            "starts_at": "2020-03-03T10:07:30.303Z",
            "activation_date": "",
            "expiry_date": "2120-03-03T10:07:30.303Z",
            "trial_days": 0,
            "trial_expiry_date": "",
            "next_billing_date": "",
            "last_billing_date": "",
            "canceled_date": null
        }
    ]
}
```

**Code examples:**

_cURL_

```curl
curl https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}} \
  -u {{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}')
request = Net::HTTP::Get.new(uri)
request.basic_auth '{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests
from requests.auth import HTTPBasicAuth

response = requests.get(
    'https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}',
    auth=HTTPBasicAuth('{{YOUR_API_KEY}}', '{{YOUR_SECRET_KEY}}'),
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, '{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

String credentials = Base64.getEncoder().encodeToString("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}".getBytes());

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}"))
    .header("Authorization", "Basic " + credentials)
    .GET();

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const credentials = Buffer.from('{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}').toString('base64');

const response = await fetch('https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}', {
  method: 'GET',
  headers: {
    'Authorization': `Basic ${credentials}`,
  },
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}", nil)
    req.SetBasicAuth("{{YOUR_API_KEY}}", "{{YOUR_SECRET_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("{{YOUR_API_KEY}}:{{YOUR_SECRET_KEY}}"));

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://payments.pabbly.com/api/v1/subscriptions/{{customer_id}}?limit={{limit}}&page={{page}}&billing_cycle={{billing_cycle}}&billing_period={{billing_period}}&product_id={{product_id}}&plan_id={{plan_id}}&status={{status}}");
request.Headers.TryAddWithoutValidation("Authorization", $"Basic {credentials}");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Subscriptions:**

- [POST /subscription/{{customer_id}} — Create Subscription For Existing Customer](/subscription-billing/subscriptions/create-subscription-for-existing-customer)
- [POST /subscription/{{subscription_id}}/cancel — Cancel Subscription For Existing Customer](/subscription-billing/subscriptions/cancel-subscription-for-existing-customer)
- [GET /subscription/{{subscription_id}} — Get Single Subscription](/subscription-billing/subscriptions/get-single-subscription)
- [GET /subscriptions — List All Subscriptions](/subscription-billing/subscriptions/list-all-subscriptions)
- [GET /scheduledchanges/{{suscription_id}} — Get Scheduled Subscription](/subscription-billing/subscriptions/get-scheduled-subscription)
- [PUT /subscription/{{subscription_id}}/upgrade-downgrade — Upgrade Downgrade Subscription](/subscription-billing/subscriptions/upgrade-downgrade-subscription)
- [POST /subscription/{{subscription_id}}/update_charges — Subscription Update Charges](/subscription-billing/subscriptions/subscription-update-charges)
- [DELETE /subscriptions/{{subscription_id}} — Delete Subscription](/subscription-billing/subscriptions/delete-subscription)
- [PUT /subscription/change-billing/{{subscription_id}} — Change Subscription Billing Date](/subscription-billing/subscriptions/change-subscription-billing-date)
- [PUT /subscription/{{subscription_id}}/update — Update Subscription](/subscription-billing/subscriptions/update-subscription)
- [PUT /subscription/{{subscription_id}}/pause — Pause Subscription](/subscription-billing/subscriptions/pause-subscription)
- [PUT /subscription/{{subscription_id}}/resume — Resume Subscription](/subscription-billing/subscriptions/resume-subscription)

