Skip to main content

list-data-sources

List Data Sources

Sprint 3

List all data sources for the current organization with pagination, filtering, and sorting.

Account Type & Use Case

Endpoint

GET /api/v1/data-sources

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Query Parameters

ParameterTypeRequiredDescription
workspace_idintegerNoFilter by workspace ID
typestringNoFilter by data source type (e.g., "postgresql", "mysql", "csv")
status_filterstringNoFilter by status (active, inactive, testing, failed, maintenance)
pageintegerNoPage number (default: 1)
page_sizeintegerNoItems per page (default: 20)
searchstringNoSearch by name or description
sort_bystringNoSort field (default: "created_at")
sort_orderstringNoSort order: "asc" or "desc" (default: "desc")

Response

Success (200)

{
"success": true,
"data": {
"items": [
{
"id": 1,
"organization_id": 1,
"workspace_id": 1,
"name": "Production PostgreSQL",
"type": "postgresql",
"description": "Main production database",
"host": "db.example.com",
"port": 5432,
"database_name": "production",
"schema_name": "public",
"file_path": null,
"use_ssh_tunnel": false,
"ssh_host": null,
"ssh_port": null,
"status": "active",
"last_tested_at": "2024-12-01T10:00:00Z",
"last_successful_connection_at": "2024-12-01T10:00:00Z",
"schema_discovered_at": "2024-12-01T09:00:00Z",
"schema_auto_refresh": true,
"tags": ["production", "database"],
"created_at": "2024-12-01T08:00:00Z",
"updated_at": "2024-12-01T10:00:00Z"
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total_items": 15,
"total_pages": 1,
"has_next": false,
"has_previous": false
}
},
"message": "Data sources retrieved successfully"
}

Error Codes

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser is not a member of any organization

Features

  • Pagination support
  • Filtering by workspace, type, and status
  • Search by name or description
  • Sorting by any field
  • Organization-scoped (only shows data sources in user's organization)

Example

curl -X GET "https://api.rivergen.com/api/v1/data-sources?page=1&page_size=20&type=postgresql&status_filter=active" \
-H "Authorization: Bearer <access_token>"