--- title: Perform a simple query slug: '114' canonical_url: https://docs.coveo.com/en/114/ collection: build-a-search-ui source_format: adoc --- # Perform a simple query The goal of any [Coveo Platform](https://docs.coveo.com/en/186/) user is to perform [queries](https://docs.coveo.com/en/231/) against a unified, secured [index](https://docs.coveo.com/en/204/) in a specific [Coveo organization](https://docs.coveo.com/en/185/), and retrieve the most relevant [query](https://docs.coveo.com/en/231/) result [items](https://docs.coveo.com/en/210/). Use the [Search request to the Search API](https://platform.cloud.coveo.com/docs?urls.primaryName=Search%20API#/Search%20V2/searchUsingPost) operation to perform a simple [query](https://docs.coveo.com/en/231/): **Request template** ```http POST https://.org.coveo.com/rest/search/v2?organizationId= HTTP/1.1 ​ Content-Type: application/json Accept: application/json Authorization: Bearer ``` **Payload** ```json { "q": } ``` In the [query](https://docs.coveo.com/en/231/) path: * Replace `` with the [ID of the target Coveo organization](https://docs.coveo.com/en/148/). In the [query](https://docs.coveo.com/en/231/) string: * If the access token that you're using to [authenticate](https://docs.coveo.com/en/2120/) the call doesn't implicitly specify the [organization](https://docs.coveo.com/en/185/) it refers to (that is, if it's not a [search token](https://docs.coveo.com/en/1346/)): -- ** Replace `` with the ID of the target [Coveo organization](https://docs.coveo.com/en/185/). -- Otherwise, you don't need to include the `organizationId` parameter in the [query](https://docs.coveo.com/en/231/) string. In the `Authorization` HTTP header: * Replace `` with an access token that grants the [privilege](https://docs.coveo.com/en/228/) to execute [queries](https://docs.coveo.com/en/231/) in the target [Coveo organization](https://docs.coveo.com/en/185/) (see [Get your Coveo access token](https://docs.coveo.com/en/123/) and [Search API authentication methods](https://docs.coveo.com/en/102/)). > **Note** > > You can pass an access token as a [query](https://docs.coveo.com/en/231/) string argument (for example, `access_token=MyAccessToken`) rather than in an `Authorization` header. In the request body: * Replace `` with the [basic query expression (`q`)](https://docs.coveo.com/en/178/) that you want to forward to the Search API, such as the [keywords](https://docs.coveo.com/en/2738/) that a user would enter in a search box. **Example** You can pass one or more [keywords](https://docs.coveo.com/en/2738/), such as `human resources jobs`, to get all of the [source](https://docs.coveo.com/en/246/) [items](https://docs.coveo.com/en/210/) that contain these [keywords](https://docs.coveo.com/en/2738/). You can pass an empty request body rather than specifying a [`q`](https://docs.coveo.com/en/178/) value to return all of the [items](https://docs.coveo.com/en/210/) in the [index](https://docs.coveo.com/en/204/) of the target [organization](https://docs.coveo.com/en/185/). You can include exact phrase match requests in the [`q`](https://docs.coveo.com/en/178/) value by surrounding groups of [keywords](https://docs.coveo.com/en/2738/) with escaped double quote characters (for example, `"q": "Coveo \"Cloud V2\" platform"`). Unless you explicitly set the `enableQuerySyntax` property to `false` in the request body, you can also include any valid [Coveo query syntax](https://docs.coveo.com/en/181/) in the [`q`](https://docs.coveo.com/en/178/) value (for example, `"q": "Example AND @sourcetype==Web"`). The body of a successful response (`200 OK`) contains information about the [query](https://docs.coveo.com/en/231/) itself, such as its `duration` and the `totalCount` of [query](https://docs.coveo.com/en/231/) result [items](https://docs.coveo.com/en/210/). Most importantly, the response body contains the [query](https://docs.coveo.com/en/231/) `results`. > **Note** > > Sometimes, the response body also contains an `executionReport` with detailed debug information. By default, elements in the `results` array are sorted by _relevancy:_ a standard set of ranking rules is applied to compute a `score` value for each [query](https://docs.coveo.com/en/231/) result [item](https://docs.coveo.com/en/210/). The higher a [query](https://docs.coveo.com/en/231/) result [item](https://docs.coveo.com/en/210/) `score` value is, the lower its 0-based [index](https://docs.coveo.com/en/204/) position in the `results` array will be. There are several ways you can affect the `score` value of [query](https://docs.coveo.com/en/231/) result [items](https://docs.coveo.com/en/210/). Of course, the Search API also lets you use sort criteria other than the `score` value, so you should never have to sort [query](https://docs.coveo.com/en/231/) result [items](https://docs.coveo.com/en/210/) client-side. Each element in the `results` array contains specific information about a single [query](https://docs.coveo.com/en/231/) result [item](https://docs.coveo.com/en/210/), such as its `title`, `clickUri`, and automatically generated `excerpt`. You can leverage these values to display relevant information when rendering the [query](https://docs.coveo.com/en/231/) results in a graphical [search interface](https://docs.coveo.com/en/2741/). You can also take advantage of the `titleHighlights` and `excerptHighlights` properties to emphasize [basic query expression](https://docs.coveo.com/en/178/) [keywords](https://docs.coveo.com/en/2738/) in the title and excerpt. The `raw` property of each `results` element is also very important, as it holds the [fields](https://docs.coveo.com/en/200/) which were retrieved for this [item](https://docs.coveo.com/en/210/), and their corresponding values. Each [field](https://docs.coveo.com/en/200/) typically contains specific [metadata](https://docs.coveo.com/en/218/) about an [item](https://docs.coveo.com/en/210/), including its most recent modification `date`, its `size`, the name of its `source`, and its `sourceType`. You can explicitly specify which [fields](https://docs.coveo.com/en/200/) to include in (or exclude from) the [query](https://docs.coveo.com/en/231/) result [items](https://docs.coveo.com/en/210/) when performing a [query](https://docs.coveo.com/en/231/). ## Sample request Forwarding a [basic query expression](https://docs.coveo.com/en/178/) to the Search API: ```http POST https://mycoveocloudv2organizationg8tp8wu3.org.coveo.com/rest/search/v2?organizationId=mycoveocloudv2organizationg8tp8wu3 HTTP/1.1 ​ Content-Type: application/json Accept: application/json Authorization: Bearer **********-****-****-****-************ ``` **Payload** ```json { "q": "Example" } ``` **Successful response - 200 OK** ```json { "totalCount": 50, ... "duration": 61, ... "results": [ { ... "title": "Example Domain", ... "clickUri": "http://www.example.com/", ... "excerpt": "Example Domain This domain is established to be used for illustrative examples in documents. ...", ... "score": 4268, ... "titleHighlights": [ { "length": 7, "offset": 0 } ], ... "excerptHighlights": [ ... ], "raw": { ... "date": 1376092475000, "size": 1270, "sourcetype": "Web", "source": "My web source", ... } }, ... ], ... } ```