# Personal Contacts Synchronization

The process for synchronizing personal contacts is as follows:

1. Client gets a sync token from the server by sending a POST request to /api/user/contacts/sync\_tokens.
2. Server reports token 001.
3. Some time passes.
4. Client performs a sync operation by sending a POST request to /api/user/contacts/sync\_tokens/{token}, supplying token 001.
5. Server returns contacts that have been created, updated, or deleted and returns token 002.

#### Getting the First Sync Token

Initially, request a sync token for contacts:

```shell
curl -X POST 'https://HOSTNAME:PORT/api/user/contacts/sync_tokens'
```

This would return something like the following:

```json
{
  "token": "001"
}
```

#### Receiving Changes

After a sync token has been obtained, the client can request all changes since the token was issued. This is done with a request that may look like this:

```shell
curl -X POST 'https://HOSTNAME:PORT/api/user/contacts/sync_tokens/001'
```

This would return something like the following:

```json
{
  "token": "002",
  "items": [
    {
      "id": "CREATED-ITEM-ID",
      "name": "...",
      "email": "...",
      "company": "...",
      "title": "...",
      "business": "...",
      "business2": "...",
      "mobile_phone": "...",
      "mobile_phone2": "...",
      "home_phone": "...",
      "home_phone2": "...",
      "other": "...",
      "business_fax": "...",
      "home_fax": "...",
      "address": "...",
      "notes": "...",
      "favorite": "...",
      "change_type": "CREATED"
    },
    {
      "id": "UPDATED-ITEM-ID",
      "name": "...",
      "email": "...",
      "company": "...",
      "title": "...",
      "business": "...",
      "business2": "...",
      "mobile_phone": "...",
      "mobile_phone2": "...",
      "home_phone": "...",
      "home_phone2": "...",
      "other": "...",
      "business_fax": "...",
      "home_fax": "...",
      "address": "...",
      "notes": "...",
      "favorite": "...",
      "change_type": "UPDATED"
    },
    {
      "id": "DELETED-ITEM-ID",
      "name": "...",
      "email": "...",
      "company": "...",
      "title": "...",
      "business": "...",
      "business2": "...",
      "mobile_phone": "...",
      "mobile_phone2": "...",
      "home_phone": "...",
      "home_phone2": "...",
      "other": "...",
      "business_fax": "...",
      "home_fax": "...",
      "address": "...",
      "notes": "...",
      "favorite": "...",
      "change_type": "DELETED"
    }
  ]
}
```


---

# 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://support.portsip.com/development-portsip/rest-apis/version-22.3/get-started/personal-contacts-synchronization.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.
