# Get all FAQs by knowledge base with pagination support

GET https://services.leadconnectorhq.com/knowledge-bases/faqs

Retrieves Q&A entries for a knowledge base, with cursor or offset pagination and optional question search.
WHEN TO USE: use this when you need to list existing FAQs; use create to add one; use update or delete to change or remove a single FAQ.
RETURNS: the FAQ list, total count, lastFaqId for the next page, and whether more results exist.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `knowledge-bases.readonly`

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `knowledgeBaseId` | string | Yes | knowledge base ID as string |
| `locationId` | string | Yes | location ID as string |
| `limit` | number | No | Limit the number of FAQs returned |
| `lastFaqId` | string | No | Last FAQ ID for pagination (cursor-based) |
| `offset` | number | No | Number of FAQs to skip (offset-based pagination) |
| `search` | string | No | Search query to filter FAQs by question (case-insensitive contains match) |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/knowledge-bases/faqs": {
      "get": {
        "summary": "Get all FAQs by knowledge base with pagination support",
        "operationId": "getAllFaqsByKnowledgeBaseWithPaginationSupport",
        "description": "Retrieves Q&A entries for a knowledge base, with cursor or offset pagination and optional question search.\nWHEN TO USE: use this when you need to list existing FAQs; use create to add one; use update or delete to change or remove a single FAQ.\nRETURNS: the FAQ list, total count, lastFaqId for the next page, and whether more results exist.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "knowledgeBaseId",
            "required": true,
            "in": "query",
            "description": "knowledge base ID as string",
            "schema": {
              "example": "710KoEzy793Fxubft0bc",
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "location ID as string",
            "schema": {
              "example": "qDZpF8GH3qvgJTmKCoL",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Limit the number of FAQs returned",
            "schema": {
              "default": 10,
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "lastFaqId",
            "required": false,
            "in": "query",
            "description": "Last FAQ ID for pagination (cursor-based)",
            "schema": {
              "example": "3rzeElC1FOVY91veVBkp",
              "type": "string"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Number of FAQs to skip (offset-based pagination)",
            "schema": {
              "default": 0,
              "example": 0,
              "type": "number"
            }
          },
          {
            "name": "search",
            "required": false,
            "in": "query",
            "description": "Search query to filter FAQs by question (case-insensitive contains match)",
            "schema": {
              "example": "pricing",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "FAQs retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListFaqsResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": [
              "knowledge-bases.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": {
      "ListFaqsResponseDTO": {
        "type": "object",
        "properties": {
          "count": {
            "type": "number",
            "description": "Total count of all FAQs in the knowledge base",
            "example": 150
          },
          "faqs": {
            "description": "Array of FAQ objects",
            "example": [
              {
                "id": "3rzeElC1FOVY91veVBkp",
                "question": "What is the capital of France?",
                "answer": "The capital of France is Paris.",
                "knowledgeBaseId": "I1rITlYLJofFosIqC4Np",
                "locationId": "qIyivCmsuEOSnyoFYEej",
                "trainedUrlId": "688e6b6d8a1887e6d94d1475",
                "deleted": false,
                "createdAt": "2025-08-02T19:47:57.243Z",
                "updatedAt": "2025-08-02T19:47:57.243Z"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "FAQ ID as string",
                  "example": "3rzeElC1FOVY91veVBkp"
                },
                "question": {
                  "type": "string",
                  "description": "FAQ question",
                  "example": "What is 1+2?"
                },
                "questionLowerCase": {
                  "type": "string",
                  "description": "FAQ question in lowercase",
                  "example": "what is 1+2?"
                },
                "answer": {
                  "type": "string",
                  "description": "FAQ answer",
                  "example": "3"
                },
                "knowledgeBaseId": {
                  "type": "string",
                  "description": "Knowledge base ID",
                  "example": "I1rITlYLJofFosIqC4Np"
                },
                "locationId": {
                  "type": "string",
                  "description": "Location ID",
                  "example": "qIyivCmsuEOSnyoFYEej"
                },
                "trainedUrlId": {
                  "type": "string",
                  "description": "Trained URL ID",
                  "example": "688e6b6d8a1887e6d94d1475"
                },
                "deleted": {
                  "type": "boolean",
                  "description": "Whether the FAQ is deleted",
                  "example": false
                },
                "createdAt": {
                  "type": "string",
                  "description": "Date when FAQ was created",
                  "example": "2025-08-02T19:47:57.243Z"
                },
                "updatedAt": {
                  "type": "string",
                  "description": "Date when FAQ was last updated",
                  "example": "2025-08-02T19:47:57.243Z"
                }
              },
              "required": [
                "id",
                "question",
                "questionLowerCase",
                "answer",
                "knowledgeBaseId",
                "locationId",
                "trainedUrlId",
                "deleted",
                "createdAt",
                "updatedAt"
              ],
              "title": "FaqResponseDTO"
            }
          },
          "lastFaqId": {
            "type": "string",
            "description": "Last FAQ ID for pagination (use as lastFaqId in next request)",
            "example": "3rzeElC1FOVY91veVBkp"
          },
          "hasMore": {
            "type": "boolean",
            "description": "Whether there are more FAQs available",
            "example": true
          }
        },
        "required": [
          "count",
          "faqs"
        ],
        "title": "ListFaqsResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs"

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

params = {
    "knowledgeBaseId": "<KNOWLEDGEBASEID>",
    "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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&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/knowledge-bases/faqs?knowledgeBaseId=<KNOWLEDGEBASEID>&locationId=<LOCATIONID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
