# Fields

You can control which fields should be included in the documents returned by a query. Provide the field names with the `fields` parameter.

The fields parameter works for single documents as well as for list endpoints.

## Control which fields are included for a response

<mark style="color:blue;">`GET`</mark> `https://api.cmft.io/v1/<repoName>/<endpoint>?fields=fields|meta|includes(<field1>,<field2>)`

#### Path Parameters

| Name     | Type   | Description                                                       |
| -------- | ------ | ----------------------------------------------------------------- |
| repoName | string | The API identifier of the repository                              |
| endpoint | string | The endpoint you'd like to request                                |
| fields   | string | Provide the field API IDs you'd like to be included in a document |

{% tabs %}
{% tab title="200 " %}

```javascript
// Query with 'title' as field
{
  "fields": {
    "title": "Roses are red"
  },
  "meta": {
    "id": "314159265358979323",
    "contentType": "poem",
    "repository": "314159265358979323",
    "revision": 1,
    "tags": [],
    "createdAt": "2018-01-01T00:00:00.000Z",
    "updatedAt": "2018-01-01T00:00:00.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

## Scopes

Returns only this scope or the stated sub-fields (e.g. `title`). There are three scopes:

* `fields`
* `meta`
* `includes`

## Value Syntax

| **Syntax** | **Description**                                       |
| ---------- | ----------------------------------------------------- |
| `a,b,c`    | comma-separated list will select multiple fields      |
| `a/b/c`    | path will select a field from its parent              |
| `a(b,c)`   | sub-selection will select many fields from a parent   |
| `a/*/c`    | the star \* wildcard will select all items in a field |

## Examples

Find some examples on the collection examples page:

{% content-ref url="/pages/-LEUZGK6bjs\_6YDrz\_rM" %}
[Collections](/apis/rest-api/examples/collections.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.comfortable.io/apis/rest-api/filters/reducing-payloads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
