Skip to main content
GET
/
api
/
datasources
/
all
List All Data Sources
curl --request GET \
  --url https://api.example.com/api/datasources/all
{
  "id": "<string>",
  "name": "<string>",
  "type": "<string>",
  "url": "<string>",
  "branch": "<string>",
  "repositoryIds": [
    {}
  ],
  "description": "<string>"
}

Overview

This endpoint returns all data sources (repositories and workspaces) in your CodeAlive account, regardless of their processing status. This is primarily intended for administrative use cases where you need to access all data sources. For chat and search operations, use the /api/datasources/alive endpoint instead, which returns only data sources in “Alive” state that are ready for querying.

Request

No request body required. Authentication via Bearer token in Authorization header.

Query Parameters

type
string
Optional filter by data source type. Options: Repository, Workspace

Response

Returns an array of data source objects.
id
string
required
Unique identifier for the data source
name
string
required
Display name of the repository or workspace
type
string
required
Type of data source: Repository or Workspace
url
string
Repository URL (for Repository type only)
branch
string
Branch name (for Repository type only)
repositoryIds
array
Array of repository IDs (for Workspace type only)
description
string
Optional description of the data source

Code Examples

import requests

url = "https://app.codealive.ai/api/datasources/all"
headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}
params = {
    "type": "Repository"
}

response = requests.get(url, headers=headers, params=params)
datasources = response.json()

for datasource in datasources:
    print(f"{datasource['name']} ({datasource['type']}): {datasource['id']}")

Example Response

[
  {
    "id": "60d21b4667d0d63ce0f9a1d1",
    "name": "MyApiProject",
    "type": "Repository",
    "url": "https://github.com/myorg/my-backend-api",
    "branch": "main"
  },
  {
    "id": "60d21b4667d0d63ce0f9a1d2",
    "name": "Development Workspace",
    "type": "Workspace",
    "description": "All development repositories",
    "repositoryIds": [
      "60d21b4667d0d63ce0f9a1d1",
      "60d21b4667d0d63ce0f9a1d3"
    ]
  }
]

Filter by Type Example

import requests

# Get only workspaces
url = "https://app.codealive.ai/api/datasources/all"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"type": "Workspace"}

response = requests.get(url, headers=headers, params=params)
workspaces = response.json()

for workspace in workspaces:
    print(f"Workspace: {workspace['name']}")
    if workspace.get('repositoryIds'):
        print(f"  Contains {len(workspace['repositoryIds'])} repositories")

Error Responses

401 Unauthorized

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or missing API key"
  }
}

429 Rate Limited

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests"
  }
}