---
title: Contact
description: Contact in the address book.
---

Contact in the address book.

The type represents a contact in the address book. You can use the type to fetch and update contacts in the address book.
If you are signed into multiple accounts on the device, you may have multiple sources that populate the address book. A source is is represented as a `ContactsContainer`. A contact may be in only one container. A CardDAV account usually has a single container whereas an Exchange account may have multiple containers.

## Properties

### birthday

Birthday.

```typescript
birthday: Date
```

### dates

Dates.

```typescript
dates: [{string: any}]
```

When updating this property, you must set the entire array of dates that you would like to store on the contact. The "identifier" key is optional.

### departmentName

Name of the department associated with the contact.

```typescript
departmentName: string
```

### emailAddresses

Email addresses.

```typescript
emailAddresses: [{string: string}]
```

An array of objects on the following form:



```javascript
{
  "identifier": "UUID-ABC-123",
  "label": "Home",
  "localizedLabel": "Home",
  "value": "my@example.com"
}
```



The identifier uniquely identifies the email address on this device. The label is a description of the email address and the value holds the email address itself.

When updating this property, you must set the entire array of email addresses that you would like to store on the contact. Each value in the array must have the "value" key. The other keys are optional.

### familyName

Family name.

```typescript
familyName: string
```

### givenName

Given name.

```typescript
givenName: string
```

### identifier

Uniquely identifies the contact on the device.

```typescript
identifier: string
```

Read-only.

### image

Profile picture.

```typescript
image: Image
```

### isBirthdayAvailable

Whether or not birthday is available.

```typescript
isBirthdayAvailable: bool
```

The `birthday` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isDatesAvailable

Whether or not dates are available.

```typescript
isDatesAvailable: bool
```

The `date` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isDepartmentNameAvailable

Whether or not department name is available.

```typescript
isDepartmentNameAvailable: bool
```

The `departmentName` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isEmailAddressesAvailable

Whether or not email addresses are available.

```typescript
isEmailAddressesAvailable: bool
```

The `emailAddresses` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isFamilyNameAvailable

Whether or not family name is available.

```typescript
isFamilyNameAvailable: bool
```

The `familyName` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isGiveNameAvailable

Whether or not given name is available.

```typescript
isGiveNameAvailable: bool
```

The `givenName` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isImageAvailable

Whether or not image is available.

```typescript
isImageAvailable: bool
```

The `image` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isJobTitleAvailable

Whether or not job title is available.

```typescript
isJobTitleAvailable: bool
```

The `jobTitle` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isMiddleNameAvailable

Whether or not middle name is available.

```typescript
isMiddleNameAvailable: bool
```

The `middleName` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isNamePrefixAvailable

Whether or not name prefix is available.

```typescript
isNamePrefixAvailable: bool
```

The `namePrefix` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isNicknameAvailable

Whether or not nickname is available.

```typescript
isNicknameAvailable: bool
```

The `nickname` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isNoteAvailable

Whether or not note is available.

```typescript
isNoteAvailable: bool
```

The `note` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Notes are not available on contacts starting from version 1.7.5.

Read-only.

### isOrganizationNameAvailable

Whether or not organization name is available.

```typescript
isOrganizationNameAvailable: bool
```

The `organizationName` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isPhoneNumbersAvailable

Whether or not phone numbers are available.

```typescript
isPhoneNumbersAvailable: bool
```

The `phoneNumbers` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isPostalAddressesAvailable

Whether or not postal addresses are available.

```typescript
isPostalAddressesAvailable: bool
```

The `postalAddresses` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isSocialProfilesAvailable

Whether or not social profiles are available.

```typescript
isSocialProfilesAvailable: bool
```

The `socialProfiles` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### isURLAddressesAvailable

Whether or not URL addresses are available.

```typescript
isURLAddressesAvailable: bool
```

The `urlAddresses` property may not be available if the container does not support it. In that case any value set on the property will be ignored.

Read-only.

### jobTitle

The contact's job title.

```typescript
jobTitle: string
```

### middleName

Middle name.

```typescript
middleName: string
```

### namePrefix

Name prefix.

```typescript
namePrefix: string
```

### nickname

Nickname.

```typescript
nickname: string
```

### note

Note for the contact.

```typescript
note: string
```

For security reasons, a contact's notes cannot be accessed in Siri, the Shortcuts app and in a notification.

Notes are not available on contacts starting from version 1.7.5.

### organizationName

Name of the organization associated with the contact.

```typescript
organizationName: string
```

### phoneNumbers

Phone numbers.

```typescript
phoneNumbers: [{string: string}]
```

An array of objects on the following form:



```javascript
{
  "identifier": "UUID-ABC-123",
  "label": "Home",
  "localizedLabel": "Home",
  "value": "(111)234-5678"
}
```



