# Message

## Creates a message

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Deletes a message delegation

<mark style="color:red;">`DELETE`</mark> `https://demo.icure.cloud/rest/v2/message/{messageId}/delegate/{delegateId}`

#### Path Parameters

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

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

{% endtab %}
{% endtabs %}

## Deletes multiple messages

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Get all messages (paginated) for current HC Party

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

#### Query Parameters

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| startKey        | String  |             |
| startDocumentId | String  |             |
| limit           | Integer |             |

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

{% endtab %}
{% endtabs %}

## Get all messages (paginated) for current HC Party and provided from address

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

#### Query Parameters

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| fromAddress     | String  |             |
| startKey        | String  |             |
| startDocumentId | String  |             |
| limit           | Integer |             |
| hcpId           | String  |             |

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

{% endtab %}
{% endtabs %}

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

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

Keys must be delimited by coma

#### Query Parameters

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

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

{% endtab %}
{% endtabs %}

## Get all messages (paginated) for current HC Party and provided to address

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

#### Query Parameters

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| toAddress       | String  |             |
| startKey        | String  |             |
| startDocumentId | String  |             |
| limit           | Integer |             |
| reverse         | Boolean |             |
| hcpId           | String  |             |

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

{% endtab %}
{% endtabs %}

## Get all messages (paginated) for current HC Party and provided transportGuid

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

#### Query Parameters

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| transportGuid   | String  |             |
| received        | Boolean |             |
| startKey        | String  |             |
| startDocumentId | String  |             |
| limit           | Integer |             |
| hcpId           | String  |             |

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

{% endtab %}
{% endtabs %}

## Get all messages starting by a prefix between two date

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

#### Query Parameters

| Name            | Type    | Description |
| --------------- | ------- | ----------- |
| transportGuid   | String  |             |
| from            | Long    |             |
| to              | Long    |             |
| startKey        | String  |             |
| startDocumentId | String  |             |
| limit           | Integer |             |
| hcpId           | String  |             |

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

{% endtab %}
{% endtabs %}

## Get children messages of provided message

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

#### Path Parameters

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

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

{% endtab %}
{% endtabs %}

## Gets a message

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

#### Path Parameters

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

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

{% endtab %}
{% endtabs %}

## Get children messages of provided message

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Get children messages of provided message

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Get all messages for current HC Party and provided transportGuids

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

#### Query Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Updates a message

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Adds a delegation to a message

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/message/{messageId}/delegate`

#### Path Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Set read status for given list of messages

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Set status bits for given list of messages

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

#### Path Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}
