# API sync before contact

Another method for syncing your base is the API sync. For this there are two important methods to implement:

## Create a new customer

<mark style="color:green;">`POST`</mark> `https://account.omnidesk.com/api/v2/customer`

#### Request Body

| Name                    | Type    | Description                                                                                                                         |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| ticket\_id              | number  | The ticket id to which the customer will be added.                                                                                  |
| noSync                  | boolean | If this parameter is set the system will not sync other tickets than the ticket\_id to the customer                                 |
| {{aCustomFieldName}}    | string  | You can optionally provide custom customer fields to add to the customer information                                                |
| customer\_link\_channel | string  | The actual email, telephone number (valid E.164) or social media account                                                            |
| lastname                | string  | Last name of the customer                                                                                                           |
| firstname               | string  | First name of the customer                                                                                                          |
| brand\_id               | integer | This provides for which configured brand the customer is created. The brand id can be found in the admin settings tab under brands. |
| primary\_id             | string  | This is the customer id of your organisation. Can also be an order id for certain businesses                                        |
| channel\_id             | string  | Options: email, telephone, facebook, twitter                                                                                        |

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

```
{    "type": "result",    "message": "User created and channel linked."}
```

{% endtab %}
{% endtabs %}

## Update customer

<mark style="color:orange;">`PUT`</mark> `https://account.omnidesk.com/api/v2/customer/updateCustomer`

The customer information fields you provide (e.g. lastname, firstname) are optional. If you do not provide a field in your request it will not get updated.

#### Request Body

| Name                 | Type   | Description                                                                 |
| -------------------- | ------ | --------------------------------------------------------------------------- |
| externalPrimaryID    | string | Your primary (customer) id.                                                 |
| brandID              | string |                                                                             |
| {{aCustomFieldName}} | string | You can optionally provide custom customer fields to update on the customer |
| lastname             | string |                                                                             |
| firstname            | string |                                                                             |

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

```
{"type": "result",    "message": "Customer updated."}
```

{% endtab %}
{% endtabs %}

## Add channel address

<mark style="color:green;">`POST`</mark> `https://account.omnidesk.com/api/v2/customer/addchannelonly`

#### Request Body

| Name             | Type    | Description                                                                                   |
| ---------------- | ------- | --------------------------------------------------------------------------------------------- |
| noSync           | boolean | If this parameter is set the system will not sync other tickets with matching contact address |
| extra\_facebook  | string  | add facebook account to the customer, in this field provide the facebook account              |
| extra\_twitter   | string  | add twitter account to the customer, in this field provide the twitter account                |
| extra\_telephone | string  | add telephone number (E.164) to the customer, in this field provide the phone number          |
| extra\_email     | string  | add email address to the customer, in this field provide the mail address                     |
| brand\_id        | string  | id of the brand of the customer                                                               |
| primary\_id      | string  | Customer id of your organization                                                              |

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

```
{    "type": "result",    "message": "Channel added to the customer."}
```

{% endtab %}
{% endtabs %}

## Purge data from customer

<mark style="color:red;">`DELETE`</mark> `https://account.omnidesk.com/api/v2/customer/purgedata`

Purges all data linked to this customer.

#### Request Body

| Name         | Type    | Description                                                 |
| ------------ | ------- | ----------------------------------------------------------- |
| external\_id | string  | Same as primary\_id: the customer id for your organisation. |
| brand\_id    | integer |                                                             |

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

```
```

{% endtab %}
{% endtabs %}


---

# 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.omnidesk.io/omnidesk/link-customer/api-syncing.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.
