**Source URL:** https://general.veevavault.dev/vql/getting-started/structuring-sending-queries.md

# Structuring & Sending a Query

This guide provides the basic structure of a VQL query and how to submit it to retrieve document and object fields.

## Structuring a Query {#Structuring_a_Query}

VQL’s syntax is similar to SQL and provides a programmatic way of searching your Vault’s data. A basic VQL query consists of a [SELECT statement with a FROM clause](/vql/clauses/select-from):

```
SELECT {fields}  
FROM {query target}

```

The `SELECT` clause provides the fields to retrieve from the specified query target, such as `id`. The `FROM` clause provides the [query target](/vql/query-targets), such as `documents`.

For example, to retrieve the latest version of all documents from a Vault, use this basic query:

```
SELECT id
FROM documents

```

## Sending a Query {#Sending_a_Query}

To send a VQL query, send a **POST** request to the `/api/{version}/query` endpoint as shown in the [Vault API Reference](/vault-api/api-reference/26.1/vault-query-language-vql). Using **POST** allows you to send a VQL statement of [up to 50,000 characters](/vql/references/system-limits-performance/execution-constraints).

### Query {#Query}

The following example sends a query that retrieves the ID and name of all documents in the specified Vault:

```
curl -X POST -H "Authorization: {session_id}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'q=select id, name__v from documents' \
"https://myvault.veevavault.com/api/v20.3/query"

```

The VQL API response includes a `data` payload with the requested fields:

### Response {#Response}

```
{
    "responseStatus": "SUCCESS",
    "responseDetails": {
        "pagesize": 1000,
        "pageoffset": 0,
        "size": 96,
        "total": 96
    },
    "data": [
        {
            "id": 119,
            "name__v": "CholeCap Batch Manufacturing RecordTest File 1"
        },
        {
            "id": 1,
            "name__v": "CholeCap Visual AidTest File 2"
        }
    ]
}

```


---

**Previous:** [Getting Started](/vql/getting-started)  
**Next:** [Document & Object Queries](/vql/getting-started/document-object-queries)