# 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="../../concepts-1/collections" %}
[collections](https://docs.comfortable.io/concepts-1/collections)
{% 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](https://docs.comfortable.io/apis/examples/single-documents#including-assets-for-documents)
{% endhint %}
