# Document

## Creates a document

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/document`

#### Request Body

| Name                                   | Type     | Description |
| -------------------------------------- | -------- | ----------- |
| body<mark style="color:red;">\*</mark> | Document |             |

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

{% endtab %}
{% endtabs %}

## Deletes a document's attachment

<mark style="color:red;">`DELETE`</mark> `https://demo.icure.cloud/rest/v2/document/{documentId}/attachment`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Deletes documents

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/document/delete/batch`

#### Request Body

| Name                                   | Type      | Description |
| -------------------------------------- | --------- | ----------- |
| body<mark style="color:red;">\*</mark> | ListOfIds |             |

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

{% endtab %}
{% endtabs %}

## List documents with no delegation

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/woDelegation`

Keys must be delimited by coma

#### Query Parameters

| Name  | Type    | Description |
| ----- | ------- | ----------- |
| limit | Integer |             |

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

{% endtab %}
{% endtabs %}

## Gets a document

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/{documentId}`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Load document's attachment

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/{documentId}/attachment/{attachmentId}`

#### Path Parameters

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark>   | String |             |
| attachmentId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| enckeys  | String |             |
| fileName | String |             |

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

{% endtab %}
{% endtabs %}

## Gets a document

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/externaluuid/{externalUuid}`

#### Path Parameters

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| externalUuid<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Gets a document

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/document/byIds`

#### Request Body

| Name                                   | Type      | Description |
| -------------------------------------- | --------- | ----------- |
| body<mark style="color:red;">\*</mark> | ListOfIds |             |

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

{% endtab %}
{% endtabs %}

## Get all documents with externalUuid

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/externaluuid/{externalUuid}/all`

#### Path Parameters

| Name                                           | Type   | Description |
| ---------------------------------------------- | ------ | ----------- |
| externalUuid<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## List documents found By type, By Healthcare Party and secret foreign keys.

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/byTypeHcPartySecretForeignKeys`

Keys must be delimited by coma

#### Query Parameters

| Name                                               | Type   | Description |
| -------------------------------------------------- | ------ | ----------- |
| documentTypeCode<mark style="color:red;">\*</mark> | String |             |
| hcPartyId<mark style="color:red;">\*</mark>        | String |             |
| secretFKeys<mark style="color:red;">\*</mark>      | String |             |

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

{% endtab %}
{% endtabs %}

## List documents found By Healthcare Party and secret foreign keys.

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/document/byHcPartySecretForeignKeys`

Keys must be delimited by coma

#### Query Parameters

| Name                                          | Type   | Description |
| --------------------------------------------- | ------ | ----------- |
| hcPartyId<mark style="color:red;">\*</mark>   | String |             |
| secretFKeys<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Updates a document

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/document`

#### Request Body

| Name                                   | Type     | Description |
| -------------------------------------- | -------- | ----------- |
| body<mark style="color:red;">\*</mark> | Document |             |

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

{% endtab %}
{% endtabs %}

## Updates a batch of documents

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/document/batch`

Returns the modified documents.

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | List |             |

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

{% endtab %}
{% endtabs %}

## Creates a document's attachment

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/document/{documentId}/attachment`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| enckeys | String |             |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| body<mark style="color:red;">\*</mark> | Object |             |

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

{% endtab %}
{% endtabs %}

## Creates a document's attachment

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/document/{documentId}/attachment/multipart`

#### Path Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| enckeys | String |             |

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

{% endtab %}
{% endtabs %}

## Update delegations in healthElements.

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/document/delegations`

Keys must be delimited by coma

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | List |             |

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

{% endtab %}
{% endtabs %}

## Creates a document's attachment

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/document/attachment`

#### Query Parameters

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| documentId<mark style="color:red;">\*</mark> | String |             |
| enckeys                                      | String |             |

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| body<mark style="color:red;">\*</mark> | Object |             |

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

{% endtab %}
{% endtabs %}
