> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Subscriptions

> The "List Subscriptions" API allows to retrieve a paginated list of subscriptions. Customize your results by filtering subscriptions based on name, alt type, subscription status, payment mode, date ra

The "List Subscriptions" API allows to retrieve a paginated list of subscriptions. Customize your results by filtering subscriptions based on name, alt type, subscription status, payment mode, date range, type of source, contact, subscription id, entity id, contact or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve subscription information.

```http theme={null}
GET https://services.leadconnectorhq.com/payments/subscriptions
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Query parameters

<ParamField query="altId" type="string" required default="3SwdhCu3svxI8AKsPJt6">
  AltId is the unique identifier e.g: account id.
</ParamField>

<ParamField query="altType" type="string" required default="account">
  AltType is the type of identifier.
</ParamField>

<ParamField query="entityId" type="string" default="61dd0fe9c077f73e67f78803">
  Entity id for filtering of subscriptions.
</ParamField>

<ParamField query="paymentMode" type="string" default="live">
  Mode of payment.
</ParamField>

<ParamField query="startAt" type="string" default="2024-02-01">
  Starting interval of subscriptions.
</ParamField>

<ParamField query="endAt" type="string" default="2024-02-13">
  Closing interval of subscriptions.
</ParamField>

<ParamField query="entitySourceType" type="string" default="funnel">
  Source of the subscriptions.
</ParamField>

<ParamField query="search" type="string" default="Awesome subscription">
  The name of the subscription for searching.
</ParamField>

<ParamField query="contactId" type="string" default="AmuzcoPBpgKeccNsFlib">
  Contact ID for the subscription
</ParamField>

<ParamField query="id" type="string" default="64bf78af39118e4011926cba">
  Subscription id for filtering of subscriptions.
</ParamField>

<ParamField query="limit" type="number" default="20">
  The maximum number of items to be included in a single page of results
</ParamField>

<ParamField query="offset" type="number" default="0">
  The starting index of the page, indicating the position from which the results should be retrieved.
</ParamField>

<ParamField query="getPaymentsCollectedCount" type="boolean" default="true">
  Get the total payments collected for the subscription.
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="data" type="object[]" required>
    An array of subscriptions

    <Expandable title="cada item">
      <ResponseField name="_id" type="string" required default="64bf78af39118e4011926cba">
        The unique identifier for the subscription.
      </ResponseField>

      <ResponseField name="altId" type="string" required default="3SwdhCu3svxI8AKsPJt6">
        AltId is the unique identifier eg: account id.
      </ResponseField>

      <ResponseField name="altType" type="string" required default="account">
        AltType is the type of identifier. Posibles valores: 'account'
      </ResponseField>

      <ResponseField name="contactId" type="string" default="XPLSw2SVagl12LMDeTmQ">
        Contact id corresponding to the subscription.
      </ResponseField>

      <ResponseField name="contactName" type="string" default="James Bond">
        Contact name corresponding to the subscription.
      </ResponseField>

      <ResponseField name="contactEmail" type="string" default="james.bond@leadwaycrm.com">
        Contact email corresponding to the subscription.
      </ResponseField>

      <ResponseField name="currency" type="string" default="USD">
        Currency in which subscription occurred.
      </ResponseField>

      <ResponseField name="amount" type="number" default="100">
        Subscription value.
      </ResponseField>

      <ResponseField name="status" type="object" required default="active">
        The status of the subscription (e.g., succeeded).
      </ResponseField>

      <ResponseField name="liveMode" type="boolean" default="false">
        Subscription is in live / test mode.
      </ResponseField>

      <ResponseField name="entityType" type="string" default="order">
        Entity type of subscription (eg: order).
      </ResponseField>

      <ResponseField name="entityId" type="string" default="62f4db0f3059ecee61379012">
        Entity id for the subscription. e.g: order id
      </ResponseField>

      <ResponseField name="entitySourceType" type="string" required default="funnel">
        Entity source type of subscription (eg: funnel).
      </ResponseField>

      <ResponseField name="entitySourceName" type="string" default="Attribution Funnel">
        Entity source name for the subscription.
      </ResponseField>

      <ResponseField name="entitySourceId" type="string" default="bevrkPbLaDNXFaqfLKMm">
        Entity source id for the subscription.
      </ResponseField>

      <ResponseField name="entitySourceMeta" type="object" default="{ domain: &#x22;app.leadwaycrm.com&#x22;, pageId:  &#x22;sxC4lNhFIavEnLZh5KhC&#x22;, pageUrl:  &#x22;/v2/preview/sxC4lNhFIavEnLZh5KhC&#x22;, stepId: &#x22;7d303d1f-cb85-403d-b548-bf01de5c7bb0&#x22; }">
        Meta content for the entity source of subscription.
      </ResponseField>

      <ResponseField name="subscriptionId" type="string" default="I-0UE609H8E43P">
        Subscription id for subscription.
      </ResponseField>

      <ResponseField name="subscriptionSnapshot" type="object" default="{ status: &#x22;ACTIVE&#x22;, status_update_time: &#x22;2022-08-16T11:06:53Z&#x22;, id: &#x22;I-0UE609H8E43P&#x22;, plan_id: &#x22;P-82K11750F0313430KMLRGE6Y&#x22;, start_time: &#x22;2022-08-16T11:05:31Z&#x22;, quantity: 1 }">
        Snapshot of subscription.
      </ResponseField>

      <ResponseField name="paymentProviderType" type="string" default="stripe">
        Payment provider for subscription.
      </ResponseField>

      <ResponseField name="paymentProviderConnectedAccount" type="string" default="ATn0CqrzrWS5ak185Bsb1xCpyzBDOZ8WdRxyFotppLYePTDhiuQ49H5QXO_L-4HKk1GBn7f9_QhbNK2s">
        Payment provider connected account id for subscription.
      </ResponseField>

      <ResponseField name="ipAddress" type="string" default="103.100.16.82">
        Ip address from where subscription was initiated.
      </ResponseField>

      <ResponseField name="createdAt" type="string" required default="2023-11-20T10:23:36.515Z">
        The creation timestamp of the subscription.
      </ResponseField>

      <ResponseField name="updatedAt" type="string" required default="2023-11-20T10:23:36.515Z">
        The update timestamp of the subscription.
      </ResponseField>

      <ResponseField name="createdBy" type="string" default="user123">
        User ID who created the subscription.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="totalCount" type="number" required>
    total subscriptions count
  </ResponseField>

  ```json theme={null}
  {
    "data": [
      {
        "_id": "64bf78af39118e4011926cba",
        "altId": "3SwdhCu3svxI8AKsPJt6",
        "altType": "account",
        "contactId": "XPLSw2SVagl12LMDeTmQ",
        "contactName": "James Bond",
        "contactEmail": "james.bond@leadwaycrm.com",
        "currency": "USD",
        "amount": "100",
        "status": "active",
        "liveMode": "false",
        "entityType": "order",
        "entityId": "62f4db0f3059ecee61379012",
        "entitySourceType": "funnel",
        "entitySourceName": "Attribution Funnel",
        "entitySourceId": "bevrkPbLaDNXFaqfLKMm",
        "entitySourceMeta": "{ domain: \"app.leadwaycrm.com\", pageId:  \"sxC4lNhFIavEnLZh5KhC\", pageUrl:  \"/v2/preview/sxC4lNhFIavEnLZh5KhC\", stepId: \"7d303d1f-cb85-403d-b548-bf01de5c7bb0\" }",
        "subscriptionId": "I-0UE609H8E43P",
        "subscriptionSnapshot": "{ status: \"ACTIVE\", status_update_time: \"2022-08-16T11:06:53Z\", id: \"I-0UE609H8E43P\", plan_id: \"P-82K11750F0313430KMLRGE6Y\", start_time: \"2022-08-16T11:05:31Z\", quantity: 1 }",
        "paymentProviderType": "stripe",
        "paymentProviderConnectedAccount": "ATn0CqrzrWS5ak185Bsb1xCpyzBDOZ8WdRxyFotppLYePTDhiuQ49H5QXO_L-4HKk1GBn7f9_QhbNK2s",
        "ipAddress": "103.100.16.82",
        "createdAt": "2023-11-20T10:23:36.515Z",
        "updatedAt": "2023-11-20T10:23:36.515Z",
        "createdBy": "user123"
      }
    ],
    "totalCount": 0
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://services.leadconnectorhq.com/payments/subscriptions' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/payments/subscriptions', {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'GET',
      'https://services.leadconnectorhq.com/payments/subscriptions',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/payments/subscriptions');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
