Playground
API playground (coming soon)
The API Playground endpoints allow for custom SQL execution and advanced query management. These features are currently in beta/testing. While some endpoints may function, they are not yet guaranteed for production use.
Saved queries
Saved queries allow you to execute pre-defined SQL queries against your Cension data.
Overview
Saved queries are SQL statements that you define and test within the Cension UI. Once saved, they are assigned a unique ID and can be executed programmatically via the API. This approach offers several benefits:
- Security: Your API clients don't need to know the database schema or execute arbitrary SQL.
- Maintainability: You can update the SQL logic in the UI without changing your application code.
- Performance: Cension handles pagination and optimization automatically.
Examples
- CRM Sync: Create a query to fetch only new leads for your CRM.
1SELECT * FROM Data WHERE created_at > NOW() - INTERVAL '1 day'Enrichment export
Enrichment Export: Join base data with enriched fields to export a clean list.
1SELECT company_name, industry, ceo_email FROM Data WHERE ceo_email IS NOT NULLExecute saved query (Public Beta)
"Running your saved SQL."
Use this endpoint to run a saved query and retrieve the results. This handles pagination and ensures you only access data you are authorized to view.
- Endpoint: GET /api/queries/{savedQueryId}
- Method: GET
- Description: Executes a saved SQL query by ID.
Parameters
- savedQueryId (Required): The ID of the saved query to execute.
- page (Optional): Page number (default: 1).
- limit (Optional): Number of items per page (default: 100, max: 10,000).
Response
1{
2 "success": true,
3 "data": [ ... ],
4 "pagination": {
5 "page": 1,
6 "limit": 100,
7 "total_count": 5000,
8 "total_pages": 50
9 }
10}Advanced query management
The following management endpoints allow programmatic creation and execution of arbitrary SQL.
Execute custom SQL
- Endpoint: POST /api/sql/execute
- Method: POST
- Description: Execute a custom SQL query directly against your dataset.
Create saved query
- Endpoint: POST /api/saved-queries
- Method: POST
- Description: Programmatically create a new saved query.
List saved queries
- Endpoint: GET /api/saved-queries
- Method: GET
- Description: Retrieve a list of all saved queries available to your user.
Execute saved query (Legacy)
- Endpoint: POST /api/saved-queries/{id}/execute
- Method: POST
- Description: Alternative endpoint for executing saved queries.