> For a complete page index, fetch https://docs.synthflow.ai/llms.txt. For full documentation content, fetch https://docs.synthflow.ai/llms-full.txt.

# List knowledge base sources

GET https://api.synthflow.ai/v2/knowledge_base/{knowledge_base_id}/sources

Returns a paginated list of sources for the specified knowledge base.

Reference: https://docs.synthflow.ai/api-reference/platform-api/knowledge-bases/list-knowledge-base-sources

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.synthflow.ai/v2` (Global, default)
- `https://api.us.synthflow.ai/v2` (United States)
- `https://api.eu.synthflow.ai/v2` (European Union)

## Request

### Path parameters

- `knowledge_base_id` (string, required) — Knowledge base ID.

### Query parameters

- `limit` (integer, optional, default: 20) — Maximum number of sources to return per page.
- `offset` (integer, optional, default: 0) — Number of sources to skip before starting to return results.
- `name` (string, optional) — Search sources by name.

## Response

### 200

200

- `status` (string, optional) — Whether the request was successful.
- `response` (KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponse, optional)

## Errors

### 400 Bad Request Error

400

## Types

### KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponse

- `total_records` (integer, optional) — Total number of sources in the knowledge base.
- `knowledge_base_id` (string, optional) — Knowledge base ID.
- `sources` (list of KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItems, optional) — List of knowledge base sources.

### KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItems

- `id` (string, optional) — Unique identifier of the source.
- `type` (enum, optional) — Source type: `text` for plain text, `link` for a web page, `file` for an uploaded file such as a PDF, `crawl` for a crawled site, or `integration` for a connected account.
  - Allowed values: `crawl`, `file`, `integration`, `link`, `text`
- `name` (string, optional) — Display name of the source.
- `content_preview` (string, optional) — Short preview of the source text content. Empty string when not available.
- `url` (string, optional) — Address of the source. For `text` and `file` sources, a download link that expires after 7 days.
- `created_at` (datetime, optional) — Timestamp when the source was created (ISO 8601).
- `updated_at` (datetime, optional) — Timestamp when the source was last updated (ISO 8601).

## Examples

**Response**

```json
{
  "status": "ok",
  "response": {
    "total_records": 3,
    "knowledge_base_id": "173925305...388602947460",
    "sources": [
      {
        "id": "173927798...08639398185900",
        "type": "text",
        "name": "Custom Knowledge",
        "content_preview": "Our return policy allows customers to...",
        "url": "",
        "created_at": {},
        "updated_at": {}
      },
      {
        "id": "173925305...388602947464",
        "type": "web",
        "name": "Company FAQ",
        "content_preview": "",
        "url": "https://example.com/faq",
        "created_at": {},
        "updated_at": {}
      },
      {
        "id": "173925305...388602947461",
        "type": "pdf",
        "name": "Product Documentation",
        "content_preview": "",
        "url": "https://example.com/documents/product-guide.pdf",
        "created_at": {},
        "updated_at": {}
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources"

querystring = {"limit":"10","offset":"0"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```go
package main

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

func main() {

	url := "https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources?limit=10&offset=0"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources?limit=10&offset=0")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources?limit=10&offset=0")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources?limit=10&offset=0");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/knowledge_base/173925305...388602947460/sources?limit=10&offset=0")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```