# Endpoints

## All Documents

<mark style="color:blue;">`GET`</mark> `https://api.cmft.io/v1/<repoName>/documents`

This endpoint provides all documents of a repository.

#### Path Parameters

| Name      | Type   | Description                          |
| --------- | ------ | ------------------------------------ |
| repoName  | string | The API identifier of the repository |
| documents | string | The endpoint to query all documents  |

#### Headers

| Name          | Type   | Description                                                                                               |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| Authorization | string | Provide the API Key in the Authorization Header. For `GET` requests it can be provided as path parameter. |

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

```
```

{% endtab %}
{% endtabs %}

## Single Document

<mark style="color:blue;">`GET`</mark> `https://api.cmft.io/v1/<repoName>/documents/<documentId>`

#### Path Parameters

| Name       | Type   | Description           |
| ---------- | ------ | --------------------- |
| documents  | string | The documents slug    |
| documentId | string | The Id for a document |

#### Headers

| Name          | Type   | Description                                                                                               |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| Authorization | string | Provide the API Key in the Authorization Header. For `GET` requests it can be provided as path parameter. |

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

```
```

{% endtab %}
{% endtabs %}

## Single Document Alias

<mark style="color:blue;">`GET`</mark> `https://api.comft.io/v1/<repoName>/alias/<myAliasName>`

You can create an alias for a single document by linking it in the Content Tree.\
Once an alias is created, it is possible to switch out the document that's connected to that alias.

#### Path Parameters

| Name        | Type   | Description                    |
| ----------- | ------ | ------------------------------ |
| alias       | string | The alias slug                 |
| myAliasName | string | The name of the alias (API Id) |

#### Headers

| Name          | Type   | Description                                                                                               |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| Authorization | string | Provide the API Key in the Authorization Header. For `GET` requests it can be provided as path parameter. |

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

```
```

{% endtab %}
{% endtabs %}

## Document Collections

<mark style="color:blue;">`GET`</mark> `https://api.cmft.io/v1/<repoName>/collections/<collectionName>`

#### Path Parameters

| Name           | Type   | Description                          |
| -------------- | ------ | ------------------------------------ |
| repoName       | string | The API identifier of the repository |
| collectionName | string | The API ID for a Collection          |

#### Headers

| Name          | Type   | Description                                                                                               |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| Authorization | string | Provide the API Key in the Authorization Header. For `GET` requests it can be provided as path parameter. |

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

```
```

{% endtab %}
{% endtabs %}

Document Collections work almost the same as the All Documents endpoint. The key difference is, that collections come a predefined set of documents, matching certain characteristics. These filters can be set in the Comfortable Web Application.

For more info on Collections, see the following page:

{% content-ref url="/pages/-LADZF1lElL5njx1B53b" %}
[Collections](/concepts-1/collections.md)
{% endcontent-ref %}

## Single Asset

<mark style="color:blue;">`GET`</mark> `https://api.cmft.io/v1/<repoName>/assets/<assetId>`

#### Path Parameters

| Name    | Type   | Description         |
| ------- | ------ | ------------------- |
| assets  | string | The assets endpoint |
| assetId | string | The Id for an asset |

#### Headers

| Name          | Type   | Description                                                                                               |
| ------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| Authorization | string | Provide the API Key in the Authorization Header. For `GET` requests it can be provided as path parameter. |

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

```
```

{% 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 %}


---

# 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/endpoints.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.
