Levered Docs
API Reference

Warehouse

Endpoints for managing your data warehouse connection.

All endpoints are under /api/v2/warehouse. All requests require an Authorization: Bearer <token> header.

Create or update connection

POST /api/v2/warehouse/connections

Auth: Required

Creates or updates the warehouse connection for your organization. Each organization has a single active connection.

Request body:

{
  "provider": "bigquery",
  "project_id": "my-gcp-project",
  "dataset_id": "levered",
  "credentials": {
    "type": "service_account",
    "project_id": "my-gcp-project",
    "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
    "client_email": "levered@my-gcp-project.iam.gserviceaccount.com"
  }
}
FieldTypeRequiredDescription
providerstringYesWarehouse provider: bigquery, snowflake, or postgres
project_idstringVariesGCP project ID (BigQuery) or account identifier (Snowflake)
dataset_idstringVariesDefault dataset or schema
credentialsobjectYesProvider-specific credentials

Provider-specific credential fields:

BigQuery: Service account JSON key (type, project_id, private_key, client_email).

Snowflake: account, username, password, warehouse, database, schema.

Postgres: host, port, database, username, password.

Response (201):

{
  "id": "connection-uuid",
  "provider": "bigquery",
  "project_id": "my-gcp-project",
  "dataset_id": "levered",
  "meta": {
    "request_id": "req_abc123",
    "organization_id": "org_xyz"
  }
}

Get connection

GET /api/v2/warehouse/connections

Auth: Required

Returns the current warehouse connection. Credentials are not included in the response.

Response:

{
  "connection": {
    "id": "connection-uuid",
    "provider": "bigquery",
    "project_id": "my-gcp-project",
    "dataset_id": "levered",
    "created_at": "2026-03-28T14:00:00Z"
  },
  "meta": {
    "request_id": "req_abc123",
    "organization_id": "org_xyz"
  }
}

If no connection is configured, connection is null.

Test connection

POST /api/v2/warehouse/connections/test

Auth: Required

Tests the current warehouse connection by executing a lightweight query.

Response (success):

{
  "success": true,
  "meta": {
    "request_id": "req_abc123",
    "organization_id": "org_xyz"
  }
}

Response (failure -- 400):

{
  "success": false,
  "error": "Permission denied for dataset 'levered'"
}

Delete connection

DELETE /api/v2/warehouse/connections

Auth: Required

Removes the warehouse connection. Metrics that depend on this connection will stop working.

Response: 204 No Content