---
title: "Execute SQL query"
method: POST
path: "/api/v1/mssql/query"
---

# Execute SQL query

`POST /api/v1/mssql/query`

## Request

- Base URL: `https://localhost:3000`
- URL: `https://localhost:3000/api/v1/mssql/query`
- Auth: OAuth 2 (authorization code, authorization URL `/oauth/authorize`, token URL `/oauth/token`)

Execute a SELECT query on the MSSQL database. Only SELECT queries are allowed for security.

## Request body

- object
  - `query` string, required: SQL SELECT query to execute

## Response `200`

Query results

- QueryResponse
  - `user` string
  - `query` string: The SQL query executed
  - `results` object[]: Array of result rows
  - `count` integer: Number of rows returned

## Other responses

- `400`: Invalid query (non-SELECT or malformed)
- `401`: Authentication required
- `500`: Internal server error
- `503`: MSSQL connection not configured for this user

---

[API](https://skmtc.dev/corpusiq/apis/multi-source-mcp-api.md) · [All operations](https://skmtc.dev/corpusiq/apis/multi-source-mcp-api/llms.txt) · [OpenAPI document](https://skmtc.dev/corpusiq/apis/multi-source-mcp-api/revisions/e25648ba6027?raw)
