# Fetch List of Redirects

GET https://services.leadconnectorhq.com/funnels/lookup/redirect/list

Retrieves a list of all URL redirects based on the given query parameters. Deprecated: use GET /funnels/lookup/redirect with header version: v4.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `funnels/redirect.readonly`

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Identifier of the location the redirect belongs to |
| `search` | string | No |  |
| `domainSuffix` | string | No | Filter redirects to this domain and its subdomains (suffix match). |
| `limit` | number | Yes |  |
| `offset` | number | Yes |  |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/funnels/lookup/redirect/list": {
      "get": {
        "summary": "Fetch List of Redirects",
        "operationId": "fetchListOfRedirects",
        "description": "Retrieves a list of all URL redirects based on the given query parameters. Deprecated: use GET /funnels/lookup/redirect with header version: v4.",
        "parameters": [
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Identifier of the location the redirect belongs to",
            "schema": {
              "example": "6p2RxpgtMKQwO3E6IUaT",
              "type": "string"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "schema": {
              "example": "example.com",
              "type": "string"
            }
          },
          {
            "name": "domainSuffix",
            "required": false,
            "in": "query",
            "description": "Filter redirects to this domain and its subdomains (suffix match).",
            "schema": {
              "example": "example.com",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": true,
            "in": "query",
            "schema": {
              "example": 20,
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": true,
            "in": "query",
            "schema": {
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response - List of URL redirects returned",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedirectListResponseDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity - The provided data is invalid or incomplete"
          }
        },
        "security": [
          {
            "Location-Access": [
              "funnels/redirect.readonly"
            ]
          }
        ]
      }
    }
  },
  "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"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as 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"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "RedirectListResponseDTO": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "example": {
              "count": 42,
              "data": []
            },
            "description": "Object containing the count of redirects and an array of redirect data"
          }
        },
        "required": [
          "data"
        ],
        "title": "RedirectListResponseDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const response = await ghl.funnels.fetchListOfRedirects({ locationId: '<LOCATIONID>', limit: '<LIMIT>', offset: '<OFFSET>' });
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

response = await client.funnels.fetch_list_of_redirects(locationId='<LOCATIONID>', limit='<LIMIT>', offset='<OFFSET>')
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$response = $ghl->funnels->fetchListOfRedirects(['locationId' => '<LOCATIONID>', 'limit' => '<LIMIT>', 'offset' => '<OFFSET>']);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/funnels/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21'
```

**Node.js**

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

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

**Python**

```python
import requests

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

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2023-02-21"
}

params = {
    "locationId": "<LOCATIONID>",
    "limit": "<LIMIT>",
    "offset": "<OFFSET>"
}

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/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/funnels/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/funnels/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2023-02-21")

  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/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>")

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

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

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2023-02-21"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/funnels/lookup/redirect/list?locationId=<LOCATIONID>&limit=<LIMIT>&offset=<OFFSET>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
