> For the complete documentation index, see [llms.txt](https://docs.comfortable.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.comfortable.io/apis/rest-api/examples/single-assets.md).

# Single Assets

## Basic asset query

Demonstrates the basic query for a single `asset`.

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

```javascript
window.fetch('https://api.cmft.io/v1/<repo>/assets/<assetID>', {
  method: 'get',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': '<apiKey>'
  }
})
  .then(function (response) { return response.json() })
  .then(function (data) {
    console.log(data)
  })
```

{% endtab %}

{% tab title="CURL" %}

```bash
curl 'https://api.cmft.io/v1/<repo>/assets/<assetID>' \
  -H 'Authorization: <apiKey>'
```

{% endtab %}

{% tab title="URL" %}

```http
https://api.cmft.io/v1/<repo>/assets/<assetID>?key=<apiKey>
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
When querying documents, add`embedAssets=true` as URL parameter or as a query option to include assets by default. This eliminates the need to perform single asset queries and reduces the number of API calls. \
[See example](/apis/rest-api/examples/single-documents.md#including-assets-for-documents)
{% endhint %}

## Response Shaping: Asset query with reduced fields

Like documents, assets have fields which can be defined when making a query. In this example, we're going to query an asset just with its target URL.

To learn how to make a request with multiple fields, take a look at the [fields query reference page](/apis/rest-api/filters/reducing-payloads.md).

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

```javascript
window.fetch('https://api.cmft.io/v1/<repo>/assets/<assetID>?fields=fields(file(url))', {
  method: 'get',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': '<apiKey>'
  }
})
  .then(function (response) { return response.json() })
  .then(function (data) {
    console.log(data)
  })
```

{% endtab %}

{% tab title="CURL" %}

```bash
curl 'https://api.cmft.io/v1/<repo>/assets/<assetID>?fields=fields(file(url))' \
  -H 'Authorization: <apiKey>'
```

{% endtab %}

{% tab title="URL" %}

```http
https://api.cmft.io/v1/<repo>/assets/<assetID>?key=<apiKey>&fields=fields(file(url))
```

{% endtab %}
{% endtabs %}

## Asset query with localisation

Example for requesting an asset in one specific language (German).

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

```javascript
window.fetch('https://api.cmft.io/v1/<repo>/assets/<assetID>?locale=de', {
  method: 'get',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': '<apiKey>'
  }
})
  .then(function (response) { return response.json() })
  .then(function (data) {
    console.log(data)
  })
```

{% endtab %}

{% tab title="CURL" %}

```bash
curl 'https://api.cmft.io/v1/<repo>/assets/<assetID>?locale=de' \
  -H 'Authorization: <apiKey>'
```

{% endtab %}

{% tab title="URL" %}

```http
https://api.cmft.io/v1/<repo>/assets/<assetID>?key=<apiKey>&locale=de
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.comfortable.io/apis/rest-api/examples/single-assets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
