Unified management of all connected data sources (Google Sheets, Microsoft Excel, SQL Server).
---
https://app.datapublisher.io/api/data-sources
---
All endpoints require JWT authentication via Authorization: Bearer header.
---
The Data Sources API provides:
Supported Source Types:
---
Get all connected data sources across all types.
Endpoint: GET /
Headers:
Authorization: Bearer
Query Parameters:
type (optional): Filter by type (google-sheets, microsoft-excel, sql-server, csv)
status (optional): Filter by status (active, expired, error)
Response (200 OK):
{
"success": true,
"dataSources": [
{
"id": "uuid-1",
"type": "google-sheets",
"name": "Sales Tracking Spreadsheet",
"status": "active",
"metadata": {
"spreadsheetId": "1ABC-DEF",
"email": "user@gmail.com",
"sheetCount": 3
},
"createdAt": "2026-01-15T10:00:00Z",
"lastUsedAt": "2026-02-12T09:30:00Z",
"lastSyncAt": "2026-02-12T09:00:00Z"
},
{
"id": "uuid-2",
"type": "microsoft-excel",
"name": "Customer Database.xlsx",
"status": "active",
"metadata": {
"workbookId": "01AZJL5P...",
"email": "user@company.com",
"worksheetCount": 5
},
"createdAt": "2026-01-20T14:00:00Z",
"lastUsedAt": "2026-02-11T16:45:00Z",
"lastSyncAt": "2026-02-11T16:00:00Z"
},
{
"id": "uuid-3",
"type": "sql-server",
"name": "Production Database",
"status": "active",
"metadata": {
"server": "sql.company.com",
"database": "SalesDB",
"username": "app_user"
},
"createdAt": "2026-02-01T08:00:00Z",
"lastUsedAt": "2026-02-12T10:15:00Z",
"lastSyncAt": null
},
{
"id": "uuid-4",
"type": "csv",
"name": "imported-customers.csv",
"status": "active",
"metadata": {
"fileName": "imported-customers.csv",
"rowCount": 500,
"columnCount": 12,
"fileSize": 125000
},
"createdAt": "2026-02-10T12:00:00Z",
"lastUsedAt": "2026-02-12T08:30:00Z",
"lastSyncAt": null
}
],
"totalCount": 4,
"byType": {
"google-sheets": 1,
"microsoft-excel": 1,
"sql-server": 1,
"csv": 1
}
}
---
Get detailed information about a specific data source.
Endpoint: GET /:sourceId
Headers:
Authorization: Bearer
Path Parameters:
sourceId: Data source UUID
Response (200 OK) - Google Sheets:
{
"success": true,
"dataSource": {
"id": "uuid-1",
"type": "google-sheets",
"name": "Sales Tracking Spreadsheet",
"status": "active",
"connectionDetails": {
"spreadsheetId": "1ABC-DEF",
"spreadsheetName": "Sales Tracking 2026",
"email": "user@gmail.com",
"sheets": [
{ "name": "January", "rowCount": 150 },
{ "name": "February", "rowCount": 200 },
{ "name": "Summary", "rowCount": 12 }
],
"tokenExpiry": "2026-02-13T10:00:00Z"
},
"syncConfig": {
"enabled": true,
"frequency": "hourly",
"lastSync": "2026-02-12T09:00:00Z",
"nextSync": "2026-02-12T10:00:00Z"
},
"createdAt": "2026-01-15T10:00:00Z",
"lastUsedAt": "2026-02-12T09:30:00Z"
}
}
Response (200 OK) - SQL Server:
{
"success": true,
"dataSource": {
"id": "uuid-3",
"type": "sql-server",
"name": "Production Database",
"status": "active",
"connectionDetails": {
"server": "sql.company.com",
"database": "SalesDB",
"username": "app_user",
"port": 1433,
"encrypt": true
},
"syncConfig": null,
"createdAt": "2026-02-01T08:00:00Z",
"lastUsedAt": "2026-02-12T10:15:00Z"
}
}
---
Test connectivity to a data source.
Endpoint: POST /:sourceId/test
Headers:
Authorization: Bearer
Response (200 OK):
{
"success": true,
"status": "active",
"message": "Connection test successful",
"details": {
"responseTime": "45ms",
"lastChecked": "2026-02-12T10:30:00Z"
}
}
Response (500 Internal Server Error) - Failed:
{
"success": false,
"status": "error",
"message": "Connection test failed",
"error": "Invalid credentials or server unreachable"
}
---
Manually refresh data from connected source.
Endpoint: POST /:sourceId/refresh
Headers:
Authorization: Bearer
Response (200 OK):
{
"success": true,
"message": "Data source refreshed successfully",
"dataSource": {
"id": "uuid-1",
"type": "google-sheets",
"lastSyncAt": "2026-02-12T10:45:00Z",
"rowsUpdated": 15,
"status": "active"
}
}
---
Remove a data source connection.
Endpoint: DELETE /:sourceId
Headers:
Authorization: Bearer
Response (200 OK):
{
"success": true,
"message": "Data source deleted successfully"
}
Note: Deletes connection credentials but preserves previously imported CSV files.
---
Get usage statistics for all data sources.
Endpoint: GET /stats
Headers:
Authorization: Bearer
Response (200 OK):
{
"success": true,
"statistics": {
"totalSources": 4,
"activeSources": 4,
"expiredSources": 0,
"errorSources": 0,
"byType": {
"google-sheets": {
"count": 1,
"totalSheets": 3,
"totalRows": 362
},
"microsoft-excel": {
"count": 1,
"totalWorkbooks": 1,
"totalWorksheets": 5
},
"sql-server": {
"count": 1,
"totalDatabases": 1,
"totalTables": 15
},
"csv": {
"count": 1,
"totalFiles": 1,
"totalSize": "125 KB"
}
},
"recentActivity": [
{
"sourceId": "uuid-3",
"type": "sql-server",
"name": "Production Database",
"action": "query_executed",
"timestamp": "2026-02-12T10:15:00Z"
},
{
"sourceId": "uuid-1",
"type": "google-sheets",
"name": "Sales Tracking Spreadsheet",
"action": "data_synced",
"timestamp": "2026-02-12T09:00:00Z"
}
]
}
}
---
Test all data sources in parallel.
Endpoint: POST /test-all
Headers:
Authorization: Bearer
Response (200 OK):
{
"success": true,
"results": [
{
"id": "uuid-1",
"type": "google-sheets",
"name": "Sales Tracking Spreadsheet",
"status": "active",
"testResult": "success"
},
{
"id": "uuid-2",
"type": "microsoft-excel",
"name": "Customer Database.xlsx",
"status": "expired",
"testResult": "token_expired"
},
{
"id": "uuid-3",
"type": "sql-server",
"name": "Production Database",
"status": "active",
"testResult": "success"
}
],
"summary": {
"total": 3,
"success": 2,
"failed": 1
}
}
---
// List all data sources
async function listDataSources() {
const response = await fetch('https://app.datapublisher.io/api/data-sources', {
headers: { 'Authorization': Bearer ${jwtToken} }
});
const { dataSources } = await response.json();
return dataSources;
}
// Get specific source details
async function getSourceDetails(sourceId) {
const response = await fetch(https://app.datapublisher.io/api/data-sources/${sourceId}, {
headers: { 'Authorization': Bearer ${jwtToken} }
});
return await response.json();
}
// Test connection
async function testConnection(sourceId) {
const response = await fetch(https://app.datapublisher.io/api/data-sources/${sourceId}/test, {
method: 'POST',
headers: { 'Authorization': Bearer ${jwtToken} }
});
return await response.json();
}
// Refresh data source
async function refreshSource(sourceId) {
const response = await fetch(https://app.datapublisher.io/api/data-sources/${sourceId}/refresh, {
method: 'POST',
headers: { 'Authorization': Bearer ${jwtToken} }
});
return await response.json();
}
// Delete source
async function deleteSource(sourceId) {
const response = await fetch(https://app.datapublisher.io/api/data-sources/${sourceId}, {
method: 'DELETE',
headers: { 'Authorization': Bearer ${jwtToken} }
});
return await response.json();
}
---
---