# Contact

## Close contacts for Healthcare Party and secret foreign keys.

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

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

## Create a contact with the current user

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

Returns an instance of created contact.

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Create a batch of contacts

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

Returns the modified contacts.

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Delete contacts.

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

Response is a set containing the ID's of deleted contacts.

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List contacts for the current user (HcParty) or the given hcparty in the filter

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

Returns a list of contacts along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.

#### Query Parameters

| Name            | Type    | Description           |
| --------------- | ------- | --------------------- |
| startDocumentId | String  | A Contact document ID |
| limit           | Integer | Number of rows        |

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List services for the current user (HcParty) or the given hcparty in the filter

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

Returns a list of contacts along with next start keys and Document ID. If the nextStartKey is Null it means that this is the last page.

#### Query Parameters

| Name            | Type    | Description           |
| --------------- | ------- | --------------------- |
| startDocumentId | String  | A Contact document ID |
| limit           | Integer | Number of rows        |

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List contacts by opening date parties with(out) pagination

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

Returns a list of contacts.

#### Query Parameters

| Name                                        | Type    | Description                 |
| ------------------------------------------- | ------- | --------------------------- |
| startKey<mark style="color:red;">\*</mark>  | Long    | The contact openingDate     |
| endKey<mark style="color:red;">\*</mark>    | Long    | The contact max openingDate |
| hcpartyid<mark style="color:red;">\*</mark> | String  | hcpartyid                   |
| startDocumentId                             | String  | A contact party document ID |
| limit                                       | Integer | Number of rows              |

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

{% endtab %}
{% endtabs %}

## Get a contact

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

#### Path Parameters

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

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

{% endtab %}
{% endtabs %}

## Get contacts

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Get an empty content

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

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

{% endtab %}
{% endtabs %}

## Get the list of all used codes frequencies in services

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/contact/service/codes/{codeType}/{minOccurences}`

#### Path Parameters

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

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

{% endtab %}
{% endtabs %}

## List services with provided ids

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

Returns a list of services

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List services linked to provided ids

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

Returns a list of services

#### Query Parameters

| Name     | Type   | Description          |
| -------- | ------ | -------------------- |
| linkType | String | The type of the link |

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List contacts found By Healthcare Party and service Id.

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

#### Query Parameters

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

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

{% endtab %}
{% endtabs %}

## List contacts found By externalId.

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

#### Query Parameters

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

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

{% endtab %}
{% endtabs %}

## List contacts found By Healthcare Party and form Id.

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

#### Query Parameters

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

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

{% endtab %}
{% endtabs %}

## List contacts found By Healthcare Party and form Id.

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

#### Query Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## List contacts found By Healthcare Party and Patient foreign keys.

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

#### Query Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

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

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/contact/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  |             |
| planOfActionsIds                              | String  |             |
| skipClosedContacts                            | Boolean |             |

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

{% endtab %}
{% endtabs %}

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

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

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

## List services by related association id

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

Returns a list of services

#### Query Parameters

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

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

{% endtab %}
{% endtabs %}

## Get ids of contacts matching the provided filter for the current user (HcParty)

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Modify a contact

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

Returns the modified contact.

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Modify a batch of contacts

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

Returns the modified contacts.

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Update delegations in healthElements.

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/contact/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 %}

## Delegates a contact to a healthcare party

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/contact/{contactId}/delegate`

It delegates a contact to a healthcare party (By current healthcare party). Returns the contact with new delegations.

#### Path Parameters

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

#### Request Body

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

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

{% endtab %}
{% endtabs %}

## Update delegations in healthElements.

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/contact/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 %}
