# Fetch List of Funnels

GET https://services.leadconnectorhq.com/funnels/funnel/list

Retrieves a list of all funnels based on the given query parameters.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** No scopes required.

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes |  |
| `type` | string | No |  |
| `category` | string | No |  |
| `offset` | string | No |  |
| `limit` | string | No |  |
| `parentId` | string | No |  |
| `name` | string | No |  |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/funnels/funnel/list": {
      "get": {
        "summary": "Fetch List of Funnels",
        "operationId": "fetchListOfFunnels",
        "description": "Retrieves a list of all funnels based on the given query parameters.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "required": true,
            "description": "API Version",
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "parentId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response - List of funnels returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunnelListResponseDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "FunnelListResponseDTO": {
        "type": "object",
        "properties": {
          "funnels": {
            "type": "object",
            "example": {
              "_id": "SkIDfu0S4m3NYQyvWHC6",
              "dateAdded": "2024-04-29T15:00:05.681Z",
              "dateUpdated": "2024-04-29T15:00:28.465Z",
              "deleted": false,
              "domainId": "",
              "locationId": "ojQjykmwNIU88vfsfzvH",
              "name": "Chaitanya Copy",
              "orderFormVersion": 2,
              "originId": "hAmyh7jrJH5FfEEKAJ9z",
              "steps": [
                {
                  "id": "f5d178c0-8bbb-4cd4-927c-691c68a62c59",
                  "name": "Step 1",
                  "originId": "80b2f227-5bc8-4ca5-980d-817745ea4e8b",
                  "pages": [
                    "2IhBmBcQRx9JXV1JZsRt"
                  ],
                  "products": [],
                  "sequence": 1,
                  "type": "optin_funnel_page",
                  "url": "/newtestifypath"
                }
              ],
              "type": "funnel",
              "updatedAt": "2024-04-29T15:00:34.233Z",
              "faviconUrl": "",
              "globalSectionVersion": 1,
              "globalSectionsPath": "funnel/SkIDfu0S4m3NYQyvWHC6/global-sections-1",
              "globalSectionsUrl": "https://firebasestorage.googleapis.com/v0/b/highlevel-staging.appspot.com/o/funnel%2FSkIDfu0S4m3NYQyvWHC6%2Fglobal-sections-1?alt=media&token=9cc5c211-093b-4751-aeba-19282ac92955",
              "isStoreActive": false,
              "trackingCodeBody": "",
              "trackingCodeHead": "",
              "url": "/chaitanya"
            }
          },
          "count": {
            "type": "number",
            "example": 24
          },
          "traceId": {
            "type": "string",
            "example": "03774d31-a57e-4b4f-95c7-315ce61969f1"
          }
        },
        "required": [
          "funnels",
          "count",
          "traceId"
        ],
        "title": "FunnelListResponseDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/funnels/funnel/list"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "locationId": "<LOCATIONID>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

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

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/funnels/funnel/list?locationId=<LOCATIONID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
