---
title: "Execute a simple query"
method: POST
path: "/"
tags: ["Query API"]
---

# Execute a simple query

`POST /`

This API queries the document at */data/system/main* by default (however, you can [configure OPA](https://www.openpolicyagent.org/docs/latest/configuration/) to use a different path to serve these queries). That document defines the response.
For example, use the following in `PUT /v1/policies/{path}`) to define a rule that will produce a value for the */data/system/main* document:

  ```yaml
  package system
  main = msg {
    msg := sprintf("hello, %v", input.user)
  }
  ```

The server will return a *not found* (404) response if */data/system/main* is undefined.

## Query parameters

- `pretty` boolean

## Request body

- QueryInputSchema

## Response `200`

Success

## Other responses

- `400` — Bad request
- `404` — Not found (for example, a requested policy module or document does not exist)
- `500` — Server error

---

[API](https://skmtc.net/open-policy-agent/apis/open-policy-agent-opa-rest-api.md) · [All operations](https://skmtc.net/open-policy-agent/apis/open-policy-agent-opa-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/open-policy-agent/open-policy-agent-opa-rest-api/revisions/47f6f2062932/schema)
