> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/api-reference/tools/insights.md).

# Insights

## Run an analytics query

> Reference parameters by name, e.g. \`{"query": "Events | where Name == eventName | take 100", "parameters": {"eventName": "Pass:Installed"}}\`.

```json
{"openapi":"3.1.1","info":{"title":"Neostore internal API","version":"v1"},"tags":[{"name":"Insights"}],"servers":[{"url":"https://app.neostore.cloud","description":"Production Server"},{"url":"https://app-qa.neostore.cloud","description":"Staging Server"}],"security":[{"admin-bearer":["tenant.insights:read"]},{"apiKey":[]}],"components":{"securitySchemes":{"admin-bearer":{"type":"oauth2","flows":{"implicit":{"authorizationUrl":"https://auth.neostore.cloud/authorize?audience=https://app.neostore.cloud/api/","scopes":{}}}},"apiKey":{"type":"apiKey","name":"X-API-KEY","in":"header"}},"schemas":{"QueryRequest":{"required":["query"],"type":"object","properties":{"query":{"type":"string","description":"KQL text. Only analytics-schema tables and columns are accepted, over the tenant's own data; invalid KQL returns 400 with a diagnostic."},"parameters":{"type":"object","additionalProperties":{"type":"string"},"description":"Query parameter values by name, passed as KQL strings. Names start with a letter or `_`, then letters, digits or `_`; `params_tenantId` is reserved."},"options":{"description":"Execution settings; defaults apply when omitted.","$ref":"#/components/schemas/QueryOptions"}},"additionalProperties":false,"description":"KQL query to run."},"QueryOptions":{"type":"object","properties":{"maxRows":{"type":"integer","description":"Row limit, 1 to 100,000 (default). Out of range, or more matching rows, returns 400: aggregate or narrow the query.","format":"int32"}},"additionalProperties":false,"description":"Execution settings."},"QueryResponse":{"type":"object","properties":{"columns":{"type":"array","items":{"type":"string"},"description":"Column names, in projection order."},"rows":{"type":"array","items":{"type":"array","items":{}},"description":"One array per row, one value per column. Empty cells are `null`, `dynamic` cells are JSON values, dates are UTC."}},"additionalProperties":false,"description":"Query result."},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"type":["null","integer"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}},"additionalProperties":{}},"HttpValidationProblemDetails":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProblemDetails"}],"properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"additionalProperties":{}}}},"paths":{"/api/{tenantId}/insights/query":{"post":{"tags":["Insights"],"summary":"Run an analytics query","description":"Reference parameters by name, e.g. `{\"query\": \"Events | where Name == eventName | take 100\", \"parameters\": {\"eventName\": \"Pass:Installed\"}}`.","parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Query text, parameters and options.","content":{"application/json":{"schema":{"description":"KQL query to run.","$ref":"#/components/schemas/QueryRequest"}},"text/json":{"schema":{"description":"KQL query to run.","$ref":"#/components/schemas/QueryRequest"}},"application/*+json":{"schema":{"description":"KQL query to run.","$ref":"#/components/schemas/QueryRequest"}}}},"responses":{"200":{"description":"Column names and rows.","content":{"text/plain":{"schema":{"description":"Query result.","$ref":"#/components/schemas/QueryResponse"}},"application/json":{"schema":{"description":"Query result.","$ref":"#/components/schemas/QueryResponse"}},"text/json":{"schema":{"description":"Query result.","$ref":"#/components/schemas/QueryResponse"}}}},"400":{"description":"Empty or invalid query, unknown table or column, invalid or reserved parameter name, `maxRows` out of range, or more rows than `maxRows`.","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"401":{"description":"The caller is not authenticated.","content":{"application/problem+json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"403":{"description":"Analytics are not enabled for the tenant."},"429":{"description":"Rate limit exceeded."},"504":{"description":"Query ran too long; aggregate or narrow it."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.thewalletcrew.io/api-reference/tools/insights.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
