---
title: "Execute Queries by ID"
method: POST
path: "/api/v2/Queries/{queryId}/execute"
tags: ["Queries"]
---

# Execute Queries by ID

`POST /api/v2/Queries/{queryId}/execute`

Run an existing LQL query registered in your FortiCNAPP instance by invoking the following endpoint:

  > `POST https://YourAccount.lacework.net/api/v2/Queries/{queryId}/execute`

  Replace `{queryId}` with the `queryId` value returned for an LQL query in the response when the `GET /api/v2/Queries` endpoint is invoked. The response is the data that the query finds in the datasource for the specified time period. For an example of how to specify a time frame, see [Example Queries](https://docs.fortinet.com/document/forticnapp/latest/lql-reference/435177/example-queries).

## Path parameters

- `queryId` string, required

## Headers

- `Authorization` string, required
- `Content-Type` string, required

## Request body

- object
  - `options` QueryExecuteOptions
    - `limit` integer — The limit field specifies the maximum number of records to return from the query. If specified, the limit must be at least 1.
  - `arguments` object[]
    - `name` string — The parameter name.
    - `value` string — The argument value (type must match LQL type)

## Response `200`

No Error

- object
  - `data` unknown[] — Result records, schema determined by query
    - unknown

## Other responses

- `4XX` — Client Error
- `5XX` — Internal Server Error

---

[API](https://skmtc.net/lacework/apis/forticnapp-api-2-0-documentation.md) · [All operations](https://skmtc.net/lacework/apis/forticnapp-api-2-0-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lacework/forticnapp-api-2-0-documentation/revisions/7015f76895f2/schema)
