# 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: list-knowledge-base-sources
      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: 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
  - url: https://api.us.synthflow.ai/v2
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

```

## SDK Code Examples

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