The identifier uniquely identifies the phone number on this device. The label is a description of the phone number and the value holds the phone number itself.

When updating this property, you must set the entire array of phone numbers that you would like to store on the contact. Each value in the array must have the "value" key. The other keys are optional.

### postalAddresses

Postal addresses.

```typescript
postalAddresses: [{string: string}]
```

An array of objects on the following form:



```javascript
{
  "identifier": "UUID-ABC-123",
  "label": "Home",
  "localizedLabel": "Home",
  "street": "240  Terry Lane",
  "city": "New York",
  "state": "New York",
  "postalCode": "10001",
  "country": "United States of America"
}
```



The identifier uniquely identifies the pstal address on this device. The label is a description of the phone number and the value holds the phone number itself.

When updating this property, you must set the entire array of postal addresses that you would like to store on the contact. The "identifier" key is optional.

### socialProfiles

Social profiles.

```typescript
socialProfiles: [{string: string}]
```

An array of objects on the following form:



```javascript
{
  "identifier": "UUID-ABC-123",
  "label": "Twitter",
  "localizedLabel": "Twitter",
  "service": "Twitter",
  "url": "https://twitter.com/scriptableapp",
  "userIdentifier": null,
  "username": "scriptableapp"
}
```



The identifier uniquely identifies the social profile on this device. The label is a description of the social profile, the service is the social profile's service name, the URL contains a link to the social profile, the userIdentifier is the identifier of the social profile and the username is the name for the social profile.

When updating this property, you must set the entire array of social profiles that you would like to store on the contact. The "identifier" key is optional.

### urlAddresses

URL addresses.

```typescript
urlAddresses: [{string: string}]
```

When updating this property, you must set the entire array of URL addresses that you would like to store on the contact. The "identifier" key is optional.

## Methods

<span id="-new-contact" class="api-anchor"></span>

### new Contact()

Constructs a contact.

```typescript
new Contact()
```

In order to add the contact to your address book, you must queue it for insertion using `Contact.add()`. When you're done making changes to the address book you should call `Contact.persistChanges()` to persist the changes.

<span id="add" class="api-anchor"></span>

### add(contact, containerIdentifier)

Queues a contact to be added.

```typescript
static add(contact: Contact, containerIdentifier: string)
```

After you have created a contact, you must queue the contact to be added to the address book and invoke `Contact.persistChanges()` to persist the changes to the address book.

For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book.

#### Parameters

**`contact` `Contact`**

Contact to queue to be added.

**`containerIdentifier` `string`**

Optional. Identifier of container to add the contact to. If null is specified, the contact will be added to the default container.

<span id="all" class="api-anchor"></span>

### all(containers)

Fetches contacts.

```typescript
static all(containers: [ContactsContainer]): Promise<[Contact]>
```

Fetches the contacts in the specified containers. A contact can be in only one container.

#### Parameters

**`containers` `[ContactsContainer]`**

Containers to fetch contacts from.

#### Return value

**`Promise<[Contact]>`**

Promise that provides the contacts when fulfilled.

<span id="delete" class="api-anchor"></span>

### delete(contact)

Queues a contact to be deleted.

```typescript
static delete(contact: Contact)
```

To delete a contact, you must queue the contact for deletion and invoke `Contact.persistChanges()` to persist the changes to the address book.

For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book.

#### Parameters

**`contact` `Contact`**

Contact to queue to be deleted.

<span id="ingroups" class="api-anchor"></span>

### inGroups(groups)

Fetches contacts in groups.

```typescript
static inGroups(groups: [ContactsGroup]): Promise<[Contact]>
```

Fetches the contacts in the specified contacts groups. A contact may belong to many groups.

#### Parameters

**`groups` `[ContactsGroup]`**

Groups to fetch contacts from.

#### Return value

**`Promise<[Contact]>`**

Promise that provides the contacts when fulfilled.

### persistChanges()

Persist queued changes to the address book.

```typescript
static persistChanges(): Promise
```

Call this function to persist changes queued with `Contact.add()`, `Contact.update()` and `Contact.delete()`.

For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book.

#### Return value

**`Promise`**

Promise that fulfills when the changes have been persisted. The promise carries no value.

<span id="update" class="api-anchor"></span>

### update(contact)

Queues an update to a contact.

```typescript
static update(contact: Contact)
```

After you have updated one or more properties on a contact, you must queue the contact to be updated and invoke `Contact.persistChanges()` to persist the changes to the address book.

For performance reasons, it is best to batch changes to the address book. Therefore you should queue all updates, insertions and removals of contacts and contacts groups to as large batches as possible and then call `Contact.persistChanges()` when you want to persist the changes to the address book.

#### Parameters

**`contact` `Contact`**

Contact to queue to be updated.