> 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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Synthflow APIs
  version: 1.0.0
paths:
  /knowledge_base/{knowledge_base_id}/sources:
    get:
      operationId: listKnowledgeBaseSources
      summary: List knowledge base sources
      description: Returns a paginated list of sources for the specified knowledge base.
      tags:
        - ''
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/knowledge_base_id'
        - name: limit
          in: query
          description: Maximum number of sources to return per page.
          required: false
          schema:
            type: integer
            default: 20
        - name: offset
          in: query
          description: Number of sources to skip before starting to return results.
          required: false
          schema:
            type: integer
            default: 0
        - name: name
          in: query
          description: Search sources by name.
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/listKnowledgeBaseSources_Response_200'
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ListKnowledgeBaseSourcesRequestBadRequestError
servers:
  - url: https://api.synthflow.ai/v2
    description: Global
  - url: https://api.us.synthflow.ai/v2
    description: United States
  - url: https://api.eu.synthflow.ai/v2
    description: European Union
components:
  schemas:
    knowledge_base_id:
      type: string
      description: Knowledge base ID.
      title: knowledge_base_id
    status:
      type: string
      description: Whether the request was successful.
      title: status
    KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItemsType:
      type: string
      enum:
        - pdf
        - text
        - web
      description: >-
        Source type: `text` for plain text, `web` for a scraped web page, or
        `pdf` for a PDF file.
      title: >-
        KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItemsType
    KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItems:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the source.
        type:
          $ref: >-
            #/components/schemas/KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItemsType
          description: >-
            Source type: `text` for plain text, `web` for a scraped web page, or
            `pdf` for a PDF file.
        name:
          type: string
          description: Display name of the source.
        content_preview:
          type: string
          description: >-
            Short preview of the source text content. Empty string when not
            available.
        url:
          type: string
          description: >-
            URL of the source. Populated for `web` and `pdf` types. Empty string
            for `text` sources.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the source was created (ISO 8601).
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the source was last updated (ISO 8601).
      title: >-
        KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItems
    KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponse:
      type: object
      properties:
        total_records:
          type: integer
          description: Total number of sources in the knowledge base.
        knowledge_base_id:
          $ref: '#/components/schemas/knowledge_base_id'
        sources:
          type: array
          items:
            $ref: >-
              #/components/schemas/KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponseSourcesItems
          description: List of knowledge base sources.
      title: >-
        KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponse
    listKnowledgeBaseSources_Response_200:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/status'
        response:
          $ref: >-
            #/components/schemas/KnowledgeBaseKnowledgeBaseIdSourcesGetResponsesContentApplicationJsonSchemaResponse
      title: listKnowledgeBaseSources_Response_200
    ListKnowledgeBaseSourcesRequestBadRequestError:
      type: object
      properties: {}
      title: ListKnowledgeBaseSourcesRequestBadRequestError
  securitySchemes:
    sec0:
      type: http
      scheme: bearer

```

## 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()
```