> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corebasehq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List data sources

> Lists the data sources the agent can reach in a project (the default
project unless `project_id` is given). Use the returned `id` values as
`source_ids` in a chat completion to scope a request to a subset. Requires
the `sources_read` permission.

Returns the queryable data sources connected to a project — databases,
REST/GraphQL APIs, SaaS connectors, and on-prem CoreMCP sources. Use the `id`
values to scope a chat request via `source_ids`. Project ids come from
[List projects](/api-reference/endpoints/projects).

## Scope a chat request

```python theme={null}
from openai import OpenAI

client = OpenAI(api_key="cb_live_xxx", base_url="https://api.corebasehq.com/api/v1")

stream = client.chat.completions.create(
    model="corebase",
    messages=[{"role": "user", "content": "Open invoices over 30 days?"}],
    stream=True,
    extra_body={
        "project_id": "p1a2…",      # run inside this workspace
        "source_ids": ["9b1c…"],    # only the ERP database
    },
)
```


## OpenAPI

````yaml api-reference/openapi.json GET /api/v1/sources
openapi: 3.1.0
info:
  title: CoreBase Developer API
  summary: Build on CoreBase with a cb_live_ token.
  description: >-
    Call CoreBase from your own apps with a `cb_live_` API token. The chat
    endpoint is OpenAI-compatible, so any OpenAI client works by pointing its
    base URL at this API. Create a token in the panel under API Tokens.


    Authenticate every request with `Authorization: Bearer cb_live_...`.
    Responses are JSON, except the chat endpoint, which streams Server-Sent
    Events.
  version: 0.0.1
  contact:
    name: CoreBase
    url: https://corebasehq.com
servers:
  - url: https://api.corebasehq.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: chat
    description: OpenAI-compatible chat completions over your connected data.
  - name: sources
    description: Data sources the agent can query.
  - name: agents
    description: Governed agent flows and their runs.
  - name: account
    description: Subscription plan and end-user usage for your organization.
paths:
  /api/v1/sources:
    get:
      tags:
        - sources
      summary: List data sources
      description: >-
        Lists the data sources the agent can reach in a project (the default

        project unless `project_id` is given). Use the returned `id` values as

        `source_ids` in a chat completion to scope a request to a subset.
        Requires

        the `sources_read` permission.
      operationId: listSources
      parameters:
        - name: project_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: List sources in this project. Omit for the default project.
            title: Project Id
          description: List sources in this project. Omit for the default project.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 200
            minimum: 1
            description: Maximum sources per page.
            default: 100
            title: Limit
          description: Maximum sources per page.
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Opaque cursor from a previous page's `next_cursor`.
            title: Cursor
          description: Opaque cursor from a previous page's `next_cursor`.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceListOut'
        '400':
          description: The cursor was invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: Missing or invalid API token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: The token lacks the permission this endpoint requires.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: The requested project does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limit exceeded. Back off and retry after the interval in the
            `Retry-After` response header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearerAuth: []
components:
  schemas:
    SourceListOut:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SourceOut'
          type: array
          title: Data
          description: The sources on this page.
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: Pass as `cursor` to fetch the next page; null on the last page.
      type: object
      required:
        - data
        - next_cursor
      title: SourceListOut
      description: A page of data sources.
    ApiError:
      properties:
        detail:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Detail
          description: Error message, or an object with a stable `error` code and context.
      additionalProperties: true
      type: object
      title: ApiError
      description: |-
        A structured error. `detail` is a human-readable message, or an object
        carrying a stable `error` code plus context.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SourceOut:
      properties:
        id:
          type: string
          title: Id
          description: Stable source id — use it as a `source_ids` entry.
        name:
          type: string
          title: Name
          description: Human-readable source name.
        kind:
          type: string
          title: Kind
          description: Source type, e.g. database, api, coremcp, or nango.
        project_id:
          type: string
          title: Project Id
          description: The project this source belongs to.
      type: object
      required:
        - id
        - name
        - kind
        - project_id
      title: SourceOut
      description: A data source the agent can query.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A `cb_live_` API token, created in the panel under API Tokens.

````