Skip to main content

Get User Projects

userId
string
required
The ID of the user whose projects to fetch

Request

GET /api/userprojects?userId={userId}

Authentication

Requires an active session. Returns 401 Unauthorized if not authenticated.

Response

projects
array
Array of project objects with connection and widget statistics
id
string
Unique project identifier
title
string
Project title
description
string
Project description
isPublic
boolean
Whether the project is publicly accessible
idPublic
string | null
Public ID for sharing the project (null if not public)
databases
string[]
Array of database connection titles
totalConnections
number
Total number of database connections
validConnections
number
Number of validated and working connections
hasValidatedConnections
boolean
Whether any connections have been validated
lastValidationDate
string | undefined
ISO timestamp of the most recent connection validation
totalSchemas
number
Number of valid database schemas
validSchemas
number
Number of successfully introspected schemas
hasIntrospectedSchemas
boolean
Whether any schemas have been introspected
lastSchemaIntrospectionAt
string | undefined
ISO timestamp of the most recent schema introspection
widgetCount
number
Total number of widgets in the project
createdAt
string
ISO timestamp of project creation
updatedAt
string
ISO timestamp of last project update

Example

const response = await fetch('/api/userprojects?userId=user_123', {
  method: 'GET',
  credentials: 'include'
});

const data = await response.json();
{
  "projects": [
    {
      "id": "proj_abc123",
      "title": "Sales Dashboard",
      "description": "Q4 sales analytics",
      "isPublic": false,
      "idPublic": null,
      "databases": ["PostgreSQL Production", "MySQL Analytics"],
      "totalConnections": 2,
      "validConnections": 2,
      "hasValidatedConnections": true,
      "lastValidationDate": "2026-03-06T12:00:00.000Z",
      "totalSchemas": 2,
      "validSchemas": 2,
      "hasIntrospectedSchemas": true,
      "lastSchemaIntrospectionAt": "2026-03-06T12:05:00.000Z",
      "widgetCount": 5,
      "createdAt": "2026-03-01T10:00:00.000Z",
      "updatedAt": "2026-03-06T12:05:00.000Z"
    }
  ]
}

Update Project Visibility

projectId
string
required
The ID of the project to update
public
boolean
required
Whether to make the project public (true) or private (false)

Request

POST /api/projects/{projectId}/public

Authentication

Requires an active session. Only the project owner can update visibility.

Request Body

{
  "public": true
}

Behavior

  • If making public and no idPublic exists, generates a new 12-character public ID using nanoid
  • If setting to private, removes the idPublic
  • If the project has no valid connections, forces isPublic to false and removes idPublic
  • Only projects with at least one valid database connection can be made public

Response

isPublic
boolean
Updated public visibility status
idPublic
string | null
The public ID for sharing (generated if made public, null if private)

Example

const response = await fetch('/api/projects/proj_abc123/public', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  credentials: 'include',
  body: JSON.stringify({ public: true })
});

const data = await response.json();
{
  "isPublic": true,
  "idPublic": "xYz9AbC12345"
}
Projects without valid database connections cannot be made public. The API will automatically set isPublic to false and remove the idPublic if there are no valid connections.

List Project Connections

projectId
string
required
The ID of the project whose connections to list

Request

GET /api/listconnections?projectId={projectId}

Authentication

Requires an active session. Only the project owner can list connections.

Response

connections
array
Array of connection summary objects
id
string
Unique connection identifier
title
string
Connection title/name
lastIntrospectionAt
string | null
ISO timestamp of last schema introspection (null if never introspected)
hasSchema
boolean
Whether the connection has an introspected schema stored
isValid
boolean | undefined
Connection validation status (undefined if not yet validated)
error
string
Error message if the request failed

Example

const response = await fetch('/api/listconnections?projectId=proj_abc123', {
  method: 'GET',
  credentials: 'include'
});

const data = await response.json();
{
  "connections": [
    {
      "id": "conn_xyz789",
      "title": "Production Database",
      "lastIntrospectionAt": "2026-03-06T12:00:00.000Z",
      "hasSchema": true,
      "isValid": true
    },
    {
      "id": "conn_abc456",
      "title": "Analytics DB",
      "lastIntrospectionAt": null,
      "hasSchema": false,
      "isValid": false
    }
  ]
}
This endpoint is useful for getting a quick overview of all connections in a project, including their validation and schema status.

Get Compatible Tables

Find tables that exist across multiple database connections with matching schemas.
connectionIds
string[]
required
Array of connection IDs to compare (minimum 2 required)

Request

POST /api/compatible-tables

Authentication

Public endpoint - no authentication required.

Request Body

{
  "connectionIds": ["conn_xyz789", "conn_abc456"]
}

Behavior

  • Retrieves schemas for all specified connections
  • Finds tables that exist in all connections
  • Verifies that matching tables have identical column names and data types
  • Returns only tables where the schema is fully compatible across all connections

Response

compatibleTables
string[]
Array of table names that exist with matching schemas in all connections
details
object
Dictionary mapping table names to their column information
error
string
Error message if the request failed

Example

const response = await fetch('/api/compatible-tables', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    connectionIds: ['conn_xyz789', 'conn_abc456', 'conn_def123']
  })
});

const data = await response.json();
{
  "compatibleTables": ["users", "products", "orders"],
  "details": {
    "users": {
      "columns": [
        { "name": "id", "type": "integer" },
        { "name": "email", "type": "varchar" },
        { "name": "created_at", "type": "timestamp" }
      ]
    },
    "products": {
      "columns": [
        { "name": "id", "type": "integer" },
        { "name": "name", "type": "varchar" },
        { "name": "price", "type": "numeric" }
      ]
    },
    "orders": {
      "columns": [
        { "name": "id", "type": "integer" },
        { "name": "user_id", "type": "integer" },
        { "name": "total", "type": "numeric" }
      ]
    }
  }
}
This endpoint is used by the Integrated DataTable widget to find tables that can be compared across multiple database connections.

Build docs developers (and LLMs) love