Getting started with ServiceNow SQL API
Summarize
Summary of Getting started with ServiceNow SQL API
The ServiceNow SQL API enables secure, read-only access to your ServiceNow instance data through standard ODBC and JDBC drivers. It allows direct connections from Business Intelligence (BI) tools and data analysis platforms, facilitating data queries using SQL, primarily SELECT statements. This integration supports advanced querying capabilities while respecting ServiceNow's security and access control models.
Show less
Key Features
- BI Tool Integration: Connect platforms like Power BI, DBeaver, and DBVisualizer directly to ServiceNow data using ODBC/JDBC.
- Secure, Read-Only Access: The API supports only SELECT queries, preventing data modification and ensuring data integrity.
- Pass-through Query Support: Execute complex SQL queries including WHERE filters, aggregations, and INNER or LEFT OUTER joins directly on ServiceNow data to optimize data retrieval.
- Fine-Grained Security Enforcement: The API enforces ServiceNow’s ACLs at table, row, and field levels by default, ensuring users only access authorized data. For some use cases, such as BI integrations, row and field-level checks can be disabled while maintaining table-level security.
- Performance Optimization: By filtering and aggregating data at the source, the SQL API reduces data transfer volumes and improves query performance.
- Authentication Required: All connections require authentication, leveraging ServiceNow’s identity and access management protocols.
How It Works
After installing the SQL API plugin, you establish an ODBC or JDBC connection from your BI tool to the ServiceNow instance. You then write SQL SELECT queries to retrieve data, which the API processes and returns as standard tabular results. The plugin supports a limited set of SQL commands focused on data retrieval.
Security and Access Control
The SQL API respects all ServiceNow ACLs and security models, validating access at multiple levels for each query. This ensures that only authorized data is accessible, although detailed ACL checks may impact response times. To improve performance for trusted BI integrations, row and field-level security can be relaxed while maintaining table-level protections.
Practical Benefits for ServiceNow Customers
- Directly query ServiceNow data without replicating it externally, reducing data duplication and simplifying your data architecture.
- Combine ServiceNow data with external datasets in your BI tools for richer analytics.
- Write targeted SQL queries to optimize data retrieval and enhance performance.
- Maintain strong data security through enforced ACLs and read-only access.
Next Steps
To implement and make full use of the SQL API, consider exploring topics such as:
- SQL API architecture and plugin installation
- Configuring security roles and permissions for SQL API access
- Common use cases and best practices for BI reporting and ad-hoc analysis
- Reference materials on supported SQL functions and query capabilities
The ServiceNow SQL API provides data access to your ServiceNow instances through industry-standard ODBC and JDBC drivers, enabling direct connections from Business Intelligence (BI) tools and data analysis platforms.
The ServiceNow SQL API plugin uses ServiceNow web services support for a query-only interface. By default, the plugin supports only SELECT statements, allowing external applications to query authorized tables. It permits a limited set of additional SQL commands and enables you to compose more complex queries to retrieve only relevant data.
What you can achieve with SQL API
With the SQL API, you can:
- Connect your BI tools: Integrate standard BI platforms such as Power BI, DBeaver, DBvisualizer, and other ODBC/JDBC-compatible tools directly with your ServiceNow data.
- Query data securely: Access data through read-only operations that help avoid unintended modifications to your ServiceNow records. Allow access only to the desired tables.
- Eliminate data duplication: Query your ServiceNow data directly without replicating it to external repositories or data warehouses.
- Combine data sources: Merge your ServiceNow data with external datasets in your analytical platforms for comprehensive analysis.
- Optimize data transfer: Write targeted SQL queries to retrieve only the data you need, reducing network overhead for data pipeline and data transformation, and improving performance.
How SQL API works
When you connect your BI tool to your ServiceNow instance through the SQL API, you establish a standard database connection using ODBC or JDBC APIs. After connecting, you can write SQL queries to retrieve data from your ServiceNow tables and fields.
The API processes your queries and returns results in standard tabular format, which your BI tool can then visualize, analyze, or export.
Pass-through query support
The SQL API supports pass-through queries, meaning you can write SQL statements that execute directly on your ServiceNow data. This enables you to:
- Apply WHERE clauses to filter data at the source.
- Perform aggregations (COUNT, SUM, AVG, etc.) on the ServiceNow side.
- Join multiple ServiceNow tables in a single query. The query engine supports only INNER and LEFT OUTER joins.
- Limit result sets to reduce data transfer.
By processing queries at the source, you reduce the amount of data transferred over the network and improve overall query performance.
Security and access control
Your current ServiceNow security model still applies when you access the SQL API. The API implements the ServiceNow ACL model, which means:
- You can only access data that your ServiceNow role and permissions allow.
- All identity and access management protocols are enforced at the API level.
- Your queries follow table-level, row level, field level, query level, and record-level security rules.
-
By default, the SQL API checks access at the table, row, and field level for every query, following ServiceNow's secure-by-default approach. The SQL API validates all ACLs in your instance record by record, which may result in longer response times. This is expected.
If your use case does not require row and field-level checks — for example, a Business Intelligence integration — you can turn them off by assigning the
sn_sql_api_privileged_moderole to the service account. Table-level ACL checks always remain in effect and cannot be turned off. - Authentication is required for all connections.
Additionally, the SQL API is read-only by design. You cannot perform INSERT, UPDATE, or DELETE operations through this interface. This helps prevent accidentally modify production data.